|
|
var $ = require('jquery'),
|
|
|
common = require('../../common/common');
|
|
|
|
|
|
var searchKeys = window.NETSALEDATA.productExtBo.searchKeys || "";
|
|
|
|
|
|
$("#searchKeys").val(searchKeys);
|
|
|
var g = new common.grid({
|
|
|
el: "#search-key",
|
|
|
hash: false,
|
|
|
columns: [{
|
|
|
display: "ID",
|
|
|
name: "id"
|
|
|
}, {
|
|
|
display: "内容",
|
|
|
name: "content"
|
|
|
}, {
|
|
|
display: "操作",
|
|
|
name: "",
|
|
|
render: function(item) {
|
|
|
return '<a class="btn btn-info add" data-index="' + item.__index + '">添加</a>';
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
g.init('/netSale/queryHotSearchTerms');
|
|
|
|
|
|
$("#searchKeys").on('change', function() {
|
|
|
searchKeys = $("#searchKeys").val();
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '.add', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
var value = $("#searchKeys").val();
|
|
|
if (value) value += ",";
|
|
|
$("#searchKeys").val(value + item.content);
|
|
|
searchKeys = $("#searchKeys").val();
|
|
|
});
|
|
|
|
|
|
$("#save-searchKey").on('click', function() {
|
|
|
common.util.__ajax({
|
|
|
url: '/netSale/saveNetSaleSearchKeys',
|
|
|
data: {
|
|
|
productSkn: window.NETSALEDATA.baseProductInfo.baseProduct.productSkn,
|
|
|
searchKeys: searchKeys
|
|
|
}
|
|
|
}, function(res) {
|
|
|
|
|
|
});
|
|
|
}); |
|
|
\ No newline at end of file |