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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var budgetDeclaratioTable = null;
var view ={
init:function(){
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),budgetDeclaratioTable)
}
},
initTable:function(){
budgetDeclaratioTable = table.render({
elem : '#budgetDeclaratioTable',
height : Lib.getTableHeight(1),
cellMinWidth: 100,
method : 'post',
url : Common.ctxPath + '/dubget/budgetDeclaratio/list.json?examine=cwc' // 数据接口
,page : Lib.tablePage // 开启分页
,limit : 10,
cols : [ [ // 表头
{
type : 'checkbox',
//fixed:'left',
},
{
field : 'deptName',
title : '科室名称',
},
{
field : 'number',
title : '预算编号',
},
{
field : 'typename',
title : '预算类型',
},
{
field : 'name',
title : '名称',
},
{
field : 'budget',
title : '预算金额',
},
{
field : 'user',
title : '申报人员',
},
{
field : 'stateText',
title : '状态',
},
{
field : 'year',
title : '年度',
} ,
{
field : '',
title : '操作记录',
templet:function(d){
return '<a class="layui-table-link" lay-event="instList">操作记录</a>'
},
},
{
title: '操作',
//rowspan: 2,
align: 'center',
fixed: 'right',
minWidth: '160',
templet: function (d) {
var edit =null;
if (d.state=='2') {
edit= '<button class="layui-btn layui-btn-sm layui-btn" lay-event="edit" title="批复">批复</button>'
+'<button class="layui-btn layui-btn-sm layui-btn-warm" lay-event="view" title="查看">查看</button>';
}
else {
edit= '<button class="layui-btn layui-btn-sm layui-btn-warm" lay-event="view" title="查看">查看</button>';
}
//var ret;
// ret = edit;
return edit;
}
}
] ],done: function (res, curr, count) {// 表格渲染完成之后的回调
var that = this.elem.next();
res.data.forEach(function (item, index) {
if (item.type === "") {
var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']");
tr.css("background-color", "red");
tr.css("color", "white");
}
});
}
});
table.on('tool(budgetDeclaratioTable)', function(obj){
var data = obj.data;
//var wagesType = $("input[name='wagesType']").val();
if(obj.event === 'view'){
var url = "/dubget/budgetDeclaratio/view.do?id="+data.id;
Common.openDlg(url,"预算>"+data.type+">查看");
}else if(obj.event === 'edit'){
var url = "/dubget/budgetDeclaratio/reply.do?type=2&id="+data.id;
if (data.type=="") {
alert("无预算类型")
}else{
Common.openDlg(url,"预算>"+data.type+">批复");
}
}else if(obj.event === 'instList'){
layer.open({
type: 2,
shade: false,
area: ['1000px', '480px'],
btn: [ '关闭'],
maxmin: true,
title:"操作记录",
content: Common.ctxPath + '/re/record/index.do?relationId='+data.id,
zIndex: layer.zIndex, //重点1
success: function(layero){
layer.setTop(layero); //重点2
}
});
}
else if(obj.event === 'delete'){/*
layer.open({
title: '申报提交'
,content: '是否提取回'
, btn: ['是', '否'] //可以无限个按钮
,yes: function(index, layero){
$.post(Common.ctxPath+"/dubget/budgetDeclaratio/state.json?id="+data.id,{state:'1'},function(result){
dataReload();
layer.close(index);
layer.msg('取回成功');
});
}, function(index){
}
});
*/}
})
},
initSearchForm:function(){
Lib.initSearchForm( $("#searchForm"),budgetDeclaratioTable,form);
},
initToolBar:function(){
toolbar = {
add : function() {
//批量审核
var data = Common.getMoreDataFromTable(table,"budgetDeclaratioTable");
var ids="";
for (var i = 0; i < data.length; i++) {
ids=ids+data[i].id+",";
}
var ada="<div class='layui-form-item'><textarea placeholder='意见' class='layui-textarea' id='opinion'></textarea></div></form>'";
layer.open({
title: '查看'
//,type : 0
,content: ada
//,area: ['500px', '400px']
,closeBtn : 2
,anim: 3
,isOutAnim : true
,btn: ['通过','不通过','取消'],
yes: function(index, layero){
$.post(Common.ctxPath+"/dubget/budgetDeclaratio/batchOpinion.json",{ids:ids,state:'3',ry:'cwc',opinion:$(layero).find('#opinion').val()},function(result){
//opinion=result.data.opinion
dataReload();
layer.close(index);
layer.msg('批复成功');
})
//console.log($(layero).find('#opinion').val())
},
btn2:function(index, layero){
//按钮【按钮二】的回调
$.post(Common.ctxPath+"/dubget/budgetDeclaratio/batchOpinion.json",{ids:ids,state:'-1',ry:'cwc',opinion:$(layero).find('#opinion').val()},function(result){
//opinion=result.data.opinion
dataReload();
layer.close(index);
layer.msg('批复成功');
})
}
,
function(index, layero){
dataReload();
layer.close(index);
}
});
// });
// }
/* $.post(Common.ctxPath+"/dubget/budgetDeclaratio/opinion.json",{id:data.id,opinion,opinion},function(result){
opinion=result.data.opinion;*/
},
edit : function() { // 获取选中数目
var data = Common.getOneFromTable(table,"budgetDeclaratioTable");
if(data==null){
return ;
}
var url = "/dubget/budgetDeclaratio/edit.do?id="+data.id;
Common.openDlg(url,"预算申报管理>"+data.id+">编辑");
},
del : function() {
layui.use(['del'], function(){
var delView = layui.del
delView.delBatch();
});
}
,
exportDocument : function() {
layui.use([ 'budgetDeclaratioApi' ], function() {
var budgetDeclaratioApi = layui.budgetDeclaratioApi
Common.openConfirm("确认要导出这些预算申报数据?", function() {
budgetDeclaratioApi.exportExcel($("#searchForm"), function(fileId) {
Lib.download(fileId);
})
})
});
},
importDocument:function(){
var uploadUrl = Common.ctxPath+"/dubget/budgetDeclaratio/excel/import.do";
//模板,
var templatePath= "/dubget/budgetDeclaratio/budgetDeclaratio_upload_template.xls";
//公共的简单上传文件处理
var url = "/core/file/simpleUpload.do?uploadUrl="+uploadUrl+"&templatePath="+templatePath;
Common.openDlg(url, "预算申报管理>上传");
}
};
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}
}
exports('cwcindex',view);
});