supplier.Index.js
4.99 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
webpackJsonp([182],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
var ENUM = {
status: {100: '暂存', 200: '审核中', 300: '通过', 900: '驳回'},
isFreeze: {'Y': '已冻结', 'N': '生效中'},
operations: {1: '创建', 2: '编辑', 3: '冻结', 4: '解冻'}
};
new common.dropDown({el: '#supplier-name', ajax: 'supplier'});
new common.dropDown({el: "#status"});
new common.dropDown({el: "#time-sort"});
new common.dropDown({el: "#isFreeze"});
var btnAuthority = JSON.parse($("#btnAuthority").val());
var g = new common.grid({
el: "#basicTable",
parms: function () {
return {
id: common.util.__input("supplier-name"),
status: common.util.__input("status"),
timeSort: common.util.__input("time-sort"),
isFreeze: common.util.__input("isFreeze")
};
},
columns: [
{display: "供应商ID", name: "id"},
{display: "供应商", name: "supplierName"},
{display: "更新时间", name: "updateTime"},
{
display: "最近操作", name: "operations", hidden: btnAuthority.columnsHidOper, render: function (item) {
return ENUM.operations[item.operations];
}
},
{
display: "状态", name: "status", render: function (item) {
return ENUM.status[item.status];
}
},
{
display: "是否生效", name: "isFreeze", hidden: btnAuthority.columnsHidisFr, render: function (item) {
return ENUM.isFreeze[item.isFreeze];
}
},
{
display: "操作", name: "id", render: function (item) {
var HtmArr = [];
// 是否冻结 Y-是,N-否
// 状态 100-暂存,200-审核中,300-通过,900-驳回
// 最近操作 1-创建,2-编辑, 3-冻结, 4-解冻
if (btnAuthority.edit) {
HtmArr.push('<a href="/supplier/infoopt/' + item.id + '" class="btn btn-info btn-xs">查看</a>');
} else {
HtmArr.push('<a href="/supplier/info/' + item.id + '" class="btn btn-info btn-xs">查看</a>');
}
if (item.status != "200") {
//updatecheck
if (btnAuthority.updatecheck) {
HtmArr.push('<a href="/supplier/updatecheck/' + item.id + '" class="btn btn-success btn-xs btn-edit">编辑</a>');
} else {
HtmArr.push('<a href="/supplier/update/' + item.id + '" class="btn btn-success btn-xs btn-edit">编辑</a>');
}
}
//暂存时,有提交
if (item.status == "100") {
HtmArr.push('<a href="JavaScript:;" data-index="' + item.__index + '" class="btn btn-primary btn-xs btn-submit">提交</a>');
}
if (btnAuthority.resetlock && item.isFreeze == "Y" && (item.status == "300" || item.status == "900")) {
HtmArr.push('<a href="javascript:;" data-index="' + item.__index + '" class="btn btn-warning btn-xs btn-recovery">恢复</a>');
}
if (btnAuthority.resetlock && item.isFreeze == "N" && (item.status == "300" || item.status == "900")) {
HtmArr.push('<a href="javascript:;" data-index="' + item.__index + '" class="btn btn-danger btn-xs btn-freeze">冻结</a>');
}
return HtmArr.join('');
}
}
]
})
g.init($("#gridurl").val());
$("#filter-btn").click(function () {
g.reload(1);
});
var Bll = {
toast: function (content, fn) {
common.dialog.confirm("温馨提示", content, function () {
common.util.__ajax({
url: '/supplier/index/status',
data: fn()
}, function () {
g.reload();
});
});
}
}
//提交操作
$(document).on('click', '.btn-submit', function () {
var item = g.rows[$(this).data("index")];
var data = function () {
return {
id: item.id,
status: 200,
operations: item.operations
};
}
Bll.toast("确定要提交该申请吗?", data);
});
//冻结操作
$(document).on('click', '.btn-freeze', function () {
var item = g.rows[$(this).data("index")];
var data = function () {
return {
id: item.id,
isFreeze: "Y",
operations: "3",
status: 200
};
}
Bll.toast("确定要冻结申请吗?", data);
});
//解冻操作
$(document).on('click', '.btn-recovery', function () {
var item = g.rows[$(this).data("index")];
var data = function () {
return {
id: item.id,
isFreeze: "N",
operations: "4",
status: 200
};
}
Bll.toast("确定要解冻申请吗?", data);
});
/***/ }
]);