operations.gate.Index.js
2.3 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
webpackJsonp([106],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/*
* @author: LiQZ
*/
var $ = __webpack_require__(1), common = __webpack_require__(2);
// 下拉框
new common.dropDown({
el: "#status"
});
var platforms = new Object();
platforms["iphone"]="IOS手机";
platforms["ipad"]="IOS Pad";
platforms["android"]="安卓手机";
platforms["androidpad"]="安卓Pad";
platforms["h5"]="手机网站";
platforms["web"]="网站";
platforms["platform"]="平台";
var tableGird = new common.grid({
el: "#table-box",
parms: function() {
return {
status: $("#status").val()
}
},
columns: [
{ display: "ID", name: "id" },
{ display: "平台元值", name: "metaKey"},
{ display: "平台名称", name: "platform", render: function(item) {
if(item.platform) {
var arr = [];
var ps = item.platform.split(",");
for(var i = 0; i < ps.length; i++) {
arr.push(platforms[ps[i]]);
}
return arr.join(" ");
}
}},
{ display: "控制器名称", name:"title"},
{ display: "价格", name:"price"},
{ display: "控制器链接地址", name:"url"},
{ display: "控制状态", name:"status", render: function(item) {
return item.status == 0 ? "已关闭":"已开启";
}},
{ display: "操作", render: function(items) {
var HtmArr = [];
HtmArr.push('<a href="/operations/gate/' + items.id + '" class="btn btn-primary btn-xs">编辑</a>');
HtmArr.push('<a href="javascript:void(0);" data-index="' + items.__index + '" class="btn btn-danger btn-xs delete">删除</a>');
return HtmArr.join('');
}
}]
});
tableGird.init('/operations/gate/list');
$(document).on("click", "#filter-btn", function () {
tableGird.reload();
});
/** 删除 */
$(document).on("click", ".delete", function () {
var item = tableGird.rows[$(this).data("index")];
common.dialog.confirm("警告", "确定删除就该开关吗?", function () {
common.util.__ajax({
url: "/operations/gate/delete",
data: {id: item.id }
}, function () {
tableGird.reload();
}, true)
})
});
/***/ }
]);