search-key.js
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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) {
});
});