index.js
3.96 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
'use strict';
var $ = require('jquery'),
common=require('../common/common');
exports.init = function() {
new common.dropDown({el: '#filter-dep'});
var g = new common.grid({
el: '#basicTable',
parms:function(){
return {
batchNo:common.util.__input("batchNo"),
name:common.util.__input("name"),
reqDepartment:common.util.__input("reqDepartment")
};
},
columns:[
{display:"批次号",name:"batchNo"},
{display:"基本信息",render:function(item){
var arr=[];
arr.push("<p>名称:"+item.name+"</p>");
arr.push("<p>次数:"+item.limitTimes+"</p>");
arr.push("<p>数量:"+item.userUseLimit+"</p>");
arr.push("<p>部门:"+item.reqDepartment+"</p>");
return arr.join('');
}},
{display:"使用日期",render:function(item){
return item.limitDateFrom+"</br> 至 "+item.limitDateTo;
}},
{display:"限购码使用说明",name:"describe"},
{display:"申请人",name:"creatorName"},
{display:"操作",render:function(item){
var HtmArr=[];
//限购码状态0:待审核 1:审核通过 2:驳回 3:过期 4:作废
HtmArr.push('<a href="/limit/code/info/'+ item.id+'" class="btn btn-info btn-xs">查看详情</a>');
if(item.status == 0){
HtmArr.push('<a class="btn btn-primary btn-xs apply-success" data-index="'+ item.__index+'" href="javascript:;">通过</a>');
HtmArr.push('<a class="btn btn-warning btn-xs apply-back" data-index="'+ item.__index+'" href="javascript:;">驳回</a>');
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>');
}else if(item.status==1){
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>');
}else if(item.status==2){
HtmArr.push('<a class="btn btn-info btn-xs apply-modify" href="/limit/code/update/'+ item.id+'">修改</a>');
}
return HtmArr.join('');
}}
]
});
g.init($("#gridurl").val());
$("#btn-search").click(function(){
g.reload();
});
$("#btn-reset").click(function(){
//g.reload();
});
var tool={
toast:function(content,fn){
common.dialog.confirm("温馨提示",content,function(){
common.util.__ajax({
url:'/limit/code/auditLimitCode',
data:fn()
},function(){
g.reload();
});
});
}
}
//审核通过
$('#basicTable').on('click', '.apply-success', function() {
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status:1,
reason:"预算不够"
};
}
tool.toast("确定要通过该申请吗?",data);
});
//驳回
$('#basicTable').on('click', '.apply-back', function() {
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status:2,
reason:$("#reason").val()
};
};
tool.toast(common.util.__template($("#template").html(),{title:"你确定要驳回该申请吗?"}),data);
});
//作废
$('#basicTable').on('click', '.apply-cancel', function() {
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status: 3,
reason:$("#reason").val()
};
}
tool.toast(common.util.__template($("#template").html(),{title:"你确定要作废此限购码吗?"}),data);
});
}