dealingproject.js
107 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
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
/**
* 待办审批
*/
var currentPage = 1;//当前页
var totalpage = 0;//总页数
var pageNum = 5;//最多显示页数
var pageSize = 100; //每页默认显示的数量100,lhy20181226修改,为了不显示分页
let screenHeight = window.screen.height;
var pageSizeLayui
if(screenHeight >= 1080) {
pageSizeLayui = 18; // 18
}else {
pageSizeLayui = 10;
};
var pageSizesLayui = [10, 15, 18, 30, 40, 50];
var currentLayui = 1;
var resultTableData = null; // 全局存储结果数据
var createdFlag = true;
var projectId;
var taskIds;
var canSelfTurning = null;
var flowObjectName = null;
var task = null;
var activityid = null;
var canFinishFlow = false;
var searchInfo;
var startTimeconditionJson;
var overTimeconditionJson;
var statusJson;
var typeJson;
var userserver;
var checkboxState = "";
var listObject;
var listShowObject;
var flowList;
var linkList;
var roleIds;
var version = '1.0'; // 版本号控制 1.0 created by zys
var orign = null; // 来源 created by zys
var isType = 2; // 默认数据申请 目前只在规划审查待办项目中
var isClickPage = false;
console.log('业务协同/规划审查js','webapp/js/projecttask/dealingproject.js')
$(function () {
// FIXME: zys
var urlParam = location.search.substr(1).split('&');
if (urlParam.length > 0) {
for (var i = 0; i < urlParam.length; i++) {
if (urlParam[i].indexOf('orign') > -1) {
orign = urlParam[i].substr(6);
break;
}
}
}
// 去掉tabs
if(orign != 'ghsc') {
$('#isTabs').remove();
};
if (orign === 'ghsc') {
$("#continueProject").remove();
$("#createProject").html('<span class="glyphicon glyphicon-download-alt" style="font-size: 15px"></span><a class="bumpbox_white">新建</a>').show();
// FIXME: 列表权限问题 前端写死
// listPrivilege = [];
} else if (orign === 'ywxt') {
version = '2.0';
$("#continueProject,#createProject").remove();
} else if (orign === 'ywxt-xmsp' || orign === 'ywxt-all') {
version = '2.0';
$("#continueProject").remove();
$(" #createProject").show();
}
// end
getRoleIds();
curserver = CONF_BACK_SERVERURL;
//获取列表按钮权
getRoleChildrenPrivilege(window.parent.listName);
getHoliday();//hyh 新增 获取假期,并且该方法设置为同步 2017、10、14
getApproveList(1);
btnEvent();
meetSearchEvent();
getSelectType();
getLayerIdByKeyName("业务类型_图层");//ljy 2018-01-08 获取键值对
$('#searchInput').bind('keypress', function (event) {
if (event.keyCode == "13") {
var condition = $("#searchInput").val();
searchInfo = condition;
getApproveList(1, condition);
}
});
//TODO 先注释lhy
setListHeight();
getUnhandledProjectCount();
});
window.onresize = setListHeight;//当窗口改变宽度时执行此函数,lhy20181226修改
function setListHeight() {
var tableTop = parseInt($("#workingsTabDiv").offset().top) - 10;
// var tableTop = parseInt($("#tbodylist").offset().top)-10;
var wh = $(window).height();
var bodyPadding = parseInt($("body").css("padding"));
var iframeTop = window.parent.$("#iframecontent").offset().top;
//$("#workingsTabDiv").css("height",wh-iframeTop-tableTop-bodyPadding+"px");
var height = wh - iframeTop - tableTop - bodyPadding - 40;//50大概是tablehead的高度
$("#tbodylist").css("height", height + "px");
//$("#datalist").css("min-width",getTableInitWidth("datalist")+"px");//设置table的初始宽度
setTableMinWidth();//设置表格的最小宽度
setCellWidth();//设置单元格宽度
}
window.onload = function () {
setTimeout(function () {
parent.window.NProgress.done()
}, 500);
}
function getRoleIds() {
userInfo = JSON.parse($.cookie('cookieuser'));
var userdetail = getUserInfoByUserid(userInfo.user.id);
var role = userdetail.roles;
var roleidArray = new Array();
for (var i = 0; i < role.length; i++) {
roleidArray.push(role[i].id);
}
roleIds = roleidArray.join(',');
}
/**
* 接件
*/
function openlayer_type() {
parent.typeIndex = parent.layer.open({
type: 2,
title: '<img src="image/projecttask/type.png" style=\"width:25px;height:25px;\"/><span>选择新建类型</span>',
shadeClose: true,
shade: 0.3,
area: ['50%', '50%'],
content: "view/projecttask/selectHandl.html?createmethod=接件&FLOWVERSION=" + version + "&orign=" + orign,
});
}
/**
* 批量发送
*/
/*function batchSendClick(){
var checboxdata = [];
var myDatatable = $('table.datatable').data('zui.datatable');
var rowdata = myDatatable.data.rows;
for(var i=0;i<rowdata.length;i++){
if(rowdata[i].checked==true){
var obj = rowdata[i];
var tid = obj.data[2].text
checboxdata.push(tid);
}
}
taskIds = checboxdata.join(",");
if(!taskIds){
layer.msg('请选择需要发送的项目',{icon:2});
return ;
}
var tid = taskIds.split(",")[0];
//校验是否为同一流程同一环节
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.task.batchSend,
headers:{
"token":$.cookie('ftoken')
},
data:{taskIds:taskIds},
dataType: 'json',
success:function(data){
if(data.status=='ok'){
//批量发送
$.ajax({
type: "POST",
url: curserver + global.modelctls.project.task.resource,
headers:{
"token":$.cookie('ftoken')
},
data:{taskid : tid},
dataType: 'json',
success:function(data){
canSelfTurning=data.activity.canSelfTurning;
flowObjectName=data.activity.flowObjectName;
task = data.task;
activityid = data.activity.id;
}
});
var index = layer.open({
type : 2,
title : '选择用户',
shadeClose : true,
shade : 0.3,
area : [ '640px', '600px' ],
offset : [ '50px' ],
content : '../../view/userlist.jsp?taskId=' + tid,
btn : [ '发送', '取消' ],
yes : function(index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']];
var splabel = iframeWin.splabel();
var toArray = [];
for (var i = 0; i < splabel.length; i++) {
var item = splabel[i];
toArray.push({
id : item.id,
name : item.name,
users : item.user
});
}
var sendInfo = {
from : {
id : task.flowObjectId,
name : task.name+",发送"
},
to : toArray
};
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.task.batchComplete,
headers:{
"token":$.cookie('ftoken')
},
data:{
taskIds : taskIds,
activityId: activityid,
sendObject : JSON.stringify(sendInfo)
},
dataType: 'json',
success:function(result){
if (result.status == 'ok') {
//发送短信微信
var tousers=iframeWin.users();
var checkMessage=iframeWin.checkMessage();
if(checkMessage!=""){
var content = iframeWin.dWxWconContent();
allSend(tousers,checkMessage,content);
}
layer.close(index);
} else {
console.info(result);
layer.msg('发送失败!',{icon:2});
}
}
});
},
end : function(index, layero) {
}
});
}else
layer.msg(data.message,{icon: 2});
}
});
}*/
function getdoctype() {
return "batchsp";
}
function getcanSelfTurningData() {
var data = {
canSelfTurning: canSelfTurning,
flowObjectName: flowObjectName
};
return data;
}
/**
* 批量结束流程
*
*/
/*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});
});
}
});
}*/
/**
*显示流程日志
*/
function openlayer_flowlog() {
parent.layer.open({
type: 2, //page层
area: ['700px', '400px'],
title: '流程日志',
shade: 0.6, //遮罩透明度
moveType: 1, //拖拽风格,0是默认,1是传统拖动
//shift: 1, //0-6的动画形式,-1不开启
content: 'ApprovalTask/Pages/flowlog.html'
});
}
function newTask() {
layer.closeAll();
window.parent.iframeLoad('projecttask/detailproject.jsp', '办理项目', 'subMenuApprovalTask_4');
}
function sendToUsers() {
parent.layer.open({
type: 2,
title: '选择人员',
shadeClose: true,
shade: 0.6,
area: ['200px', '400px'],
content: ['ApprovalTask/Pages/selectUsers.html'] //iframe的url
, btn: ['确定']
, yes: function (index, layero) {
layer.closeAll();
}
});
}
/**
* 已经不使用,下次没发现什么问题可删除 2018-01-08
*/
/*function opendetailproject(obj){
var jqobj=$(obj);
var tds = jqobj.find("td");
var taskid = tds[3].innerText;
var title = tds[6].innerText;
var titleEncode = encodeURI(encodeURI(title));
var stats = "projecting";
var url = CONF_FRONT_SERVERURL + 'view/projecttask/detailproject.jsp?taskId=' + taskid+"&stats="+stats+"&titleEncode="+titleEncode;
//打开后修改样式,修改未读样式
var obj_div=$(obj).css("font-weight","");
//window.open(url);
parent.saveOpenNew(window.open(url)); //hyh 修改 2017/11/6
}*/
/**
* 根据获取到的权限判断时候拥有列表显示的权限
* hepo20171023
*/
function getListShowPrivilege() {
// var privilege = listPrivilege;
// var flag = false;
// if (privilege.length > 0) {
// for (var i = 0; i < privilege.length; i++) {
// // if(privilege[i].name.indexOf("列表")!=-1){
// // // flag=true;
// // // break;
// // // }
// /*权限限制问题,先强行通过*/
// //todo
// flag = true
// }
// }
// return flag;
// FIXME: 开启所有权限 默认
return true;
}
/**
* 获取待办列表
*/
function getApproveList(pageIndex, condition, starttimecondition,
overtimecondition, statuscondition, typecondition) {
//若没有列表显示的权限 不加载
if (!getListShowPrivilege()) {
parent.layer.msg('没有显示列表的权限', {icon: 2});
return;
}
currentPage = pageIndex ? pageIndex : 1;
if (searchInfo)
condition = searchInfo.toString();
if (startTimeconditionJson)
starttimecondition = startTimeconditionJson;
if (overTimeconditionJson)
overtimecondition = overTimeconditionJson
if (statusJson)
statuscondition = statusJson
var documentType = $('#documentType').find("option:selected").val();
var projectTypes = $('#projectTypes').val();
var list = '/dblb/list/workings';
var username = null;
if(username == '' || username == null || username == "undefined"){
username = userInfo.user.loginname;
}
if(username == '' || username == null || username == "undefined"){
username = "申请者";
}
$.ajax({
type: "POST",
url: `${CONF_NEWGHSC_SERVERURL}${list}`,
headers: {
"token": $.cookie('ftoken')
},
data: {
pageIndex: pageIndex,
pageSize: pageSize,
condition: condition,
userName: username,
starttimecondition: starttimecondition,
overtimecondition: overtimecondition,
statuscondition: statuscondition,
typecondition: projectTypes,
documentType: documentType
},
dataType: 'json',
beforeSend: function () {
parent.window.$.showLoading();
},
complete: function () {
// parent.window.$.hideLoading();
},
error(e) {
// debugger
},
success: function (res) {
var result = res.data;
var totalre = result["total"];
// layuiPage(totalre);
dealingProjectDate(result, condition);
if (totalre == 0) {
$('#msg').css("display", "block");
$('#nvaTab').css("visibility", "hidden");
} else {
$('#msg').css("display", "none");
$("#page").text("共" + totalre + "条");
$("#page").css("font-size", "13px");
$("#page").css("margin-right", "25px");
$("#page").css("margin-top", "5px");
$('#nvaTab').css("visibility", "visible");
}
}
});
}
var nScrollTop = 0;
function srollPage(pageIndex, nDivHight) {
$("table tbody").scroll(function () {
var nScrollHight = $(this)[0].scrollHeight;
nScrollTop = $(this)[0].scrollTop;
if (nScrollTop + nDivHight >= nScrollHight) {
var pagenumber = pageIndex + 1;
if (pagenumber <= totalpage) {
parent.window.processBar.showBar();
getApproveList(pagenumber);
$("table tbody").scrollTop(nScrollTop);
} else {
layer.msg('没有更多数据加载', {
icon: 5
, shade: 0.01
});
}
}
});
}
/* hzw 2018/3/15 注释 不影响可以删除
* var zuidate = {
cols: [
{width: 'auto', text: '项目id', type: 'number', flex: false, colClass: 'hidden'},
{width: 'auto', text: '流程id', type: 'number', flex: false, colClass: 'hidden'},
{width: 'auto', text: '实例id', type: 'number', flex: false, colClass: 'hidden'},
{width: '40', text: '<img src="../../image/projecttask/projecttaskinfo.png "style="width:16px;">',type: 'string', flex: false,sort:false},//hyh 修改,给图标一栏的头部加个图标 2017/10/23
{width: '70', text: '状态', type: 'string', flex: false, colClass: '',sort:false},
{width: '100', text: '当前环节', type: 'string', flex: false, colClass: '',sort:false },
{width: 'auto', text: '项目类型', type: 'string', flex: false,colClass: '',sort:false},
{width: '200', text: '项目编号', type: 'number', flex: false, colClass: '',sort:false},
{width: 'auto', text: '项目名称', type: 'string', flex: false, colClass: '',sort:false },
{width: 'auto', text: '建设单位', type: 'string', flex: false,colClass: '',sort:false },
{width: 'auto', text: '主办科室 ', type: 'string', flex: false,colClass: '',sort:false },
{width: '100', text: '主办人', type: 'string', flex: false,colClass: '',sort:false },
{width: 'auto', text: '接件日期', type: 'date', flex: false,colClass: '',sort:true },
{width: '100', text: '理论办结日期', type: 'date', flex: false,sort:false}
// {width: '180', text: '<img src="../assets/images/projecttask/operation.png" style="width:20px;height:20px;margin-right:10px;">操作', type: 'string',flex: false,sort:false}
// ,],
rows:[]
}*/
/* hzw 2018/3/15 注释 不影响可以删除
* function zuitable(){
$('table.datatable').datatable({
checkable: true,
sortable: true,
checkByClickRow:false,
minFixedLeftWidth: 300,
});
}*/
var dataTable = [];
function dealingProjectDate(result, condition) {
//zuidate.rows = [];
var data = [];
var result_map = result["Data"];
var listpath = [];
listObject = [];
listShowObject = [];
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 flowid = map_result["FLOWID"];
var taskkey = map_result["TASK_DEF_KEY_"];
var attachpath = map_result["ATTACHPATH"];
//审批任务列表
var description = map_result["DESCRIPTION"];
var str = "";
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 projectflowtype = map_result["PROJECTFLOWTYPE"] == null ? "" : map_result["PROJECTFLOWTYPE"];
var flowname = map_result["FLOWNAME"] == null ? "" : map_result["FLOWNAME"];
var buildunit = map_result["BUILDUNIT"] == null ? "" : map_result["BUILDUNIT"];
var bindingassignee = map_result["BINDINGASSIGNEE"] == null ? "-" : map_result["BINDINGASSIGNEE"];
var meetingprojectstate = map_result["MEETINGPROJECTSTATE"] == null ? "" : map_result["MEETINGPROJECTSTATE"];
var activityName = map_result["ACTIVITYNAME"] == null ? "无" : map_result["ACTIVITYNAME"];
var status = map_result["PROJECTSTATUS"] == null ? "-" : map_result["PROJECTSTATUS"];
var flowrevisionid = map_result["FLOWREVISIONID"] == null ? "" : map_result["FLOWREVISIONID"];
var bindingunit = map_result["BINDINGUNIT"] == null ? "-" : map_result["BINDINGUNIT"];
//根据流程版本获取总时限
var timelimitDays = map_result["FINISHTIME"] == null ? 0 : map_result["FINISHTIME"];
var suptotaltime = map_result["SUPTOTALTIME"] == null ? 0 : map_result["SUPTOTALTIME"];
var officialdate = getAddDate(new Date(map_result["CREATETIME"]).format("yyyy-MM-dd hh:mm:ss"), timelimitDays, suptotaltime)//hyh 新增,根据办结天数算出办结时间 2017、10、13
var flowItemType = map_result["FLOWITEMTYPE"] ? map_result["FLOWITEMTYPE"] : null;
var cgbbh = map_result["CGBBH"] ? map_result["CGBBH"] : "";
var SPJD = map_result["SPJD"] ? map_result["SPJD"] : "";
var XMLX = map_result["XMLX"] ? map_result["XMLX"] : "";
console.log(XMLX);
var yt = null;
if(map_result["YT"] == "-"){
yt = "";
}else{
yt = map_result["YT"];
}
var mj = null;
if(map_result["MJ"] == "-" || map_result["MJ"] == "请选择"){
mj = " ";
}else if(map_result["MJ"] == "1"){
mj = "公开";
}else if(map_result["MJ"] == "2"){
mj = "秘密";
}else if(map_result["MJ"] == "3"){
mj = "机密";
}else if(map_result["MJ"] == "4"){
mj = "绝密";
}
var xzqhbsm = null;
if(map_result["XZQHBSM"] == "-" || map_result["XZQHBSM"] == "请选择"){
xzqhbsm = "";
}else{
xzqhbsm = map_result["XZQHBSM"];
}
//因为 审批列表使用的是zui组件,所以无法更换
if (searchInfo) { //搜索结果关键字变红 yyl 20180309
projectcode = projectcode.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
projectname = projectname.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
buildunit = buildunit.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
bindingunit = bindingunit.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
buildadddress = buildadddress.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
bindingassignee = bindingassignee.replace(searchInfo,
'<span style="color:red">' + searchInfo
+ '</span>');
}
//续办图标
var continueProject = "";
var projectid = map_result["PROJECTID"] == null ? "" : map_result["PROJECTID"];
bjqx = lefttime(new Date(), new Date(officialdate));
var cqStr = "";
// var color=changrowcolor(bjqx);
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
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"];
var instanceid = map_result["INSTANCEID"] == null ? "" : map_result["INSTANCEID"];
var taskid = map_result["TASKID"] == null ? "" : map_result["TASKID"];
listObject.push(map_result);
listpath.push(attachpath);
var row = {
"PROJECTID": projectid,
"INSTANCEID": instanceid,
"TASKID": taskid,
"BJQX": cqStr,
"PROJECTSTATUS": status,
"ACTIVITYNAME": activityName,
"MEETINGPROJECTSTATE": meetingprojectstate,
"FLOWNAME": flowname,
"PROJECTCODE": projectcode,
"CASECODE": casecode,
"PROJECTNAME": projectname,
"PROJECTFLOWTYPE": projectflowtype,
"BUILDADDRESS": buildadddress,
// "REGISTERTIME": registertime?registertime.format("yyyy-MM-dd hh:mm:ss").split("00:00:00")[0]:"",
"REGISTERTIME": registertime ? registertime.format("yyyy-MM-dd") : "",
"BUILDUNIT": buildunit,
"BINDINGASSIGNEE": bindingassignee,
"BINDINGUNIT": bindingunit,
// "RECEIVETIME": recevietime?recevietime.format("yyyy-MM-dd hh:mm:ss"):"",
"RECEIVETIME": recevietime ? recevietime.format("yyyy-MM-dd") : "",
"FINISHTIME": officialdate,
"FLOWREVISIONID": flowrevisionid,
"DESCRIPTION": description,
"ATTACHPATH": attachpath,
"TASK_DEF_KEY_": taskkey,
"FLOWITEMTYPE": flowItemType,
"CGBBH":cgbbh,
"YT":yt,
"MJ":mj ? mj : '',
"XZQHBSM":xzqhbsm,
"SPJD":SPJD,
"XMLX":XMLX
}
data.push(row);
listShowObject.push(row);
}
}
}
}
// 全局存储 数据
resultTableData = data
// // // TODO 获取数据后组装数据,新添加lhy20181225
dynamicWorkingTable(data, "workingsTabDiv", 'searchtext');
}
/* hzw 2018/3/15 注释 不影响可以删除
* function openRefreshList(){
zuidate.rows = [];
$('table.datatable').datatable('load',getApproveList(1));
}*/
//check box 勾选事件
function CheckItem(obj) {
// $("input[type='checkbox']:checked").each(function(i){
// $(this).prop('checked','');
// });
canFinishFlow = true;
var checkBoxs = $("input[type='checkbox']:checked");
var tds = checkBoxs.parent().parent().find("td");
if (checkBoxs.length == 0) {
projectId = null;
taskIds = null;
canFinishFlow = false;
$("#continueProject").attr("disabled", "disabled");
return;
}
if (checkBoxs.length > 1) {
$("#continueProject").attr("disabled", "disabled");
projectId = '';
var i = 0;
taskIds = '';
$("#continueProject").attr("disabled", "disabled");
$("input[type='checkbox']:checked").each(function (i) {
var tds = $(this).parent().parent().find("td");
if (tds[4].innerText != "退件")
canFinishFlow = false;
if (i == 0) {
projectId += tds[1].innerText;
taskIds += tds[3].innerText;
} else {
projectId += ',' + tds[1].innerText;
taskIds += ',' + tds[3].innerText;
}
i++;
});
i = 0;
} else {
$("#continueProject").attr("disabled", null);
projectId = tds[1].innerText;
taskIds = tds[3].innerText;
if (tds[4].innerText != "退件")
canFinishFlow = false;
}
}
/**
* 动态分页按钮
* @param tatalre
* @param totalpa
*/
/* hzw 2018/3/15 注释 不影响可以删除
* function dynamicPage(totalre,totalpa,currentPage){
$("#total_records").html(totalre);
$("#total_page").html(totalpa);
var pageStart = "";
var pageEnd = "";
if(currentPage<=Math.round(pageNum/2)+1){
pageStart = 1;
pageEnd = pageNum;
}
if(currentPage>Math.round(pageNum/2)+1){
pageStart = currentPage-Math.round(pageNum/2);
pageEnd = currentPage+Math.round(pageNum/2)-2;
}
if(pageEnd>totalpa){
pageEnd = totalpa;
}
var ulcontent = $(".pagination");
ulcontent.children().filter('li').remove();
ulcontent.append("<li> <a onclick=\"jumpPage(0)\" aria-label=\"Previous\">" +
"<span aria-hidden=\"true\">上一页</span></a></li> ");
for(var i=pageStart;i<=pageEnd;i++){
if(i==currentPage){
ulcontent.append("<li class=\"active\"><a onclick=\"getApproveList("+i+")\">"+i+"</a></li>");
}else{
ulcontent.append("<li><a onclick=\"getApproveList("+i+")\">"+i+"</a></li>");
}
}
ulcontent.append("<li> <a onclick=\"jumpPage(1)\" aria-label=\"Next\">" +
"<span aria-hidden=\"true\">下一页</span></a></li> ");
pagging.modifyPagging(totalre, totalpa,currentPage);
}*/
pagging.config.list = getApproveList;
/**
* 上一页、下一页调转
* @param index
*/
/* hzw 2018/3/15 注释 不影响可以删除
* function jumpPage(index){
var pageindex=1;
if(index==0){//上一页
pageindex = currentPage-1<=1?1:currentPage-1;
}else {
pageindex= currentPage+1>=totalpage?totalpage:currentPage+1;
}
getApproveList(pageindex);
}
function newTab(url, tabname, tabid){
window.parent.iframeLoad(url, tabname, tabid);
}
function refreshTable(){
zuidate.rows = [];
$('table.datatable').datatable('load',getApproveList(1));
}
function checkboxStop(){
$("input[type='checkbox']").click(function(e){
e.stopPropagation();
});
}*/
/**
* 上会
* @param obj
*/
function openProject(obj) {
// var tid = $(obj).parents().parents().children("td:nth-child(3)").text();
// var projectId = $(obj).parents().parents().children("td:nth-child(1)").text();
// window.open(global.contextPath+'/mvc/meetingProject/findSpProject.do?projectId='+projectId+"&spParameter="+tid);
//
//
var checboxnumber = 0;
var checboxdata = [];
var myDatatable = $('table.datatable').data('zui.datatable');
var rowdata = myDatatable.data.rows;
for (var i = 0; i < rowdata.length; i++) {
if (rowdata[i].checked == true) {
checboxnumber++;
var obj = rowdata[i];
checboxdata.push(obj);
}
}
if (checboxnumber == 0) {
alert("请选择项目")
}
if (checboxnumber > 1) {
alert("只能选择一个项目上会")
}
if (checboxdata.length == 1) {
var data = checboxdata[0];
var projectId = data.data[0].text;
var tid = data.data[2].text;
var state = data.data[4].text;
if (state == "上会") {
alert("项目已经上会");
return;
}
//window.open(global.contextPath+'/mvc/meetingProject/findSpProject.do?projectId='+projectId+"&spParameter="+tid);
parent.saveOpenNew(window.open(window.open(global.contextPath + '/mvc/meetingProject/findSpProject.do?projectId=' + projectId + "&spParameter=" + tid))); //hyh 修改 2017/11/6
}
}
/**
* 撤会
*/
function closeProject(obj) {
var projectId = $(obj).parents().parents().children("td:nth-child(1)").text();
$.post(global.contextPath + '/mvc/meetingProject/closeProject.do', {
projectId: projectId
}, function (result) {
if (result.status == 'ok') {
action = "撤会";
updateStatus(projectId);
layer.msg("撤会成功", {
icon: 1,
time: 1500,
offset: '300px'
}, function () {
getApproveList(currentPage, "");
});
} else {
layer.msg(result.message, {icon: 2});
}
}).error(function (e) {
$.messager.alert('错误', 'HTTP请求失败,请检查网络!');
});
event.stopPropagation();
}
/**
* 回退
*/
function mbFallBack(obj) {
var taskId = $(obj).parents().parents().children("td:nth-child(3)").text();
var projectId = $(obj).parents().parents().children("td:nth-child(1)").text();
action = "回退";
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.task.fallback,
headers: {
"token": $.cookie('ftoken')
},
data: {taskid: taskId},
dataType: 'json',
success: function (result) {
if (result.status == 'ok') {
console.debug(result);
global.main.closeTab('taskId_' + taskId);
action = "回退";
updateStatus(projectId);
layer.msg("回退成功", {
icon: 1,
time: 1500,
offset: '300px'
}, function () {
getApproveList(currentPage, "");
});
} else {
console.info(result);
layer.msg("回退失败", {
icon: 2,
time: 1500,
offset: '300px'
}, function () {
});
}
},
error: function (e) {
$.messager.alert('错误', 'HTTP请求失败,请检查网络!');
}
});
event.stopPropagation();
}
/**
* 退件
*/
function mbReject(obj) {
var taskId = $(obj).parents().parents().children("td:nth-child(3)").text();
var projectId = $(obj).parents().parents().children("td:nth-child(1)").text();
parent.layer.confirm(
'确认退件吗?',
{icon: 3, title: '提示'},
function (index) {
action = "退件";
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.task.reject,
headers: {
"token": $.cookie('ftoken')
},
data: {taskid: taskId},
dataType: 'json',
success: function (result) {
if (result.status == 'ok') {
console.debug(result);
global.main.closeTab('taskId_' + taskId);
updateStatus(projectId);
parent.layer.msg("退件成功", {
icon: 1,
time: 1500,
offset: '300px'
}, function () {
getApproveList(currentPage, "");
});
} else {
console.info(result);
layer.msg("退件失败", {
icon: 2,
time: 1500,
offset: '300px'
}, function () {
});
}
},
error: function (e) {
$.messager.alert('错误', 'HTTP请求失败,请检查网络!');
}
});
});
event.stopPropagation();
}
/**
* 续办
* hzw 2018/3/15 注释 提取到layuiDataList.js作为通用方法 不影响可以删除
*/
function openlayer_continue(obj) {
var checboxnumber = 0;
var checboxdata = [];
var myDatatable = $('table.datatable').data('zui.datatable');
var rowdata = myDatatable.data.rows;
for (var i = 0; i < rowdata.length; i++) {
if (rowdata[i].checked == true) {
checboxnumber++;
var obj = rowdata[i];
checboxdata.push(obj);
}
}
if (checboxnumber == 0) {
parent.layer.msg("请选择项目!", {icon: 2});
}
if (checboxnumber > 1) {
parent.layer.msg("只能选择一个项目!", {icon: 2});
}
if (checboxdata.length == 1) {
var data = checboxdata[0];
var projectId = data.data[0].text;
$.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') {
layer.open({
type: 2,
title: '审批类型',
shadeClose: true,
shade: 0.6,
offset: '20px',
area: ['80%', '80%'],
content: 'selecttype.jsp?projectId=' + projectId //iframe的url
});
} else
layer.msg(data.message, {icon: 2});
}
});
event.stopPropagation();
}
}
function changeStatus() {
var selectStatus = $('#selectStatus').find("option:selected").val();
statusJson = selectStatus;
getApproveList(1);
}
function changeType() {
if ($('#documentType').val() != "所有") {
$('#projectTypes').val("");
}
if ($('#projectTypes').val().replace(/(^\s*)|(\s*$)/g, "") == "" && $('#optionType').find(".remove").length != 0) {
$("#optionType").find(".remove").remove();
}
nScrollTop = 0;
getApproveList(1);
}
//根据操作更新当前公文的动作状态
function updateStatus(projectId) {
$.post(global.contextPath + global.modelctls.flowEngine.updateActionStatus, {
action: action,
pid: projectId
}, function (data) {
});
}
function allSend(tousers, checkMessage, content) {
$.post(global.contextPath + global.modelctls.sms.sendAll, {
jsonUserId: tousers,
content: content,
checkMessage: checkMessage
}, function (result) {
var dXmsg = "";
var wXmsg = "";
if (result[0] != "") {
result[0] = (result[0].substring(result[0].length - 1) == ',') ? result[0].substring(0, result[0].length - 1) : result[0];
dXmsg = result[0] + "号码不存在";
}
if (result[1] != "") {
result[1] = (result[1].substring(result[1].length - 1) == ',') ? result[1].substring(0, result[1].length - 1) : result[1];
wXmsg += result[1] + "微信号未绑定"
}
if (checkMessage == "message") {
if (dXmsg == "")
layer.msg("已发送短信提醒", {icon: 1});
else
layer.msg(dXmsg, {icon: 2});
} else if (checkMessage == "wechat") {
if (wXmsg == "")
layer.msg("已发送微信提醒", {icon: 1});
else
layer.msg(wXmsg, {icon: 2});
} else {
var msg = dXmsg + "," + wXmsg;
if (msg == ",")
layer.msg("提醒成功", {icon: 1});
else {
msg = (msg.substr(0, 1) == ',') ? msg.substr(1) : msg;
layer.msg(msg, {icon: 2});
}
}
});
}
function btnEvent() {
$('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 condition = $("#searchInput").val();
searchInfo = condition;
getApproveList(currentPage, condition);
}
});
$("#searchBtn").click(function () {
var condition = $("#searchInput").val();
searchInfo = condition;
nScrollTop = 0;
getApproveList(currentPage, condition);
});
$("#searchInput").on('input', function (e) {
searchInfo = $("#searchInput").val();
if (searchInfo == '') {
nScrollTop = 0;
getApproveList(1, "");
}
});
// $('table.datatable').datatable().on("sort.zui.datatable", function(event) {
// alert("111");
// });
}
function searQuery() {
var condition = $("#searchInput").val();
searchInfo = condition;
zuidate.rows = [];
nScrollTop = 0;
getApproveList(1, condition);
}
function supendTack(obj) {
var taskId = $(obj).parents().parents().children("td:nth-child(3)").text();
// $.post(global.contextPath + global.modelctls.flowEngine.task.suspend,{taskid: taskId}, function (result) {
// if (result.status == 'ok') {
// alert("111");
// }
// });
event.stopPropagation();
}
function activation(obj) {
var taskId = $(obj).parents().parents().children("td:nth-child(3)").text();
// $.post(global.contextPath + global.modelctls.flowEngine.task.activation,{taskid: taskId}, function (result) {
// if (result.status == 'ok') {
// alert("111");
// }
// });
event.stopPropagation();
}
/**
* 项目树
*/
function openlayer_tree() {
//var checkboxData = getCheckStatus().data;//改为如下,因为待办项目不是使用layui的数据表格显示的
var checkboxData;
if (window.parent.listName == "待办项目") {
checkboxData = getCheckedProjectData();
} else {
checkboxData = getCheckStatus().data;
}
if (checkboxData.length == 0) {
parent.layer.msg("请选择项目!", {icon: 2});
} else if (checkboxData.length > 1) {
parent.layer.msg("只能选择一个项目!", {icon: 2});
} else if (checkboxData.length == 1) {
var projectid = checkboxData[0].PROJECTID;
var url = CONF_FRONT_SERVERURL
+ 'view/projecttask/projectTree.jsp' + '?projectId=' + projectid;
layer.open({
type: 2, //page层
area: ['50%', '90%'],
offset: '10px',
title: '项目一棵树',
shadeClose: true,
shade: 0.6, //遮罩透明度
moveType: 1, //拖拽风格,0是默认,1是传统拖动
moveOut: true,
maxmin: true,//最大化最小化
//shift: 1, //0-6的动画形式,-1不开启
content: url
});
}
}
/**
* 结束流程
*/
/*function openlayer_endtask(){
var taskArray=[];
var projectids =[];
var myDatatable = $('table.datatable').data('zui.datatable');
var rowdata = myDatatable.data.rows;
for(var i=0;i<rowdata.length;i++){
if(rowdata[i].checked==true){
var obj = rowdata[i];
var taskid = obj.data[2].text
if(obj.data[4].text != '退件'){
parent.layer.msg("结束失败!只有状态为'退件'的案件才可以结束!", {icon : 2});
return false ;
}else{
taskArray.push(taskid);
projectids.push(obj.data[0].text);
}
}
}
if(taskArray!=null && taskArray.length>0){
parent.layer.open({
content: '确定结束选中流程吗?',
btn: ['确认', '取消'],
shadeClose: true,
icon: 3,
yes: function(){
var taskString = taskArray.join();
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.task.finishFlow,
headers:{
"token":$.cookie('ftoken')
},
data:{
taskIds : taskString,
},
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});
//openRefreshList();
}
}
});
parent.layer.closeAll();
}
});
}else{
parent.layer.msg("请选择项目!", {icon : 2});
}
}*/
/**
* TEST
* 日志
*/
function openJournal() {
var checboxnumber = 0;
var checboxdata = [];
var myDatatable = $('table.datatable').data('zui.datatable');
var rowdata = myDatatable.data.rows;
for (var i = 0; i < rowdata.length; i++) {
if (rowdata[i].checked == true) {
checboxnumber++;
var obj = rowdata[i];
checboxdata.push(obj);
}
}
if (checboxnumber == 0) {
parent.layer.msg("请选择项目!", {icon: 2});
}
if (checboxnumber > 1) {
parent.layer.msg("只能选择一个项目!", {icon: 2});
}
if (checboxdata.length == 1) {
var data = checboxdata[0];
var flowInstanceId = data.data[1].text;
var url = CONF_FRONT_SERVERURL + 'view/projecttask/flowlog.jsp?flowInstanceId='
+ flowInstanceId;
layer.open({
type: 2, //page层
area: ['70%', '90%'],
offset: '10px',
title: '流程日志',
shadeClose: true,
shade: 0.6, //遮罩透明度
moveType: 1, //拖拽风格,0是默认,1是传统拖动
moveOut: true,
//shift: 1, //0-6的动画形式,-1不开启
content: url
});
}
}
function updateActionStatus() {
$.ajax({
type: "POST",
url: curserver + global.modelctls.flowEngine.updateActionStatus,
headers: {
"token": $.cookie('ftoken')
},
data: {action: action, pid: projectid},
success: function (data) {
}
});
}
function selectProjecType() {
// console.log()
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);
layer.close(index);
if ($('#projectTypes').val() != "") {
$('#documentType').val("所有");
}
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>');
}
nScrollTop = 0;
getApproveList(1);
},
end: function (index, layero) {
}
});
}
function remove(e) {
$(e.parentElement).find("input[type='text']").val("");
getApproveList(1);
$(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);
}
}
}
});
}
var showDataList;//按顺序存放显示的表格行数据
/**
* 组装数据
* hzw 2018/4/27 修改 lhy
* @param result 数据
* @param tbodyid 列表ID
* @param searchtext 搜索关键字
*/
function dynamicWorkingTable(result, tbodyid, searchtext) {
layui.use('element', function () {
var element = layui.element;
showDataList = [];
var data = result;
if (data == null) {
return;
}
//先分组归类项目信息
var groupData = groupByFlowType(data);
var str = JSON.stringify(result);
$("#" + tbodyid).children().remove();
var htmlTable = "";
var pageData;
if (groupData.length > 0) {//如果有分组数据
if (orign === 'ghsc') {
// -- 规划审查 待办项目
//添加表头
if(isType == 1) {
// -- 数据申请 根据类型切换表头
htmlTable += "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
"<thead><tr class=\"tabletitle\"> " +
"<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
"<th width=\"3%\" class=\"statusIcon\"></th>" +
"<th width=\"5%\"><div class=\"tableCell\">状态</div></th> " +
"<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">数据类型</div></th>" + // --
"<th width=\"20%\"><div class=\"tableCell\">数据用途</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">密级</div></th>" + //"<th width=\"12%\"><div class=\"tableCell\">业务类型</div></th>" +
// "<th width=\"10%\"><div class=\"tableCell\">项目版本</div></th>" + //"<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">当前环节</div></th>" + // --
"<th width=\"8%\"><div class=\"tableCell\">申请部门</div></th>" + // --
"<th width=\"11%\"><div class=\"tableCell\">申请时间</div></th>" +
"</tr>" +
"</thead>" +
"<tbody id=\"tbodylist\">"
}else {
htmlTable += "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
"<thead><tr class=\"tabletitle\"> " +
"<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
"<th width=\"3%\" class=\"statusIcon\"></th>" +
"<th width=\"5%\"><div class=\"tableCell\">状态</div></th> " +
"<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">规划类型</div></th>" + // --
"<th width=\"20%\"><div class=\"tableCell\">项目名称</div></th>" +
"<th width=\"5%\"><div class=\"tableCell\">行政辖区</div></th>" + //"<th width=\"12%\"><div class=\"tableCell\">业务类型</div></th>" +
"<th width=\"5%\"><div class=\"tableCell\">项目版本</div></th>" + //"<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">当前环节</div></th>" + // --
"<th width=\"10%\"><div class=\"tableCell\">审批阶段</div></th>" + // --
"<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" + // --
"<th width=\"11%\"><div class=\"tableCell\">报送时间</div></th>" +
"</tr>" +
"</thead>" +
"<tbody id=\"tbodylist\">"
}
// -- 筛选数据逻辑
data = data.filter(item => {
// return item.FLOWNAME.indexOf('规划成果审查') > -1 ||
// item.FLOWNAME.indexOf('申请数据流程') > -1 ||
// item.FLOWNAME.indexOf('数据申请') > -1
if(isType == 1) {
return item.FLOWNAME.indexOf('数据申请') > -1
}else {
return item.FLOWNAME.indexOf('规划成果审查') > -1 ||
item.FLOWNAME.indexOf('申请数据流程') > -1
};
});
// -- 分页逻辑单独抽出
if (createdFlag || isClickPage) {
createdFlag = false;
isClickPage = false;
createPage(data);
}
// 分页没有被创建 并且 数据量大于 分页条数 才显示分页
// if(createdFlag && data.length > pageSizeLayui) {
// createPage(data);
// createdFlag = false;
// };
var _url = '/xm/getLcList';
var user = JSON.parse(parent.userCookies).user;
var _obj = {
userId: user.id,
userName: user.realname,
};
postDataToServe(_url, {..._obj, pageData: JSON.stringify(data)}, res => {
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < res.length; j++) {
if (data[i].PROJECTID == res[j].id) {
data[i].REGISTERTIME = res[j].rwjssj
data[i].PROJECTNAME = res[j].xmmc || ""
data[i].PROJECTCODE = res[j].xmbh || ""
data[i].BINDINGASSIGNEE = res[j].jbr || ""
data[i].BINDINGUNIT = res[j].bm || ""
}
}
}
}, false);
data.forEach((ele) => {
// -- REGISTERTIME 用rwjssj来 转化为时间戳 处理排序
if(ele.REGISTERTIME) {
ele.timeStampVal = (new Date(ele.REGISTERTIME)).getTime();
}else {
ele.timeStampVal = 0;
}
});
ownSort(data);
pageData = data.slice((currentLayui - 1) * pageSizeLayui, (currentLayui - 1) * pageSizeLayui + pageSizeLayui);
for (var i = 0; i < groupData.length; i++) {//遍历分组数据
/*if(i>0){//TODO 测试
break;
}*/
var flowType = groupData[i]["type"];
var flowTypeName = groupData[i]["name"];
var sum = 0;//统计属于该类型的项目个数
var htmlTableBodyTr = "";//归类项目内容
var _url = '/xm/getLcList';
var user = JSON.parse(parent.userCookies).user;
var _obj = {
userId: user.id,
userName: user.realname,
};
// data = data.filter(item => (
// item.FLOWNAME.indexOf('规划成果审查') > -1 ||
// item.FLOWNAME.indexOf('申请数据流程') > -1
// ));
// // --
// if(createdFlag) {
// createPage(data);
// createdFlag = false;
// };
//
// var pageData = data.slice((currentLayui - 1) * pageSizeLayui, (currentLayui - 1) * pageSizeLayui + pageSizeLayui);
// 优化调用 --
// postDataToServe(_url, {..._obj, pageData: JSON.stringify(pageData)}, res => {
// for (var i = 0; i < pageData.length; i++) {
// for (var j = 0; j < res.length; j++) {
// if (pageData[i].PROJECTID == res[j].id) {
// pageData[i].REGISTERTIME = res[j].rwjssj
// pageData[i].PROJECTNAME = res[j].xmmc || ""
// pageData[i].PROJECTCODE = res[j].xmbh || ""
// pageData[i].BINDINGASSIGNEE = res[j].jbr || ""
// pageData[i].BINDINGUNIT = res[j].bm || ""
// }
// }
// }
// }, false);
for (var j = 0; j < pageData.length; j++) {//遍历所有项目数据
var flowTypeStr = pageData[j]["PROJECTFLOWTYPE"];
var obj = JSON.stringify(pageData[j]);
var fontweight = "";
var descrption = pageData[j]["DESCRIPTION"];
if (descrption != "read") {
fontweight = ' style=\"font-weight: 600;color: blue;\" ';
};
//状态-项目编号-项目名称-业务类型-发起部门-接受日期
if (flowType == flowTypeStr) {
if(isType == 1) {
// 数据申请
htmlTableBodyTr += "<tr id=\"" + pageData[j]["PROJECTID"] + "\" " + fontweight + ' class=\"group' + i + '\">' +
"<td width=\"1%\" class=\"checkboxCls\" >" + '<input class="son_check" type="checkbox" name="layTableCheckbox" lay-skin="primary" title="" >' + "</td>" +
"<td width=\"3%\" onclick=\'workingSeeDetail(this)\' class=\"statusIcon\">" + pageData[j]["BJQX"] + "</td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTSTATUS"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTSTATUS"] + "</div></td>" +
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTCODE"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTCODE"] + "</div></td>" +
// -- 数据类型
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["FLOWNAME"] +"><div class=\"tableCell\">" + pageData[j]["FLOWNAME"] + "</div></td>" +
// -- 数据用途 暂无字段
"<td width=\"30%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["YT"] +"><div class=\"tableCell\">" + pageData[j]["YT"] + "</div></td>" +
// -- 密级 暂无字段
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["MJ"] +"><div class=\"tableCell\">" + pageData[j]["MJ"] + "</div></td>" +
// -- 项目版本
// "<td width=\"10%\" onclick=\'workingSeeDetail(this)\' title=" + '' +"><div class=\"tableCell\">" + '' + "</div></td>" +
// -- 当前环节
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["ACTIVITYNAME"] +"><div class=\"tableCell\">" + pageData[j]["ACTIVITYNAME"] + "</div></td>" +
// -- 申请部门
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["BINDINGUNIT"] +"><div class=\"tableCell\">" + pageData[j]["BINDINGUNIT"] + "</div></td>" +
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["FLOWNAME"] + "</div></td>" +
// "<td width=\"8%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["BINDINGUNIT"] + "</div></td>" +
// "<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["REGISTERTIME"] +"><div class=\"tableCell\">" + pageData[j]["REGISTERTIME"] + "</div></td>" + // REGISTERTIME RECEIVETIME
`<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title='${ pageData[j]["REGISTERTIME"]}'><div class=\"tableCell\"> ${pageData[j]["REGISTERTIME"]} </div></td>` +
"</tr>";
}else {
// 成果审查
htmlTableBodyTr += "<tr id=\"" + pageData[j]["PROJECTID"] + "\" " + fontweight + ' class=\"group' + i + '\">' +
"<td width=\"1%\" class=\"checkboxCls\" >" + '<input class="son_check" type="checkbox" name="layTableCheckbox" lay-skin="primary" title="" >' + "</td>" +
"<td width=\"3%\" onclick=\'workingSeeDetail(this)\' class=\"statusIcon\">" + pageData[j]["BJQX"] + "</td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTSTATUS"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTSTATUS"] + "</div></td>" +
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTCODE"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTCODE"] + "</div></td>" +
// -- 规划类型
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["XMLX"] +"><div class=\"tableCell\">" + pageData[j]["XMLX"] + "</div></td>" +
"<td width=\"30%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTNAME"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTNAME"] + "</div></td>" +
// -- 行政辖区
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["XZQHBSM"] +"><div class=\"tableCell\">" + pageData[j]["XZQHBSM"] + "</div></td>" +
// -- 项目版本
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["CGBBH"] +"><div class=\"tableCell\">" + pageData[j]["CGBBH"] + "</div></td>" +
// -- 当前环节
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["ACTIVITYNAME"] +"><div class=\"tableCell\">" + pageData[j]["ACTIVITYNAME"] + "</div></td>" +
// -- 所属阶段
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["SPJD"] +"><div class=\"tableCell\">" + pageData[j]["SPJD"] + "</div></td>" +
// -- 发起部门
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["BINDINGUNIT"] +"><div class=\"tableCell\">" + pageData[j]["BINDINGUNIT"] + "</div></td>" +
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["FLOWNAME"] + "</div></td>" +
// "<td width=\"8%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["BINDINGUNIT"] + "</div></td>" +
// "<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title`=" + pageData[j]["REGISTERTIME"]+"><div class=\"tableCell\">" + pageData[j]["REGISTERTIME"] + "</div></td>" +
`<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title='${ pageData[j]["REGISTERTIME"]}'><div class=\"tableCell\"> ${pageData[j]["REGISTERTIME"]} </div></td>` +
"</tr>";
}
sum++;
showDataList.push(pageData[j]);//将显示的数据保存
}
}
//往表格中添加一行用于提示分类的标志行
var htmlTableHeadTr = "";
htmlTable += htmlTableHeadTr + htmlTableBodyTr;
}
}
/*
* 业务协同策划生成页面
* */
else if (orign === 'ajcc') {
// $("#ywxt-tabs").css('display', 'inline-block');
$("#workingsTabDiv").css('margin-top', '10px');
//添加表头
htmlTable += "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
"<thead><tr class=\"tabletitle\"> " +
"<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
// "<th width=\"3%\" class=\"statusIcon\"></th>" +
"<th width=\"5%\"><div class=\"tableCell\">序号</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">案件名称</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">案件类型</div></th> " +
"<th width=\"6%\"><div class=\"tableCell\">责任单位</div></th>" +
"<th width=\"6%\"><div class=\"tableCell\">所属区域</div></th>" +
"<th width=\"6%\"><div class=\"tableCell\">来件人</div></th>" +
"<th width=\"6%\"><div class=\"tableCell\">登记时间</div></th>" +
"<th width=\"11%\"><div class=\"tableCell\">接受时间</div></th>" +
// "<th width=\"10%\"><div class=\"tableCell\">当前环节</div></th>" +
// "<th width=\"7%\"><div class=\"tableCell\">接收时间</div></th>" +
// "<th width=\"5%\"><div class=\"tableCell\">经办人</div></th>" +
// "<th width=\"7%\"><div class=\"tableCell\">所属部门</div></th>" +
// "<th width=\"7%\"><div class=\"tableCell\">策划结论</div></th>" +
"</tr>" +
"</thead>" +
"<tbody id=\"tbodylist\">"
for (var i = 0; i < groupData.length; i++) {//遍历分组数据
/*if(i>0){//TODO 测试
break;
}*/
var flowType = groupData[i]["type"];
var flowTypeName = groupData[i]["name"];
var sum = 0;//统计属于该类型的项目个数
var htmlTableBodyTr = "";//归类项目内容
data = data.filter(item => (
item.FLOWNAME === '项目策划流程' || item.FLOWNAME === '项目储备策划生成'
));
if (createdFlag && isClickPage) {
createPage(data);
createdFlag = false;
};
data.forEach((ele, index) => {
if(ele.RECEIVETIME) {
ele.timeStampVal = (new Date(ele.RECEIVETIME)).getTime();
}else {
ele.timeStampVal = 0;
}
});
ownSort(data);
pageData = data.slice((currentLayui - 1) * pageSizeLayui, (currentLayui - 1) * pageSizeLayui + pageSizeLayui);
var dataCopy = JSON.parse(JSON.stringify(data))
for (var j = 0; j < data.length; j++) {//遍历所有项目数据
var flowTypeStr = data[j]["PROJECTFLOWTYPE"];
var obj = JSON.stringify(data[j]);
var fontweight = "";
var descrption = data[j]["DESCRIPTION"];
if (descrption != "read") {
fontweight = ' style=\"font-weight: 600;color: blue;\" ';
}
if (flowType == flowTypeStr) {
htmlTableBodyTr += "<tr id=\"" + pageData[j]["PROJECTID"] + "\" " + fontweight + ' class=\"group' + i + '\">' +
"<td width=\"1%\" class=\"checkboxCls\" >" + '<input class="son_check" type="checkbox" name="layTableCheckbox" lay-skin="primary" title="" >' + "</td>" +
"<td width=\"3%\" onclick=\'workingSeeDetail(this)\' class=\"statusIcon\">" + pageData[j]["BJQX"] + "</td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["PROJECTSTATUS"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BUILDADDRESS"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\' data-field=\"FLOWNAME\"><div class=\"tableCell\">" + pageData[j]["FLOWNAME"] + "</div></td>" +
"<td width=\"6%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["PROJECTCODE"] + "</div></td>" +
"<td width=\"6%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["PROJECTID"] + "</div></td>" +
"<td width=\"6%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BUILDADDRESS"] + "</div></td>" +
"<td width=\"6%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BINDINGUNIT"] + "</div></td>" +
"<td width=\"11%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["ACTIVITYNAME"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BINDINGASSIGNEE"] + "</div></td>" +
"<td width=\"7%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BUILDADDRESS"] + "</div></td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["REGISTERTIME"] + "</div></td>" +
"<td width=\"7%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + pageData[j]["BINDINGASSIGNEE"] + "</div></td>" +
"<td width=\"7%\">" + data[j]["BINDINGUNIT"] + "</td>" +
"</tr>";
sum++;
showDataList.push(data[j]);//将显示的数据保存
}
}
//往表格中添加一行用于提示分类的标志行
var htmlTableHeadTr = "";
htmlTable += htmlTableHeadTr + htmlTableBodyTr;
}
}
/*
* 业务协同项目审批页面
* */
// else if (orign === 'ywxt-xmsp' || orign === 'ywxt-all') {
// // 业务协同 代办项目 --
// // $("#ywxt-xmsp-tabs").show();
// // $("#workingsTabDiv").css('margin-top', '-15px');
// //添加表头
// htmlTable += "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
// "<thead><tr class=\"tabletitle\"> " +
// "<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
// "<th width=\"3%\" class=\"statusIcon\"></th>" +
// "<th width=\"5%\"><div class=\"tableCell\">状态</div></th>" +
// "<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" +
// "<th width=\"20%\"><div class=\"tableCell\">项目名称</div></th> " +
// "<th width=\"12%\"><div class=\"tableCell\">业务类型</div></th>" +
// "<th width=\"7%\"><div class=\"tableCell\">发起部门</div></th>" +
// "<th width=\"11%\"><div class=\"tableCell\">接收时间</div></th>" +
// "</tr>" +
// "</thead>" +
// "<tbody id=\"tbodylist\">"
//
// for (var i = 0; i < groupData.length; i++) {//遍历分组数据
// /*if(i>0){//TODO 测试
// break;
// }*/
// var flowType = groupData[i]["type"];
// var flowTypeName = groupData[i]["name"];
// var sum = 0;//统计属于该类型的项目个数
// var htmlTableBodyTr = "";//归类项目内容
//
// // -- ↓
// data = data.filter(item => (
// item.FLOWNAME === "工程建设许可阶段并联审批" ||
// item.FLOWNAME === "立项用地规划许可阶段并联审批" ||
// item.FLOWNAME === "施工许可阶段并联审批" ||
// item.FLOWNAME === "竣工验收阶段并联审批" ||
// item.FLOWNAME === "成果审查子流程测试" ||
// item.FLOWNAME === "项目储备策划生成" ||
// item.FLOWNAME === "出让类项目储备策划生成" ||
// item.FLOWNAME==='项目策划生成(政府投资工程建设项目类)'||
// item.FLOWNAME==='项目策划生成(企业投资项目用地储备类)'
// // || item.FLOWNAME === "数据申请"
// ));
//
// if (createdFlag) {
// createPage(data);
// createdFlag = false;
// }
// ;
// data.forEach((ele) => {
// if(ele.RECEIVETIME) {
// ele.timeStampVal = (new Date(ele.REGISTERTIME)).getTime();
// }else {
// ele.timeStampVal = 0;
// }
// });
// ownSort(data);
// pageData = data.slice((currentLayui - 1) * pageSizeLayui, (currentLayui - 1) * pageSizeLayui + pageSizeLayui);
//
// var dataCopy = JSON.parse(JSON.stringify(pageData))
// var _url = '/xm/getLcList';
// var user = JSON.parse(parent.userCookies).user;
// var _obj = {
// userId: user.id,
// userName: user.realname,
//
// };
// postDataToServe(_url, {..._obj, data: JSON.stringify(pageData)}, res => {
// for (var i = 0; i < pageData.length; i++) {
// for (var j = 0; j < res.length; j++) {
// if (pageData[i].PROJECTID == res[j].id) {
// pageData[i].REGISTERTIME = res[j].rwjssj
// pageData[i].PROJECTNAME = res[j].xmmc || ""
// pageData[i].PROJECTCODE = res[j].xmbh || ""
// pageData[i].BINDINGASSIGNEE = res[j].jbr || ""
// pageData[i].ZPMSPH = res[j].cbbh || ""
// pageData[i].BUILDADDRESS = res[j].jsdw || ""
// pageData[i].CASECODE = res[j].jsdd || ""
// pageData[i].BINDINGUNIT = res[j].bm || ""
// pageData[i].SPJD = res[j].SPJD || ""
//
// if (pageData[i].ACTIVITYNAME === '发起项目' ||
// pageData[i].ACTIVITYNAME === '预选址及审核' ||
// pageData[i].ACTIVITYNAME === '空间协调' ||
// pageData[i].ACTIVITYNAME === '空间协调意见汇总' ||
// pageData[i].ACTIVITYNAME === '前期工作计划决策') {
// pageData[i].BUILDUNIT = "空间协调"
// } else if (pageData[i].ACTIVITYNAME === '提交可研材料' ||
// pageData[i].ACTIVITYNAME === '可研初审' ||
// pageData[i].ACTIVITYNAME === '联评联审' ||
// pageData[i].ACTIVITYNAME === '下达可研报告通知函') {
// pageData[i].BUILDUNIT = "可研协调"
// } else if (pageData[i].FLOWNAME === '工程建设许可阶段并联审批') {
// pageData[i].BUILDUNIT = "工程建设许可"
// } else if (pageData[i].FLOWNAME === '立项用地规划许可阶段并联审批') {
// pageData[i].BUILDUNIT = "用地规划许可"
// } else if (pageData[i].FLOWNAME === '施工许可阶段并联审批') {
// pageData[i].BUILDUNIT = "施工许可"
// } else if (pageData[i].FLOWNAME === '竣工验收阶段并联审批') {
// pageData[i].BUILDUNIT = "竣工验收"
// }
// }
// }
// }
// }, false);
// // -- ↑
// for (var j = 0; j < pageData.length; j++) {//遍历所有项目数据
// var flowTypeStr = pageData[j]["PROJECTFLOWTYPE"];
// var obj = JSON.stringify(pageData[j]);
// var fontweight = "";
// var descrption = pageData[j]["DESCRIPTION"];
// if (descrption != "read") {
// fontweight = ' style=\"font-weight: 600;color: blue;\" ';
// }
// // if (flowType == flowTypeStr) {
// htmlTableBodyTr += "<tr id=\"" + pageData[j]["PROJECTID"] + "\" " + fontweight + ' class=\"group' + i + '\">' +
// "<td width=\"1%\" class=\"checkboxCls\" >" + '<input class="son_check" type="checkbox" name="layTableCheckbox" lay-skin="primary" title="" >' + "</td>" +
// "<td width=\"3%\" onclick=\'workingSeeDetail(this)\' class=\"statusIcon\">" + pageData[j]["BJQX"] + "</td>" +
//
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTSTATUS"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTSTATUS"] + "</div></td>" +
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTCODE"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTCODE"] + "</div></td>" +
//
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["PROJECTNAME"] +"><div class=\"tableCell\">" + pageData[j]["PROJECTNAME"] + "</div></td>" +
//
// "<td width=\"12%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["FLOWNAME"] +"><div class=\"tableCell\">" + pageData[j]["FLOWNAME"] + "</div></td>" +
// "<td width=\"7%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["BINDINGUNIT"] +"><div class=\"tableCell\">" + pageData[j]["BINDINGUNIT"] + "</div></td>" +
// // "<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["REGISTERTIME"] +"><div class=\"tableCell\">" + pageData[j]["REGISTERTIME"] + "</div></td>" +
// `<td width=\"11%\" onclick=\'workingSeeDetail(this)\' title='${ pageData[j]["REGISTERTIME"]}'><div class=\"tableCell\"> ${pageData[j]["REGISTERTIME"]} </div></td>` +
//
// // "<td width=\"12%\" onclick=\'workingSeeDetail(this)\' title=" + pageData[j]["FLOWNAME"] +"><div class=\"tableCell\">" + pageData[j]["FLOWNAME"] + "</div></td>" +
// "</tr>";
// sum++;
// showDataList.push(pageData[j]);//将显示的数据保存
// // }
// }
// if( i >= groupData.length) {
// ownSort(showDataList);
// //往表格中添加一行用于提示分类的标志行
// }
// var htmlTableHeadTr = "";
// htmlTable = "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
// "<thead><tr class=\"tabletitle\"> " +
// "<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
// "<th width=\"3%\" class=\"statusIcon\"></th>" +
// "<th width=\"5%\"><div class=\"tableCell\">状态</div></th>" +
// "<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" +
// "<th width=\"20%\"><div class=\"tableCell\">项目名称</div></th> " +
// "<th width=\"22%\"><div class=\"tableCell\">业务类型</div></th>" +
// "<th width=\"10%\"><div class=\"tableCell\">发起部门</div></th>" +
// "<th width=\"14%\"><div class=\"tableCell\">接收时间</div></th>" +
// "</tr>" +
// "</thead>" +
// "<tbody id=\"tbodylist\">" + htmlTableHeadTr + htmlTableBodyTr;
//
// }
// }
else if(orign =='phgl'){
//添加表头
htmlTable += "<table class=\"striped\" id=\"datalist\" style=\"table-layout: fixed;width: 100%;\">" +
"<thead><tr class=\"tabletitle\"> " +
"<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" +
"<th width=\"10%\"><div class=\"tableCell\">项目编号</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">项目名称</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">地籍编号</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">用地面积(亩)</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">宗地位置</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">土地用途</div></th>" +
"<th width=\"8%\"><div class=\"tableCell\">责任单位</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">所属区域</div></th>" +
"<th width=\"10%\"><div class=\"tableCell\">创建时间</div></th>" +
"</tr>" +
"</thead>" +
"<tbody id=\"tbodylist\">"
for (var i = 0; i < groupData.length; i++) {//遍历分组数据
/*if(i>0){//TODO 测试
break;
}*/
var flowType = groupData[i]["type"];
var flowTypeName = groupData[i]["name"];
var sum = 0;//统计属于该类型的项目个数
var htmlTableBodyTr = "";//归类项目内容
for (var j = 0; j < data.length; j++) {//遍历所有项目数据
var flowTypeStr = data[j]["PROJECTFLOWTYPE"];
var obj = JSON.stringify(data[j]);
var fontweight = "";
var descrption = data[j]["DESCRIPTION"];
if (descrption != "read") {
fontweight = ' style=\"font-weight: 600;color: blue;\" ';
}
if (flowType == flowTypeStr) {
htmlTableBodyTr += "<tr id=\"" + data[j]["PROJECTID"] + "\" " + fontweight + ' class=\"group' + i + '\">' +
"<td width=\"1%\" class=\"checkboxCls\" >" + '<input class="son_check" type="checkbox" name="layTableCheckbox" lay-skin="primary" title="" >' + "</td>" +
"<td width=\"3%\" onclick=\'workingSeeDetail(this)\' class=\"statusIcon\">" + data[j]["BJQX"] + "</td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["PROJECTSTATUS"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["FLOWNAME"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["PROJECTCODE"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["CASECODE"] + "</div></td>" +
"<td width=\"20%\" onclick=\'workingSeeDetail(this)\' data-field=\"PROJECTNAME\"><div class=\"tableCell\">" + data[j]["PROJECTNAME"] + "</div></td>" +
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["BUILDADDRESS"] + "</div></td>" +
"<td width=\"8%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["BUILDUNIT"] + "</div></td>" +
"<td width=\"10%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["REGISTERTIME"] + "</div></td>" +
"<td width=\"5%\" onclick=\'workingSeeDetail(this)\'><div class=\"tableCell\">" + data[j]["BINDINGASSIGNEE"] + "</div></td>" +
"<td width=\"10%\">" + data[j]["BINDINGUNIT"] + "</td>" +
"</tr>";
sum++;
showDataList.push(data[j]);//将显示的数据保存
}
}
//往表格中添加一行用于提示分类的标志行
// var htmlTableHeadTr = "<tr class=\"flowtypeParent\" id=\"" + "group" + i + "\">" +
// "<td width=\"1%\" class=\"iconTd\">" + "<span class=\"glyphicon glyphicon-minus\"></span>" + "</td>" +
// "<td width=\"3%\">" + flowTypeName + "(" + sum + ")" + "</td>" +
// "<td width=\"5%\">" + "" + "</td>" +
// "<td width=\"10%\">" + "" + "</td>" +
// "<td width=\"10%\">" + "" + "</td>" +
// "<td width=\"10%\">" + "" + "</td>" +
// "<td width=\"20%\">" + "" + "</td>" +
// "<td width=\"8%\">" + "" + "</td>" +
// "<td width=\"8%\">" + "" + "</td>" +
// "<td width=\"10%\">" + "" + "</td>" +
// "<td width=\"5%\">" + "" + "</td>" +
// "<td width=\"10%\">" + "" + "</td>" +
// "</tr>";
// htmlTable += htmlTableHeadTr + htmlTableBodyTr;
}
}
;
htmlTable += "</tbody></table>";
//TODO 先注释 $("#"+tbodyid).append(contentstr);
$("#" + tbodyid).append(htmlTable);
//设置未读加粗和鼠标悬停显示内容
setCell(showDataList);
setListHeight();//设置table高度适应
//复选框的点击事件
chexboxClickEvent();
//隐藏或显示按钮点击事件
ShowHideClickEvent();
tabSize.init('datalist');
setTableMinWidth();//设置表格的最小宽度
setCellWidth();//设置单元格宽度
}
;
setTimeout(() => {
parent.window.$.hideLoading();
}, 500)
})
}
/*
* 创建分页
* */
function createPage(data) {
let len = data.length;
layui.use(['laypage', 'layer'], () => {
var laypage = layui.laypage;
// 初始化分页
laypage.render({
elem: 'page2'
, count: len
, limit: pageSizeLayui
, limits: pageSizesLayui
, layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
, jump: function (obj, first) {
//首次不执行
if(!first){
parent.window.$.showLoading();
setTimeout(() => {
pageSizeLayui = obj.limit;
currentLayui = obj.curr;
dynamicWorkingTable(resultTableData, "workingsTabDiv", 'searchtext');
}, 500)
}
}
});
})
}
/*
* desc 冒泡排序
* */
function ownSort(arr){
for(i=0;i<arr.length-1;i++){
for(j=0;j<arr.length-1-i;j++){
/**
* 比较第j位和j+1的initial值
* 如果j位的initial值比j+1位的initial值大,那么他们的位置发生交换
* 如果j位的initial值比j+1位的initial值小,那么位置不变
*/
if(arr[j].timeStampVal < arr[j+1].timeStampVal){
var temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
}
/**
* 以projectflowtype分组归类项目信息
*/
function groupByFlowType(result) {
var groupData = [];
var returnData = [];
for (var i = 0; i < result.length; i++) {
var flowType = result[i]["PROJECTFLOWTYPE"];
if (groupData.indexOf(flowType) == -1) {
for (var j = 0; j < optionFlowData.length; j++) {
var flowTypeStr = optionFlowData[j]["value"];
if (flowType == flowTypeStr) {
var flowTypeName = optionFlowData[j]["text"];
break;
}
}
var obj = {
"type": flowType,
"name": flowTypeName,
}
groupData.push(flowType);
returnData.push(obj);
}
}
return returnData;
}
/**
* 查看项目详情
*/
function workingSeeDetail(td) {
var data;
//如果这个复选框被选中,则获取这行tr的id(项目id)
var trProjectId = $(td).parent().attr("id");
console.log("选中的项目id=" + trProjectId);
for (var i = 0; i < listShowObject.length; i++) {
var listProjectId = listShowObject[i].PROJECTID
if (trProjectId.trim() == listProjectId) {
data = listShowObject[i];
break;
}
}
if (orign === 'ywxt' || orign === 'ywxt-xmcb' || orign === 'ywxt-xmsp' || orign === 'ywxt-all') {
data.FLOWVERSION = '2.0'
} else {
// create by zys 2020/3/16 版本号控制 start
data.FLOWVERSION = version;
}
// end
//不再验证会议状态
openApproveDetail(data);
/*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);
}*/
}
/**
* 鼠标悬停显示title 这是修改过的代办项目显示页面使用,lhy修改20181227
* 待办项目未读加粗
*/
/*function setCell(data) {
$("#workingsTabDiv tbody td,#workingsTabDiv thead th").each(function() {
var text = $(this).first()[0].innerText.trim();
if(text == "") text = "";
$(this).attr("title", text);
})
if(window.parent.listName == "待办项目") {
$("#datalist tbody tr").not(".flowtypeParent").each(function(index) {//筛选不为分类行的tr,lhy20181227
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");
})*/
/**
* 复选框的点击事件
*/
function chexboxClickEvent() {
//全局的checkbox选中和未选中的样式
$parentChexbox = $('.parent_check'), //全选
$dataBox = $('#tbodylist'), //用于判断全局与子类的关系
$sonCheckBox = $('.son_check'); //单个子类选中
//全局全选与单个的关系
$parentChexbox.click(function () {
var $checkboxs = $dataBox.find('input[type="checkbox"]');
if ($(this).is(':checked')) {
$checkboxs.prop("checked", true);
} else {
$checkboxs.prop("checked", false);
}
//判断:所有子复选框个数
var len = $sonCheckBox.length;
var num = 0;
//判断子复选框选了几个
$sonCheckBox.each(function () {
if ($(this).is(':checked')) {
num++;
}
});
//续办,日志,删除按钮状态
buttonStyle(getCheckedProjectData().length, num == len);
});
$sonCheckBox.each(function () {
$(this).click(function () {
if ($(this).is(':checked')) {
//判断:所有单个是否勾选
var len = $sonCheckBox.length;
var num = 0;
//判断子复选框选了几个
$sonCheckBox.each(function () {
if ($(this).is(':checked')) {
//如果这个复选框被选中,则获取这行tr的id(项目id)
var projectId = $(this).parent().parent().attr("id");
num++;
}
});
if (num == len) {
$parentChexbox.prop("checked", true);
/* console.log("全选了共"+num+"个复选框");*/
}
} else {
//单个取消勾选,全局全选取消勾选
$parentChexbox.prop("checked", false);
}
//续办,日志,删除按钮状态
buttonStyle(getCheckedProjectData().length, num == len);
})
})
}
/**
* 获取复选框选中的项目信息
*/
function getCheckedProjectData() {
//存放已选择的项目信息
var checkedProjectList = [];
//判断子复选框选了几个
$("input[name='layTableCheckbox']").each(function () {
if ($(this).is(':checked')) {
//如果这个复选框被选中,则获取这行tr的id(项目id)
var trProjectId = $(this).parent().parent().attr("id");
/!*console.log("选中的项目id="+trProjectId);*!/
for (var i = 0; i < listShowObject.length; i++) {//通过项目id获取当前行的数据
var listProjectId = listShowObject[i].PROJECTID
if (trProjectId == listProjectId) {
checkedProjectList.push(listShowObject[i]);
}
}
}
});
return checkedProjectList;
}
/**
* 隐藏或显示按钮的点击事件
*/
function ShowHideClickEvent() {
$iconTd = $('.iconTd');
$iconTd.each(function () {
$(this).click(function () {
var trId = $(this).parent().attr("id");
$(this).parent().nextAll("." + trId).toggle();
var display = $(this).parent().nextAll("." + trId).css('display');
if (display == 'none') {
//如果是隐藏的就改变图标
$(this).html('<span class="glyphicon glyphicon-plus"></span>');//显示加号
} else {
$(this).html('<span class="glyphicon glyphicon-minus"></span>');//显示减号
}
})
})
$flowtypeParent = $('.flowtypeParent');
$flowtypeParent.each(function () {
$(this).dblclick(function () {//双击事件
var trId = $(this).attr("id");
$(this).nextAll("." + trId).toggle();
var display = $(this).nextAll("." + trId).css('display');
if (display == 'none') {
//如果是隐藏的就改变图标
$(this).children(".iconTd").html('<span class="glyphicon glyphicon-plus"></span>');//显示加号
} else {
$(this).children(".iconTd").html('<span class="glyphicon glyphicon-minus"></span>');//显示减号
}
})
})
}
var tabSize = tabSize || {};
//表头拖动事件
tabSize.init = function (id) {
var i,
self,
table = document.getElementById(id),
header = table.rows[0],
tableX = header.clientWidth,
length = header.cells.length;
for (i = 0; i < length; i++) {
header.cells[i].onmousedown = function () {
self = this;
if (event.offsetX > self.offsetWidth - 10) {
self.mouseDown = true;
self.oldX = event.x;
self.oldWidth = self.offsetWidth;
}
};
header.cells[i].onmousemove = function () {
setCellWidth();//设置单元格宽度
if (event.offsetX > this.offsetWidth - 10) {
this.style.cursor = 'col-resize';
} else {
this.style.cursor = 'default';
}
if (self == undefined) {
self = this;
}
if (self.mouseDown != null && self.mouseDown == true) {
self.style.cursor = 'default';
if (self.oldWidth + (event.x - self.oldX) > 0) {
self.width = self.oldWidth + (event.x - self.oldX);
}
self.style.width = self.width;
table.style.width = tableX + (event.x - self.oldX) + 'px';
self.style.cursor = 'col-resize';
}
};
table.onmouseup = function () {
if (self == undefined) {
self = this;
}
self.mouseDown = false;
self.style.cursor = 'default';
tableX = header.clientWidth;
// setCellWidth();//设置单元格宽度
};
}
};
/**
* 设置表格的th和td宽度一致
*/
function setCellWidth() {
var thHeader = $("#datalist").find("th");//获取表头对象
var trBody = $('#tbodylist').find("tr");//获取表格tr
$("#tbodylist tr").each(function () {
//var t = $(this).nextAll("td");
var t = $(this).children("td");
$(this).children("td").each(function (index) {
var td_width = thHeader.eq(index).width();
$(this).width(td_width);
/*var td_width1 = $(this).width();
if(index != thHeader.length-1){
$(this).width(thHeader.eq(index).width());
}else{
// TO需要判断是否出现了滚动条
$(this).width(thHeader.eq(index).width() - 10);//最后一个td减去滚动条的宽度
}*/
});
});
}
/**
* 获取表格的初始宽度
*/
function getTableInitWidth(id) {
var table = document.getElementById(id);
var header = table.rows[0];
var tableX = header.clientWidth;
return tableX;
}
/**
* 设置表格的最小宽度
*/
function setTableMinWidth() {
var minWidth = $("#workingsTabDiv").width();
if (minWidth < 1000) minWidth = 1000;//设置最小宽度是为了出现X向滚动条
$("#datalist").css("min-width", minWidth + "px");//设置table的初始宽度
}
function WaitingToStart() {
layer.open({
id: '_id_',
type: 1,
maxmin: true,
area: ['80%', '80%'],
content: '<div><table id="waitingprocessinglist" lay-filter="test"></table></div>',
success: function (layero, index) {
layui.use('table', function () {
var table = layui.table;
var tableObj = table.render({
page: true
,
elem: '#waitingprocessinglist'
,
height: 'full-' + (($("body").height() - ($("#_id_").offset().top + $("#_id_").height() - 65)) + $("#_id_").offset().top + 40)
,
url: CONF_DOCKINGSYSTEM_SERVERURL + '/xiangj/resource/getUnhandledItems'
,
where: {roleid: roleIds}
,
cols: [[ //表头
{field: 'flowname', title: '业务类型'}
, {field: 'xmmc', title: '项目名称'}
, {field: 'jsdd', title: '建设地点'}
, {field: 'sxmc', title: '事项名称'}
, {field: 'sxbm', title: '事项编码'}
]]
,
parseData: function (res) { //res 即为原始返回的数据
// 如果只有一页,则隐藏页码。
var pageelm = $('[lay-id=' + tableObj.config.id + ']').find('.layui-table-page');
if (res.total < tableObj.config.limit) {
pageelm.css('display', 'none');
} else {
pageelm.css('display', 'block');
}
return {
'code': 0, //解析接口状态
'msg': '获取数据成功', //解析提示文本
'count': res.total, //解析数据长度
'data': res.records //解析数据列表
};
}
,
done: function (res, curr, count) {
// 点击行打开详情页。鼠标按下到放开间隔超过半秒,不打开详情页(避免复制文字的时候也打开详情页)
this.elem.parent().find('tr[data-index]').mousedown(function () {
var stop, flag = true;
stop = setTimeout(function () {
flag = false;
}, 500);
$(this).one('mouseup', function () {
if (flag) {
clearTimeout(stop);
// 获取参数
var data = res.data;
var dataIndex = this.getAttribute('data-index');
var rowdata = dataIndex && data[dataIndex];
var flowid = rowdata && rowdata.flowid;
var dockingid = rowdata && rowdata.sxslbm;
if (!flowid) {
return layer.msg('没有绑定启动流程!');
}
if (!dockingid) {
return layer.msg('获取实例编码失败!');
}
// 项目文件夹ID
$.cookie('uuid', uuid(), {path: '/frontweb/view/projecttask'});
// 打开页面
var url = CONF_FRONT_SERVERURL + 'view/projecttask/detailproject.jsp?dockingid=' + dockingid + '&flowid=' + flowid + '&create=0&stats=create';
window.open(handleJumpUrl(url));
}
});
});
}
});
});
}
});
}
function getUnhandledProjectCount() {
$.ajax({
url: CONF_DOCKINGSYSTEM_SERVERURL + '/xiangj/resource/getUnhandledItemCount',
data: {roleid: roleIds},
success: function (result) {
if (result) {
$('.w-badge').text(result).css('display', 'inline-block');
} else {
$('.w-badge').css('display', 'none');
}
},
error: function (error) {
}
})
}
function uuid() {
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
// postDataToServe
function postDataToServe(_url, _data, _fn, _async) {
if (!_url) {
layer.msg('请选择正确url!');
return false;
}
$.ajax({
type: "POST",
async: _async ? true : false,
dataType: 'json',
contentType: "application/json",
url: `${CONF_NEWGHSC_SERVERURL}${_url}`,
data: JSON.stringify(_data),
// headers:{"token":$.cookie('ftoken')},
success: function (res) {
if (res.code == 200 && res.data) {
if (typeof _fn === 'function') {
_fn.call(this, res.data, res);
}
}
},
error: function () {
// FIXME:页面报错:'layer.msg is not a fonction' 暂时注掉
// layer.msg('请求错误,请联系管理员!');
}
});
}
// ly 新加方法,变量列表
var lyfunc = {
tabsChanges: function (val) {
parent.window.$.showLoading();
if(val == 1) {
$('#sjsqTable').addClass("select-tables");
$('#sjsqTable').find('img').attr("src","./img/menu-document-selected.png");
$('#cgscTable').removeClass("select-tables");
$('#cgscTable').find('img').attr("src","./img/menu-document-checkbox.png");
}else {
$('#cgscTable').addClass("select-tables");
$('#cgscTable').find('img').attr("src","./img/menu-document-selected.png");
$('#sjsqTable').find('img').attr("src","./img/menu-document-checkbox.png");
$('#sjsqTable').removeClass("select-tables");
};
isType = val;
isClickPage = true;
dynamicWorkingTable(resultTableData, "workingsTabDiv", 'searchtext');
}
}