dataTable.js
24 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
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
var fields = [];
var checkedProjectList = [];
function setLayuiData(_data, type, version) {
//高度最大化
var layuiTableCol = [[ //标题栏
{ field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "37" }
, { field: 'BJQX', event: "event2", unresize: false, width: "3%" }
, { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" }
, { field: 'PROJECTCODE', title: '项目编号', width: "8%", event: "eventProjectcode" }
, { field: 'PROJECTNAME', title: '项目名称', width: "8%", event: "eventProjectname" }
, { field: 'FLOWNAME', title: '业务类型', width: "12%", event: "eventflowname" }
, { field: 'BINDINGUNIT', title: '发起部门', width: "10%", event: "eventBindingunit" }
, { field: 'REGISTERTIME', title: '上报时间', width: "8%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME.split(" ")[0] } }
]];
if (orign == 'ghsc') {
// isType; // 1 数据申请 2 成果审查
if(isType == 1) {
// -- 数据申请
layuiTableCol = [[ //标题栏
{ field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "31" }
, { field: 'BJQX', event: "event2", unresize: false, width: "3%" }
, { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" }
, { field: 'PROJECTCODE', title: '项目编号', width: "10%", event: "eventProjectcode" }
// 数据类型
, { field: 'FLOWNAME', title: '数据类型', width: "8%", event: "eventProjectstatus" }
// -- 数据用途 暂无字段
, { field: 'YT', title: '数据用途', width: "20%", event: "eventProjectname" }
// 密级 暂无字段
, { field: 'MJ', title: '密级', width: "10%", event: "eventProjectstatus" }
, { field: 'ACTIVITYNAME', title: '当前环节', width: "10%", event: "eventProjectstatus" }
, { field: 'BINDINGASSIGNEE', title: '申请部门', width: "8%", event: "eventInterconnect" }
, { field: 'REGISTERTIME', title: '申请时间', width: "10%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : ''} }
]];
}else {
layuiTableCol = [[ //标题栏
{ field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "31" }
, { field: 'BJQX', event: "event2", unresize: false, width: "3%" }
, { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" }
, { field: 'PROJECTCODE', title: '项目编号', width: "10%", event: "eventProjectcode" }
// 规划类型 暂无字段
, { field: 'XMLX', title: '规划类型', width: "8%", event: "eventProjectstatus" }
, { field: 'PROJECTNAME', title: '项目名称', width: "20%", event: "eventProjectname" }
// 行政辖区 暂无字段
, { field: 'XZQHBSM', title: '行政辖区', width: "5%", event: "eventProjectstatus" }
// 项目版本 暂无字段
, { field: 'CGBBH', title: '项目版本', width: "5%", event: "eventProjectstatus" }
, { field: 'ACTIVITYNAME', title: '当前环节', width: "10%", event: "eventProjectstatus" }
, { field: 'SPJD', title: '审批阶段', width: "10%", event: "eventProjectstatus" }
, { field: 'BINDINGASSIGNEE', title: '发起部门', width: "8%", event: "eventInterconnect" }
, { field: 'REGISTERTIME', title: '报送时间', width: "10%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : '' } }
// , { field: 'FLOWNAME', title: '业务类型', width: "12%", event: "eventflowname" }
]];
}
}
else if (orign == 'ywxt') {
// 业务协同 策划生成
layuiTableCol = [[ //标题栏
{field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"}
,{field: 'BJQX', event:"event2",unresize:false, width:"3%"}
,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"}
,{field: 'FLOWNAME', title: '业务类型',width:"16%",event:"eventflowname"}
,{field: 'PROJECTNAME', title: '项目名称',width:"20%", event:"eventProjectname"}
,{field: 'PROJECTCODE', title: '储备编号', width:"7%", event:"eventProjectcode"}
,{field: 'PROJECTCODE', title: '项目编号', width:"10%", event:"eventProjectcode"}
,{field: 'CASECODE', title: '建设地点', width:"7%", event:"eventProjectcode"}
,{field: 'BUILDADDRESS', title: '建设单位', width:"7%",event:"eventBuildadddress"}
,{field: 'BUILDUNIT', title: '当前阶段', width:"7%", event:"eventBuildunit"}
,{field: 'ACTIVITYNAME', title: '当前环节', width:"7%", event:"eventBuildunit"}
,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) {return d.REGISTERTIME.split(" ")[0]}}
,{field: 'BINDINGASSIGNEE', title: '经办人', width:"5%", event:"eventInterconnect"}
,{field: 'BINDINGUNIT', title: '所属部门', width:"5%", event:"eventInterconnect"}
,{field: 'BINDINGASSIGNEE', title: '策划结论', event:"eventBindingunit"}
]];
}
else if (orign === 'ywxt-xmcb') {
// 业务协同 项目储备
layuiTableCol = [[ //标题栏
{field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"}
,{field: 'BJQX', event:"event2",unresize:false, width:"3%"}
,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"}
,{field: 'FLOWNAME', title: '业务类型',width:"15%",event:"eventflowname"}
,{field: 'PROJECTNAME', title: '项目名称',width:"20%", event:"eventProjectname"}
,{field: 'PROJECTCODE', title: '储备编号', width:"10%", event:"eventProjectcode"}
,{field: 'CASECODE', title: '建设地点', width:"7%", event:"eventProjectcode"}
,{field: 'BUILDADDRESS', title: '建设单位', width:"7%",event:"eventBuildadddress"}
,{field: 'BUILDUNIT', title: '当前阶段', width:"7%", event:"eventBuildunit"}
,{field: 'ACTIVITYNAME', title: '当前环节', width:"7%", event:"eventBuildunit"}
,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) {return d.REGISTERTIME.split(" ")[0]}}
,{field: 'BINDINGASSIGNEE', title: '经办人', width:"5%", event:"eventInterconnect"}
,{field: 'BINDINGUNIT', title: '所属部门', width:"5%", event:"eventInterconnect"}
,{field: 'BINDINGASSIGNEE', title: '是否反库', event:"eventBindingunit"}
]];
}
else if (orign === 'ywxt-xmsp' || orign === 'ywxt-all') {
// 业务协同 项目审批
layuiTableCol = [[ //标题栏
{field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"}
,{field: 'BJQX', event:"event2",unresize:false, width:"3%"}
,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"}
,{field: 'PROJECTCODE', title: '项目编号', width:"10%", event:"eventProjectcode"}
,{field: 'PROJECTNAME', title: '项目名称',width:"15%", event:"eventProjectname"}
,{field: 'FLOWNAME', title: '业务类型',width:"20%",event:"eventflowname"}
,{field: 'BINDINGUNIT', title: '发起部门', width:"10%", event:"eventInterconnect"}
,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : ''}}
]];
}
var tableTop = $("#nvaTab").offset().top-10;
var bodyPadding = parseInt($("body").css("padding"));
var iframeTop = window.parent.$("#iframecontent").offset() ? window.parent.$("#iframecontent").offset().top : "";
var fullHeight = iframeTop != "" ? 'full-' + parseInt(iframeTop + bodyPadding + tableTop) : "full-300";
layui.use(['table', 'element'], function () {
var table = layui.table;
var element = layui.element;
//展示已知数据
table.render({
elem: '#dataList'
, id: 'tableRenderId'
, cols: layuiTableCol
, data: _data
, skin: 'line' //表格风格
//,even: true
, limit: pageSize //每页默认显示的数量
, size: "sm"
, height: fullHeight
//,height: 'full-295'
, done: function (res, curr, count) {
setCell(res.data);
}
});
//获取选中行
window.getCheckStatus = function () {
var checkStatus = table.checkStatus('tableRenderId');
console.log("输出选中行--------");
console.log(checkStatus);
console.log("--------");
return checkStatus;
}
var objtr; //选中行的DOM元素
//监听单元格事件
table.on('tool(listEvent)', function (obj) {
var data = obj.data;
myDatatable = obj.data;
//除了复选框单元格,点击其他单元格跳详情页
if (obj.event == 'eventCheckbox') {
objtr = obj.tr;
} else {
if (data.MEETINGPROJECTSTATE != null && data.MEETINGPROJECTSTATE != "" && parent.listName != "项目查询" && parent.listName != "已办项目") {
parent.layer ? parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }) : opener.parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 });
return;
} else {
// create by zys 2020/3/16 版本号控制 start
data.FLOWVERSION = version;
// end
openApproveDetail(data);
}
}
});
//监听复选框事件
table.on('checkbox(listEvent)', function (obj) {
//续办,日志,删除按钮状态
buttonStyle(getCheckStatus().data.length, obj.type == "all");
//选中行样式(全选)
if (obj.type == "all" && obj.checked) {
// checkedAllStyle(obj.checked);
checkedProjectList = getCheckStatus().data;
} else if (obj.type == "all" && !obj.checked) {
checkedProjectList = [];
}
if (obj.checked && obj.type == "one") {
checkedProjectList.push(obj.data);
} else if (!obj.checked && obj.type == "one") {
checkedProjectList.splice(checkedProjectList.indexOf(obj.data), 1);
}
/*//选中行样式(单选)
if(objtr && obj.checked) {
$(objtr[0]).addClass("layui-table-checked");
objtr = "";
}else if(objtr){
$(objtr[0]).removeClass("layui-table-checked");
objtr = "";
}*/
});
});
}
function setSreachLayuiData(_data, type) {
//高度最大化
var tableTop = $("#nvaTab").offset().top - 10;
var bodyPadding = parseInt($("body").css("padding"));
var iframeTop = window.parent.$("#iframecontent").offset() ? window.parent.$("#iframecontent").offset().top : "";
var fullHeight = iframeTop != "" ? 'full-' + parseInt(iframeTop + bodyPadding + tableTop) : "full-300";
layui.use(['table', 'element'], function () {
var table = layui.table;
var element = layui.element;
//展示已知数据
table.render({
elem: '#dataList'
, id: 'tableRenderId'
, cols: [[ //标题栏
{ field: 'CHECKBOX', type: 'checkbox', title: '复选框', event: "eventCheckbox", width: 40 }
, { field: 'name', event: "event2", width: 30 }
, { field: 'LAY_TABLE_INDEX', title: '状态', width: "4%", event: "eventProjectstatus" }
, { field: 'FLOWNAME', title: '工程类型', width: "8%", event: "eventflowname" }
, { field: 'PROJECTCODE', title: '项目编号', width: "9%", event: "eventProjectcode" }
, { field: 'CASECODE', title: '报建编号', width: "8%", event: "eventcasecode" }
, { field: 'PROJECTNAME', title: '项目名称', width: "20%", event: "eventProjectname" }
, { field: 'BUILDADDRESS', title: '建设位置', event: "eventBuildadddress" }
, { field: 'BUILDUNIT', title: '建设单位', width: "8%", event: "eventBuildunit" }
, { field: 'CERTIFICATENUMBER', title: '证号', width: "8%", event: "eventCretificatenumber" }
, { field: 'FD11', title: '选址意见书证号', width: "8%", event: "eventFd11" }
, { field: 'REGISTERTIME', title: '登记时间', width: "9%", event: "eventRegistertime" }
, { field: 'AGENT', title: '提交人', width: "5%", event: "eventagent" }
, { field: 'AGENTOFFICE', title: '主办科室', width: "6%", event: "eventBindingunit" }
]]
, data: _data
, skin: 'line' //表格风格
//,even: true
, limit: pageSize //每页默认显示的数量
, size: "sm"
, height: fullHeight
//,height: 'full-295'
, done: function (res, curr, count) {
setCell(res.data);
console.log(table);
}
});
//获取选中行
window.getCheckStatus = function () {
var checkStatus = table.checkStatus('tableRenderId');
return checkStatus;
}
var objtr; //选中行的DOM元素
//监听单元格事件
table.on('tool(listEvent)', function (obj) {
var data = obj.data;
//除了复选框单元格,点击其他单元格跳详情页
if (obj.event == 'eventCheckbox') {
objtr = obj.tr;
} else {
if (data.MEETINGPROJECTSTATE != null && data.MEETINGPROJECTSTATE != "" && parent.listName != "项目查询" && parent.listName != "已办项目") {
parent.layer ? parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }) : opener.parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 });
return;
} else {
openApproveDetail(data);
}
}
});
//监听复选框事件
table.on('checkbox(listEvent)', function (obj) {
//续办,日志,删除按钮状态
buttonStyle(getCheckStatus().data.length, obj.type == "all");
// buttonStyle(obj.data.length, obj.type == "all");
//选中行样式(全选)
if (obj.type == "all") {
checkedAllStyle(obj.checked);
}
//选中行样式(单选)
if (objtr && obj.checked) {
$(objtr[0]).addClass("layui-table-checked");
objtr = "";
} else if (objtr) {
$(objtr[0]).removeClass("layui-table-checked");
objtr = "";
}
});
});
}
//layui分页控件
function layuiPage(total) {
layui.use('laypage', function () {
var laypage = layui.laypage;
console.log("当前第几页")
laypage.render({
elem: 'page'
, count: total
, limit: pageSize
, curr: currentPage
//,limits: [10, 12, 16, 20]
, theme: "#337ab7"
, layout: ['prev', 'page', 'next', 'skip']
// ,layout: total <= pageSize ? ['count'] : ['count', 'prev', 'page', 'next', 'skip']
, jump: function (obj, first) {
console.log("++++++++Obj")
console.log(obj)
console.log("+++++++++first")
console.log(first)
currentPage = obj.curr;
pageSize = obj.limit;
//首次不执行
if (!first) {
console.log(obj, first);
// var ss = htmlTableBodyTr.concat().splice((obj.curr || 1)*10 , 10);
// $('#dataList').html(ss);
getApproveList(obj.curr);
}
}
});
});
}
//表头全选行样式
function checkedAllStyle(checked) {
$(".layui-table-body tr").each(function () {
if (checked) {
$(this).addClass("layui-table-checked");
} else {
$(this).removeClass("layui-table-checked");
}
})
}
/**
* 鼠标悬停显示title
* 待办项目未读加粗
*/
function setCell(data) {//方法已经不用了,李lhy20181228
$(".layui-table-body tr td").each(function () {
var text = $(this).first()[0].innerText.trim();
if (text == "") text = "";
$(this).attr("title", text);
})
//注释lhy,已经修改到dealingproject.js文件里加粗
if (window.parent.listName == "待办项目") {
$(".layui-table-body tr").each(function (index) {
if (data[index].DESCRIPTION != "read") {
$(this).css("font-weight", "600");
}
})
}
$(".layui-table-header th").each(function (index) {
var field = $(this).attr("data-field");
fields.push(field);
})
/* $(".laytable-cell-1-BJQX").each(function() {
$(this).removeClass("laytable-cell-1-BJQX");
})*/
}
/**
* 根据二级菜单打开对应详情页
* @param data 列表数据
* @returns
*/
function openApproveDetail(data) {
var type = window.parent.listName ? window.parent.listName : sreachparent(opener, "listName");
var detailType = null;
if(type == "待办项目"){
detailType = 1;
}else if (type == "已办项目"){
detailType = 2;
}
data.detailType = detailType;
if (type == "项目管理") data.stats = "Manage";
else if (type == "项目查询") data.stats = "search";
else if (type == "待办项目") data.stats = "projecting";
else if (type == "已办项目") data.stats = "dealedproject";
else if (type == "补正项目") data.stats = "correctionproject";
//去掉搜索高亮标签
data.PROJECTNAME = data.PROJECTNAME.replace('<span style="color:red">', '').replace('</span>', '');
data.PROJECTNAME = data.PROJECTNAME.replace('<img src="../../image/home-content/fj.png" title="附件" style="width:18px;height:18px;margin-right: 5px;">', '');
jumpdetailPage(data);
}
/**
* 审批列表按钮样式
* @param length
* @param bol
* @returns
*/
function buttonStyle(length, bol) {
if (length == 1) {
// 结束 续办 删除 日志 项目树 取回
$("#endButton, #continueProject, #deleteProject, #journal, #projectTreebtn, #recaptionButton").removeClass("disabled").removeClass("buttonStatusStyle").addClass("btn-info");
} else if (length > 1) {
//复选框多选且不在全选状态
$("#journal, #continueProject, #projectTreebtn").addClass("disabled").addClass("buttonStatusStyle").removeClass("btn-info");
if (bol) {
//复选框多选且全选状态
$("#deleteProject, #endButton, #recaptionButton").removeClass("disabled").removeClass("buttonStatusStyle").addClass("btn-info");
}
} else {
$("#endButton, #continueProject, #journal, #deleteProject, #projectTreebtn, #recaptionButton").addClass("disabled").addClass("buttonStatusStyle").removeClass("btn-info");
}
}
/**
* 续办
* @returns
*/
function openlayer_continue() {
var checkboxData = [];
if (window.parent.listName == "待办项目") {
// checkboxData = checkedProjectList;
checkboxData = getCheckedProjectData();
} else {
checkboxData = getCheckStatus().data;
}
if (checkboxData.length == 0) {
parent.layer.msg("请选择项目!", { icon: 2 });
return;
}
if (checkboxData.length > 1) {
parent.layer.msg("只能选择一个项目!", { icon: 2 });
return;
}
if (checkboxData.length == 1) {
var projectId = checkboxData[0].PROJECTID;
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.getProjectCasecode,
headers: {
"token": $.cookie('ftoken')
},
data: { projectId: projectId },
dataType: 'json',
success: function (data) {
if (data.status == 'ok') {
parent.layer.open({
type: 2,
title: '审批类型',
shadeClose: true,
shade: 0.6,
area: ['80%', '80%'],
content: 'view/projecttask/selectHandl.html?createmethod=续办&projectId=' + projectId //iframe的url
});
} else
layer.msg(data.message, { icon: 2 });
}
});
event.stopPropagation();
}
}
/**
* 日志
* @returns
*/
function openJournal() {
var checkboxData;
if (window.parent.listName == "待办项目") {
// checkboxData = checkedProjectList;
checkboxData = getCheckedProjectData();
} else {
checkboxData = getCheckStatus().data;
}
if (checkboxData.length == 0) {
parent.layer.msg("请选择项目!", { icon: 2 });
}
if (checkboxData.length > 1) {
parent.layer.msg("只能选择一个项目!", { icon: 2 });
}
if (checkboxData.length == 1) {
var flowInstanceId = checkboxData[0].INSTANCEID;
var url = global.contextPath + '/view/projecttask/flowlog.jsp?flowInstanceId=' + flowInstanceId;
parent.layer.open({
type: 2, // page层
area: ['70%', '90%'],
title: '流程日志',
shadeClose: true,
shade: 0.6, // 遮罩透明度
moveType: 1, // 拖拽风格,0是默认,1是传统拖动
moveOut: true,
// shift: 1, //0-6的动画形式,-1不开启
content: url
});
}
}
/**
* 刷新
* @returns
*/
function openRefreshList() {
getApproveList(1);
}
/**
* 批量结束
* @returns
*/
function finishFlow() {
if (!taskIds) {
layer.msg('请选择需要结束的项目', { icon: 2 });
return;
}
if (!canFinishFlow) {
layer.msg('所选择的项目包含非退件项目,无法结束', { icon: 2 });
return;
}
layer.open({
content: '确定结束该项目吗?',
btn: ['确认', '取消'],
shadeClose: true,
icon: 3,
yes: function () {
var url = global.contextPath + global.modelctls.flowEngine.task.finishFlow;
$.post(url, { taskIds: taskIds }, function (data) {
if (data.status == 'ok') {
layer.msg(data.message, { icon: 1 });
getApproveList(1);
} else
layer.msg(data.message, { icon: 2 });
});
}
});
}
/**
* 结束
* @returns
*/
function openlayer_endtask() {
var taskArray = [];
var checkboxData;
if (window.parent.listName == "待办项目") {
// checkboxData = checkedProjectList;
checkboxData = getCheckedProjectData();
} else {
checkboxData = getCheckStatus().data;
}
for (var i = 0; i < checkboxData.length; i++) {
if (checkboxData[i].PROJECTSTATUS == "退件") {
taskArray.push({ taskId: checkboxData[i].TASKID, projectId: checkboxData[i].PROJECTID });
} else {
parent.layer.msg("结束失败!只有状态为'退件'的案件才可以结束!", { icon: 2 });
return;
}
}
if (checkboxData.length == 0) {
parent.layer.msg("请选择项目!", { icon: 2 });
} else {
parent.layer.open({
content: '确定结束选中流程吗?',
btn: ['确认', '取消'],
shadeClose: true,
icon: 3,
yes: function () {
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.task.finishFlow,
headers: {
"token": $.cookie('ftoken')
},
contentType: "application/json",
data: JSON.stringify(taskArray),
success: function (result) {
if (result.status == 'ok') {
/*action = "退件办结";
for(var i=0;i<projectids.length;i++){
projectid = projectids[i];
updateActionStatus();
}
var taskListArray=[];
var taskList=result.data;
for(var i=0;i<taskList.length;i++){
taskListArray.push(taskList[i].instanceId);
}
if(taskListArray!=null){
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.updateProjectTwo,
headers:{
"token":$.cookie('ftoken')
},
data:{
taskList : taskListArray.join()
},
dataType: 'json',
success:function(msg){
}
});
}*/
parent.layer.msg(result.message, { icon: 1 });
setTimeout(function () {
self.close();
window.location.reload();
}, 1500);
//openRefreshList();
} else {
parent.layer.msg(result.message, { icon: 2 });
setTimeout(function () {
self.close();
window.location.reload();
}, 1500);
}
}
});
parent.layer.closeAll();
}
});
}
}
/**
* 改变列宽,不允许溢出列表
* @param ruleWidth 原表头的宽度
* @param dragWidth 拖拽后表头的宽度
* @returns 列表宽度, 拖拽后列表行的宽度
*
* 在layui的js中引用该方法
* 目前在layui.all.js的6282行中引用
*/
function dragMaxWidth(dict, dragdropWidth) {
var ruleWidth = dict.ruleWidth;
/*var dragWidth = dragdropWidth - ruleWidth;
dragWidth = dragWidth/fields.length-2;
if(fields && dragWidth>0) {
console.log("向右: " + dragWidth);
for(var i=0; i<fields.length; i++) {
if(fields[i] == dict.field) {
$(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) {
if($(this).width() != 0){
var width = $(this).width()+(dragdropWidth - ruleWidth);
console.log(width);
$(this).css("width",width+"px");
$(this).parent().css("width",width+1+"px");
}
})
}else {
$(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) {
if($(this).width() != 0){
var width = $(this).width()-dragWidth;
//console.log(width);
$(this).css("width",width+"px");
$(this).parent().css("width",width+1+"px");
}
})
}
}
}
if(fields && aa>0){
console.log("向左: " + aa);
for(var i=0; i<fields.length; i++) {
if(fields[i] == dict.field || fields[i] == "CHECKBOX")
continue;
$(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) {
if($(this).width() != 0){
$(this).css("width",($(this).width()+aa)<60?60:($(this).width()+aa)+"px");
}
})
}
}*/
// 数据列表的宽度
var tableWidth = $("#nvaTab").width();
// 列表行的宽度
var trOffsetWidth = $(".layui-table-body tr:last")[0].offsetWidth;
var maxWidth = trOffsetWidth - ruleWidth + dragdropWidth;
return [tableWidth, maxWidth];
}