product.productMaterial.Index.js
2.68 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
webpackJsonp([135],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(1),
common=__webpack_require__(2);
// 设置 物理类目 下拉框
$('#max-sort-select').html(common.util.__template($('#max-sort-template').html()));
// 取全局属性中的 物理类目列表
var maxSortIds = window.ViewModel || {};
var g = new common.grid({
el: '#basicTable',
parms: function() {
return {
maxSortId: common.util.__input('max-sort-select')
};
},
columns: [
{display: "ID", name: "id"},
{display: "分类", render: function(item) {
var sortName = '';
$.each(maxSortIds, function(_, sort) {
if(+item.maxSortId == +sort.id) {
sortName = sort.sortName;
return true;
}
});
return sortName;
}},
{display: "材质名称", name: "caption"},
{display: "英文名称", name: "encaption"},
{display: "图片", render: function(item) {
var htmlArr = [];
htmlArr.push('<div>');
htmlArr.push('<img src="' + item.imageUrl + '?imageView2/2/w/120/h/60">');
htmlArr.push('</div>');
return htmlArr.join('');
}},
{display: "备注", width: '50%', render: function(item) {
return "<p style='word-break:break-all;'>" + item.remark + "</p>";
}},
{display: "操作", render: function(item) {
var htmlArr = [];
htmlArr.push("<div>");
htmlArr.push('<a href="/goods/material/edit/' + item.id + '" class="btn btn-primary btn-xs">编辑</a>');
htmlArr.push('<a href="javascript:;" class="btn btn-danger del-btn btn-xs" data-id="' + item.id + '">删除</a>');
htmlArr.push('<a href="/goods/material/bindinfo/' + item.id + '" target="_blank" class="btn btn-info btn-xs">查看绑定</a>');
htmlArr.push('</div>');
return htmlArr.join('');
}}
]
});
g.init('/product/material/list');
// 筛选
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
// 删除
$(document).on('click', '.del-btn', function() {
var id = $(this).data('id');
common.dialog.confirm("温馨提示", "你确定要删除吗?", function() {
common.util.__ajax({
url: '/product/material/delete',
data: {
materialId: id
},
aysnc: false
}, function(res) {
if(res && res.code == 200) {
g.reload();
}
});
});
});
/***/ }
]);