|
@@ -0,0 +1,765 @@
|
|
1
|
+<!DOCTYPE html>
|
|
2
|
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
3
|
+<head>
|
|
4
|
+ <meta charset="UTF-8">
|
|
5
|
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
6
|
+ <title>Title</title>
|
|
7
|
+ <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
|
|
8
|
+ <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
|
|
9
|
+ <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
|
|
10
|
+
|
|
11
|
+</head>
|
|
12
|
+<body>
|
|
13
|
+<h1> 你好 世界</h1>
|
|
14
|
+<script type="text/html" id="toolbarDemo">
|
|
15
|
+ <div class="layui-btn-container" style="display: flex;">
|
|
16
|
+ <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="view">
|
|
17
|
+ <i class="layui-icon layui-icon-file" style="font-size: 10px;"></i>查看
|
|
18
|
+ </button>
|
|
19
|
+ <button class="layui-btn layui-btn-sm data-add-btn" lay-event="tjrevokeApprove">
|
|
20
|
+ <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>撤销审批
|
|
21
|
+ </button>
|
|
22
|
+ <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spOption">
|
|
23
|
+ <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>审核
|
|
24
|
+ </button>
|
|
25
|
+ <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spList">
|
|
26
|
+ <i class="layui-icon layui-icon-list" style="font-size: 10px;"></i>审批列表
|
|
27
|
+ </button>
|
|
28
|
+ <button class="layui-btn layui-btn-sm" lay-event="export" style="background-color: black">
|
|
29
|
+ <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出列表
|
|
30
|
+ </button>
|
|
31
|
+ <button class="layui-btn layui-btn-sm layui-btn-checked" lay-event="xmzy" id="zy" style="display: none">
|
|
32
|
+ <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>项目转移
|
|
33
|
+ </button>
|
|
34
|
+ </div>
|
|
35
|
+</script>
|
|
36
|
+<input type="hidden" id="userId" name="userId" class="layui-input" th:value="${userId}">
|
|
37
|
+<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
|
38
|
+
|
|
39
|
+<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
|
|
40
|
+<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
|
|
41
|
+<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
|
|
42
|
+<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
|
|
43
|
+<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
|
|
44
|
+<script th:inline="javascript" type="text/javascript">
|
|
45
|
+ var updateflag = 0;
|
|
46
|
+ var fyApproval = {};
|
|
47
|
+
|
|
48
|
+ layui.use(['form', 'table', 'tableSelect', 'laydate', 'layCascader'], function () {
|
|
49
|
+ var form = layui.form,
|
|
50
|
+ tableSelect = layui.tableSelect,
|
|
51
|
+ laydate = layui.laydate,
|
|
52
|
+ table = layui.table;
|
|
53
|
+ layCascader = layui.layCascader;
|
|
54
|
+ var userId = $("#userId").val();
|
|
55
|
+ var cascader;
|
|
56
|
+ var sqsj1 = '',
|
|
57
|
+ sqsj2 = '';
|
|
58
|
+ //申请时间
|
|
59
|
+ laydate.render({
|
|
60
|
+ elem: '#sqsj1',
|
|
61
|
+ done: function (value, date, endDate) {
|
|
62
|
+ sqsj1 = $("#sqsj1").val();
|
|
63
|
+ sqsj2 = $("#sqsj2").val();
|
|
64
|
+ if (sqsj1 != "" && sqsj2 != "") {
|
|
65
|
+ if (sqsj1 > sqsj2) {
|
|
66
|
+ Message.warning("起始时间不能晚于终止时间!", 1500);
|
|
67
|
+ $("#sqsj1").val("");
|
|
68
|
+ }
|
|
69
|
+ }
|
|
70
|
+ }
|
|
71
|
+ });
|
|
72
|
+ laydate.render({
|
|
73
|
+ elem: '#sqsj2',
|
|
74
|
+ done: function (value, date, endDate) {
|
|
75
|
+ sqsj1 = $("#sqsj1").val();
|
|
76
|
+ sqsj2 = $("#sqsj2").val();
|
|
77
|
+ if (sqsj1 != "" && sqsj2 != "") {
|
|
78
|
+ if (sqsj1 > sqsj2) {
|
|
79
|
+ Message.warning("终止时间不能早于开始时间!", 1500);
|
|
80
|
+ $("#sqsj2").val("");
|
|
81
|
+ }
|
|
82
|
+ }
|
|
83
|
+ }
|
|
84
|
+ });
|
|
85
|
+ var index2 = layer.load(0, {shade: 0.1});
|
|
86
|
+ AjaxUtil.get({
|
|
87
|
+ url: AjaxUtil.ctx + 'userinfo/listDeptForSelect',
|
|
88
|
+ success: function (res) {
|
|
89
|
+ layer.close(index2);
|
|
90
|
+ var datalist = [];
|
|
91
|
+ // 添加“全部”选项
|
|
92
|
+ datalist.push({
|
|
93
|
+ value: '', // 空值
|
|
94
|
+ label: '全部', // 显示文本
|
|
95
|
+ children: [] // 需要子项以保持一致性
|
|
96
|
+ });
|
|
97
|
+
|
|
98
|
+ for (let item of res.data) {
|
|
99
|
+ item.value = item.deptName;
|
|
100
|
+ item.label = item.deptName;
|
|
101
|
+ // 确保每个部门也有一个 children 属性
|
|
102
|
+ item.children = [];
|
|
103
|
+ datalist.push(item);
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ // 扁平数据转树
|
|
107
|
+ var options = arrayToTree(datalist, "50");
|
|
108
|
+ // var options = arrayToTree(datalist, "0");
|
|
109
|
+
|
|
110
|
+ // 初始化cascader实例
|
|
111
|
+ cascader = layCascader({
|
|
112
|
+ elem: '#ssbmmc',
|
|
113
|
+ clearable: true,
|
|
114
|
+ showAllLevels: false, // 配置仅显示最后一级
|
|
115
|
+ props: {
|
|
116
|
+ checkStrictly: true, // 配置选择任意一级选项
|
|
117
|
+ },
|
|
118
|
+ options: options
|
|
119
|
+ });
|
|
120
|
+
|
|
121
|
+ // 监听cascader变化
|
|
122
|
+ cascader.changeEvent(function (value, node) {
|
|
123
|
+ // 主动关闭面板
|
|
124
|
+ cascader.close();
|
|
125
|
+ $("#deptId").val(value);
|
|
126
|
+ });
|
|
127
|
+ },
|
|
128
|
+ error: function (error) {
|
|
129
|
+ layer.close(index2);
|
|
130
|
+ Message.error('获取部门信息失败!', 1000);
|
|
131
|
+ }
|
|
132
|
+ });
|
|
133
|
+
|
|
134
|
+ //电科院负责人
|
|
135
|
+ tableSelect.render({
|
|
136
|
+ elem: '#dkyfzrxm',
|
|
137
|
+ checkedKey: 'id',
|
|
138
|
+ searchKey: 'xm',
|
|
139
|
+ searchPlaceholder: '搜索姓名',
|
|
140
|
+ table: {
|
|
141
|
+ url: AjaxUtil.ctx + 'basePerson/rylist',
|
|
142
|
+ cols: [
|
|
143
|
+ [
|
|
144
|
+ {type: "checkbox", fixed: 'left',title: '😊'},
|
|
145
|
+ {type: 'numbers', align: 'center',title: '序号'},
|
|
146
|
+ {field: 'xm', width: '15%', title: '姓名', align: 'left'},
|
|
147
|
+ {field: 'dwmc', title: '公司/单位', align: 'left'}
|
|
148
|
+ ]
|
|
149
|
+ ]
|
|
150
|
+ },
|
|
151
|
+ done: function (elem, data) {
|
|
152
|
+ var NEWJSON = [];
|
|
153
|
+ var NEWJSON1 = [];
|
|
154
|
+ layui.each(data.data, function (index, item) {
|
|
155
|
+ NEWJSON.push(item.xm);
|
|
156
|
+ NEWJSON1.push(item.id);
|
|
157
|
+ })
|
|
158
|
+ elem.val(NEWJSON.join(","));
|
|
159
|
+ $("#dkyfzr").val(NEWJSON1.join(","));
|
|
160
|
+ }
|
|
161
|
+ });
|
|
162
|
+ var getYear = document.getElementById('nf').value;
|
|
163
|
+ var currTable = table.render({
|
|
164
|
+ elem: '#currentTableId',
|
|
165
|
+ url: AjaxUtil.ctx + 'staBudgetapproval/list_allApply/?nf='+getYear,
|
|
166
|
+ method: 'post',
|
|
167
|
+ toolbar: '#toolbarDemo',
|
|
168
|
+ // defaultToolbar: ['filter', 'print'],
|
|
169
|
+ cols: [
|
|
170
|
+ [
|
|
171
|
+ {type: "radio", title: '😊'},
|
|
172
|
+ {type: 'numbers',title: '序号'},
|
|
173
|
+ {field: 'xmmc', width: '15%', title: '项目名称'},
|
|
174
|
+ {field: 'erpbh', width: '9%', title: 'ERP编号'},
|
|
175
|
+ {field: 'sfbyj', width: '8%', title: '是否备用金', align: 'center', templet: function (d) {
|
|
176
|
+ if (1 == d.sfbyj) {
|
|
177
|
+ return '<span class="layui-badge layui-bg-blue">是</span>';
|
|
178
|
+ } else {
|
|
179
|
+ return '<span class="layui-badge layui-bg-orange">否</span>';
|
|
180
|
+ }
|
|
181
|
+ }
|
|
182
|
+ },
|
|
183
|
+ {field: 'sqje', width: '7%', title: '申请金额(元)'},
|
|
184
|
+ {field: 'bzje', width: '7%', title: '报账金额(元)'},
|
|
185
|
+ {field: 'bhsje', width: '7%', title: '不含税金额(元)'},
|
|
186
|
+ {field: 'fylbmc', width: '15%', title: '费用类别'},
|
|
187
|
+ {field: 'xmlxmc', width: '10%', title: '项目类型'},
|
|
188
|
+ {field: 'spzt', width: '9%', title: '审批状态'},
|
|
189
|
+ {field: 'sqrxm', width: '5%', title: '申请人'},
|
|
190
|
+ {field: 'bh', width: '8%', title: '科研费号'},
|
|
191
|
+ {field: 'dkyfzrxm', width: '8%', title: '电科院负责人'},
|
|
192
|
+ {field: 'ssbmmc', width: '8%', title: '所属部门'},
|
|
193
|
+ {field: 'nf', width: '4%', title: '年份'},
|
|
194
|
+ {field: 'sqsj', width: '8%', title: '申请时间', align: 'center'},
|
|
195
|
+ {field: 'sqmc', width: '25%', title: '申请名称'}
|
|
196
|
+ ]
|
|
197
|
+ ],
|
|
198
|
+ autoSort: false,
|
|
199
|
+ limits: [10, 15, 20, 25, 50, 100],
|
|
200
|
+ limit: 10,
|
|
201
|
+ page: true,
|
|
202
|
+ skin: 'grid',
|
|
203
|
+ parseData: function (res) { //res 即为原始返回的数据
|
|
204
|
+ return {
|
|
205
|
+ "code": res.code, //解析接口状态
|
|
206
|
+ "msg": res.message, //解析提示文本
|
|
207
|
+ "count": res.data.total, //解析数据长度
|
|
208
|
+ "data": res.data.rows //解析数据列表
|
|
209
|
+ };
|
|
210
|
+ },
|
|
211
|
+ done: function (res, curr, count) { // done为数据渲染完的回调
|
|
212
|
+
|
|
213
|
+ if (res.data && Array.isArray(res.data)) {
|
|
214
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
215
|
+ console.log(res.data[i]);
|
|
216
|
+ if (res.data[i].sfth==1){
|
|
217
|
+ const Index = i ;
|
|
218
|
+ $(`.layui-table tr[data-index="${Index}"]`).css('background-color', '#ADD8E6');
|
|
219
|
+ }
|
|
220
|
+ }
|
|
221
|
+ }
|
|
222
|
+ console.log(userId);
|
|
223
|
+ if(userId == 1 || userId == 42){/*
|
|
224
|
+ $('#zy').css('display', 'block');*/
|
|
225
|
+ }
|
|
226
|
+ }
|
|
227
|
+ });
|
|
228
|
+ // 监听搜索操作
|
|
229
|
+ form.on('submit(data-search-btn)', function (data) {
|
|
230
|
+ // 执行搜索重载
|
|
231
|
+ currTable.reload({
|
|
232
|
+ page: {
|
|
233
|
+ curr: 1 // 页码从1开始
|
|
234
|
+ },
|
|
235
|
+ where: form.val("search-form")
|
|
236
|
+ });
|
|
237
|
+ return false;
|
|
238
|
+ });
|
|
239
|
+
|
|
240
|
+ // 监听重置操作
|
|
241
|
+ form.on('submit(data-reset-btn)', function (data) {
|
|
242
|
+ form.val("search-form", {
|
|
243
|
+ "bh": '',
|
|
244
|
+ "erpbh": '',
|
|
245
|
+ "xmlx": '',
|
|
246
|
+ "sfbyj": '',
|
|
247
|
+ "xmmc": '',
|
|
248
|
+ "ssbmmc": '',
|
|
249
|
+ "nf": '0',
|
|
250
|
+ "spzt": '',
|
|
251
|
+ "sfbz": '',
|
|
252
|
+ "dkyfzr": '',
|
|
253
|
+ "sqsj1": '',
|
|
254
|
+ "sqsj2": ''
|
|
255
|
+ });
|
|
256
|
+ cascader.reload();
|
|
257
|
+ // 执行搜索重载
|
|
258
|
+ currTable.reload({
|
|
259
|
+ page: {
|
|
260
|
+ curr: 1
|
|
261
|
+ },
|
|
262
|
+ where: form.val("search-form")
|
|
263
|
+ });
|
|
264
|
+ return false;
|
|
265
|
+ });
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+ // 监听工具栏事件
|
|
269
|
+ table.on('toolbar(currentTableFilter)', function (obj) {
|
|
270
|
+ if (obj.event === 'add') { // 监听添加操作
|
|
271
|
+ layer.open({
|
|
272
|
+ title: '新建费用申请',
|
|
273
|
+ type: 2,
|
|
274
|
+ shade: 0.3,
|
|
275
|
+ maxmin: true,
|
|
276
|
+ area: ['1020px', layerheight + 'px'],
|
|
277
|
+ content: AjaxUtil.ctx + 'staBudgetapproval/forApplyAdd',
|
|
278
|
+ end: function (index) {
|
|
279
|
+ // 重载表格
|
|
280
|
+ if (updateflag == 1)
|
|
281
|
+ currTable.reload();
|
|
282
|
+ updateflag = 0;
|
|
283
|
+ }
|
|
284
|
+ });
|
|
285
|
+ } else if (obj.event == 'edit') {
|
|
286
|
+ var dataApproval = table.cache["currentTableId"];
|
|
287
|
+ if (dataApproval.length == 0)
|
|
288
|
+ return;
|
|
289
|
+
|
|
290
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
291
|
+ , data = checkStatus.data;
|
|
292
|
+ if (data == null || data.length === 0) {
|
|
293
|
+ Message.warning("请选择要编辑的费用申请!", 1500);
|
|
294
|
+ } else if (data.length > 1) {
|
|
295
|
+ Message.warning("请选择一条记录进行编辑!", 1500);
|
|
296
|
+ } else if (data[0].spzt == "作废") {
|
|
297
|
+ Message.warning("该费用申请已作废!", 1500);
|
|
298
|
+ } else if (data[0].spzt == "审批结束") {
|
|
299
|
+ Message.warning("该费用申请已审批结束,不能修改!", 1500);
|
|
300
|
+ } else if (data[0].spzt != null && data[0].spzt.indexOf("未提交") < 0) {
|
|
301
|
+ Message.warning("该费用申请审批中,不能修改!", 1500);
|
|
302
|
+ ;
|
|
303
|
+ } else if (data[0].sqr != userId) {
|
|
304
|
+ Message.error("您不是该费用的申请人,不能修改!", 1500);
|
|
305
|
+ } else {
|
|
306
|
+ layer.open({
|
|
307
|
+ title: '编辑费用申请',
|
|
308
|
+ type: 2,
|
|
309
|
+ shade: 0.3,
|
|
310
|
+ maxmin: true,
|
|
311
|
+ shadeClose: true,
|
|
312
|
+ area: ['1020px', layerheight + 'px'],
|
|
313
|
+ content: AjaxUtil.ctx + 'staBudgetapproval/forApplyUpdate/' + data[0].id+'?fylbmc='+data[0].fylbmc,
|
|
314
|
+ end: function (index) {
|
|
315
|
+ if (updateflag == 1)
|
|
316
|
+ currTable.reload();
|
|
317
|
+ updateflag = 0;
|
|
318
|
+ }
|
|
319
|
+ });
|
|
320
|
+ // layer.full(index);
|
|
321
|
+ }
|
|
322
|
+ } else if (obj.event == 'view') {
|
|
323
|
+ var dataApproval = table.cache["currentTableId"];
|
|
324
|
+ if (dataApproval.length == 0)
|
|
325
|
+ return;
|
|
326
|
+
|
|
327
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
328
|
+ , data = checkStatus.data;
|
|
329
|
+ if (data == null || data.length === 0) {
|
|
330
|
+ Message.warning("请选择要查看的费用申请!", 1500);
|
|
331
|
+ } else if (data.length > 1) {
|
|
332
|
+ Message.warning("请选择一条记录进行查看!", 1500);
|
|
333
|
+ } else {
|
|
334
|
+ var title = '浏览费用申请';
|
|
335
|
+ var width = '1020px';
|
|
336
|
+ var content = AjaxUtil.ctx + 'staBudgetapproval/forApplyView/' + data[0].id+'?fylbmc='+data[0].fylbmc;
|
|
337
|
+ if (data[0].sfbyj == 1) {
|
|
338
|
+ title = '浏览备用金申请';
|
|
339
|
+ if (data[0].fylbmc == null) {
|
|
340
|
+ width = layerwidth + 'px';
|
|
341
|
+ content = AjaxUtil.ctx + 'staBudgetapproval/forImprestView/' + data[0].id;
|
|
342
|
+ }
|
|
343
|
+ }
|
|
344
|
+ layer.open({
|
|
345
|
+ title: title,
|
|
346
|
+ type: 2,
|
|
347
|
+ shade: 0.3,
|
|
348
|
+ maxmin: true,
|
|
349
|
+ shadeClose: true,
|
|
350
|
+ area: [width, layerheight + 'px'],
|
|
351
|
+ content: content,
|
|
352
|
+ end: function (index) {
|
|
353
|
+ layer.close(index);
|
|
354
|
+ }
|
|
355
|
+ });
|
|
356
|
+ // layer.full(index);
|
|
357
|
+ }
|
|
358
|
+ } else if (obj.event === 'delete') { // 监听删除操作
|
|
359
|
+ var dataApproval = table.cache["currentTableId"];
|
|
360
|
+ if (dataApproval.length == 0)
|
|
361
|
+ return;
|
|
362
|
+
|
|
363
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
364
|
+ , data = checkStatus.data;
|
|
365
|
+ if (data == null || data.length === 0) {
|
|
366
|
+ Message.warning("请选择要删除的费用申请!", 1500);
|
|
367
|
+ return;
|
|
368
|
+ } else {
|
|
369
|
+ for (let item of data) {
|
|
370
|
+ if (item.sqr != userId) {
|
|
371
|
+ Message.error("存在您不是申请人的费用,不能直接删除!", 2000);
|
|
372
|
+ return;
|
|
373
|
+ }
|
|
374
|
+ if (item.spzt != "未提交") {
|
|
375
|
+ if (item.spzt == "审批结束")
|
|
376
|
+ Message.warning("存在已审批结束的费用申请,不能直接删除!", 2000);
|
|
377
|
+ else if (data[0].spzt != null)
|
|
378
|
+ Message.warning("存在审批中的费用申请,不能直接删除!", 2000);
|
|
379
|
+ return;
|
|
380
|
+ }
|
|
381
|
+ }
|
|
382
|
+ }
|
|
383
|
+ layer.confirm('确定批量删除费用申请吗?', function (index) {
|
|
384
|
+ layer.close(index);
|
|
385
|
+ AjaxUtil.post({
|
|
386
|
+ url: AjaxUtil.ctx + "staBudgetapproval/batchDelete",
|
|
387
|
+ contentType: "application/json",
|
|
388
|
+ data: JSON.stringify(data),
|
|
389
|
+ success: function (res) {
|
|
390
|
+ if (res.code === 0) {
|
|
391
|
+ Message.success(1500, res.message, function () {
|
|
392
|
+ // 重载表格
|
|
393
|
+ currTable.reload();
|
|
394
|
+ });
|
|
395
|
+ } else {
|
|
396
|
+ Message.error(res.message, 1000);
|
|
397
|
+ }
|
|
398
|
+ },
|
|
399
|
+ error: function (error) {
|
|
400
|
+ }
|
|
401
|
+ });
|
|
402
|
+ });
|
|
403
|
+ } else if (obj.event === 'tjApprove') {
|
|
404
|
+ var projects = table.cache["currentTableId"];
|
|
405
|
+ if (projects.length == 0)
|
|
406
|
+ return;
|
|
407
|
+
|
|
408
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
409
|
+ , data = checkStatus.data;
|
|
410
|
+ if (data == null || data.length === 0) {
|
|
411
|
+ Message.warning("请选择要提交审批的费用申请!", 2000);
|
|
412
|
+ } else if (data.length > 1) {
|
|
413
|
+ Message.warning("请选择一条记录进行提交!", 1500);
|
|
414
|
+ } else if (data[0].spzt == "审批结束") {
|
|
415
|
+ Message.warning("该费用申请已审批结束!", 1500);
|
|
416
|
+ } else if (data[0].spzt == "作废") {
|
|
417
|
+ Message.warning("该费用申请已作废!", 1500);
|
|
418
|
+ } else if (data[0].spzt != null && data[0].spzt.indexOf("未提交") < 0) {
|
|
419
|
+ Message.warning("该费用申请正在审批中……", 1500);
|
|
420
|
+ } else if (data[0].sqr != userId) {
|
|
421
|
+ Message.error("您不是该费用的申请人!", 1500);
|
|
422
|
+ } else {
|
|
423
|
+ xmApproval = {
|
|
424
|
+ "xmid": data[0].id,
|
|
425
|
+ "xm": data[0].sqmc,
|
|
426
|
+ "zt": data[0].spzt,
|
|
427
|
+ "sqje": data[0].sqje
|
|
428
|
+ };
|
|
429
|
+ if (data[0].spzt == null) {
|
|
430
|
+ xmApproval.zt = "未提交";
|
|
431
|
+ data[0].spzt = "未提交";
|
|
432
|
+ }
|
|
433
|
+
|
|
434
|
+ var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveAdd';
|
|
435
|
+ if (data[0].spzt != "未提交")
|
|
436
|
+ content = AjaxUtil.ctx + 'staBudgetapproval/forApproveUpdate/' + data[0].id + '/' + data[0].sqje + '?spzt=' + data[0].spzt;
|
|
437
|
+
|
|
438
|
+ var index = layer.open({
|
|
439
|
+ title: '提交审批',
|
|
440
|
+ type: 2,
|
|
441
|
+ shade: 0.3,
|
|
442
|
+ maxmin: true,
|
|
443
|
+ shadeClose: true,
|
|
444
|
+ area: ['1025px', layerheight + 'px'],
|
|
445
|
+ content: content,
|
|
446
|
+ end: function () {
|
|
447
|
+ if (updateflag == 1)
|
|
448
|
+ currTable.reload();
|
|
449
|
+ updateflag = 0;
|
|
450
|
+ layer.close(index);
|
|
451
|
+ }
|
|
452
|
+ });
|
|
453
|
+ }
|
|
454
|
+ } else if (obj.event === 'spOption') {
|
|
455
|
+ var projects = table.cache["currentTableId"];
|
|
456
|
+ if (projects.length == 0)
|
|
457
|
+ return;
|
|
458
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
459
|
+ , data = checkStatus.data;
|
|
460
|
+ if (data == null || data.length === 0) {
|
|
461
|
+ Message.warning("请选择要审批的费用申请!", 2000);
|
|
462
|
+ } else if (data.length > 1) {
|
|
463
|
+ Message.warning("请选择一条记录进行审批!", 1500);
|
|
464
|
+ } else if (data[0].spzt == null || data[0].spzt.indexOf("未提交") >= 0) {
|
|
465
|
+ Message.warning("该费用申请尚未提交审批!", 1500);
|
|
466
|
+ } else if (data[0].spzt == "审批结束") {
|
|
467
|
+ Message.warning("该费用申请已审批结束!", 2000);
|
|
468
|
+ } else if (data[0].spzt == "作废") {
|
|
469
|
+ Message.warning("该费用申请已作废!", 1500);
|
|
470
|
+ } else {
|
|
471
|
+ xmApproval = {
|
|
472
|
+ "xmid": data[0].id,
|
|
473
|
+ "xm": data[0].sqmc,
|
|
474
|
+ "zt": data[0].spzt,
|
|
475
|
+ "sqje": data[0].sqje
|
|
476
|
+ };
|
|
477
|
+
|
|
478
|
+ var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveAdd';
|
|
479
|
+ if (data[0].spzt != "未提交")
|
|
480
|
+ content = AjaxUtil.ctx + 'staBudgetapproval/forApproveUpdate/' + data[0].id + '/' + data[0].sqje + '?spzt=' + data[0].spzt;
|
|
481
|
+
|
|
482
|
+ layer.open({
|
|
483
|
+ title: '审批意见',
|
|
484
|
+ type: 2,
|
|
485
|
+ shade: 0.3,
|
|
486
|
+ maxmin: true,
|
|
487
|
+ shadeClose: true,
|
|
488
|
+ area: ['1025px', layerheight + 'px'],
|
|
489
|
+ content: content,
|
|
490
|
+ end: function (index) {
|
|
491
|
+ if (updateflag == 1)
|
|
492
|
+ currTable.reload();
|
|
493
|
+ updateflag = 0;
|
|
494
|
+ }
|
|
495
|
+ });
|
|
496
|
+ }
|
|
497
|
+ } else if (obj.event === 'spList') {
|
|
498
|
+ var projects = table.cache["currentTableId"];
|
|
499
|
+ if (projects.length == 0)
|
|
500
|
+ return;
|
|
501
|
+
|
|
502
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
503
|
+ , data = checkStatus.data;
|
|
504
|
+ if (data == null || data.length === 0) {
|
|
505
|
+ Message.warning("请选择要查看审批列表的费用申请!", 1500);
|
|
506
|
+ } else if (data.length > 1) {
|
|
507
|
+ Message.warning("请选择一条记录进行查看!", 1500);
|
|
508
|
+ } else if (data[0].spzt == null || data[0].spzt == "未提交") {
|
|
509
|
+ Message.warning("该备费用申请尚未提交审批!", 1500);
|
|
510
|
+ } else {
|
|
511
|
+ xmApproval = {
|
|
512
|
+ "xmid": data[0].id,
|
|
513
|
+ "xm": data[0].sqmc,
|
|
514
|
+ "zt": data[0].spzt,
|
|
515
|
+ "sqje": data[0].sqje
|
|
516
|
+ };
|
|
517
|
+
|
|
518
|
+ var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveList';
|
|
519
|
+ if (data[0].sfbyj == 1)
|
|
520
|
+ content = AjaxUtil.ctx + 'staBudgetapproval/forApproveList1';
|
|
521
|
+
|
|
522
|
+ var index = layer.open({
|
|
523
|
+ title: '审批列表',
|
|
524
|
+ type: 2,
|
|
525
|
+ shade: 0.3,
|
|
526
|
+ maxmin: true,
|
|
527
|
+ shadeClose: true,
|
|
528
|
+ area: ['1300px', layerheight + 'px'],
|
|
529
|
+ content: content,
|
|
530
|
+ end: function () {
|
|
531
|
+ layer.close(index);
|
|
532
|
+ }
|
|
533
|
+ });
|
|
534
|
+ }
|
|
535
|
+ } else if (obj.event === 'reimburse') {
|
|
536
|
+ var projects = table.cache["currentTableId"];
|
|
537
|
+ if (projects.length == 0)
|
|
538
|
+ return;
|
|
539
|
+
|
|
540
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
541
|
+ , data = checkStatus.data;
|
|
542
|
+ if (data == null || data.length === 0) {
|
|
543
|
+ Message.warning("请选择要报账的费用申请!", 1500);
|
|
544
|
+ } else if (data.length > 1) {
|
|
545
|
+ Message.warning("请选择一条记录进行报账!", 1500);
|
|
546
|
+ } else if (data[0].spzt == "作废") {
|
|
547
|
+ Message.warning("该费用申请已作废!", 1500);
|
|
548
|
+ } else if (data[0].spzt.indexOf("未提交") >= 0) {
|
|
549
|
+ Message.warning("该费用申请尚未提交审批!", 1500);
|
|
550
|
+ } else if (data[0].spzt != "审批结束") {
|
|
551
|
+ Message.warning("该费用申请正在审批中……", 1500);
|
|
552
|
+ } else if (data[0].sfbz == 1) {
|
|
553
|
+ Message.warning("该费用申请已报账", 1500);
|
|
554
|
+ } else {
|
|
555
|
+ var index = layer.open({
|
|
556
|
+ title: '新建报账',
|
|
557
|
+ type: 2,
|
|
558
|
+ shade: 0.3,
|
|
559
|
+ maxmin: true,
|
|
560
|
+ shadeClose: true,
|
|
561
|
+ area: ['970px', '750px'],
|
|
562
|
+ content: AjaxUtil.ctx + "staReimbursement/forAdd/" + data[0].id,
|
|
563
|
+ end: function () {
|
|
564
|
+ if (updateflag == 1)
|
|
565
|
+ currTable.reload();
|
|
566
|
+ updateflag = 0;
|
|
567
|
+ layer.close(index);
|
|
568
|
+ }
|
|
569
|
+ });
|
|
570
|
+ }
|
|
571
|
+ } else if (obj.event === 'nullify') { // 监听作废操作
|
|
572
|
+ var projects = table.cache["currentTableId"];
|
|
573
|
+ if (projects.length == 0)
|
|
574
|
+ return;
|
|
575
|
+
|
|
576
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
577
|
+ , data = checkStatus.data;
|
|
578
|
+ if (data == null || data.length === 0)
|
|
579
|
+ Message.warning("请选择要作废的费用申请!", 1000);
|
|
580
|
+ else {
|
|
581
|
+ layer.confirm('确定批量作废费用申请吗?', function (index) {
|
|
582
|
+ layer.close(index);
|
|
583
|
+ AjaxUtil.post({
|
|
584
|
+ url: AjaxUtil.ctx + "staBudgetapproval/batchNullify",
|
|
585
|
+ contentType: "application/json",
|
|
586
|
+ data: JSON.stringify(data),
|
|
587
|
+ success: function (res) {
|
|
588
|
+ if (res.code === 0) {
|
|
589
|
+ Message.success(1500, res.message, function () {
|
|
590
|
+ // 重载表格
|
|
591
|
+ currTable.reload();
|
|
592
|
+ });
|
|
593
|
+ } else {
|
|
594
|
+ Message.error(res.message, 1000);
|
|
595
|
+ }
|
|
596
|
+ },
|
|
597
|
+ error: function (error) {
|
|
598
|
+ }
|
|
599
|
+ });
|
|
600
|
+ });
|
|
601
|
+ }
|
|
602
|
+ } else if (obj.event === 'tjrevokeApprove') {
|
|
603
|
+ var projects = table.cache["currentTableId"];
|
|
604
|
+ if (projects.length == 0)
|
|
605
|
+ return;
|
|
606
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
607
|
+ , data = checkStatus.data;
|
|
608
|
+ if (data == null || data.length === 0) {
|
|
609
|
+ Message.warning("请选择要撤销的费用申请!", 1500);
|
|
610
|
+ } else if (data.length > 1) {
|
|
611
|
+ Message.warning("请选择一条记录进行撤销!", 1500);
|
|
612
|
+ } else if (data[0].spzt == "审批结束") {
|
|
613
|
+ Message.warning("该费用申请已审批结束!", 1500);
|
|
614
|
+ }else if(data[0].spzt == "未提交"|| data[0].spzt == "未提交(返回)"){
|
|
615
|
+ Message.warning("该费用申请还未提交审批!", 1500);
|
|
616
|
+ }
|
|
617
|
+ // else if (data[0].cjr != userId) {
|
|
618
|
+ // Message.error("您不是该任务书的创建人!", 1500);}
|
|
619
|
+ else {
|
|
620
|
+ xmApproval = {
|
|
621
|
+ "xmid": data[0].id,
|
|
622
|
+ "xm": data[0].zwmc,
|
|
623
|
+ "zt": "未提交"
|
|
624
|
+ };
|
|
625
|
+ if (data[0].spzt == null) {
|
|
626
|
+ xmApproval.zt = "未提交";
|
|
627
|
+ data[0].spzt = "未提交";
|
|
628
|
+ }
|
|
629
|
+ var project = {
|
|
630
|
+ "id": xmApproval.xmid,
|
|
631
|
+ "spzt": data[0].spzt
|
|
632
|
+ }
|
|
633
|
+ layer.confirm('确定撤销费用申请吗?', function (index) {
|
|
634
|
+ layer.close(index);
|
|
635
|
+ AjaxUtil.post({
|
|
636
|
+ url: AjaxUtil.ctx + "staBudgetapproval/TJrevokeApprove",
|
|
637
|
+ contentType: "application/json",
|
|
638
|
+ data: JSON.stringify(project),
|
|
639
|
+ success: function (res) {
|
|
640
|
+ if (res.code === 0) {
|
|
641
|
+ Message.success(1500, res.message, function () {
|
|
642
|
+ // 重载表格
|
|
643
|
+ currTable.reload();
|
|
644
|
+ });
|
|
645
|
+ } else {
|
|
646
|
+ Message.error(res.message, 1000);
|
|
647
|
+ }
|
|
648
|
+ },
|
|
649
|
+ error: function (error) {
|
|
650
|
+ }
|
|
651
|
+ });
|
|
652
|
+ });
|
|
653
|
+ }
|
|
654
|
+ }else if (obj.event === 'export'){
|
|
655
|
+
|
|
656
|
+ var formData = form.val('search-form');
|
|
657
|
+ // 获取form 表单代码
|
|
658
|
+ console.log(formData);
|
|
659
|
+ var formDataString = JSON.stringify(formData);
|
|
660
|
+ AjaxUtil.post({
|
|
661
|
+ url:AjaxUtil.ctx +'staBudgetapproval/getAll/'+formDataString,
|
|
662
|
+ contentType: "application/json",
|
|
663
|
+ timeout: 15000, //大批量导出时会出现超时问题
|
|
664
|
+ success: function(res){
|
|
665
|
+ console.log(res);
|
|
666
|
+ table.exportFile('currentTableId',res.data,'xlsx');
|
|
667
|
+ },
|
|
668
|
+ error:function (error) {
|
|
669
|
+ Message.error(error,2000)
|
|
670
|
+
|
|
671
|
+ }
|
|
672
|
+ });
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+ }else if (obj.event === 'xmzy'){
|
|
676
|
+ var project = table.cache['currentTableId'];// 绑定表格元素 cache 表示缓存的意思
|
|
677
|
+ // 判断缓存是否为空
|
|
678
|
+ if(project.length == 0){
|
|
679
|
+ return;
|
|
680
|
+ }
|
|
681
|
+ // 获取table 中 缓存的数据
|
|
682
|
+ var checkStatus = table.checkStatus('currentTableId')
|
|
683
|
+ ,data = checkStatus.data;
|
|
684
|
+ if (data == null || data.length === 0){
|
|
685
|
+ layer.msg('请选择要转移的项目',{icon: 3});
|
|
686
|
+ }else if (data.length > 1){
|
|
687
|
+ layer.msg('请选择一条项目进项转移',{icon:3});
|
|
688
|
+ }else if (data[0].spzt != '审批结束'){
|
|
689
|
+ layer.msg('"'+data[0].sqmc+'"未审批结束,不能转移',{icon:3});
|
|
690
|
+ }else {
|
|
691
|
+ layer.open({
|
|
692
|
+ title: '项目转移',
|
|
693
|
+ type: 2,
|
|
694
|
+ shade: 0.3,
|
|
695
|
+ maxmin: true,
|
|
696
|
+ shadeClose: true,
|
|
697
|
+ area: ['1090px', layerheight + 'px'],
|
|
698
|
+ content: AjaxUtil.ctx + 'staBudgetapproval/updateSsbm/' + data[0].id,
|
|
699
|
+ success: function (layero, index) {
|
|
700
|
+ },
|
|
701
|
+ end: function (index) {
|
|
702
|
+ // 刷新表格
|
|
703
|
+ if (updateflag == 1)
|
|
704
|
+ currTable.reload();
|
|
705
|
+ updateflag = 0;
|
|
706
|
+ }
|
|
707
|
+ });
|
|
708
|
+ }
|
|
709
|
+ }
|
|
710
|
+ });
|
|
711
|
+
|
|
712
|
+ //双击
|
|
713
|
+ table.on('rowDouble(currentTableFilter)', function (obj) {
|
|
714
|
+ var data = obj.data;
|
|
715
|
+ var title = '浏览费用申请';
|
|
716
|
+ var width = '1020px';
|
|
717
|
+ var content = AjaxUtil.ctx + 'staBudgetapproval/forApplyView/' + data.id;
|
|
718
|
+ if (data.sfbyj == 1) {
|
|
719
|
+ title = '浏览备用金申请';
|
|
720
|
+ if (data.fylbmc == null) {
|
|
721
|
+ width = layerwidth + 'px';
|
|
722
|
+ content = AjaxUtil.ctx + 'staBudgetapproval/forImprestView/' + data.id;
|
|
723
|
+ }
|
|
724
|
+ }
|
|
725
|
+ layer.open({
|
|
726
|
+ title: title,
|
|
727
|
+ type: 2,
|
|
728
|
+ shade: 0.3,
|
|
729
|
+ maxmin: true,
|
|
730
|
+ shadeClose: true,
|
|
731
|
+ area: [width, layerheight + 'px'],
|
|
732
|
+ content: content,
|
|
733
|
+ end: function (index) {
|
|
734
|
+ layer.close(index);
|
|
735
|
+ }
|
|
736
|
+ });
|
|
737
|
+ });
|
|
738
|
+ });
|
|
739
|
+
|
|
740
|
+ function setUpdateFlag() {
|
|
741
|
+ updateflag = 1;
|
|
742
|
+ }
|
|
743
|
+
|
|
744
|
+ function getXmApproval() {
|
|
745
|
+ return xmApproval;
|
|
746
|
+ }
|
|
747
|
+
|
|
748
|
+ function arrayToTree(data, firstPid) {
|
|
749
|
+ const result = [];
|
|
750
|
+ getChildren(data, result, firstPid)
|
|
751
|
+ return result;
|
|
752
|
+ }
|
|
753
|
+
|
|
754
|
+ function getChildren(data, result, parentId) {
|
|
755
|
+ for (const item of data) {
|
|
756
|
+ if (item.parentId === parentId) {
|
|
757
|
+ const newItem = {...item, children: []};
|
|
758
|
+ result.push(newItem);
|
|
759
|
+ getChildren(data, newItem.children, item.deptId);
|
|
760
|
+ }
|
|
761
|
+ }
|
|
762
|
+ }
|
|
763
|
+</script>
|
|
764
|
+</body>
|
|
765
|
+</html>
|