searchproject.js
33.1 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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
var currentPage = 1;// 当前页
var totalpage = 0;// 总页数
var pageNum = 5;// 最多显示页数
var pageSize = 13;//列表显示行数
var projectId;
var conditionstrs = [];
var canSelfTurning = null;
var flowObjectName = null;
var searchInfo;
var andconditionJson;
var curserver;
var agent;
var projectSearchClick;
var checkboxState = "";
var listObject;
var flowList;
var linkList;
var idTmr;
var isShow=false;
pagging.config.list = getApproveList;
$(function() {
curserver = CONF_BACK_SERVERURL;
getHoliday();//hyh 新增 获取假期,并且该方法设置为同步 2017、10、14
bottomEvent();
jdate();
//getSelectType();
getLayerIdByKeyName();//ljy 2018-01-08 获取键值对
sreachChange();
var tbodylist=$("#nvaTab .layui-table-body tbody").children();
if(tbodylist.length<=0) {
$("#export_ecxel").attr("disabled","disabled");
$("#export_ecxelAll").attr("disabled","disabled");
}
});
window.onload = function(){
setTimeout(function() {parent.window.NProgress?parent.window.NProgress.done():""}, 500);
}
function statschange(){
andconditionJson = JSON.stringify(getcondition());
getApproveList(1, searchInfo, andconditionJson);
}
/**
* 审批查询
*/
function moreSearchShow() {
var node_search = $('#moreSearch');
if (node_search.is(":hidden")) {
node_search.show("fast");
$("#btn_moresearch").html("模糊查询");
$("#searchInput").attr("disabled", "disabled");
$("#searchbtninfo").attr("disabled", "disabled");
} else {
node_search.hide("fast");
$("#searchInput").attr("disabled", null);
$("#searchbtninfo").attr("disabled", null);
$("#btn_moresearch").html("高级查询");
}
}
/**
* 续办
*/
function openlayer_continue(projectid, event) {
if (event)
event.cancelBubble = true;
if (projectid)
projectId = projectid;
if (!projectId) {
layer.msg('请选择续办的项目', {
icon : 2
});
return;
}
layer.open({
type : 2,
title : '审批类型',
shadeClose : true,
shade : 0.6,
offset : '20px',
area : [ '900px', '500px' ],
content : 'selecttype.jsp?projectId=' + projectId // iframe的url
});
}
function bottomEvent() {
$('input[type="text"]').keydown( function(e) {
if(event.keyCode == 13){
currentPage=1;
}else{
currentPage=$(".layui-input").val();
}
});
$(document).keyup(function (e) {//捕获文档对象的按键弹起事件
if (e.keyCode == 13) {//按键信息对象以参数的形式传递进来了
var conditionstr = null;
pagging.config.list = getApproveList;
searchInfo = $("#searchInput").val();
conditionstr = searchInfo.trim();
conditionstrs = conditionstr.split(" ");
andconditionJson = JSON.stringify(getcondition());
getApproveList(currentPage, searchInfo, andconditionJson);
}
});
// 查询
$("#query_bycondition").click(function() {
var conditionstr = null;
pagging.config.list = getApproveList;
searchInfo = $("#searchInput").val();
conditionstr = searchInfo.trim();
conditionstrs = conditionstr.split(" ");
andconditionJson = JSON.stringify(getcondition());
getApproveList(1, searchInfo, andconditionJson);
});
// 清除查询
$("#clean_query").click(function() {
conditionstrs = [];
$("#searchInput").val("");
$("#bindingUnit").val("");
$("#bindingAssignee").val("");
$("#signStartTime").val("");
$("#signEndTime").val("");
$("#limitStartTime").val("");
$("#limitEndTime").val("");
$("#dateStartTime").val("");
$("#dateEndTime").val("");
$(".remove").click(); // 重置业务类型
var statusQuery = document.getElementById("StatusQuery");
for (var i = 0; i < statusQuery.options.length; i++) {
if (statusQuery.options[i].innerHTML == "所有") {
statusQuery.options[i].selected = true;
}
}
searchInfo = "";
andconditionJson = "";
getApproveList(1);
});
$('#searchInput').bind('keypress', function(event) {
if (event.keyCode == "13") {
var conditionstr = null;
searchInfo = $("#searchInput").val();
conditionstr = searchInfo.trim();
conditionstrs = conditionstr.split(" ");
getApproveList(1, searchInfo);
}
});
$('#export_ecxel').bind('click', function(event) {
if(getExplorer()=='ie') {
var curTbl = document.getElementById(tableid);
var oXL = new ActiveXObject("Excel.Application");
//创建AX对象excel
var oWB = oXL.Workbooks.Add();
//获取workbook对象
var xlsheet = oWB.Worksheets(1);
//激活当前sheet
var sel = document.body.createTextRange();
sel.moveToElementText(curTbl);
//把表格中的内容移到TextRange中
sel.select;
//全选TextRange中内容
sel.execCommand("Copy");
//复制TextRange中内容
xlsheet.Paste();
//粘贴到活动的EXCEL中
oXL.Visible = true;
//设置excel可见属性
try {
var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
} catch (e) {
print("Nested catch caught " + e);
} finally {
oWB.SaveAs(fname);
oWB.Close(savechanges = false);
//xls.visible = false;
oXL.Quit();
oXL = null;
//结束excel进程,退出完成
//window.setInterval("Cleanup();",1);
idTmr = window.setInterval("Cleanup();", 1);
}
} else {
tableToExcel();
}
});
$('#export_ecxelAll').bind('click', function(event) {
var conditionstr = null;
pagging.config.list = getApproveList;
searchInfo = $("#searchInput").val();
conditionstr = searchInfo.trim();
conditionstrs = conditionstr.split(" ");
andconditionJson = JSON.stringify(getcondition());
getApproveListAllToExcel(1, searchInfo, andconditionJson);
});
}
function getExplorer() {
var explorer = window.navigator.userAgent ;
//ie
if (explorer.indexOf("MSIE") >= 0) {
return 'ie';
}
//firefox
else if (explorer.indexOf("Firefox") >= 0) {
return 'Firefox';
}
//Chrome
else if(explorer.indexOf("Chrome") >= 0){
return 'Chrome';
}
//Opera
else if(explorer.indexOf("Opera") >= 0){
return 'Opera';
}
//Safari
else if(explorer.indexOf("Safari") >= 0){
return 'Safari';
}
}
function Cleanup() {
window.clearInterval(idTmr);
CollectGarbage();
}
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64 = function(s) {
return window.btoa(unescape(encodeURIComponent(s)))
},
// 下面这段函数作用是:将template中的变量替换为页面内容ctx获取到的值
format = function(s, c) {
return s.replace(/{(\w+)}/g,
function(m, p) {
return c[p];
}
)
};
return function() {
var theadList=$("#nvaTab .layui-table-header thead tr").children();
var tbodyList=$("#nvaTab .layui-table-body tbody").children();
var thead="";
var tbodylist="";
for(var i=0;i<theadList.length;i++) {
if(i<2) {
continue;
}else {
thead+="<th>"+theadList[i].textContent+"</th>";
}
}
thead ="<tr>"+thead+"</tr>";
for(var i=0;i<tbodyList.length;i++) {
var childrenlist=tbodyList[i].children;
var tbody="";
for(var j=0;j<childrenlist.length;j++) {
if(j<2) {
continue;
}else {
tbody+="<td>"+childrenlist[j].textContent+"</td>";
}
}
tbodylist +="<tr>"+tbody+"</tr>";
}
// 获取表单的名字和表单查询的内容
var ctx = {worksheet: name || 'Worksheet', table: thead+tbodylist};
// format()函数:通过格式操作使任意类型的数据转换成一个字符串
// base64():进行编码
var link = document.createElement("a");
link.download ='导出项目_'+new Date().format("yyyy-MM-dd ")+'.xls';
link.href=uri + base64(format(template, ctx));
document.body.appendChild(link);
link.click();
}
})()
var tableToExcelAll = (function(data) {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64 = function(s) {
return window.btoa(unescape(encodeURIComponent(s)))
},
// 下面这段函数作用是:将template中的变量替换为页面内容ctx获取到的值
format = function(s, c) {
return s.replace(/{(\w+)}/g,
function(m, p) {
return c[p];
}
)
};
return function(data) {
var theadList=$("#nvaTab .layui-table-header thead tr").children();
var thead="";
var tbodylist="";
for(var i=0;i<theadList.length;i++) {
if(i<2) {
continue;
}else {
thead+="<th>"+theadList[i].textContent+"</th>";
}
}
thead ="<tr>"+thead+"</tr>";
for(var i=0;i<data["Data"].length;i++){
for(var j=0;j<data["Data"][i].length;j++){
var dataobj = data["Data"][i][j];
var taskid = dataobj["TASKID"] == null ? "null": dataobj["TASKID"]
var status = dataobj["PROJECTSTATUS"] == null ? "-" : dataobj["PROJECTSTATUS"];
var casecode = dataobj["CASECODE"] == null ? "" : dataobj["CASECODE"];
var projectcode = dataobj["PROJECTCODE"] == null ? "" : dataobj["PROJECTCODE"];
var projectname = dataobj["PROJECTNAME"] == null ? "" : dataobj["PROJECTNAME"];
var buildadddress = dataobj["BUILDADDRESS"] == null ? "" : dataobj["BUILDADDRESS"];
var buildunit = dataobj["BUILDUNIT"] == null ? "" : dataobj["BUILDUNIT"];
var cretificatenumber = dataobj["CERTIFICATENUMBER"] == null ? "" : dataobj["CERTIFICATENUMBER"];
var fd11 = dataobj["FD11"] == null ? "" : dataobj["FD11"];
var recevietime = new Date(dataobj["CREATETIME"]);
var bindingunit = dataobj["BINDINGUNIT"]==null?"-":dataobj["BINDINGUNIT"];
if(taskid=="null"){
if(status == "-"){
status = "办结";
}
}
recevietime = recevietime?recevietime.format("yyyy-MM-dd hh:mm:ss"):"";
tbodylist+="<tr><td>"+status+"</td><td>"+projectcode+"</td><td>"+casecode+"</td><td>"+projectname+"</td><td>"+buildadddress+"</td><td>"+buildunit+"</td><td>"+cretificatenumber+"</td><td>"+fd11+"</td><td>"+recevietime+"</td><td>"+bindingunit+"</td></tr>";
}
}
// 获取表单的名字和表单查询的内容
var ctx = {worksheet: name || 'Worksheet', table: thead+tbodylist};
// format()函数:通过格式操作使任意类型的数据转换成一个字符串
// base64():进行编码
var link = document.createElement("a");
link.download ='导出项目_'+new Date().format("yyyy-MM-dd ")+'(全部).xls';
link.href=uri + base64(format(template, ctx));
document.body.appendChild(link);
link.click();
}
})()
// 获取查询条件
function getcondition() {
/**
* 状态
*/
var StatusQuery = $('#StatusQuery').find("option:selected").val();
var bindingAssignee = $("#bindingAssignee").val();
var bindingUnit = $("#bindingUnit").val();
var flowname = $('#projectTypes').val();
var signStartTime = $("#signStartTime").val();
var signEndTime = $("#signEndTime").val();
var limitStartTime = $("#limitStartTime").val();
var limitEndTime = $("#limitEndTime").val();
var conditionjson = {
flowname : flowname,
statusQuery : StatusQuery,
bindingUnit : bindingUnit,
bindingAssignee : bindingAssignee,
signStartTime : signStartTime,
signEndTime : signEndTime,
limitStartTime : limitStartTime,
limitEndTime : limitEndTime
}
return conditionjson
}
function getApproveList(pageIndex, condition, andcondition, typecondition) {
currentPage = pageIndex;
if (searchInfo)
condition = searchInfo;
if (andconditionJson)
andcondition = andconditionJson;
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.list.approve,
headers:{
"token":$.cookie('ftoken')
},
data:{
pageIndex : pageIndex,
pageSize :pageSize,
searchInfo : condition,
andcondition : andcondition
},
dataType: 'json',
beforeSend: function(){
parent.window.$.showLoading();
},
complete: function(){
parent.window.$.hideLoading();
},
success:function(result){
if(result.message){
parent.layer.msg(result.message);
return;
}else if(result.status=="error"){
parent.layer.msg("查询失败!请联系管理员!", {icon : 2});
return;
}
zuiData(result);
if(result.Data.length>0) {
$("#export_ecxel").attr("disabled",false);
$("#export_ecxelAll").attr("disabled",false);
}else {
$("#export_ecxel").attr("disabled",true);
$("#export_ecxelAll").attr("disabled",true);
}
if(result.total>=0){
var totalre = result["total"];
if (totalre == 0) {
$('#msg').css("display", "block");
$('#nvaTab').css("visibility", "hidden");
$('#promptDiv').css('display', 'none');
} else {
$('#msg').css("display", "none");
$('#nvaTab').css("visibility", 'visible');
$('#promptDiv').css('display', 'none');
}
layuiPage(totalre);
}
//checkboxStop();
}
});
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.list.approveCount,
headers:{
"token":$.cookie('ftoken')
},
data:{
pageIndex : pageIndex,
pageSize :pageSize,
searchInfo : condition,
andcondition : andcondition
},
dataType: 'json',
success:function(result){
var totalre = result["total"];
if (totalre == 0) {
$('#msg').css("display", "block");
$('#nvaTab').css("visibility", "hidden");
$('#promptDiv').css('display', 'none');
} else {
$('#msg').css("display", "none");
$('#nvaTab').css("visibility", 'visible');
$('#promptDiv').css('display', 'none');
}
layuiPage(totalre);
}
});
}
function getApproveListAllToExcel(pageIndex, condition, andcondition, typecondition) {
if (searchInfo)
condition = searchInfo;
if (andconditionJson)
andcondition = andconditionJson;
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.list.approve,
headers:{
"token":$.cookie('ftoken')
},
data:{
pageIndex : 0,
pageSize :0,
searchInfo : condition,
andcondition : andcondition
},
dataType: 'json',
beforeSend: function(){
parent.window.$.showLoading();
},
complete: function(){
parent.window.$.hideLoading();
},
success:function(result){
if(result.message){
layer.msg(result.message);
return;
}
if(getExplorer()=='ie') {
var curTbl = document.getElementById(tableid);
var oXL = new ActiveXObject("Excel.Application");
//创建AX对象excel
var oWB = oXL.Workbooks.Add();
//获取workbook对象
var xlsheet = oWB.Worksheets(1);
//激活当前sheet
var sel = document.body.createTextRange();
sel.moveToElementText(curTbl);
//把表格中的内容移到TextRange中
sel.select;
//全选TextRange中内容
sel.execCommand("Copy");
//复制TextRange中内容
xlsheet.Paste();
//粘贴到活动的EXCEL中
oXL.Visible = true;
//设置excel可见属性
try {
var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
} catch (e) {
print("Nested catch caught " + e);
} finally {
oWB.SaveAs(fname);
oWB.Close(savechanges = false);
//xls.visible = false;
oXL.Quit();
oXL = null;
//结束excel进程,退出完成
//window.setInterval("Cleanup();",1);
idTmr = window.setInterval("Cleanup();", 1);
}
} else {
tableToExcelAll(result);
}
}
});
}
function zuiData(result) {
var data = [];
var result_map = result["Data"];
var listpath=[];
listObject= [];
for (var i = 0; i < result_map.length; i++) {
var list_re = result_map[i];
if (list_re.length > 0) {
for (var j = 0; j < list_re.length; j++) {
var map_result = list_re[j];
var spListShowOrHidden = map_result["SPLISTSHOWORHIDDEN"];
if(spListShowOrHidden && spListShowOrHidden == "hidden"){
continue;
}else{
var lamp = "";
var bjqx = "";
var cqStr = "";
var flowid = map_result["FLOWID"];
var username = map_result["USER_ID_"];
var assignee = map_result["ASSIGNEE_"];
var taskkey = map_result["TASK_DEF_KEY_"];
var attachpath = map_result["ATTACHPATH"];
var description = map_result["DESCRIPTION"];
var projectid = map_result["PROJECTID"] == null ? ""
: map_result["PROJECTID"]
var instanceid = map_result["INSTANCEID"] == null ? ""
: map_result["INSTANCEID"]
var taskid = map_result["TASKID"] == null ? "null"
: map_result["TASKID"]
var recevietime = new Date(map_result["CREATETIME"]);
var projectcode = map_result["PROJECTCODE"] == null ? ""
: map_result["PROJECTCODE"];
var casecode = map_result["CASECODE"] == null ? ""
: map_result["CASECODE"];
var registertime = map_result["REGISTERTIME"] == null ? ""
: new Date(map_result["REGISTERTIME"]);
var buildadddress = map_result["BUILDADDRESS"] == null ? ""
: map_result["BUILDADDRESS"];
var projectname = map_result["PROJECTNAME"] == null ? ""
: map_result["PROJECTNAME"];
var flowname = map_result["FLOWNAME"] == null ? ""
: map_result["FLOWNAME"];
var buildunit = map_result["BUILDUNIT"] == null ? ""
: map_result["BUILDUNIT"];
// var bindingassignee = map_result["CKQZ"] == null ? ""
// : map_result["CKQZ"];
/*ljy--20170929*/
var bindingassignee = map_result["BINDINGASSIGNEE"]==null?"-":map_result["BINDINGASSIGNEE"];
var bindingunit = map_result["BINDINGUNIT"]==null?"-":map_result["BINDINGUNIT"];
var activityName = map_result["ACTIVITYNAME"] == null ? "结束"
: map_result["ACTIVITYNAME"];
var status = map_result["PROJECTSTATUS"] == null ? "-"//hyh 新增-,谢文洲要求 2017/10/24
: map_result["PROJECTSTATUS"];
var flowItemType = map_result["FLOWITEMTYPE"]?map_result["FLOWITEMTYPE"]:null;
if (conditionstrs.length>0) {
for(var t=0;t<conditionstrs.length;t++){
if(conditionstrs[t].length != 0){
projectcode = projectcode.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
projectname = projectname.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
buildunit = buildunit.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
bindingunit = bindingunit.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
buildadddress = buildadddress.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
casecode = casecode.replace(conditionstrs[t],
'<span style="color:red">' + conditionstrs[t]
+ '</span>');
}
}
}
// 根据流程版本获取总时限
var timelimitDays = map_result["FINISHTIME"] == null ? 0
: map_result["FINISHTIME"];
var suptotaltime = map_result["SUPTOTALTIME"]==null?0:map_result["SUPTOTALTIME"];
// var officialdate = AddDays(map_result["CREATETIME"],
// parseInt(timelimitDays));
var officialdate =getAddDate(new Date(map_result["CREATETIME"]).format("yyyy-MM-dd hh:mm:ss"),timelimitDays,suptotaltime)//hyh 新增,根据办结天数算出办结时间 2017、10、13
bjqx = lefttime(new Date(), new Date(officialdate));
// var color = changrowcolor(bjqx);
if(taskid=="null"){
if(status == "-"){
status = "办结";
}
}
if(status == "办结") {
cqStr += '<div style=" display: inline-block; margin-right: 5px; "><img src="../../image/projecttask/over.png" title="办结" style="width:18px;height:18px;margin-top: 4px"></div>';
}else if(status == "退件办结") {
cqStr += '<div style=" display: inline-block; margin-right: 5px; "><img src="../../image/projecttask/over.png" title="退件办结" style="width:18px;height:18px;margin-top: 4px"></div>';
}else if(status == "回退") {
cqStr += '<div style=" display: inline-block; margin-right: 5px; "><img src="../../image/projecttask/rollback.png" title="回退" style="width:18px;height:18px;margin-top: 4px"></div>';
}else if(status == "退件") {
cqStr += '<div style=" display: inline-block; margin-right: 5px; "><img src="../../image/projecttask/return.png" title="退件" style="width:18px;height:18px;margin-top: 4px"></div>';
}else if(bjqx=="超时"){
cqStr += '<div style="display: inline-block; margin-right: 5px;"><img src="../../image/projecttask/redhint.png" title="超时-'+officialdate+'" style="width:16px;height:16px; margin-top: 4px"></div>' //hyh 修改,谢文洲要求改审批图标 2017/10/23
if(status=="办结"){
officialdate = '<span>'+ officialdate + '</span>';
}else{
officialdate = '<span style="color:red;font-weight:bold;">'+ officialdate + '</span>';
}
}else if(bjqx=="快超时") {
cqStr += '<div style=" display: inline-block; margin-right: 5px;"><img src="../../image/projecttask/grayhint.png" title="快超时-'+officialdate+'" style="width:16px;height:16px;margin-top: 4px"></div>'//hyh 修改,谢文洲要求改审批图标 2017/10/23
}else if(status == "在办") {
cqStr += '<div style=" display: inline-block; margin-right: 5px; "><img src="../../image/projecttask/process.png" title="在办" style="width:18px;height:18px;margin-top: 4px"></div>';
}
var flowrevisionid = map_result["FLOWREVISIONID"] == null ? "":map_result["FLOWREVISIONID"];
listObject.push(map_result);
listpath.push(attachpath);
var row = {
"PROJECTID": projectid,
"INSTANCEID": instanceid,
"TASKID": taskid,
"BJQX": cqStr,
"PROJECTSTATUS": status,
"ACTIVITYNAME": activityName,
"FLOWNAME": flowname,
"PROJECTCODE": projectcode,
"CASECODE": casecode,
"PROJECTNAME": projectname,
"BUILDADDRESS": buildadddress,
"REGISTERTIME": registertime?registertime.format("yyyy-MM-dd hh:mm:ss").split("00:00:00")[0]:"",
"BUILDUNIT": buildunit,
"BINDINGASSIGNEE": bindingassignee,
"BINDINGUNIT": bindingunit,
"RECEIVETIME": recevietime?recevietime.format("yyyy-MM-dd hh:mm:ss"):"",
"FINISHTIME": officialdate,
"FLOWREVISIONID": flowrevisionid,
"ATTACHPATH":attachpath,
"TASK_DEF_KEY_":taskkey,
"AGENT":username==null?assignee:username,
"FLOWITEMTYPE":flowItemType
}
data.push(row);
}
}
}
}
setLayuiData(data);
/*$.ajax({
type: "POST",
async: true,
url: CONF_DOC_SERVERURL +"ftpfile/recordList.do",
data: {pathList:JSON.stringify(listpath)},
success: function(result) {
var img = '<img class="img" src="../../image/home-content/fj.png" title="附件" style="width:18px;height:18px;margin-right: 5px;">';
var htlist=$("#nvaTab tbody tr");
var recordData=result.data;
if(recordData) {
for(var y=0;y<listObject.length;y++){
var cupath = listObject[y].ATTACHPATH;
var flowId= listObject[y].FLOWID;
var flowObjectId=listObject[y].TASK_DEF_KEY_;
var flowrevision=listObject[y].FLOWREVISIONID;
var task1=listObject[y].TASKID;
var flowlist1=flowList[flowId];
var flowobject1=linkList[flowrevision+flowObjectId];
if(task1 && flowobject1 && cupath!=null && cupath!="undefined") {
for(var l=0;l<flowobject1.length;l++){
for(var k=0;k<flowlist1.length;k++){
if(flowobject1[l].RESOURCEID==flowlist1[k].RESOURCEID) {
flowlist1.splice(k,1);
}
}
}
if(flowlist1.length>0) {
for(var v=0;v<flowlist1.length;v++){
var flowpath=cupath+"/"+flowlist1[v].MATERNAME;
for(var x=0;x<recordData.length;x++){
var filepath=recordData[x].slice(1,flowpath.length+1);
if(flowpath == filepath) {
recordData.splice(x,1);
}
}
}
}
for(var j=0;j<recordData.length;j++){
var compare=recordData[j].slice(1,cupath.length+1);
if(compare == cupath){
var data=layui.table.cache.tableRenderId;
for(var k=0;k<data.length;k++) {
if(data[k].ATTACHPATH==cupath) {
$(htlist[k]).find(".img").remove();
$(htlist[k]).find("td[data-field=\"PROJECTNAME\"] div").prepend(img);
break;
}
}
break;
}
}
}else if(task1 && !flowobject1 && cupath!=null && cupath!="undefined") {
if(cupath!=null && flowlist1) {
for(var v=0;v<flowlist1.length;v++){
for(var x=0;x<recordData.length;x++){
var flowpath=cupath+"/"+flowlist1[v].MATERNAME;
var filepath=recordData[x].slice(1,flowpath.length+1);
if(flowpath == filepath) {
recordData.splice(x,1);
}
}
}
for(var j=0;j<recordData.length;j++){
var compare=recordData[j].slice(1,cupath.length+1);
if(compare == cupath){
var data=layui.table.cache.tableRenderId;
for(var k=0;k<data.length;k++) {
if(data[k].ATTACHPATH==cupath) {
$(htlist[k]).find(".img").remove();
$(htlist[k]).find("td[data-field=\"PROJECTNAME\"] div").prepend(img);
break;
}
}
break;
}
}
}else if(cupath!=null && cupath!="undefined"){
for(var j=0;j<recordData.length;j++){
var compare=recordData[j].slice(1,cupath.length+1);
if(compare == cupath){
var data=layui.table.cache.tableRenderId;
for(var k=0;k<data.length;k++) {
if(data[k].ATTACHPATH==cupath) {
$(htlist[k]).find(".img").remove();
$(htlist[k]).find("td[data-field=\"PROJECTNAME\"] div").prepend(img);
break;
}
}
break;
}
}
}
}else if(!task1 && cupath!=null && cupath!="undefined"){
for(var j=0;j<recordData.length;j++){
var compare=recordData[j].slice(1,cupath.length+1);
if(compare == cupath){
var data=layui.table.cache.tableRenderId;
for(var k=0;k<data.length;k++) {
if(data[k].ATTACHPATH==cupath) {
$(htlist[k]).find(".img").remove();
$(htlist[k]).find("td[data-field=\"PROJECTNAME\"] div").prepend(img);
break;
}
}
break;
}
}
}
}
}
},
error: function(e) {
console.log(e);
}
})*/
}
function searQuery() {
var condition = $("#searchInput").val();
searchInfo = condition;
andconditionJson = JSON.stringify(getcondition());
getApproveList(1, searchInfo, andconditionJson);
}
pagging.config.list = function(pageindex) {
if (searchInfo)
getApproveList(pageindex, searchInfo);
else
getApproveList(pageindex);
};
// check box 勾选事件
function CheckItem(obj) {
// var checkBoxs = $("input[type='checkbox']:checked");
// var tds = checkBoxs.parent().parent().find("td");
// if(checkBoxs.length>1){
// $("#continueProject").attr("disabled","disabled");
// projectId = null;
// }else{
// $("#continueProject").attr("disabled",null);
// projectId = tds[1].innerText
// }
}
/*
* hy 2017-09-7添加
*/
////20171222 yyl 项目查询列表关闭项目详情页面后不刷新
function openRefreshList(){
zuidate.rows = [];
//$('table.datatable').datatable('load',getApproveList(currentPage));
}
function changeKeyWordColor() {
var projectCode = $("#projectCode").val();
var projectName = $("#projectName").val();
var bindingUnit = $("#bindingUnit").val();
var bindingAssignee = $("#bindingAssignee").val();
var nowTask = $("#nowTask").val();
}
$("#searchInput").on('input', function(e) {
searchInfo = $("#searchInput").val();
if (searchInfo == '')
getApproveList(1);
});
function getdoctype() {
return "spSearchProject";
}
function openSelectAgent(){
var index = layer.open({
type : 2,
title : '选择用户',
shadeClose : true,
shade : 0.3,
area : [ '640px', '600px' ],
content : '../../view/userlist.jsp',
btn : [ '确定', '取消' ],
yes : function(index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']];
var username = iframeWin.selectSearchUser();
//获取经办人搜索 yyl 2018.01.05
$('#agent').val(username);
if($('#agent').val().replace(/(^\s*)|(\s*$)/g, "")!=""&& $('#operator').find(".remove").length==0) {
$("#operator").append('<span class="glyphicon glyphicon-remove remove" title="移除内容" onclick="remove(this)" ></span>');
}
layer.close(index);
andconditionJson = JSON.stringify(getcondition());
getApproveList(1, searchInfo, andconditionJson);
},
end : function(index, layero) {
}
});
}
function selectProjecType(){
// console.log('123')
var index = layer.open({
type : 2,
title : '选择业务类型',
shadeClose : true,
shade : 0.3,
area : [ '650px', '600px' ],
content : '../../view/userlist.jsp?name=projectType',
btn : [ '确定', '取消' ],
yes : function(index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']];
var username = iframeWin.selectSearchUser();
//获取业务类型搜索 yyl 2018.01.05
$('#projectTypes').val(username);
if($('#projectTypes').val().replace(/(^\s*)|(\s*$)/g, "")!=""&& $('#optionType').find(".remove").length==0) {
$("#optionType").append('<span class="glyphicon glyphicon-remove remove" title="移除内容" onclick="remove(this)" ></span>');
}
layer.close(index);
andconditionJson = JSON.stringify(getcondition());
getApproveList(1, searchInfo, andconditionJson);
},
end : function(index, layero) {
}
});
}
function getcanSelfTurningData(){
var data={canSelfTurning:canSelfTurning,
flowObjectName:flowObjectName};
return data;
}
function remove(e) {
$(e.parentElement).find("input[type='text']").val("");
$(e).remove();
}
function valchange(e){
if($(e).val().replace(/(^\s*)|(\s*$)/g, "")!=""&& $(e.parentElement).find(".remove").length==0) {
$(e.parentElement).append('<span class="glyphicon glyphicon-remove remove" title="移除内容" onclick="remove(this)" ></span>');
}else if($(e).val().replace(/(^\s*)|(\s*$)/g, "")==""&& $(e.parentElement).find(".remove").length!=0) {
$(e.parentElement).find(".remove").remove();
}
}
function getMaterialverifyData(){
$.ajax({
type: "POST",
async: true,
headers:{
"token":$.cookie('ftoken')
},
url: curserver+"/mvc/project/getMaterialverify.do",
success: function(result) {
var instance=result.instance;//流程数据
var link=result.link;//节点数据
flowList= {};
linkList= {};
var dest;
for(var i=0;i<instance.length;i++) {
var a=instance[i];
if(!flowList[a.FLOWID]) {
dest=[];
dest.push(a);
flowList[a.FLOWID]=dest;
}else {
flowList[a.FLOWID].push(a);
}
}
for(var i=0;i<link.length;i++) {
var b=link[i];
if(!linkList[b.FLOWREVISIONID+b.FLOWOBJECTID]) {
dest=[];
dest.push(b);
linkList[b.FLOWREVISIONID+b.FLOWOBJECTID]=dest;
}else {
linkList[b.FLOWREVISIONID+b.FLOWOBJECTID].push(b);
}
}
}
});
}
function sreachChange(){
$("#openPage").click(function(){
window.open(CONF_FRONT_SERVERURL+"/view/projecttask/searchproject.jsp");
});
$("#sreachChange").click(function(){
if(!isShow) {
$("#operationishsow").show();
$("#content").text("模糊查询");
$("#export_ecxel").show();
$("#export_ecxelAll").show();
isShow=!isShow;
}else {
$("#operationishsow").hide();
$("#content").text("高级查询");//精确查询改为高级查询 2018年12月5日 yyl
$("#export_ecxel").hide();
$("#export_ecxelAll").hide();
isShow=!isShow;
}
});
}