designOperate_wev8.js
171 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
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
/**
* JS实现replaceAll方法
*/
String.prototype.replaceAll = function (str1,str2){
var str = this;
var result = str.replace(eval("/"+str1+"/gi"),str2);
return result;
}
/**
* 模板保存、恢复等相关操作方法封装
*/
var formOperate=(function (){
/**
* 拼接指定窗口的datajson串,适用于主表、标签页、明细表
*/
function joinDataStrBySymbol(symbol){
if(!globalData.hasCache(symbol))
return "";
var excelDiv;
//由于拼接datajson需要用到对应的sheet面板内容,故每次拼接需将sheetjson恢复在隐藏的面板中,只用于保存
if(symbol.indexOf("detail_") > -1){
excelDiv = jQuery("#excelDiv");
}else{
excelDiv = jQuery("#excelDiv_hidden");
var sheetJson = globalSheet.getCacheValue(symbol+"_sheet");
onlyResumePanel(excelDiv, sheetJson);
}
var ss = excelDiv.wijspread("spread");
var sheet = ss.getActiveSheet();
var spans = sheet.getSpans(); //获取合并单元格
var dataobj = globalData.getCacheValue(symbol);
var ecs = globalData.getCacheValue(symbol).ecs;
//给ecs添加合并单元格信息
for(var item in ecs){
var id_x = item.split(",")[0];
var id_y = item.split(",")[1];
var rowspan = 1;
var colspan = 1;
//获取合并单元格信息
for (var i = 0; i < spans.length; i++) {
if ((spans[i].row + "") == id_x && (spans[i].col + "") == id_y) {
rowspan = spans[i].rowCount;
colspan = spans[i].colCount;
break;
}
}
ecs[item].rowspan = rowspan;
ecs[item].colspan = colspan;
//若单元格未设置公式,且单元格上有formula标识,将formula标识删掉
if(ecs[item].formula && !formulaOperate.judgeCellContainFormulaFace(symbol, item)) {
delete ecs[item].formula;
}
}
//计算最大行数、列数
var maxCell = getMaxCell(sheet, ecs);
var rowcount = parseInt(maxCell.split(",")[0]);
var columncount = parseInt(maxCell.split(",")[1]);
var save2Json = "";
if(symbol === "main"){
save2Json += "\"emaintable\":{";
}else{
save2Json += "\""+symbol+"\":{";
}
//行头
save2Json +="\"rowheads\":{"
for (var i = 0; i <= rowcount; i++) {
save2Json += "\"row_"+i+"\":\""+sheet.getRowHeight(i, $.wijmo.wijspread.SheetArea.rowHeader)+"\"";
save2Json += (rowcount-i>0)?",":"";
}
save2Json +="},"
//列头
save2Json += "\"colheads\":{"
for (var i = 0; i <= columncount; i++) {
var ispercent = sheet.getValue(0,i,$.wijmo.wijspread.SheetArea.colHeader);
var cw = sheet.getColumnWidth(i, $.wijmo.wijspread.SheetArea.colHeader);
if(ispercent.indexOf("%") >0)
cw = ispercent.substring(ispercent.indexOf("(")+1,ispercent.indexOf(")"));
save2Json += "\"col_"+i+"\":\""+cw+"\"";
save2Json += (columncount-i>0)?",":"";
}
save2Json +="},"
//保存行列自定义属性
if(dataobj.rowattrs && !jQuery.isEmptyObject(dataobj.rowattrs))
save2Json += "\"rowattrs\":"+JSON.stringify(dataobj.rowattrs)+",";
if(dataobj.colattrs && !jQuery.isEmptyObject(dataobj.colattrs))
save2Json += "\"colattrs\":"+JSON.stringify(dataobj.colattrs)+",";
//浮动图片
if(sheet._floatingObjectArray){
var floatpic = JSON.stringify((sheet._floatingObjectArray).toJSON());
if(floatpic)
save2Json += "\"floatingObjectArray\":"+floatpic+",";
}
if(ss.backgroundImage()){
save2Json += "\"backgroundImage\":\""+ss.backgroundImage()+"\",";
}
//单元格
save2Json += "\"ec\":[";
var ecs2Json = "";
var edtitlerow = 0;
var edtailrow = 0;
_tagArray_main = new Array();
for(var item in ecs){
//坐标拆分
var id_x = item.split(",")[0];
var id_y = item.split(",")[1];
var ecObj = ecs[item];
var etype = ecObj.etype;
if(etype == "invoiceScan"){
var _type = "";
if(symbol == "main"){
_type = "1";
}else if((symbol.indexOf("detail_") > -1)){
_type = "2";
}
if(_type != ""){
var _flag = judgeInvoiceScanBtn(symbol,_type);
if(_flag){
if(_type == "1"){//主表
_tagArray_main.push(symbol+","+id_x+","+id_y);
}else if(_type == "2"){//明细表
_tagArray_detail.push(symbol+","+id_x+","+id_y);
}
}
}
}
if(etype === celltype.DE_TITLE)
edtitlerow = id_x;
else if(etype === celltype.DE_TAIL)
edtailrow = id_x;
etype = transformerEtype(etype);
ecs2Json += joinSingleCellStr(sheet, id_x, id_y, ecObj, etype);
ecs2Json += ",";
}
ecs2Json = ecs2Json.substring(0,ecs2Json.lastIndexOf(","));
save2Json += ecs2Json;
save2Json += "]"; //对应 ec: [
if(symbol.indexOf("detail_") > -1){
save2Json += ",";
save2Json += "\"edtitleinrow\":\""+edtitlerow+"\",";
save2Json += "\"edtailinrow\":\""+edtailrow+"\",";
save2Json += "\"edlockedcol\":\""+detailOperate.getLockedColumn()+"\",";
save2Json += "\"seniorset\":\""+(detailOperate.hasOpenSeniorSet()?1:0)+"\""; //中间不可有任何空格,用于主表保存判断
}
save2Json += "}"; //对应 emaintable:{
return save2Json;
}
//获取最多单元格
function getMaxCell(sheet, ecs){
var maxrow = 0;
var maxcol = 0;
for(var item in ecs){
var ecObj = ecs[item];
if(ecObj.etype === celltype.DE_TITLE || ecObj.etype === celltype.DE_TAIL)
continue;
var r = parseInt(item.split(",")[0]);
var c = parseInt(item.split(",")[1]);
var cur_row = r + parseInt(ecObj.rowspan) - 1;
var cur_col = c + parseInt(ecObj.colspan) - 1;
if((cur_row > maxrow || cur_col > maxcol) && (!ecObj.etype || ecObj.etype === celltype.TEXT) && !ecObj.formula){
//过滤掉空内容单元格,空内容单元格包含(边框/背景色/自定义属性)才认为是有效单元格,无效单元格直接删除
var celltext = jQuery.trim(sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).text());
if(celltext === ""){
var borderStr = parseCellBorderStr(sheet, r, c, ecObj);
var _style = sheet.getStyle(r, c, $.wijmo.wijspread.SheetArea.viewport);
if(_style == null) _style = new $.wijmo.wijspread.Style();
if(borderStr === "" && !_style.backColor && jQuery.isEmptyObject(ecObj.attrs)){
delete ecs[item];
continue;
}
}
}
if(cur_row > maxrow)
maxrow = cur_row;
if(cur_col > maxcol)
maxcol = cur_col;
}
//解决在内容列后设置空列(一列或连续多列)且宽度为%情况,此列应作为生效列处理
for(var i=0; i<3 ; i++){
var colheadvalue = sheet.getValue(0, maxcol+1,$.wijmo.wijspread.SheetArea.colHeader);
if(colheadvalue.indexOf("%") > -1)
maxcol++;
else
break;
}
return maxrow+","+maxcol;
}
/**
* 拼接多内容窗口的datajson串,只适用于多内容面板
*/
function joinMcDataStr(mcpoint){
if(!globalData.hasCache(mcpoint) || !globalSheet.hasCache(mcpoint+"_sheet"))
return "";
var dataobj = globalData.getCacheValue(mcpoint);
var sheetjson = globalSheet.getCacheValue(mcpoint+"_sheet");
//将dataobj缓存转为datajson串,需先将内容恢复到面板
var mc_ss = jQuery("#excelDiv_mc").wijspread("spread");
var mc_sheet = mc_ss.getActiveSheet();
var mc_sheetjson = JSON.parse(sheetjson);
mc_sheet.isPaintSuspended(true);
mc_ss.fromJSON(mc_sheetjson);
mc_sheet.isPaintSuspended(false);
mc_sheet = mc_ss.getActiveSheet();
var mc_datastr = "\""+mcpoint+"\":{";
mc_datastr += "\"rowcount\":\""+mc_sheet.getRowCount()+"\",";
mc_datastr += "\"colcount\":\"2\",";
mc_datastr += "\"ec\":["
var ecs = dataobj.ecs;
var ecs2Json = "";
for(var r=0; r<mc_sheet.getRowCount(); r++){
var id_x = r;
var id_y = 0;
if(ecs[id_x+","+id_y]){
var celltext = mc_sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).text();
var ecObj = ecs[id_x+","+id_y];
if(jQuery.trim(celltext) != "" || celltext.indexOf(" ") > -1 || !jQuery.isEmptyObject(ecObj.attrs)){
var etype = ecObj.etype;
etype = transformerEtype(etype);
ecs2Json += joinSingleCellStr(mc_sheet, id_x, id_y, ecObj, etype);
ecs2Json += ",";
}
}
id_y = 1; //拼接换行信息
if(ecs[id_x+","+id_y] && ecs[id_x+","+id_y].etype === celltype.BR){
var ecObj_br = ecs[id_x+","+id_y];
ecs2Json += "{";
ecs2Json += "\"id\":\""+id_x+","+id_y+"\",";
ecs2Json += "\"etype\":\""+transformerEtype(ecObj_br.etype)+"\",";
ecs2Json += "\"brsign\":\""+ecObj_br.brsign+"\"";
ecs2Json += "},";
}
}
ecs2Json = ecs2Json.substring(0,ecs2Json.lastIndexOf(","));
mc_datastr += ecs2Json;
mc_datastr += "]";
mc_datastr += "}";
return mc_datastr;
}
/**
* 拼接单个单元格串
*/
function joinSingleCellStr(sheet, id_x, id_y, ecObj, etype){
var ecs2Json = "";
ecs2Json += "{";
ecs2Json += "\"id\":\""+id_x+","+id_y+"\",";
if(ecObj.colspan)
ecs2Json += "\"colspan\":\""+ecObj.colspan+"\",";
if(ecObj.rowspan)
ecs2Json += "\"rowspan\":\""+ecObj.rowspan+"\",";
ecs2Json += "\"etype\":\""+(!!etype ? etype : 0)+"\",";
//etype 已转换成数字,不同单元格类型保存不同属性
if(etype === "2" || etype === "3" || etype === "4" || etype === "5" || etype === "6"
|| etype === "11" || etype === "18" || etype === "19") {
ecs2Json += "\"field\":\""+ecObj.efieldid+"\","; //字段ID,流程节点ID(不可变更顺序紧跟etype后面,流程导入替换用到)
if(!!ecObj.efieldtype)
ecs2Json += "\"fieldtype\":\""+ecObj.efieldtype+"\","; //字段ID,流程节点ID
if(!!ecObj.uuid)
ecs2Json += "\"uuid\":\""+ecObj.uuid+"\","; //唯一uuid,和单元格进行绑定,用于签字意见分离
}else if(etype === "7"){
ecs2Json += "\"detail\":\""+ecObj.edetail+"\","; //明细表
}else if(etype === "12"){ //标签页信息保存
if(ecObj.tab)
ecs2Json += "\"tab\":"+JSON.stringify(ecObj.tab)+",";
}else if(etype === "13"){ //多内容字段
ecs2Json += "\"mcpoint\":\""+ecObj.mcpoint+"\",";
}else if(etype === "15" || etype === "16" || etype === "17" || etype === "23"){ //门户元素、Iframe区域、扫描码
if(ecObj.jsonparam)
ecs2Json += "\"jsonparam\":"+JSON.stringify(ecObj.jsonparam)+",";
}
//自定义属性
if(ecObj.attrs && !jQuery.isEmptyObject(ecObj.attrs))
ecs2Json += "\"attrs\":"+JSON.stringify(ecObj.attrs)+",";
//单元格格式化
if(etype === "3" && ecObj.enumbric){
ecs2Json += "\"format\":{";
ecs2Json += (ecObj.enumbric.n_set)?"\"numberType\":\""+ecObj.enumbric.n_set+"\",":"\"numberType\":\"-1\",";
ecs2Json += (ecObj.enumbric.n_decimals)?"\"decimals\":\""+ecObj.enumbric.n_decimals+"\",":"\"decimals\":\"-1\",";
ecs2Json += (ecObj.enumbric.n_us)?"\"thousands\":\""+ecObj.enumbric.n_us+"\",":"\"thousands\":\"-1\",";
ecs2Json += (ecObj.enumbric.n_target)?"\"formatPattern\":\""+ecObj.enumbric.n_target+"\"":"\"formatPattern\":\"-1\"";
ecs2Json += "},";
}
//财务格式
if(ecObj.financial)
ecs2Json += "\"financial\":\""+ecObj.financial+"\",";
//公式
if(ecObj.formula)
ecs2Json += "\"formula\":\""+ecObj.formula+"\",";
//************样式保存(字体、缩进、背景色) begin**********
//原有保存采用从datajson读缓存方式,新方式采用从当前sheet读可视化样式,保证两JSON样式同步
var userNewWay = true;
if(userNewWay){
var _style = sheet.getStyle(id_x, id_y, $.wijmo.wijspread.SheetArea.viewport);
if(!!_style){
ecs2Json += "\"font\":{"+parseCellStyleStr(_style)+"},";
if(_style.textIndent){
var _textIndent = _style.textIndent;
var isAlignLeft = (!_style.hAlign || _style.hAlign === $.wijmo.wijspread.HorizontalAlign.left);
if(isAlignLeft && baseOperate.judgeCellDefaultRetractFace(ecObj))
_textIndent = _textIndent-2.5;
if(_textIndent > 0)
ecs2Json += "\"etxtindent\":\""+_textIndent+"\",";
}
if(_style.backColor)
ecs2Json += "\"backgroundColor\":\""+_style.backColor+"\",";
}
}
//************样式保存(字体、缩进、背景色) end**********
//************边框保存 begin*************
var borderStr = parseCellBorderStr(sheet, id_x, id_y, ecObj);
if(borderStr !== "")
ecs2Json += "\"eborder\":["+borderStr+"],";
//************边框保存 end*************
var celltext = sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).text();
celltext = replaceCellText(celltext);
ecs2Json += "\"evalue\":\""+celltext+"\"";
ecs2Json += "}"; //对应 ec 中第一个{
return ecs2Json;
}
/**
* 解析单元格字体、居中等样式
*/
function parseCellStyleStr(_style){
var stylestr = "";
if(!!_style.font){
var cellfont = _style.font;
if(cellfont.indexOf("bold") > -1)
stylestr += "\"bold\":\"true\",";
if(cellfont.indexOf("italic") > -1)
stylestr += "\"italic\":\"true\",";
if(cellfont.indexOf("pt") > -1)
stylestr += "\"font-size\":\""+cellfont.match(/\d+pt/g)+"\",";
var cellfontfamily = baseOperate.getCellFontFamilyFace(cellfont);
if(cellfontfamily !== "")
stylestr += "\"font-family\":\""+cellfontfamily+"\",";
}
if(!!_style.foreColor)
stylestr += "\"color\":\""+_style.foreColor+"\",";
if(!!_style.textDecoration){
if(_style.textDecoration === 1)
stylestr += "\"underline\":\"true\",";
else if(_style.textDecoration === 2)
stylestr += "\"deleteline\":\"true\",";
else if(_style.textDecoration === 3){
stylestr += "\"underline\":\"true\",";
stylestr += "\"deleteline\":\"true\",";
}
}
if(_style.hAlign){
if(_style.hAlign === $.wijmo.wijspread.HorizontalAlign.left)
stylestr += "\"text-align\":\"left\",";
else if(_style.hAlign === $.wijmo.wijspread.HorizontalAlign.center)
stylestr += "\"text-align\":\"center\",";
else if(_style.hAlign === $.wijmo.wijspread.HorizontalAlign.right)
stylestr += "\"text-align\":\"right\",";
}
if(_style.vAlign){
if(_style.vAlign === $.wijmo.wijspread.VerticalAlign.top)
stylestr += "\"valign\":\"top\",";
else if(_style.vAlign === $.wijmo.wijspread.VerticalAlign.center)
stylestr += "\"valign\":\"middle\",";
else if(_style.vAlign === $.wijmo.wijspread.VerticalAlign.bottom)
stylestr += "\"valign\":\"bottom\",";
}
if(stylestr.length >0 && stylestr.substring(stylestr.length-1) === ",")
stylestr = stylestr.substring(0, stylestr.length-1);
return stylestr;
}
/**
* 解析单元格边框样式,生成串
*/
function parseCellBorderStr(sheet, id_x, id_y, ecObj){
var borderStr = "";
var topborder = sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).borderTop();
if(topborder && topborder.style != 0)
borderStr += "{\"kind\":\"top\",\"style\":\""+topborder.style+"\",\"color\":\""+topborder.color+"\"},";
var leftborder = sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).borderLeft();
if(leftborder && leftborder.style != 0)
borderStr += "{\"kind\":\"left\",\"style\":\""+leftborder.style+"\",\"color\":\""+leftborder.color+"\"},";
var rightborder;
if(ecObj.colspan > 1)
rightborder = sheet.getCell(id_x,(parseInt(id_y)+ecObj.colspan-1)+"",$.wijmo.wijspread.SheetArea.viewport).borderRight();
else
rightborder = sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).borderRight();
if(rightborder && rightborder.style != 0)
borderStr += "{\"kind\":\"right\",\"style\":\""+rightborder.style+"\",\"color\":\""+rightborder.color+"\"},";
var bottomborder;
if(ecObj.rowspan > 1)
bottomborder = sheet.getCell((parseInt(id_x)+ecObj.rowspan-1)+"",id_y,$.wijmo.wijspread.SheetArea.viewport).borderBottom();
else
bottomborder = sheet.getCell(id_x,id_y,$.wijmo.wijspread.SheetArea.viewport).borderBottom();
if(bottomborder && bottomborder.style != 0)
borderStr += "{\"kind\":\"bottom\",\"style\":\""+bottomborder.style+"\",\"color\":\""+bottomborder.color+"\"},";
if(borderStr.length > 0 && borderStr.substring(borderStr.length-1) === ",")
borderStr = borderStr.substring(0, borderStr.length-1);
return borderStr;
}
/**
* 判断是否发票扫描按钮,但是后台没有配置字段对应
*/
function judgeInvoiceScanBtn(symbol,type,array){
var flag = false;
jQuery.ajax({
type: "post",
url: "/fna/invoice/invoiceWf/exceldesign/invoiceSave.jsp",
data: {symbol:symbol, type:type,workflowid:wfinfo.wfid},
dataType: "json",
async:false,
success: function(_json){
flag = _json.flag;
}
});
return flag;
}
/**
* 模板窗口保存
*/
function saveLayoutWindow(flag){
if(flag != "save2Confirm"){ //模板校验明细是否全为高级模式
var existSeniorSetDetail = false;
var notOpenDetailIndex = "";
for(var symbol in globalData.getCache()){
if(symbol.indexOf("detail_") > -1){
var detail_datastr = globalData.getCacheValue(symbol);
if(detail_datastr.indexOf("\"seniorset\":\"1\"") > -1){
existSeniorSetDetail = true;
}else{
if(notOpenDetailIndex === "")
notOpenDetailIndex = symbol.replace("detail_", "");
}
}
}
if(existSeniorSetDetail && notOpenDetailIndex !== ""){
window.top.Dialog.alert("<font style=\"color:red;font-size:14px\">模板不合法,请调整模板!</font></br>原因:明细表"+notOpenDetailIndex+"未启用高级定制");
return;
}
}
if(flag === "saveLayout"){
if(!check_form(LayoutForm,"layoutname"))
return;
//模板名称不可重复
var layoutname = "$["+jQuery("#layoutname").val()+"]$";
if(jQuery("#otherslayoutname").val().indexOf(layoutname) > -1){
window.top.Dialog.alert("当前模板名称已被使用,请修改模板名称再保存!");
return;
}
if(storage.getItem(storageKey))
storage.removeItem(storageKey);
__displayloaddingblock("show");
}
//=============== 拼接控件sheetjson begin ==========
var cur_symbol = globalData.getCacheValue("symbol");
if(cur_symbol === "main"){
saveCurrentSheet("main");
}else if(cur_symbol.indexOf("tab_") > -1){
tabOperate.saveTabInfoFace();
}
var allSheetJsonStr = "";
if(flag != "save2Confirm"){
allSheetJsonStr += "{";
for(var key in globalSheet.getCache()){
allSheetJsonStr += "\""+key+"\":";
allSheetJsonStr += globalSheet.getCacheValue(key);
allSheetJsonStr += ",";
}
allSheetJsonStr = allSheetJsonStr.substring(0,allSheetJsonStr.lastIndexOf(","));
allSheetJsonStr+="}";
$("#pluginjson").val(allSheetJsonStr);
}
//=============== 拼接控件sheetjson end ==========
//=============== 拼接数据datajson begin ==========
var save2Json = "{";
save2Json += "\"eformdesign\":{";
save2Json += "\"eattr\":{";
save2Json += "\"formname\":\""+replaceCellText(jQuery("#layoutname").val())+"\",";
save2Json += "\"wfid\":\""+jQuery("#wfid").val()+"\",";
save2Json += "\"nodeid\":\""+jQuery("#nodeid").val()+"\",";
save2Json += "\"formid\":\""+jQuery("#formid").val()+"\",";
save2Json += "\"isbill\":\""+jQuery("#isbill").val()+"\"";
save2Json += "},";
save2Json += "\"etables\": {";
for(var key in globalSheet.getCache()){
var symbol = key.replace("_sheet", "");
var dataJsonStr = "";
if(symbol === "main" || symbol.indexOf("tab_") > -1){ //拼接主表及标签页
refreshECByFormulaNew(symbol);
dataJsonStr = joinDataStrBySymbol(symbol);
}else if(symbol.indexOf("detail_") > -1){ //拼接明细
dataJsonStr = globalData.getCacheValue(symbol);
}else if(symbol.indexOf("mc_") > -1){ //拼接多字段
dataJsonStr = joinMcDataStr(symbol);
}
if(dataJsonStr != "")
save2Json += dataJsonStr+",";
}
save2Json = save2Json.substring(0, save2Json.lastIndexOf(","));
save2Json += "}"; //对应 etables:{
if (flag != "export") {//导出模板时,不导出公式数据
//如果有公式,需要拼接公式信息
if (formulaObj.getFormulas()) {
save2Json += ",\"formula\":";
save2Json += formulaOperate.saveFormulasFace();
}
}
save2Json += "}"; //对应 eformdesign:{
save2Json += "}"; //对应 json 开始的{
if(flag != "save2Confirm")
$("#datajson").val(save2Json);
//=============== 拼接数据datajson end ==========
//保存、预览
if(flag == "saveLayout"){
if(_tagArray_main.length > 0){
window.top.Dialog.confirm(_excel_reminder_8, function(){
//清除主表发票字段
for(var i = 0;i<_tagArray_main.length;i++){
var str = _tagArray_main[i];
var id_x = str.split(",")[1];
var id_y = str.split(",")[2];
var main_dataobj = globalData.getCacheValue("main");
var main_sheet = jQuery("#excelDiv").wijspread("spread").getActiveSheet();
baseOperate.cleanCellTextFace(main_sheet, main_dataobj.ecs[id_x+","+id_y], id_x, id_y);
}
//重新获取datajson,pluginjson
repeatGetJson(flag);
if(jQuery("input#nodeEditFormLayout").val() == "1"){
window.top.Dialog.confirm(_excel_reminder_7, function(){
saveLayout();
}, function(){
__displayloaddingblock("hide");
});
}else{
saveLayout();
}
}, function(){
__displayloaddingblock("hide");
});
}else{
if(jQuery("input#nodeEditFormLayout").val() == "1"){
window.top.Dialog.confirm(_excel_reminder_7, function(){
saveLayout();
}, function(){
__displayloaddingblock("hide");
});
}else{
saveLayout();
}
}
}else if(flag == "preViewLayout"){
preViewLayout();
}else if(flag === "export"){
var exportFile = "{\"dataobj\":"+save2Json+",\"sheetobj\":"+allSheetJsonStr+"}";
return exportFile;
}else if(flag==="save2Confirm"){
return save2Json;
}
}
function repeatGetJson(flag){
//=============== 拼接控件sheetjson begin ==========
var cur_symbol = globalData.getCacheValue("symbol");
if(cur_symbol === "main"){
saveCurrentSheet("main");
}else if(cur_symbol.indexOf("tab_") > -1){
tabOperate.saveTabInfoFace();
}
var allSheetJsonStr = "";
if(flag != "save2Confirm"){
allSheetJsonStr += "{";
for(var key in globalSheet.getCache()){
allSheetJsonStr += "\""+key+"\":";
allSheetJsonStr += globalSheet.getCacheValue(key);
allSheetJsonStr += ",";
}
allSheetJsonStr = allSheetJsonStr.substring(0,allSheetJsonStr.lastIndexOf(","));
allSheetJsonStr+="}";
$("#pluginjson").val(allSheetJsonStr);
}
//=============== 拼接控件sheetjson end ==========
//=============== 拼接数据datajson begin ==========
var save2Json = "{";
save2Json += "\"eformdesign\":{";
save2Json += "\"eattr\":{";
save2Json += "\"formname\":\""+replaceCellText(jQuery("#layoutname").val())+"\",";
save2Json += "\"wfid\":\""+jQuery("#wfid").val()+"\",";
save2Json += "\"nodeid\":\""+jQuery("#nodeid").val()+"\",";
save2Json += "\"formid\":\""+jQuery("#formid").val()+"\",";
save2Json += "\"isbill\":\""+jQuery("#isbill").val()+"\"";
save2Json += "},";
save2Json += "\"etables\": {";
for(var key in globalSheet.getCache()){
var symbol = key.replace("_sheet", "");
var dataJsonStr = "";
if(symbol === "main" || symbol.indexOf("tab_") > -1){ //拼接主表及标签页
dataJsonStr = joinDataStrBySymbol(symbol);
}else if(symbol.indexOf("detail_") > -1){ //拼接明细
dataJsonStr = globalData.getCacheValue(symbol);
}else if(symbol.indexOf("mc_") > -1){ //拼接多字段
dataJsonStr = joinMcDataStr(symbol);
}
if(dataJsonStr != "")
save2Json += dataJsonStr+",";
}
save2Json = save2Json.substring(0, save2Json.lastIndexOf(","));
save2Json += "}"; //对应 etables:{
//如果有公式,需要拼接公式信息
if(formulaObj.getFormulas()){
save2Json += ",\"formula\":";
save2Json += formulaOperate.saveFormulasFace();
}
save2Json += "}"; //对应 eformdesign:{
save2Json += "}"; //对应 json 开始的{
if(flag != "save2Confirm")
$("#datajson").val(save2Json);
//=============== 拼接数据datajson end ==========
}
/**
* 明细窗口保存
*/
function saveDetailWindow(d_identy, flag){
clearECValueByFormulaNew("detail_"+d_identy);
var detail2Json = joinDataStrBySymbol("detail_"+d_identy);
if(flag === "save2Confirm")
return detail2Json;
else{
var verifyresult = detailOperate.verifyDetailTemplateFace();
if(verifyresult != "pass"){
window.top.Dialog.alert("<font style=\"color:red;font-size:14px\">模板不合法,请调整模板!</font></br>原因:"+verifyresult);
return;
}
if(!detailOperate.verifyLockedCfgFace()) //锁定列合规校验
return;
var saveDetailFn = function(){
//存放到主表缓存中
if(!!detail2Json){
parentWin_Main.globalData.addCache("detail_"+d_identy, detail2Json); //保存自定义属性 json
var ss = jQuery("#excelDiv").wijspread("spread");
var detail_sheetJson = JSON.stringify(ss.toJSON());
parentWin_Main.globalSheet.addCache("detail_"+d_identy+"_sheet", detail_sheetJson); //保存组件生成的 json
}
//给主界面的明细权限赋值
var detailAttr=getGroupAttr();
$("#detailgroupattr"+(parseInt(d_identy)-1),parentWin_Main.document).val(detailAttr);
detailFormulaTempAry.length = 0;
var _dialog = parent.getDialog(window);
_dialog.close();
}
if(_tagArray_detail.length > 0){
////
window.top.Dialog.confirm(_excel_reminder_8, function(){
var sheet = getCurrentSheet();
var dataobj = getCurrentDataObj();
for(var i = 0;i<_tagArray_detail.length;i++){
var str = _tagArray_detail[i];
var id_x = str.split(",")[1];
var id_y = str.split(",")[2];
baseOperate.cleanCellTextFace(sheet, dataobj.ecs[id_x+","+id_y], id_x, id_y);
}
//重新获取json
detail2Json = joinDataStrBySymbol("detail_"+d_identy);
saveDetailFn();
}, function(){
return;
});
}else{
saveDetailFn();
}
}
}
/**
* 保存当前编辑主表/标签页Sheet(dataobj在globaldata中为全局对象不需处理;sheetjson需重新放入globalsheet)
*/
function saveCurrentSheet(cur_symbol){
var ss = jQuery("#excelDiv").wijspread("spread");
var cur_sheetJson = clearECValueByFormulaNew(cur_symbol, ss);
globalSheet.addCache(cur_symbol+"_sheet", cur_sheetJson);
}
/**
* 加载模板时先序列化缓存
*/
function resumeLayoutCache(sheetJson, dataJson){
if(!sheetJson || !dataJson)
return false;
sheetJson = sheetJson.replace(new RegExp("#title_br_replacestr#","gm")," ");
dataJson = dataJson.replace(new RegExp("#title_br_replacestr#","gm")," ");
sheetJson = JSON.parse(sheetJson); //为了循环转成json
for(var skey in sheetJson){ //转成字符串加入globalSheet缓存
globalSheet.addCache(skey, JSON.stringify(sheetJson[skey]));
}
dataJson = JSON.parse(dataJson);
for(var dkey in dataJson.eformdesign.etables){ //转成字符串加入globalData缓存
if(dkey === "emaintable"){
globalData.addCache("main", JSON.stringify(dataJson.eformdesign.etables[dkey]));
}else if(dkey.indexOf("tab_") > -1 || dkey.indexOf("mc_") > -1){
globalData.addCache(dkey, JSON.stringify(dataJson.eformdesign.etables[dkey]));
}else if(dkey.indexOf("detail_") > -1){
globalData.addCache(dkey, "\""+dkey+"\":"+JSON.stringify(dataJson.eformdesign.etables[dkey]));
}
}
//恢复老版公式
if(dataJson.eformdesign.formula)
formulaOperate.resumeFormulasFace(dataJson.eformdesign.formula);
//恢复新版公式
var datajsonFormula = getDataJsonFormula();
if (!!datajsonFormula) {
datajsonFormula = JSON.parse(datajsonFormula);
formulaOperate.resumeFormulasFace(datajsonFormula)
}
return true;
}
/**
* 序列号datajson
*/
function serialDataJson(symbol){
var dataJson;
if(symbol === "main" || symbol.indexOf("tab_") > -1 || symbol.indexOf("mc_") > -1){
dataJson = globalData.getCacheValue(symbol);
dataJson = JSON.parse(dataJson);
}else if(symbol.indexOf("detail_") > -1){
var detail_datajson = JSON.parse("{"+parentWin_Main.globalData.getCacheValue(symbol)+"}");
dataJson = detail_datajson[symbol];
//明细高级定制,兼容历史模板
if(jQuery.isEmptyObject(dataJson.seniorset) || dataJson.seniorset === "0"){
jQuery("#openSeniorSet").attr("checked", false).attr("disabled", false).next().removeClass("jNiceCheckbox_disabled").removeClass("jNiceChecked_disabled").addClass("jNiceCheckbox");
jQuery(".belSeniorSet").hide();
}
//明细锁定列
var initLockedCol = -1;
if((wfinfo.layouttype === "2" || (wfinfo.layouttype === "0" && jQuery("[name=dtlallowscroll]").attr("checked"))) && dataJson.edlockedcol && parseInt(dataJson.edlockedcol) > -1)
initLockedCol = parseInt(dataJson.edlockedcol);
window.setTimeout(function(){
detailOperate.setLockedColumn(initLockedCol);
}, 1000);
}
initDataobj(symbol); //初始化缓存
var dataobj = globalData.getCacheValue(symbol);
//恢复行列自定义属性
if(!jQuery.isEmptyObject(dataJson.rowattrs))
dataobj.rowattrs = dataJson.rowattrs;
if(!jQuery.isEmptyObject(dataJson.colattrs))
dataobj.colattrs = dataJson.colattrs;
//恢复单元格属性
var ecs = dataJson.ec;
for(var i=0; i<ecs.length; i++){
resumeCell(symbol, ecs[i]);
}
}
//恢复一个单元格
function resumeCell(symbol, cell_obj){
var etype = reverseTransformerEtype(cell_obj.etype);
if(etype === celltype.DE_TITLE || etype === celltype.DE_TAIL
|| etype === celltype.DE_BTN || etype === celltype.DE_CHECKALL
|| etype === celltype.DE_CHECKSINGLE || etype === celltype.DE_SERIALNUM || etype === celltype.DE_SERIALTITLE){
$(".excelHeadContent").find("[name='"+etype+"']").addClass("shortBtn_disabled").removeClass("shortBtn");
}else if(etype === celltype.FNAME || etype === celltype.FCONTENT || etype === celltype.NNAME
|| etype === celltype.NADVICE || etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT){
setFieldAttrHave(cell_obj.field,etype,1);
}else if(etype === celltype.DETAIL){
haveDetailMap[cell_obj.detail]="on";
}else if(etype === celltype.TAB && symbol === "main"){
var tab_obj = cell_obj.tab;
for(var key in tab_obj){
if(key.indexOf("order_") == -1)
continue;
var tab_id = tab_obj[key].substring(0, tab_obj[key].indexOf(","));
var curTabIndex = parseInt(tab_id.replace("tab_",""));
if(curTabIndex > existMaxTabIndex)
existMaxTabIndex = curTabIndex;
}
}else if(etype === celltype.MC){
var curMcIndex = parseInt(cell_obj.mcpoint.replace("mc_", ""));
if(curMcIndex > existMaxMcIndex)
existMaxMcIndex = curMcIndex;
}
var bxid = cell_obj.id;
var enumbric;
if(!jQuery.isEmptyObject(cell_obj.format)){
enumbric = {};
enumbric.n_set = cell_obj.format.numberType;
enumbric.n_decimals = cell_obj.format.decimals;
enumbric.n_us = cell_obj.format.thousands;
enumbric.n_target = cell_obj.format.formatPattern;
}
var cell = {};
cell.etype = etype;
cell.id = bxid;
cell.enumbric = enumbric;
if(!jQuery.isEmptyObject(cell_obj.field))
cell.efieldid = cell_obj.field;
if(!jQuery.isEmptyObject(cell_obj.uuid))
cell.uuid = cell_obj.uuid;
if(!jQuery.isEmptyObject(cell_obj.fieldtype))
cell.efieldtype = cell_obj.fieldtype;
if(!jQuery.isEmptyObject(cell_obj.detail) && etype === celltype.DETAIL)
cell.edetail = cell_obj.detail;
if(!jQuery.isEmptyObject(cell_obj.financial))
cell.financial = cell_obj.financial;
if(!jQuery.isEmptyObject(cell_obj.formula))
cell.formula = cell_obj.formula;
if(!jQuery.isEmptyObject(cell_obj.tab) && etype === celltype.TAB)
cell.tab = cell_obj.tab;
if(!jQuery.isEmptyObject(cell_obj.mcpoint) && etype === celltype.MC)
cell.mcpoint = cell_obj.mcpoint;
if(!jQuery.isEmptyObject(cell_obj.brsign) && etype === celltype.BR)
cell.brsign = cell_obj.brsign;
if(!jQuery.isEmptyObject(cell_obj.attrs))
cell.attrs = cell_obj.attrs;
if(!jQuery.isEmptyObject(cell_obj.jsonparam))
cell.jsonparam = cell_obj.jsonparam;
setCellProperties(bxid, etype, cell, symbol);
}
/**
* 恢复指定窗口,包括画布恢复sheetjson、以及字段名称图片处理等
*/
function resumeSheetData(symbol, excelDiv){
var sheetJson;
if(isDetail === "on")
sheetJson = parentWin_Main.globalSheet.getCacheValue(symbol+"_sheet");
else
sheetJson = globalSheet.getCacheValue(symbol+"_sheet");
onlyResumePanel(excelDiv, sheetJson);
var ss = excelDiv.wijspread("spread");
var sheet = ss.getActiveSheet();
var signInputJson = {};
//主表
if(symbol == 'main' || symbol.indexOf('mc_') != -1){
try {
var _signInputJson = getSingInputJson()
if(typeof(_signInputJson) === 'string' && _signInputJson.length > 0){
signInputJson = JSON.parse(_signInputJson);
}
} catch (e) {}
}
sheet.isPaintSuspended(true);
var ecs = globalData.getCacheValue(symbol).ecs;
//刷新公式数据,删除含有非字段单元格的老板公式,
refreshFormulas(symbol);
//打开面板时需要根据公式信息重新构造ec
refreshECByFormulaNew(symbol);
for(var cellid in ecs){
var r = cellid.split(",")[0];
var c = cellid.split(",")[1];
var cellobj = ecs[cellid];
var etype = cellobj.etype;
var efieldid = ecs[cellid].efieldid;
var uuid = ecs[cellid].uuid;
var wfid = wfinfo.wfid;
var nodeid = wfinfo.nodeid;
var modeid = wfinfo.modeid;
var belongGroup = efieldid == "-1" || efieldid == "-2" || efieldid == "-3";
//更新节点名称
if(etype === celltype.NNAME || etype === celltype.NADVICE){
var value = '';
var key = wfid + ',' + nodeid + ',' + modeid + ',' + efieldid + ',' + uuid;
if(jQuery("input#wfnode"+efieldid).length > 0){
value = jQuery("input#wfnode"+efieldid).val();
} else if(efieldid == 999999999 && etype === celltype.NADVICE){
value = signInputJson['defaultName'];
}
if(belongGroup && etype === celltype.NADVICE){
value = jQuery("input#wfnode"+efieldid).attr('nodenameSign');
}
if(etype === celltype.NADVICE){
var appendValue = signInputJson[key];
if(appendValue == undefined){
appendValue = signInputJson['defaultValue'];
}
if(appendValue !== undefined && appendValue.length > 0){
value += "("+appendValue+")";
}
}
if(value !== undefined && value.length > 0){
sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value(value);
}
}
//刷新字段单元格内容及图片
refreshFieldCellTextImg(sheet, cellobj);
}
sheet.isPaintSuspended(false);
baseOperate.bindSpreadEventFace(ss);
baseOperate.spreadCellClickFace();
}
//刷新公式数据,删除含有非字段单元格的老板公式,
function refreshFormulas(symbol) {
var _formulaObj = isDetail==="on" ? parentWin_Main.formulaObj : formulaObj;
var paramtxt = "";
var sheet = getCurrentSheet();
var ecs = globalData.getCacheValue(symbol).ecs;
var formulas = _formulaObj.getFormulas();
if (formulas) {
for (var __key in formulas) {
if (__key && __key.split(".")[0] && __key.split(".")[0].toLowerCase() == symbol) {
var formulaStr = formulas[__key].trim();
if (formulaStr) {
//MAIN.FORMULAB7: "=MAX(detail_2.C4,detail_2.D4,detail_2.E4)"
if (__key && __key.toUpperCase().indexOf(".FORMULA") > -1) {
var cellletter = __key.substring(__key.toUpperCase().indexOf(".FORMULA") + 8);
var cellIndex = formulaOperate.getCellIndexByLetterFace(sheet, cellletter.toUpperCase());
if (!!!ecs[cellIndex] || ecs[cellIndex].etype != celltype.FCONTENT) {
_formulaObj.delOneFormula(__key);
}
}
}
}
}
}
}
/**
* 根据公式信息,重新刷新ecs数据,将设置了公式但未设置ec的数据,构建出新的ec
* 此情况发生情况举例:在主表给明细表的非字段单元格赋值,在未打开明细表之前没有相应ec,但是有对应的formula
* 打开面板时重新构造ec,保存html模板时也需要根据公式信息重新构造ec
*/
function refreshECByFormulaNew(symbol) {
var sheet = getCurrentSheet();
var ecs = globalData.getCacheValue(symbol).ecs;
//MAIN.FORMULAB7#new#:"[main.6309]=Lower('ABDcEfghi')###[主表.z4]=Lower('ABDcEfghi')###1#6306##2#6307#_#值改变时 (触发字段: z1)##获取输入焦点时 (触发字段: z2)###公式名"
var _formulaObj = isDetail==="on" ? parentWin_Main.formulaObj : formulaObj;
var paramtxt = "";
var formulas = _formulaObj.getFormulas();
var tempSymbol = symbol;
if (formulas) {
for(var __key in formulas){
var formulaStr = formulas[__key].trim();
if (formulaStr) {
var formulaArr = formulaStr.split("###");
if (formulaArr && formulaArr.length >= 3) {
var singleFormula = formulaArr[0].split("#rn#");
for (var i = 0; i < singleFormula.length; i++) {
var temp = singleFormula[i];
var leftValue = formulaOperate.getLeftValueFace(temp).leftValue;
if (leftValue) {
var reg = /(main|tab_\d+|detail_\d+)![a-z]+\d+/g;
leftValue = leftValue.toLowerCase();
leftValue = leftValue.match(reg);
if (leftValue && leftValue.length > 0) {
if (tempSymbol == leftValue[0].split("!")[0]) {
var cellIndex = formulaOperate.getCellIndexByLetterFace(sheet, leftValue[0].split("!")[1].toUpperCase());
if (cellIndex && !!!ecs[cellIndex]) {
var cellobj = {};
cellobj.id = cellIndex;
cellobj.etype = celltype.TEXT;
cellobj.formula = 'y';
cellobj.colspan = 1;
cellobj.rowspan = 1;
cellobj.evalue = '';
ecs[cellIndex] = cellobj;
}
}
}
}
}
}
}
}
}
}
/**
* 当单元格为非字段单元格时,且该单元格设置了公式,清除单元格上的 (fx)标识
* 若单元格未设置公式,且单元格上游formula标识,将formula标识删掉
*/
function clearECValueByFormulaNew(symbol, ss){
if (typeof ss === "undefined") {
ss = jQuery("#excelDiv").wijspread("spread");
}
var sheet = ss.getActiveSheet();
var ecs = globalData.getCacheValue(symbol).ecs;
//给ecs添加合并单元格信息
for(var item in ecs){
var r = item.split(",")[0];
var c = item.split(",")[1];
if(!formulaOperate.judgeCellContainFormulaFace(globalData.getCacheValue("symbol"), item) && ecs[item].formula == 'y') {
formulaOperate.controlFormulaSignFace(sheet, r, c, "remove");
delete ecs[item].formula;
}
if ((typeof ecs[item].etype === "undefined" || ecs[item].etype == celltype.TEXT) && ecs[item].formula == 'y') {
formulaOperate.controlFormulaSignFace(sheet, r, c, "remove");
}
}
var cur_sheetJson = JSON.stringify(ss.toJSON());
return cur_sheetJson;
}
/**
* 刷新字段单元格内容及图片
*/
function refreshFieldCellTextImg(sheet, cellobj){
var etype = cellobj.etype;
if(etype === celltype.FNAME || etype === celltype.FCONTENT
|| etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT){
var efieldid = cellobj.efieldid;
var cellid = cellobj.id;
var r = cellid.split(",")[0];
var c = cellid.split(",")[1];
if(judgeFieldExist(efieldid)){
sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value(getFieldName(efieldid));
if(etype === celltype.FCONTENT){
if(formulaOperate.judgeCellContainFormulaFace(globalData.getCacheValue("symbol"), cellid))
sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value(sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value()+" (fx)");
var fieldattr = parseInt(getFieldAttr(efieldid));
if(wfinfo.layouttype === "1") //打印模式图片变灰
fieldattr = 1;
//根据字段属性获取对应图片
var bgimage = getCellFieldImage(cellobj, fieldattr);
sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).backgroundImage(bgimage);
}else if(etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT){
sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value(sheet.getCell(r,c,$.wijmo.wijspread.SheetArea.viewport).value()+"(合计)");
}
}else{ //不存在的字段清除内容及属性,用于formid不同时模板导入
baseOperate.cleanCellTextFace(sheet, cellobj, r, c);
}
} else if (etype === celltype.TEXT || typeof etype == "undefined") {
var cellid = cellobj.id;
if (cellid && cellid.split(",") && cellid.split(",").length == 2) {
var r = cellid.split(",")[0];
var c = cellid.split(",")[1];
if (formulaOperate.judgeCellContainFormulaFace(globalData.getCacheValue("symbol"), cellid)) {
formulaOperate.controlFormulaSignFace(sheet, r, c, "add");
} else {
formulaOperate.controlFormulaSignFace(sheet, r, c, "remove");
}
}
}
}
/**
* 根据sheetjson只恢复面板
*/
function onlyResumePanel(excelDiv, sheetJson){
var ss = excelDiv.wijspread("spread");
var sheet = ss.getActiveSheet();
//先清除已有面板的背景图
baseOperate.clearBgImgFace(excelDiv);
sheet.isPaintSuspended(true);
sheetJson = JSON.parse(sheetJson);
ss.fromJSON(sheetJson);
ss.tabStripVisible(false);
sheet.isPaintSuspended(false);
}
/**
* 初始化窗口的缓存,删除字符串缓存,初始化JSON缓存
*/
function initDataobj(symbol){
if(globalData.hasCache(symbol))
globalData.removeCache(symbol);
var init_dataobj = {};
init_dataobj.ecs = {};
globalData.addCache(symbol, init_dataobj);
}
function replaceCellText(s){
s = s.replace(new RegExp("\\\\","gm"),"\\\\");
s = s.replace(new RegExp("\"","gm"),"\\\"");
//s = s.replace(new RegExp("/","gm"),"\\/");
//s = s.replace(new RegExp("'","gm"),"\\\'");
s = s.replace(new RegExp("\n","gm"),"\\n");
s = s.replace(new RegExp("\r","gm"),"\\r");
s = s.replace(new RegExp("\t","gm"),"\\t");
s = s.replace(new RegExp("\v","gm"),"\\v");
s = s.replace(new RegExp("\f","gm"),"\\f");
return s;
}
function importTemplate(allJsonObj){
if(globalSheet)
globalSheet.removeAllCache();
if(globalData)
globalData.removeAllCache();
jQuery(".s_module").removeClass("current");
jQuery(".s_format").addClass("current");
jQuery(".excelBody").show();
jQuery(".excelHeadBG").show();
jQuery(".excelSet").show();
jQuery(".moduleContainer").hide();
jQuery(".excelHeadContent").children(".s_format").show();
//需先退出标签页编辑窗口
if($(".tabdiv").css("display") != "none")
tabOperate.controlTabAreaFace("hide");
var sheetJson;
var dataJson;
for(var key in allJsonObj){
if(key === "sheetobj"){
sheetJson = JSON.stringify(allJsonObj[key]);
}else if(key === "dataobj"){
dataJson = JSON.stringify(allJsonObj[key]);
}
}
if(resumeLayoutCache(sheetJson, dataJson))
formOperate.resumeWindowFace("main");
}
return {
//保存整个模板
saveLayoutWindowFace: function(flag){
return saveLayoutWindow(flag);
},
//保存明细窗口
saveDetailWindowFace: function(d_identy, flag){
return saveDetailWindow(d_identy, flag);
},
//保存当前编辑的主表/标签页Sheet
saveCurrentSheetFace: function(cur_symbol){
saveCurrentSheet(cur_symbol);
},
//恢复模板缓存
resumeLayoutCacheFace: function(){
var sheetJson = getSheetJson();
var dataJson = getDataJson();
return resumeLayoutCache(sheetJson, dataJson);
},
//恢复界面
resumeWindowFace: function(symbol){
globalData.addCache("symbol", symbol);
if(symbol === "main"){ //恢复主面板时,需同时恢复标签页及多内容
resetFieldAttrHaveMap();
for(var key in globalData.getCache()){
if(key === "main" || key.indexOf("tab_") > -1 || key.indexOf("mc_") > -1){
serialDataJson(key);
}
}
}else if(symbol.indexOf("detail_") > -1){
serialDataJson(symbol);
}
resumeSheetData(symbol, jQuery("#excelDiv"));
},
//用于主界面<--->Tab页间切换,不处理dataobj
switchWindowFace: function(symbol){
globalData.addCache("symbol", symbol);
resumeSheetData(symbol, jQuery("#excelDiv"));
},
//用于主面板-->多内容面板,只恢复面板内容及相应处理
switchEditMCFace: function(mcpoint){
resumeSheetData(mcpoint, jQuery("#excelDiv_mc"));
},
//初始化指定窗口缓存
initWindowFace: function(symbol){
globalData.addCache("symbol", symbol);
initDataobj(symbol);
},
//根据sheetjson只恢复面板内容
onlyResumePanelFace: function(excelDiv, sheetJson){
onlyResumePanel(excelDiv, sheetJson);
},
//刷新字段单元格内容及图片
refreshFieldCellTextImgFace: function(sheet, cellobj){
refreshFieldCellTextImg(sheet, cellobj);
},
//模板导入、本地缓存导入
importTemplateFace: function(allJson, type){
try{
var allJsonObj = JSON.parse(allJson);
if(type === "impTemplate"){
if(allJsonObj.dataobj.eformdesign.eattr.formid == $("#formid").val()){
importTemplate(allJsonObj);
}else{
window.top.Dialog.confirm("导入文件中表单与当前编辑模板表单不一致,请确认是否继续?", function(){
importTemplate(allJsonObj);
});
}
}else if(type === "impCache"){
importTemplate(allJsonObj);
}
}catch(e){
window.top.Dialog.alert("导入失败,请确认");
}
}
};
})();
/**
* 标签页相关操作方法封装
*/
var tabOperate = (function (){
//单元格插入标签页
function insertTabPage(){
var imgsrc = "/workflow/exceldesign/image/rightBtn/tabsmall_wev8.png";
var sheet = getCurrentSheet();
var c = sheet.getActiveColumnIndex();
var r = sheet.getActiveRowIndex();
setCellTextImage(sheet, r, c, "标签页", imgsrc);
restoreCellProperties("", r+","+c);
var _cell = {};
var _tab = {};
_cell.tab = _tab;
_tab.name = "标签页";
_tab.defshow = "0";
_tab.style = "-1";
_tab.areaheight = "1";
_tab.order_1 = getNextTabSymbol() + "," + "标签页1";
setCellProperties(r+","+c, celltype.TAB, _cell);
baseOperate.controlDiscriptionAreaFace();
baseOperate.autoExtendRowColFace(sheet, r, c);
}
function getNextTabSymbol(){
existMaxTabIndex++;
return "tab_"+existMaxTabIndex;
}
//页面初始化绑定Tab的相关事件
function bindTabEvent(){
$(".tabdiv .tab_turnleft").click(function(){
var scrollleft = $(".tabdiv .tab_head").scrollLeft() - 80;
$(".tabdiv .tab_head").scrollLeft(scrollleft);
});
$(".tabdiv .tab_turnright").click(function(){
var scrollleft = $(".tabdiv .tab_head").scrollLeft() + 80;
var diffWidth = getTotalWidth() - $(".tabdiv .tab_head").width();
if(scrollleft > diffWidth)
scrollleft = diffWidth;
$(".tabdiv .tab_head").scrollLeft(scrollleft);
});
$(".tabdiv .tab_add").click(function(){
var hasTabLength = $(".tabdiv .tab_head").find(".t_sel,.t_unsel").size()+1;
append_SingleTab(getNextTabSymbol(), "标签页"+hasTabLength, false, false);
apply_TabStyle();
});
var areaheight_input = $("#areaheightspan #areaheight");
areaheight_input.blur(function(){
if(isNaN($(this).val())){
$(this).val("300");
}else{
if($(this).val()==="" || parseInt($(this).val()) <= 0)
$(this).val("300");
}
});
$(".tabdiv #areaselect").change(function(){
var selVal = $(this).val();
if(selVal === "1"){
$("#areaheightspan").hide();
}else if(selVal === "2"){
$("#areaheightspan").show();
if(areaheight_input.val() === "")
areaheight_input.val("300");
}
});
$(".tabdiv .canceltab").click(function(){
saveTabInfo(); //保存标签页相关信息
controlTabArea("hide");
formOperate.switchWindowFace("main"); //恢复主表
});
var tabstyle_obj = $("div.tabdiv #tabstyle");
$(".tabdiv .changeskin").click(function(){
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
var url = "/workflow/exceldesign/tabStyleChoose.jsp?tabstyle="+tabstyle_obj.val();
dialog.Title = "选择标签页样式";
dialog.Width = 1000;
dialog.Height = 600;
dialog.Drag = true;
dialog.URL = url;
dialog.callbackfun = function(paramobj,datas){
if(datas.styleid){
$(".tabdiv #tabstyle").val(datas.styleid);
if(datas.divstyle)
tabStyleCache.addCache(datas.styleid, datas.divstyle);
apply_TabStyle();
}
}
dialog.show();
});
}
//双击主字段打开Tab编辑窗口
function switchEditTab(maincellid){
var dataobj_main = globalData.getCacheValue("main");
if(!dataobj_main.ecs[maincellid] || !dataobj_main.ecs[maincellid].tab)
return;
controlTabArea("show");
var tab_obj = dataobj_main.ecs[maincellid].tab;
//生成顶部Tab页,先清空重置
$(".tabdiv .t_area").children().remove();
$(".tabdiv #maincellid").val(maincellid);
if(tab_obj.name)
$(".tabdiv #tabname").val(tab_obj.name);
if(tab_obj.style){
$(".tabdiv #tabstyle").val(tab_obj.style);
add_TabStyle(tab_obj.style); //获取标签页样式
}
var defshow = 0;
var defshow_tabid = "";
if(tab_obj.defshow)
defshow = parseInt(tab_obj.defshow);
if(tab_obj.areaheight){
if(tab_obj.areaheight === "1"){
var option = $(".tabdiv #areaselect").find("option[value='1']");
$(".tabdiv #areaselect").selectbox("change", option.attr("value"), option.html());
}else{
var option = $(".tabdiv #areaselect").find("option[value='2']");
$(".tabdiv #areaselect").selectbox("change", option.attr("value"), option.html());
$(".tabdiv #areaheight").val(tab_obj.areaheight.split(",")[1]);
}
}
for(var key in tab_obj){
if(key.indexOf("order_") == -1)
continue;
var curIndex = parseInt(key.replace("order_",""))
var value = tab_obj[key];
var idx = value.indexOf(",");
var isfirst = curIndex == 1 ? true : false;
var isshow = false;
if(curIndex-1 == defshow){
defshow_tabid = value.substring(0, idx);
isshow = true;
}
append_SingleTab(value.substring(0, idx), value.substring(idx+1), isfirst, isshow);
}
setDefaultTab(defshow);
apply_TabStyle();
$(".tabdiv .tab_head").find("div#"+defshow_tabid).click(); //显示Tab页的Sheet
}
/**
* 添加单一标签项
* id标签页ID
* text标签页名称
* isfirst true是否第一个标签页,第一个不生成分隔线
* isshow true代表选中标签
*/
function append_SingleTab(t_id, t_text, isfirst, isshow){
var tab_template = jQuery(".tabdiv #tab_template").clone();
var singleTab = tab_template.find(".t_unsel");
singleTab.attr("id", t_id).attr("title", t_text+"(ID:"+t_id+")");
singleTab.find("span").text(t_text);
if(isfirst)
tab_template.find(".t_sep").remove();
if(isshow){
singleTab.add(singleTab.children()).each(function(){
$(this).attr("class", $(this).attr("class").replace("_unsel", "_sel"));
});
}
$(".tabdiv .t_area").append(tab_template.children());
bindEvent_SingleTab(singleTab);
}
//保存标签页相关信息
function saveTabInfo(){
var dataobj_main = globalData.getCacheValue("main");
var cellid = $(".tabdiv #maincellid").val();
if(!dataobj_main.ecs[cellid] || !dataobj_main.ecs[cellid].tab)
return;
//将Tab页信息写入主表的JSON中
var tabOperArea = jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel");
var tab_obj = {};
tab_obj.name = $(".tabdiv #tabname").val();
tab_obj.style = $(".tabdiv #tabstyle").val();
if($(".tabdiv #areaselect").val() === "1"){
tab_obj.areaheight = "1";
}else if($(".tabdiv #areaselect").val() === "2"){
tab_obj.areaheight = "2,"+$(".tabdiv #areaheight").val();
}
tabOperArea.each(function(index){
if($(this).find("img").size() > 0) //默认选中
tab_obj.defshow = index;
tab_obj["order_"+(index+1)] = $(this).attr("id")+","+$(this).find("span").text();
});
dataobj_main.ecs[cellid].tab = tab_obj;
//保存当前的标签页sheet
formOperate.saveCurrentSheetFace(globalData.getCacheValue("symbol"));
}
//================标签页样式应用 begin==========
var tabStyleCache = new scpCache();
function add_TabStyle(styleid){
if(tabStyleCache.hasCache(styleid))
return;
jQuery.ajax({
type: "post",
url: "/workflow/exceldesign/tabStyleOperation.jsp",
data: {method:"selectone", styleid:styleid},
dataType: "JSON",
success: function(msg){
msg = jQuery.trim(msg);
var stylejson = {};
//生成自定义标签页样式
if(msg === "none"){
if(styleid>0) styleid = -1;
var sysStyle = tabPage.sysStyleFace();
var sysDefault = tabPage.sysDefaultFace();
jQuery.extend(true, stylejson, sysDefault, sysStyle["style"+styleid]);
}else{
stylejson = JSON.parse(msg);
}
var tabStyle = tabPage.getDivStyle_ByStyleFace(stylejson);
tabStyleCache.addCache(styleid, tabStyle);
}
});
}
function apply_TabStyle(){
var cur_styleid = $(".tabdiv #tabstyle").val();
if(!tabStyleCache.hasCache(cur_styleid)){ //异步等待
window.setTimeout(function(){
apply_TabStyle();
},100);
return;
}else{
tabPage.applyDivStyleFace($(".tabdiv .tab_head"), tabStyleCache.getCacheValue(cur_styleid));
//必须等样式应用完才能算宽度
controlTabHeadCss();
}
}
//================标签页样式应用 end==========
//给LI绑定单击、双击、右键事件
function bindEvent_SingleTab(singleTab){
singleTab.bind({
click: function(){
var cur_symbol = globalData.getCacheValue("symbol");
if(singleTab.attr("id") == cur_symbol)
return;
formOperate.saveCurrentSheetFace(cur_symbol);
showTabWindow(singleTab);
},
dblclick: function(){
modifyTabName(singleTab);
}
});
singleTab.contextMenu({
menu : 'tabRightMenu',
button: 3, //3: right click
onPopup : function(el,e) {
var tabOperArea = jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel");
var curIndex = Math.floor((el.index()+1)/2);
$('#tabRightMenu').html("");
var menuJson = "{";
menuJson += "\"children\": [{";
menuJson += "\"title\" : \"重命名\",";
menuJson += "\"icon\": \"rmodifyname\",";
menuJson += "\"action\": \"modifyname\"";
menuJson += "}";
if(tabOperArea.size() > 1){
menuJson += ",{";
menuJson += "\"title\" : \"删除标签\",";
menuJson += "\"icon\": \"rdeletetab\",";
menuJson += "\"action\": \"deletetab\"";
menuJson += "}";
}
menuJson += ",{";
menuJson += "\"title\" : \"设为默认标签\",";
menuJson += "\"icon\": \"rsetdefault\",";
menuJson += "\"action\": \"setdefault\"";
menuJson += "}";
if(tabOperArea.size() > 1){
menuJson += ",{";
menuJson += "\"title\" : \"\"";
menuJson += "}";
}
if(curIndex != 0){
menuJson += ",{";
menuJson += "\"title\" : \"前移\",";
menuJson += "\"icon\": \"rmovefront\",";
menuJson += "\"action\": \"movefront\"";
menuJson += "}";
}
if(curIndex != tabOperArea.size()-1){
menuJson += ",{";
menuJson += "\"title\" : \"后移\",";
menuJson += "\"icon\": \"rmovebehind\",";
menuJson += "\"action\": \"movebehind\"";
menuJson += "}";
}
if(curIndex != 0){
menuJson += ",{";
menuJson += "\"title\" : \"移至最前\",";
menuJson += "\"icon\": \"rmostfront\",";
menuJson += "\"action\": \"mostfront\"";
menuJson += "}";
}
if(curIndex != tabOperArea.size()-1){
menuJson += ",{";
menuJson += "\"title\" : \"移至最后\",";
menuJson += "\"icon\": \"rmostbehind\",";
menuJson += "\"action\": \"mostbehind\"";
menuJson += "}";
}
menuJson += "]}";
menuJson = JSON.parse(menuJson);
$('#tabRightMenu').mac('menu', menuJson);
},
offset: { x: 0, y: 0 }
}, function(action, el, pos) {
var curIndex = Math.floor((el.index()+1)/2);
if(action === "modifyname"){
modifyTabName(el);
}else if(action === "deletetab"){
window.top.Dialog.confirm("确定要删除【"+el.find("span").text()+"】及其包含的所有内容吗?",function(){
if(curIndex === 0)
el.add(el.next()).remove();
else
el.add(el.prev()).remove();
var tabsymbol = el.attr("id");
deleteSingleTabCache(tabsymbol);
if(globalData.getCacheValue("symbol") === tabsymbol){
showTabWindow(jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel").eq(0));
}
if(el.find("img").size() >0 ){
setDefaultTab(0);
}
controlTabHeadCss();
var scrollleft = $(".tabdiv .tab_head").scrollLeft();
var diffWidth = getTotalWidth() - $(".tabdiv .tab_head").width();
if(scrollleft > diffWidth)
scrollleft = diffWidth;
$(".tabdiv .tab_head").scrollLeft(scrollleft);
});
}else if(action === "setdefault"){
setDefaultTab(curIndex);
}else if(action === "movefront" || action === "mostfront"){
var tabObj = el;
var sepObj = el.prev();
var setIndex = 0;
if(action === "movefront")
setIndex = curIndex-1;
tabObj.add(sepObj).remove();
jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel").eq(setIndex).before(tabObj).before(sepObj);
bindEvent_SingleTab(el);
}else if(action === "movebehind" || action === "mostbehind"){
var tabObj = el;
var sepObj = el.next();
var setIndex = jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel").size()-2;
if(action === "movebehind")
setIndex = curIndex;
tabObj.add(sepObj).remove();
jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel").eq(setIndex).after(tabObj).after(sepObj);
bindEvent_SingleTab(el);
}
});
}
//显示某个Tab页内容
function showTabWindow(singleTab){
var tab_head = jQuery(".tabdiv .tab_head");
var cur_sel = tab_head.find(".t_sel");
cur_sel.add(cur_sel.children()).each(function(){
$(this).attr("class", $(this).attr("class").replace("_sel", "_unsel"));
});
singleTab.add(singleTab.children()).each(function(){
$(this).attr("class", $(this).attr("class").replace("_unsel", "_sel"));
});
apply_TabStyle();
var tabsymbol = singleTab.attr("id");
if(globalSheet.hasCache(tabsymbol+"_sheet")){ //存在则恢复Tab
formOperate.switchWindowFace(tabsymbol);
}else{
//先清除已有面板的背景图
baseOperate.clearBgImgFace();
initSpreadGrid(jQuery("#excelDiv"), "0"); //初始化空Tab页
formOperate.initWindowFace(tabsymbol);
}
}
//删除某个标签页缓存、同时恢复属性
function deleteSingleTabCache(tabsymbol){
var ecs = globalData.getCacheValue(tabsymbol).ecs;
//还原字段已使用、明细已添加等
for(var cellid in ecs){
restoreCellProperties(tabsymbol, cellid);
}
//移除缓存
globalData.removeCache(tabsymbol);
globalSheet.removeCache(tabsymbol+"_sheet");
}
//设置默认标签页
function setDefaultTab(defindex){
var tabOperArea = jQuery(".tabdiv .tab_head").find(".t_sel,.t_unsel");
tabOperArea.find("img").remove();
tabOperArea.eq(defindex).find("span").before("<img class=\"defaultimg\" src=\"/workflow/exceldesign/image/shortBtn/tab/defaulttab_wev8.png\" />");
}
//标签页重命名
function modifyTabName(singleTab){
var spanObj = singleTab.find("span");
var spanText = spanObj.text();
var t_middle = spanObj.parent();
var inputObj = jQuery("<input type='text' style='border:1px solid #b2b7c6; width:"+(spanObj.width()+30)+"px'/>");
spanObj.remove();
t_middle.append(inputObj);
inputObj.val(spanText).focus();
inputObj.bind("blur",function(){
var curVal = inputObj.val();
if(jQuery.trim(curVal) == ""){
//window.top.Dialog.alert("标签项名称不能为空!");
curVal = spanText;
}
inputObj.remove();
t_middle.append("<span>"+curVal+"</span>");
singleTab.attr("title", curVal+"(ID:"+singleTab.attr("id")+")");
controlTabHeadCss();
});
}
//控制tab区域显示及隐藏
function controlTabArea(flag){
var tabarea_height = $(".tabdiv").height() + $(".tabSplitLine").height();
if(flag === "show"){
$("table.s_insert").find("[name='tabpage']").hide();
$(".tabdiv").add(".tabSplitLine").show();
$(".tabdiv .tab_bottomleft").width($(".tab_bottom").width()-$(".tabdiv .tab_bottomright").width());
$("#excelDiv").height($("#excelDiv").height() - tabarea_height);
$(".excelSet").height($(".excelSet").height() - tabarea_height);
$(".tableBody").height($(".tableBody").height() - tabarea_height);
//选中格式栏、隐藏样式栏
$(".editor_nav .s_format").click();
$(".editor_nav .s_style").hide();
}else if(flag === "hide"){
$("table.s_insert").find("[name='tabpage']").show();
$(".tabdiv").add(".tabSplitLine").hide();
$("#excelDiv").height($("#excelDiv").height() + tabarea_height);
$(".excelSet").height($(".excelSet").height() + tabarea_height);
$(".tableBody").height($(".tableBody").height() + tabarea_height);
//显示样式栏
$(".editor_nav .s_style").show();
}
var ss = jQuery("#excelDiv").wijspread("spread");
ss._doResize();
}
//控制标签页头部样式
function controlTabHeadCss(){
var totalWidth = getTotalWidth();
var maxWidth = $(".tabdiv .tab_bottomleft").width()-20-50-20;
if(totalWidth > maxWidth){
$(".tabdiv .tab_head").width(maxWidth);
$(".tabdiv .tab_turnleft").css("visibility", "visible");
$(".tabdiv .tab_turnright").css("display", "block");
}else{
$(".tabdiv .tab_head").width(totalWidth+"px");
$(".tabdiv .tab_turnleft").css("visibility", "hidden");
$(".tabdiv .tab_turnright").css("display", "none");
}
}
function getTotalWidth(){
var totalWidth = 35;
$(".tabdiv .t_area").children().each(function(){
totalWidth += $(this).width();
});
return totalWidth;
}
return {
//单元格插入标签页
insertTabPageFace: function(){
insertTabPage();
},
//绑定标签页相应事件
bindTabEventFace: function(){
bindTabEvent();
},
//双击打开编辑标签页
switchEditTabFace: function(maincellid){
switchEditTab(maincellid);
},
//保存标签页信息写入主表的dataobj
saveTabInfoFace: function(){
saveTabInfo();
},
//控制tab区域显示及隐藏
controlTabAreaFace: function(flag){
controlTabArea(flag);
},
//根据主表cellid删除标签页所有缓存
deleteTabCache: function(tab_obj){
for(var key in tab_obj){
if(key.indexOf("order_") == -1)
continue;
var value = tab_obj[key];
var tabsymbol = value.substring(0, value.indexOf(","));
deleteSingleTabCache(tabsymbol);
}
},
//公式选择时获取所有存在标签项,excelUploadFormula.js公式调用
getTabListFace: function(){
var tabList = {};
var maincellid_editing = "";
if(jQuery(".excelHeadBG .tabdiv").css("display") != "none"){
maincellid_editing = jQuery(".tabdiv #maincellid").val();
jQuery(".tabdiv .t_area").find(".t_sel,.t_unsel").each(function(){
tabList[jQuery(this).attr("id")] = jQuery(this).find("span").text();
});
}
var main_ecs = globalData.getCacheValue("main").ecs;
for(var item in main_ecs){
if(main_ecs[item].etype === celltype.TAB && item !== maincellid_editing){
var tab_obj = main_ecs[item].tab;
for(key in tab_obj){
if(key.indexOf("order_") > -1){
var value = tab_obj[key];
var idx = value.indexOf(",");
tabList[value.substring(0, idx)] = value.substring(idx+1);
}
}
}
}
return tabList;
}
}
})();
/**
* 多字段相关操作方法封装
*/
var mcOperate = (function (){
/**
* 点击插入多字段(空单元格直接弹出多内容面板、含内容单元格把字段内容自动置于多内容面板内部)
*/
function insertMoreContent(){
var sheet = getCurrentSheet();
var c = sheet.getActiveColumnIndex();
var r = sheet.getActiveRowIndex();
var cellid = r+","+c;
//判断是覆盖单元格/扩充成多字段
var dataobj = getCurrentDataObj();
var celltext = sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).text();
var opertarget = judgeCellOperTarget(dataobj, celltext, r, c);
var mcCellArr = new Array();
if(opertarget === 1){
restoreCellProperties("", cellid);
}else if(opertarget === 2){
var curCellObj = $.extend(true, {}, dataobj.ecs[r+","+c]);;
delete dataobj.ecs[r+","+c];
curCellObj.celltext = celltext;
curCellObj.imgsrc = sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).backgroundImage();
curCellObj._style = sheet.getStyle(r, c, $.wijmo.wijspread.SheetArea.viewport);
mcCellArr.push(curCellObj);
}else{ //单元格已经是多字段单元格,不允许再插入
return;
}
setCellToMC(sheet, r, c);
if(opertarget === 1){
editMoreContent(cellid, true);
}else if(opertarget === 2){
editMoreContent(cellid, extendOpenMcPanel);
appendCellArrToPanel(mcCellArr);
if(!extendOpenMcPanel) //未打开面板,需自动保存面板信息
confirmEdit(extendOpenMcPanel);
}
}
/**
* 拖拽操作多字段
* opertarget:2,扩展字段为多内容字段; opertarget:3,内容追加至多字段面板
*/
function operMoreContent(opertarget, mcCellArr){
var sheet = getCurrentSheet();
var c = sheet.getActiveColumnIndex();
var r = sheet.getActiveRowIndex();
if(opertarget === 2){
setCellToMC(sheet, r, c);
}
editMoreContent(r+","+c, extendOpenMcPanel);
appendCellArrToPanel(mcCellArr);
if(!extendOpenMcPanel) //未打开面板,需自动保存面板信息
confirmEdit(extendOpenMcPanel);
}
function setCellToMC(sheet, r, c){
var imgsrc = "/workflow/exceldesign/image/shortBtn/morecontent/more_wev8.png";
setCellTextImage(sheet, r, c, "多内容", imgsrc);
setCellProperties(r+","+c, celltype.MC, {"mcpoint": getNextMcSymbol()});
baseOperate.controlDiscriptionAreaFace();
}
function getNextMcSymbol(){
existMaxMcIndex++;
return "mc_"+existMaxMcIndex;
}
function editMoreContent(cellid, needShowPanel){
var dataobj = getCurrentDataObj();
var mcpoint = "";
if(dataobj.ecs && dataobj.ecs[cellid] && dataobj.ecs[cellid].mcpoint)
mcpoint = dataobj.ecs[cellid].mcpoint;
if(mcpoint === "")
return;
jQuery("input#mcpoint").val(mcpoint);
if(needShowPanel){
//窗口定位、显示
var location = locateMcSheet(cellid);
jQuery("div#mcDiv").css({"top":location.split(",")[0]+"px", "left":location.split(",")[1]+"px"});
panelControl('show');
}
isEditMoreContent = true;
//面板恢复
var isinit = globalSheet.hasCache(mcpoint+"_sheet") ? false : true;
var mc_ss = jQuery("#excelDiv_mc").wijspread("spread");
var mc_sheet = mc_ss.getActiveSheet();
//窗口内容恢复
if(isinit){
globalData.addCache(mcpoint, {"ecs": {}});
mc_sheet.isPaintSuspended(true);
mc_ss.fromJSON(initJSON_moreContent);
mc_sheet.isPaintSuspended(false);
baseOperate.bindSpreadEventFace(mc_ss);
//面板初始化时每行第二列需添加换行标示
mc_sheet = mc_ss.getActiveSheet();
for(var r=0; r<mc_sheet.getRowCount(); r++){
setCellToBr(r);
}
}else{
formOperate.switchEditMCFace(mcpoint);
}
//隐藏行头列头
mc_sheet = mc_ss.getActiveSheet();
mc_sheet.setColumnHeaderVisible(false);
mc_sheet.setRowHeaderVisible(false);
}
function locateMcSheet(cellid){
var sheet = getCurrentSheet();
//计算绝对定位top
var top = 0;
var topRow = sheet.getViewportTopRow(1); //当前显示的第一行
var cellRow = parseInt(cellid.split(",")[0]);
var maxTopVal = jQuery("div#excelDiv").height()-jQuery("div#mcDiv").height();
while(true){
top = 20;
for(var i=topRow; i<=cellRow; i++){
top += parseFloat(sheet.getRowHeight(i, $.wijmo.wijspread.SheetArea.rowHeader));
}
topRow++;
if(top < maxTopVal || cellRow < topRow)
break;
//整体上移一行再次计算
sheet.showRow(topRow, $.wijmo.wijspread.VerticalPosition.top);
}
//计算绝对定位left
var left = 0;
var leftCol = sheet.getViewportLeftColumn(1);
var cellCol = parseInt(cellid.split(",")[1]);
var maxLeftVal = jQuery("div#excelDiv").width()-jQuery("div#mcDiv").width();
while(true){
left = 40;
for(var i=leftCol; i<cellCol; i++){
left += parseFloat(sheet.getColumnWidth(i, $.wijmo.wijspread.SheetArea.colHeader));
}
leftCol++;
if(left < maxLeftVal || cellCol < leftCol)
break;
//整体左移一列再次计算
sheet.showColumn(leftCol, $.wijmo.wijspread.HorizontalPosition.left);
}
return top+","+left;
}
//追加单元格数组至多内容面板
function appendCellArrToPanel(cellarr){
var mc_sheet = getCurrentSheet();
var mc_dataobj = getCurrentDataObj();
var beginRow = countLastNullRow(mc_sheet);
var setCol = 0;
mc_sheet.isPaintSuspended(true);
for(var i=0; i<cellarr.length; i++){
var setRow = beginRow + i;
//最后行自动扩充
baseOperate.autoExtendRowColFace(mc_sheet, setRow, setCol);
//根据数组信息追加单元格
var cellObj = cellarr[i];
delete cellObj.formula;
var _cell = mc_sheet.getCell(setRow, setCol, $.wijmo.wijspread.SheetArea.viewport);
_cell.value(cellObj.celltext);
delete cellObj.celltext;
if(cellObj.imgsrc){
_cell.backgroundImage(cellObj.imgsrc);
_cell.backgroundImageLayout($.wijmo.wijspread.ImageLayout.None);
delete cellObj.imgsrc;
}
if(cellObj._style){ //单元格样式设置,缓存不用处理(字体、字体颜色、背景色、缩进)
var _cellstyle = mc_sheet.getStyle(setRow, setCol, $.wijmo.wijspread.SheetArea.viewport);
if(_cellstyle == undefined)
_cellstyle = new $.wijmo.wijspread.Style();
_cellstyle.font = cellObj._style.font;
_cellstyle.foreColor = cellObj._style.foreColor;
_cellstyle.backColor = cellObj._style.backColor;
_cellstyle.textIndent = cellObj._style.textIndent;
delete cellObj._style;
}
delete mc_dataobj.ecs[setRow+","+setCol];
cellObj.id = setRow+","+setCol;
mc_dataobj.ecs[setRow+","+setCol] = cellObj;
}
mc_sheet.isPaintSuspended(false);
}
//计算多字段面板最后空行
function countLastNullRow(mc_sheet){
var c = 0;
var notNullRow = -1;
for(var r=0; r<mc_sheet.getRowCount(); r++){
var celltext = mc_sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).text();
if(!!celltext)
notNullRow = r;
}
notNullRow++;
return notNullRow;
}
function confirmEdit(needHidePanel){
//dataobj缓存不用处理,模板保存时拼接;sheetjson串重新放入缓存中
var mcpoint = jQuery("input#mcpoint").val();
var mc_ss = jQuery("#excelDiv_mc").wijspread("spread");
var mc_sheetjson = JSON.stringify(mc_ss.toJSON());
globalSheet.addCache(mcpoint+"_sheet", mc_sheetjson);
//多字段内容拼接作为主面板单元格内容
var mc_sheet = jQuery("#excelDiv_mc").wijspread("spread").getActiveSheet();
var shortname = "";
var shouldClean = true;
for(var r=0; r<mc_sheet.getRowCount(); r++){
var curtext = mc_sheet.getCell(r, 0, $.wijmo.wijspread.SheetArea.viewport).text();
if(jQuery.trim(curtext) != "" || curtext.indexOf(" ") > -1){
if(curtext.lastIndexOf("(") > -1 && curtext.lastIndexOf(")") > -1){//这种方式会有一些问题,如果节点中也包含中文的括号就不行
curtext = curtext.substring(0,curtext.lastIndexOf("("));
}
shortname += curtext+"; ";
shouldClean = false;
}
}
if(shouldClean){
cleanPanelAndCell();
}else{
var sheet = jQuery("#excelDiv").wijspread("spread").getActiveSheet();
var ar = sheet.getActiveRowIndex();
var ac = sheet.getActiveColumnIndex();
sheet.getCell(ar, ac, $.wijmo.wijspread.SheetArea.viewport).value(shortname);
}
//隐藏面板
if(needHidePanel)
panelControl('hide');
isEditMoreContent = false;
baseOperate.controlDiscriptionAreaFace();
}
function cleanPanel(){
window.top.Dialog.confirm(_excel_reminder_6,function(){
cleanPanelAndCell();
panelControl('hide');
isEditMoreContent = false;
});
}
function cleanPanelAndCell(){
var mcpoint = jQuery("input#mcpoint").val();
cleanMcPanelCache(mcpoint);
var symbol = globalData.getCacheValue("symbol");
var main_dataobj = globalData.getCacheValue(symbol);
var main_sheet = jQuery("#excelDiv").wijspread("spread").getActiveSheet();
var ar = main_sheet.getActiveRowIndex();
var ac = main_sheet.getActiveColumnIndex();
baseOperate.cleanCellTextFace(main_sheet, main_dataobj.ecs[ar+","+ac], ar, ac);
main_sheet.setIsProtected(false);
}
function cleanMcPanelCache(mcpoint){
if(globalData.hasCache(mcpoint)){
var ecs = globalData.getCacheValue(mcpoint).ecs;
for(var cellid in ecs){
restoreCellProperties(mcpoint, cellid);
}
}
//移除缓存
globalData.removeCache(mcpoint);
globalSheet.removeCache(mcpoint+"_sheet");
}
function panelControl(flag){
var curSymbol = globalData.getCacheValue("symbol");
var excelMasking = jQuery("div#excelMasking");
var tabHeadMasking = jQuery("div#tabHeadMasking");
var mcDiv = jQuery("div#mcDiv");
var headArea = $(".editor_nav").find(".s_detail,.s_style,.s_module");
var mc_hide = $(".excelHeadBG").find("td[target='mc_hide'],div[target='mc_hide']");
var mc_splithide = $("table.s_format").find("td[target='mc_splithide']");
if(flag === 'show'){
var headHeight = $(".editor_nav").height()+$(".excelHeadBG").height();
excelMasking.css({"width":$("#excelDiv").width(), "height":$("#excelDiv").height()});
if(curSymbol === "main")
excelMasking.css("top", headHeight);
else if(curSymbol.indexOf("tab_") > -1){
excelMasking.css("top", headHeight+$("div.tabdiv").height());
tabHeadMasking.css({"height":$("div.tabdiv").height(), "top":headHeight});
tabHeadMasking.show();
}
excelMasking.show();
mcDiv.show();
$(".editor_nav .s_format").click();
headArea.hide();
mc_hide.hide();
mc_splithide.removeClass("splitTHead");
}else if(flag === 'hide'){
excelMasking.hide();
tabHeadMasking.hide();
mcDiv.hide();
headArea.show();
if(curSymbol.indexOf("tab_") > -1)
$("table.s_insert").find("[name='tabpage']").hide();
mc_hide.show();
mc_splithide.addClass("splitTHead");
}
jQuery("div[name='formulaClear']").hide();
}
function setCellToBr(r){
var mc_sheet = getCurrentSheet();
var mc_dataobj = getCurrentDataObj();
var c = 1;
var imgSrc = "/workflow/exceldesign/image/shortBtn/morecontent/wrap_wev8.png";
mc_sheet.getCell(r, c,$.wijmo.wijspread.SheetArea.viewport).backgroundImage(imgSrc);
mc_sheet.getCell(r, c,$.wijmo.wijspread.SheetArea.viewport).backgroundImageLayout($.wijmo.wijspread.ImageLayout.Center);
var cellobj = {};
cellobj.etype = celltype.BR;
cellobj.brsign = "N";
if(mc_dataobj && mc_dataobj.ecs)
mc_dataobj.ecs[r+","+c] = cellobj;
}
function switchCellBrSign(r){
var mc_sheet = getCurrentSheet();
var mc_dataobj = getCurrentDataObj();
var c = 1;
var brsign;
if(mc_dataobj && mc_dataobj.ecs && mc_dataobj.ecs[r+","+c])
brsign = mc_dataobj.ecs[r+","+c].brsign;
else
return;
var imgSrc;
if(brsign === "Y"){
imgSrc = "/workflow/exceldesign/image/shortBtn/morecontent/wrap_wev8.png";
mc_dataobj.ecs[r+","+c].brsign = "N";
}else if(brsign === "N"){
imgSrc = "/workflow/exceldesign/image/shortBtn/morecontent/wrap_hot_wev8.png";
mc_dataobj.ecs[r+","+c].brsign = "Y";
}
mc_sheet.getCell(r, c,$.wijmo.wijspread.SheetArea.viewport).backgroundImage(imgSrc);
mc_sheet.getCell(r, c,$.wijmo.wijspread.SheetArea.viewport).backgroundImageLayout($.wijmo.wijspread.ImageLayout.Center);
}
return {
//插入多字段
insertMoreContentFace: function(){
insertMoreContent();
},
//拖拽操作多字段
operMoreContentFace: function(opertarget, mcCellArr){
operMoreContent(opertarget, mcCellArr);
},
//打开编辑多字段窗口
editMoreContentFace: function(cellid){
editMoreContent(cellid, true);
},
//窗口点击确定接口
confirmFace: function(){
confirmEdit(true);
},
//窗口点击清除接口
cleanFace: function(){
cleanPanel();
},
//删除整个多内容缓存,恢复字段
deleteMcCache: function(mcpoint){
cleanMcPanelCache(mcpoint);
},
//转换单元格为换行单元格
setCellToBrFace: function(r){
setCellToBr(r);
},
//双击/右键切换单元格换行符
switchCellBrSignFace: function(r){
switchCellBrSign(r);
}
}
})();
/**
* 插入项 相关操作方法封装
*/
var insertOperate = (function(){
function insertScriptCode(){
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
var url = "/workflow/exceldesign/excelUploadCode.jsp";
dialog.Title = "插入代码";
dialog.Width = $(window).width()-300;
dialog.Height = $(window).height()-200;
dialog.maxiumnable = true;
dialog.Drag = true;
dialog.URL = url;
dialog.show();
}
function insertLink(){
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
var ar = sheet.getActiveRowIndex(); ///当前活动单元格
var ac = sheet.getActiveColumnIndex();
var urlParams = "";
if(dataobj && dataobj.ecs && dataobj.ecs[ar+","+ac]){
var cellobj = dataobj.ecs[ar+","+ac];
var etype = cellobj.etype;
if(etype===celltype.LINKTEXT){
urlParams += "?srcdeal="+cellobj.efieldtype;
urlParams += "&srcfile="+encodeURIComponent(cellobj.efieldid);
}else if(etype==="" || etype===celltype.TEXT){
}else{
window.top.Dialog.alert("单元格内非文本,禁止插入链接!");
return;
}
}
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
var url = "/workflow/exceldesign/excelUploadLink.jsp"+urlParams;
dialog.Title = "插入链接";
dialog.Width = 500;
dialog.Height = 340;
dialog.Drag = true;
dialog.URL = url;
dialog.show();
dialog.callbackfun = function (paramobj, result) {
if(!result) return;
var djson = result;
var cell = sheet.getCell(ar,ac,$.wijmo.wijspread.SheetArea.viewport);
if(cell.value() === null || cell.value() === "")
cell.value(djson.srcfile);
sheet.getCell(ar, ac,$.wijmo.wijspread.SheetArea.viewport).textDecoration($.wijmo.wijspread.TextDecorationType.Underline);
var celljson = {};
celljson.efieldid = djson.srcfile;
celljson.efieldtype = djson.srcdeal;
setCellProperties(ar+","+ac, celltype.LINKTEXT, celljson);
baseOperate.autoExtendRowColFace(sheet, ar, ac);
}
}
function portalDesign(target){
if(target == "insert" && parseInt(wfinfo.modeid) <= 0){
window.top.Dialog.alert("模板需先保存,才允许插入门户元素!");
return;
}
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
var cellid = r+","+c;
var hpid = "";
if(target == "setting" && dataobj.ecs[cellid].jsonparam && dataobj.ecs[cellid].jsonparam.hpid)
hpid = dataobj.ecs[cellid].jsonparam.hpid;
var url = "/homepage/maint/HomepageForWorkflow.jsp?isSetting=true&hpid="+hpid;
var paramStr = "&wfid="+wfinfo.wfid+"&nodeid="+wfinfo.nodeid+"&formid="+wfinfo.formid
+"&isbill="+wfinfo.isbill+"&moduleid="+wfinfo.modeid+"&layouttype="+wfinfo.layouttype;
paramStr += "&layoutname="+encodeURI(jQuery("#workflowname").val()+"-"+jQuery("#layoutname").val());
var dialog=new window.top.Dialog();
dialog.currentWindow = window;
dialog.Model=true;
dialog.maxiumnable=true;
dialog.Width = $(window.top).width()-60;
dialog.Height = $(window.top).height()-80;
dialog.hideDraghandle = false;
dialog.URL= url+paramStr;
dialog.Title="设置元素";
dialog.callbackfun = function(paramobj, datas){
if(target == "insert"){
restoreCellProperties("", cellid);
baseOperate.autoExtendRowColFace(sheet, r, c);
}
var imgsrc = "/workflow/exceldesign/image/controls/portal_wev8.png";
var celltext = "门户元素";
if(!!datas.elements)
celltext += " ("+datas.elements+")";
setCellTextImage(sheet, r, c, celltext, imgsrc);
setCellProperties(cellid, celltype.PORTAL, {"jsonparam": datas});
baseOperate.controlDiscriptionAreaFace();
}
dialog.CancelEvent = function(){
dialog.innerFrame.contentWindow.closeDialogCallback();
};
dialog.show();
}
function deletePortalElm(hpid){
/*$.post(
"/homepage/maint/HomepageForWorkflowOperation.jsp",
{method:"delHpInfo", hpid:hpid},
function (data) {
}
);*/
}
function iframeDesign(target){
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
var cellid = r+","+c;
var url = "/workflow/exceldesign/setIframe.jsp?firstParam=1";
if(target == "setting" && dataobj.ecs[cellid].jsonparam){
var jsonparam = dataobj.ecs[cellid].jsonparam;
for(var key in jsonparam){
url += "&"+key+"="+encodeURIComponent(jsonparam[key]);
}
}
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Title = "插入Iframe区域";
dialog.Width = 700;
dialog.Height = 500;
dialog.maxiumnable = false;
dialog.URL = url;
dialog.callbackfun = function (paramobj, datas) {
if(target == "insert"){
restoreCellProperties("", cellid);
baseOperate.autoExtendRowColFace(sheet, r, c);
}
var imgsrc = "/workflow/exceldesign/image/controls/iframeArea_wev8.png";
setCellTextImage(sheet, r, c, "Iframe区域", imgsrc);
setCellProperties(cellid, celltype.IFRAME, {"jsonparam":datas});
};
dialog.show();
}
function scanCodeDesign(target){
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
var cellid = r+","+c;
var url = "/workflow/exceldesign/setScanCode.jsp?formid="+wfinfo.formid+"&isbill="+wfinfo.isbill;
if(target == "setting" && dataobj.ecs[cellid].jsonparam){
var jsonparam = dataobj.ecs[cellid].jsonparam;
for(var key in jsonparam){
url += "&"+key+"="+jsonparam[key];
}
}
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Title = "插入二维/条形码";
dialog.Width = 700;
dialog.Height = 500;
dialog.maxiumnable = false;
dialog.URL = url;
dialog.callbackfun = function (paramobj, datas) {
if(target == "insert"){
restoreCellProperties("", cellid);
baseOperate.autoExtendRowColFace(sheet, r, c);
}
if(datas.codetype){
var setText = datas.codetype=="1" ? "二维码" : "条形码";
var imgsrc = "/workflow/exceldesign/image/controls/scanCode_"+datas.codetype+"_wev8.png";
setCellTextImage(sheet, r, c, setText, imgsrc);
}
setCellProperties(cellid, celltype.SCANCODE, {"jsonparam":datas});
};
dialog.show();
}
function invoiceScanDesign(target){
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
var cellid = r+","+c;
var url = "/fna/invoice/invoiceWf/exceldesign/FnaInvoiceWfPage.jsp?workflowid="+wfinfo.wfid;
if(target == "setting" && dataobj.ecs[cellid].jsonparam){
var jsonparam = dataobj.ecs[cellid].jsonparam;
for(var key in jsonparam){
url += "&"+key+"="+jsonparam[key];
}
}
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Title = "发票扫描设置";
dialog.Width = 500;
dialog.Height = 300;
dialog.maxiumnable = false;
dialog.URL = url;
dialog.callbackfun = function (paramobj, datas) {
if(target == "insert"){
restoreCellProperties("", cellid);
baseOperate.autoExtendRowColFace(sheet, r, c);
}
if(datas.btn_titie){
var setText = datas.btn_titie;
var imgsrc = "/workflow/exceldesign/image/controls/invoiceScanSmall.png";
setCellTextImage(sheet, r, c, setText, imgsrc);
}
setCellProperties(cellid, celltype.INVOICESCAN, {"jsonparam":datas});
};
dialog.show();
}
return {
//插入代码块
insertScriptCodeFace: function(){
insertScriptCode();
},
//插入链接
insertLinkFace: function(){
insertLink();
},
//门户元素设置(target:insert-插入,setting-设置)
portalDesignFace: function(target){
portalDesign(target);
},
//删除门户元素
deletePortalElmFace: function(hpid){
deletePortalElm(hpid);
},
//iframe区域设置(target:insert-插入,setting-设置)
iframeDesignFace: function(target){
iframeDesign(target);
},
//扫描码设置(target:insert-插入,setting-设置)
scanCodeDesignFace: function(target){
scanCodeDesign(target);
},
//发票扫描
invoiceScanDesignFace:function(target){
invoiceScanDesign(target);
}
}
})();
/**
* 明细高级定制相关操作方法封装
*/
var detailOperate = (function(){
function doInsertDetail(action){
var imgsrc = "/workflow/exceldesign/image/shortBtn/detail/detailTable_wev8.png";
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
setCellTextImage(sheet, r, c, "明细表"+action.split("_")[1], imgsrc);
restoreCellProperties("", r+","+c);
setCellProperties(r+","+c, celltype.DETAIL, {"edetail":action});
haveDetailMap[action]="on";
baseOperate.controlDiscriptionAreaFace();
baseOperate.autoExtendRowColFace(sheet, r, c);
}
function openDetailWin(edetail){
var dlg=new window.top.Dialog("excelDesignDetailDialog");
dlg.currentWindow = window;
dlg.Model=true;
dlg.maxiumnable=true;
dlg.Width = $(window.top).width()-60;
dlg.Height = $(window.top).height()-80;
dlg.hideDraghandle = true;
var detaillimit=$("input[name='detailgroupattr"+(parseInt(edetail.replace('detail_',''))-1)+"']").val();
var detailNum = getDetailNum();
var url="/workflow/exceldesign/excelMain.jsp?wfid="+wfinfo.wfid+"&isDetail=on&d_identy="+edetail+"&d_num="+detailNum+
"&formid="+$("#formid").val()+"&isbill="+$("#isbill").val()+
"&nodeid="+$("#nodeid").val()+"&layouttype="+$("#layouttype").val()+"&detaillimit="+detaillimit;
dlg.URL= url;
dlg.Title="新版流程模式设计器";
dlg.show();
}
function addDetailRowMark(obj){
var sheet = getCurrentSheet();
var sel = sheet.getSelections();
var objname = $(obj).attr("name");
if(objname === celltype.DE_TITLE && sheet.getActiveRowIndex() == 0){
window.top.Dialog.alert("第一行之前不能加入表头标识!");
return;
}else if(objname === celltype.DE_TAIL && sheet.getActiveRowIndex() == sheet.getRowCount()-1){
window.top.Dialog.alert("最后一行之后不能加入表尾标识!");
return;
}
var insertRowIndex = sheet.getActiveRowIndex();
if(objname === celltype.DE_TAIL){
var _span = sheet.getSpan(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), $.wijmo.wijspread.SheetArea.viewport);
if(_span)
insertRowIndex = insertRowIndex+(_span.rowCount-1);
insertRowIndex++;
}
sheet.isPaintSuspended(true);
baseOperate.insertDetailRowMarkFace(insertRowIndex);
var canMerge = true; //合并三行,第二行插表头标识,则新插入的行存在合并单元格,addSpan会导致设计器整体失效
for(var i=0; i<sheet.getColumnCount(); i++){
if(sheet.getSpan(insertRowIndex, i, $.wijmo.wijspread.SheetArea.viewport)){
canMerge = false;
break;
}
}
if(canMerge){
//合并单元格、添加样式及文字
sheet.addSpan(insertRowIndex, 0, 1, sheet.getColumnCount());
var cellvalue = (objname === celltype.DE_TITLE) ? "表头标识" : "表尾标识";
setRowMarkStyle(sheet, insertRowIndex, cellvalue);
//设置单元格属性
setCellProperties(insertRowIndex+",0", objname);
$(obj).addClass("shortBtn_disabled").removeClass("shortBtn");
}
sheet.setSelection(insertRowIndex, 0, 1, sheet.getColumnCount());
sheet.isPaintSuspended(false);
}
function setRowMarkStyle(sheet, row, cellvalue){
sheet.getCell(row, 0, $.wijmo.wijspread.SheetArea.viewport).value(cellvalue);
var _style = new $.wijmo.wijspread.Style();
_style.backColor = "#eeeeee";
sheet.setStyle(row, 0, _style, $.wijmo.wijspread.SheetArea.viewport);
}
function addDetailCellMark(obj){
var objname = $(obj).attr("name");
var imgsrc = "/workflow/exceldesign/image/shortBtn/detail/"+objname+"_wev8.png";
var sheet = getCurrentSheet();
var r = sheet.getActiveRowIndex();
var c = sheet.getActiveColumnIndex();
restoreCellProperties("", r+","+c);
var cvalue = "";
if(objname === celltype.DE_CHECKALL)
cvalue = "全选";
else if(objname === celltype.DE_CHECKSINGLE)
cvalue = "选中";
else if(objname === celltype.DE_SERIALNUM || objname === celltype.DE_SERIALTITLE)
cvalue = "序号";
setCellTextImage(sheet, r, c, cvalue, imgsrc);
//设置单元格属性;
setCellProperties(r+","+c, objname);
$(obj).addClass("shortBtn_disabled").removeClass("shortBtn");
baseOperate.autoExtendRowColFace(sheet, r, c);
sheet.setSelection(r, c, 1, 1); //解决添加后直接删除无效问题
}
function clickOpenSeniorSet(){
if(jQuery("#openSeniorSet").attr("checked")){
jQuery("#openSeniorSet").attr("checked",false).next().removeClass("jNiceChecked");
var allowInit = false;
var mark = getHeadTailMark();
var exist = existSeniorElements();
if(!exist && mark.headRow && mark.tailRow && mark.tailRow-mark.headRow === 2)
allowInit = true;
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Title = "信息确认";
dialog.Width = 460;
dialog.Height = 200;
dialog.Drag = true;
dialog.URL = "/workflow/exceldesign/seniorSetConfirm.jsp?allowInit="+allowInit;
dialog.callbackfun = function(paramobj, retstr){
retstr = jQuery.trim(retstr);
if(!!retstr && retstr === "true") //自动初始化
autoExtendToSenior(mark);
jQuery("#openSeniorSet").attr("checked",true).next().addClass("jNiceChecked");
jQuery(".belSeniorSet").show();
};
dialog.show();
}else{
jQuery(".belSeniorSet").hide();
}
}
//针对历史单行模板自动初始化行头、序号、合计等
function autoExtendToSenior(mark){
var sheet = getCurrentSheet();
var dataobj = getCurrentDataObj();
sheet.isPaintSuspended(true);
//插两列
sheet.setSelection(0, 0, 1, 2);
baseOperate.insertRowColsFace("col");
//处理第一行
var firstCellStyle = sheet.getStyle(0, 2, $.wijmo.wijspread.SheetArea.viewport);
if(firstCellStyle == null) firstCellStyle = new $.wijmo.wijspread.Style();
var firstCellStyleNew = firstCellStyle.clone();
firstCellStyleNew.backgroundImage = null;
sheet.setStyle(0, 0, firstCellStyleNew.clone(), $.wijmo.wijspread.SheetArea.viewport);
setCellProperties("0,0", "");
sheet.setStyle(0, 1, firstCellStyleNew.clone(), $.wijmo.wijspread.SheetArea.viewport);
setCellProperties("0,1", "");
//处理表头行,合并单元格情况只取合并源单元格样式
var headFirstCellRow = mark.headRow-1;
var headFirstCellCol = 2;
var _span = sheet.getSpan(headFirstCellRow, headFirstCellCol, $.wijmo.wijspread.SheetArea.viewport);
if(_span){ //合并单元格取源
headFirstCellRow = _span.row;
headFirstCellCol = _span.col;
}
var headRow = mark.headRow-1;
var headCellStyle = sheet.getStyle(headFirstCellRow, headFirstCellCol, $.wijmo.wijspread.SheetArea.viewport);
if(headCellStyle == null) headCellStyle = new $.wijmo.wijspread.Style();
sheet.setSelection(headRow, 0, 1, 1);
sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), headCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
addDetailCellMark(jQuery("div[name='de_checkall']"));
sheet.setSelection(headRow, 1, 1, 1);
sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), headCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
addDetailCellMark(jQuery("div[name='de_serialtitle']"));
//处理字段行,不存在合并情况
var fieldRow = mark.tailRow-1;
var fieldCellStyle = sheet.getStyle(fieldRow, 2, $.wijmo.wijspread.SheetArea.viewport);
if(fieldCellStyle == null) fieldCellStyle = new $.wijmo.wijspread.Style();
sheet.setSelection(fieldRow, 0, 1, 1);
sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), fieldCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
addDetailCellMark(jQuery("div[name='de_checksingle']"));
sheet.setSelection(fieldRow, 1, 1, 1);
sheet.setStyle(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex(), fieldCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
addDetailCellMark(jQuery("div[name='de_serialnum']"));
//check框、序号居中显示
sheet.getCells(fieldRow, 0, fieldRow, 1, $.wijmo.wijspread.SheetArea.viewport).vAlign($.wijmo.wijspread.VerticalAlign.center);
sheet.getCells(fieldRow, 0, fieldRow, 1, $.wijmo.wijspread.SheetArea.viewport).hAlign($.wijmo.wijspread.VerticalAlign.center);
//合并表头、表尾标识
sheet.addSpan(mark.headRow, 0, 1, sheet.getColumnCount()+2);
setRowMarkStyle(sheet, mark.headRow, "表头标识");
sheet.addSpan(mark.tailRow, 0, 1, sheet.getColumnCount()+2);
setRowMarkStyle(sheet, mark.tailRow, "表尾标识");
//生成合计行
var sumfield = jQuery(".tableBody").find("tr[name='_sumfield']");
var needCreateSumRow = false;
sumfield.each(function(){
var sumfieldid = jQuery(this).find("a[_flag='SumFcontent']").attr("_fieldid");
if(fieldAttrHaveMap["Fcontent+"+sumfieldid] === "1"){
needCreateSumRow = true;
return true;
}
});
if(needCreateSumRow){
if(sheet.getRowCount() > mark.tailRow+1){ //避免影响已存在的行,还是插入行稳妥
sheet.setSelection(mark.tailRow+1, 0, 1, sheet.getColumnCount());
baseOperate.insertRowColsFace("row");
}else{ //扩充行
baseOperate.autoExtendRowColFace(sheet, mark.tailRow, 0);
}
var dataobj = getCurrentDataObj()
var sumRow = mark.tailRow+1;
for(var i=0; i<sheet.getColumnCount(); i++){
var headCellStyle = sheet.getStyle(headRow, i, $.wijmo.wijspread.SheetArea.viewport);
if(headCellStyle == null) headCellStyle = new $.wijmo.wijspread.Style();
var sumCellStyle = headCellStyle.clone();
sumCellStyle.backgroundImage = null;
sumCellStyle.textIndent = 0;
sheet.setStyle(sumRow, i, sumCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
if(i === 0){
}else if(i === 1){
sheet.addSpan(sumRow, 0, 1, 2);
sheet.getCell(sumRow, 0, $.wijmo.wijspread.SheetArea.viewport).value("合计");
setCellProperties(sumRow+","+0, celltype.TEXT);
}else{
if(dataobj.ecs[fieldRow+","+i] && dataobj.ecs[fieldRow+","+i].efieldid){
var fieldid = dataobj.ecs[fieldRow+","+i].efieldid;
sheet.setSelection(sumRow, i, 1, 1);
setCellProperties(sumRow+","+i, "");
sumfield.find("a[_flag='SumFcontent'][_fieldid='"+fieldid+"']").click();
var sumCellStyle = sheet.getStyle(sumRow, i, $.wijmo.wijspread.SheetArea.viewport);
sumCellStyle.foreColor = "#ff0000";
sheet.setStyle(sumRow, i, sumCellStyle.clone(), $.wijmo.wijspread.SheetArea.viewport);
}
}
}
}
sheet.setSelection(0, 0, 1, 1);
sheet.isPaintSuspended(false);
}
//模板校验合法
function verifyDetailTemplate(){
var mark = getHeadTailMark();
if(!mark.headRow)
return "表头标识不存在";
if(!mark.tailRow)
return "表尾标识不存在";
if(mark.headRow >= mark.tailRow)
return "表头标识必须处于表尾标识之前行";
var dataobj = getCurrentDataObj();
if(jQuery("#openSeniorSet").attr("checked")){ //高级模式
for(var item in dataobj.ecs){
var etype = dataobj.ecs[item].etype;
var currow = parseInt(item.split(",")[0]);
if(etype === celltype.DE_CHECKALL && currow >= mark.headRow)
return "明细行全选标识必须处于表头标识之前行";
if(etype === celltype.DE_CHECKSINGLE && (currow <= mark.headRow || currow >= mark.tailRow))
return "明细行选中标识必须处于表头标识与表尾标识之间";
if(etype === celltype.DE_SERIALNUM && (currow <= mark.headRow || currow >= mark.tailRow))
return "行序号标识必须处于表头标识与表尾标识之间";
if((etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT) && currow > mark.headRow && currow < mark.tailRow)
return "合计字段及标签不可处于表头标识与表尾标识之间行";
}
}else{
for(var item in dataobj.ecs){
var etype = dataobj.ecs[item].etype;
var currow = parseInt(item.split(",")[0]);
if(etype === celltype.DE_CHECKALL || etype === celltype.DE_CHECKSINGLE || etype === celltype.DE_SERIALNUM || etype === celltype.DE_SERIALTITLE
|| etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT)
return "模板未启用高级定制却含有明细高级定制项";
}
}
return "pass";
}
function getHeadTailMark(){
var dataobj = getCurrentDataObj();
var mark = {};
for(var item in dataobj.ecs){
if(dataobj.ecs[item].etype === celltype.DE_TITLE)
mark.headRow = parseInt(item.split(",")[0]);
else if(dataobj.ecs[item].etype === celltype.DE_TAIL)
mark.tailRow = parseInt(item.split(",")[0]);
}
return mark;
}
function existSeniorElements(){
var dataobj = getCurrentDataObj();
for(var item in dataobj.ecs){
var etype = dataobj.ecs[item].etype;
if(etype === celltype.DE_CHECKALL || etype === celltype.DE_CHECKSINGLE
|| etype === celltype.DE_SERIALNUM || etype === celltype.DE_SERIALTITLE || etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT){
return true;
}
}
return false;
}
//初始化明细模板
function initDetailTemplate(){
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Width = 810;
dialog.Height = 570;
dialog.maxiumnable=true;
dialog.hideDraghandle = true;
var url = "/workflow/exceldesign/excelInitModule.jsp?fromwhere=initdetail&detailindex="+detailIdenty;
url += "&wfid="+wfinfo.wfid+"&nodeid="+wfinfo.nodeid+"&formid="+wfinfo.formid+"&isbill="+wfinfo.isbill+"&layouttype="+wfinfo.layouttype;
if(!jQuery("#dtladd").is(":checked") && !jQuery("#dtledit").is(":checked"))
url += "&viewonly=1";
dialog.URL = url;
dialog.show();
dialog.callbackfun = function(paramobj, datas){
var styleissys = datas.styleissys;
var styleid = datas.styleid;
var fieldinfo = datas.fieldinfo;
var isSysStyle = styleissys === "sys";
jQuery.ajax({
type : "post",
url : "/workflow/exceldesign/excelStyleOperation.jsp",
data : {method:(isSysStyle?"searchsysone":"searchone"), styleid:styleid},
dataType : "JSON",
success : function(res){
var bordercolor,labelbgcolor,fieldbgcolor;
var stylejson = JSON.parse(res);
if(isSysStyle){
bordercolor = stylejson["bordercolor"];
labelbgcolor = stylejson["labelbgcolor"];
fieldbgcolor = stylejson["fieldbgcolor"];
}else{
bordercolor = stylejson["detail_border"];
labelbgcolor = stylejson["detail_label_bgcolor"];
fieldbgcolor = stylejson["detail_field_bgcolor"];
}
var sheet = getCurrentSheet();
sheet.isPaintSuspended(true);
//先清空已有面板内容
sheet.setSelection(0, 0, 1, 1);
baseOperate.insertRowColsFace("row");
sheet.setSelection(1, 0, sheet.getRowCount()-1, sheet.getColumnCount());
baseOperate.deleteRowColsFace("row");
sheet.setSelection(0, 0, 1, 1);
for(var r=0; r<3; r++){
baseOperate.insertRowColsFace("row");
}
//绘制低级定制模板
var tableBody = jQuery(".tableBody");
var fieldindex = 0;
for(var i=0; i<fieldinfo.length; i++){
var fieldid = fieldinfo[i].fieldid;
var fieldattr = parseInt(fieldinfo[i].fieldattr);
setFieldAttr(fieldid, fieldattr);
if(fieldattr === 0)
continue;
//第一行设置含对象
setCellProperties(0+","+fieldindex, "");
//第二行设置标签
var _labelstyle = new $.wijmo.wijspread.Style();
_labelstyle.backColor = labelbgcolor;
sheet.setStyle(1, fieldindex, _labelstyle, $.wijmo.wijspread.SheetArea.viewport);
sheet.getCell(1, fieldindex, $.wijmo.wijspread.SheetArea.viewport).hAlign($.wijmo.wijspread.HorizontalAlign.center);
sheet.getCell(1, fieldindex, $.wijmo.wijspread.SheetArea.viewport).vAlign($.wijmo.wijspread.VerticalAlign.center);
sheet.setSelection(1, fieldindex, 1, 1);
tableBody.find("a[_flag='Fname'][_fieldid='"+fieldid+"']").click();
//第三行设置字段
var _fieldstyle = new $.wijmo.wijspread.Style();
_fieldstyle.backColor = fieldbgcolor;
sheet.setStyle(2, fieldindex, _fieldstyle, $.wijmo.wijspread.SheetArea.viewport);
sheet.getCell(2, fieldindex, $.wijmo.wijspread.SheetArea.viewport).hAlign($.wijmo.wijspread.HorizontalAlign.left);
sheet.getCell(2, fieldindex, $.wijmo.wijspread.SheetArea.viewport).vAlign($.wijmo.wijspread.VerticalAlign.center);
sheet.setSelection(2, fieldindex, 1, 1);
tableBody.find("a[_flag='Fcontent'][_fieldid='"+fieldid+"']").click();
//设置列宽
sheet.setColumnWidth(fieldindex, 120, $.wijmo.wijspread.SheetArea.viewport);
fieldindex++;
}
//设置边框
var lineBorder = new $.wijmo.wijspread.LineBorder(bordercolor, $.wijmo.wijspread.LineStyle.thin);
sheet.setBorder(new $.wijmo.wijspread.Range(0, 0, 0, fieldindex), lineBorder, {top:true})
sheet.setBorder(new $.wijmo.wijspread.Range(1, 0, 2, fieldindex), lineBorder, {all:true})
//删除空列
sheet.setSelection(0, fieldindex, 1, sheet.getColumnCount());
baseOperate.deleteRowColsFace("col");
//设置表头表尾、按钮
sheet.setSelection(0, fieldindex-1, 1, 1);
jQuery(".excelHeadContent").find("[name='de_btn']").click();
sheet.setSelection(2, sheet.getColumnCount(), 1, 1);
jQuery(".excelHeadContent").find("[name='de_title']").click();
sheet.setSelection(3, sheet.getColumnCount(), 1, 1);
jQuery(".excelHeadContent").find("[name='de_tail']").click();
//转换为高级定制模式
if(jQuery("#openSeniorSet").is(":checked")){
var mark = getHeadTailMark();
autoExtendToSenior(mark);
}
sheet.isPaintSuspended(false);
setLockedColumn(-1);
}
});
}
}
var lockedColumn = -1;
function setLockedColumn(col){
lockedColumn = col;
var isLockedColumn = col > -1;
//锁定列控制明细横向滚动条
if(isLockedColumn){
jQuery("[name=dtlallowscroll]").attr("disabled",true).attr("checked",true).next().removeClass("jNiceCheckbox").addClass("jNiceCheckbox_disabled").addClass("jNiceChecked");
}else{
jQuery("[name=dtlallowscroll]").attr("disabled",false).next().removeClass("jNiceCheckbox_disabled").addClass("jNiceCheckbox");
}
//控制锁定列头的样式
var sheet = getCurrentSheet();
sheet.isPaintSuspended(true);
var lockedbgcolor = "#B0D7FF";
for(var c=0; c<sheet.getColumnCount(); c++){
var _style = sheet.getStyle(0, c, $.wijmo.wijspread.SheetArea.colHeader) || new $.wijmo.wijspread.Style();
if(c === lockedColumn){
_style.font = "bold 9pt Microsoft YaHei";
_style.backColor = lockedbgcolor;
}else{
_style.font = "";
delete _style.backColor;
}
sheet.setStyle(0, c, _style, $.wijmo.wijspread.SheetArea.colHeader);
}
sheet.isPaintSuspended(false);
}
function verifyLockedCfg(){
if(lockedColumn < 0)
return true;
var sheet = getCurrentSheet();
var dataobj = getCurrentDataObj();
//锁定列列宽不能为百分百
var edtitlerow = -1;
var edtailrow = -1;
var hasPrecent = false;
for(var item in dataobj.ecs){
var etype = dataobj.ecs[item].etype;
var rowid = parseInt(item.split(",")[0]);
var colid = parseInt(item.split(",")[1]);
var ispercent = sheet.getValue(0, colid, $.wijmo.wijspread.SheetArea.colHeader);
if(ispercent.indexOf("%") > -1) {
hasPrecent = true;
sheet.setSelection(-1, colid, sheet.getRowCount(), 1);
}
if(etype === celltype.DE_TITLE)
edtitlerow = rowid;
else if(etype === celltype.DE_TAIL)
edtailrow = rowid;
}
if(hasPrecent){
window.top.Dialog.alert(SystemEnv.getHtmlNoteName(6352));
return false;
}
var hasMerge = false;
var spans = sheet.getSpans();
for (var i = 0; i < spans.length; i++) {
var span_row = parseInt(spans[i].row);
var span_col = parseInt(spans[i].col);
var span_mergecol = parseInt(spans[i].colCount);
if(span_mergecol > 1 && span_row !== edtitlerow && span_row !== edtailrow
&& span_col <= lockedColumn && span_col+span_mergecol-1 > lockedColumn){
sheet.setSelection(span_row, span_col, 1, 1);
hasMerge = true;
break;
}
}
if(hasMerge){
window.top.Dialog.alert(SystemEnv.getHtmlNoteName(6353));
return false;
}
return true;
}
return {
//单元格插入明细表
doInsertDetailFace: function(action){
return doInsertDetail(action);
},
//双击打开明细设计器窗口
openDetailWinFace: function(edetail){
return openDetailWin(edetail);
},
//添加表头表尾
addDetailRowMarkFace: function(obj){
return addDetailRowMark(obj);
},
//添加按钮、全选、单选、序号等
addDetailCellMarkFace: function(obj){
return addDetailCellMark(obj);
},
//启用、关闭高级定制
clickOpenSeniorSetFace: function(){
return clickOpenSeniorSet();
},
//模板校验合法性
verifyDetailTemplateFace: function(){
return verifyDetailTemplate();
},
//判断是否是高级定制
hasOpenSeniorSet: function(){
if(jQuery("#openSeniorSet").attr("checked"))
return true;
else
return false;
},
//初始化明细模板
initDetailTemplateFace: function(){
return initDetailTemplate();
},
//明细锁定列右键操作,0:取消锁定、1:锁定至此列、2:锁定首列
lockDetailColumnFace: function(type){
var newLockedColumn = -1;
if(type === 2){
var sheet = getCurrentSheet();
newLockedColumn = sheet.getActiveColumnIndex();
}else if(type === 3){
newLockedColumn = 0;
}
setLockedColumn(newLockedColumn);
},
//插入删除行时,位移控制锁定列
offsetLockedColumnFace: function(opreation,activenum,movenum){
if(lockedColumn < 0)
return;
var newLockedColumn = lockedColumn;
if(opreation === "insert" && newLockedColumn >= activenum){
newLockedColumn += movenum;
}else if(opreation === "delete"){
if(newLockedColumn === activenum){
newLockedColumn = -1;
}else if(newLockedColumn > activenum){
newLockedColumn -= movenum;
}
}
setLockedColumn(newLockedColumn);
},
setLockedColumn: function(column){
setLockedColumn(column);
},
//保存-获取当前锁定列号
getLockedColumn: function(){
return lockedColumn;
},
//保存明细判断锁定列是否满足条件
verifyLockedCfgFace: function(){
return verifyLockedCfg();
},
}
})();
//=================设计器全局缓存结构*** begin========
var globalSheet = new scpCache(); //控件JSON存储缓存
var globalData = new scpCache(); //datajson存储缓存,对于主表及Tab页存封装的dataobj对象,对于明细存字符串
/**
* JSON格式属性缓存
*/
function scpCache(){
var cache = {};
return {
//将数据添加到缓存里面
addCache: function(key, value){
if(!(key in cache)){
cache[key] = value;
}else {
delete cache[key];
cache[key] = value;
}
},
//移除缓存中的数据
removeCache: function(key){
if(key in cache) {
delete cache[key];
}
},
//移除缓存中的所有数据
removeAllCache: function(){
for(key in cache)
delete cache[key];
},
//判断缓存中是否有该键值对
hasCache: function(key){
if(key in cache)
return true;
return false;
},
//根据键值获取缓存中的值
getCacheValue: function(key){
if(key in cache)
return cache[key];
return "";
},
//返回cache对象
getCache: function(){
return cache;
},
//返回cache对象的大小
getCacheSize: function(){
var i=0;
for(key in cache)
i++;
return i;
}
}
};
//=================设计器全局缓存结构*** end========
/**
* 获取当前编辑Sheet,对当前面板的操作都应通过此方法获取
*/
function getCurrentSheet(){
var excelDiv = isEditMoreContent ? jQuery("#excelDiv_mc") : jQuery("#excelDiv");
var ss = excelDiv.wijspread("spread");
var sheet = ss.getActiveSheet();
return sheet;
}
/**
* 获取当前编辑面板对应的dataobj,对当前面板的操作都应通过此方法获取
*/
function getCurrentDataObj(){
if(isEditMoreContent){
var mcpoint = jQuery("input#mcpoint").val();
if(mcpoint !=="" && globalData.hasCache(mcpoint))
return globalData.getCacheValue(mcpoint);
}else{
var symbol = globalData.getCacheValue("symbol");
if(globalData.hasCache(symbol))
return globalData.getCacheValue(symbol)
}
return null;
}
/**
* 获取当前表格的key
* @returns {*}
*/
function getSymbol(){
if(isEditMoreContent){
var mcpoint = jQuery("input#mcpoint").val();
if(mcpoint !=="" && globalData.hasCache(mcpoint))
return mcpoint;
}else{
return "main";
}
}
//全局变量
var forBug_copyvalue = "";
var isEditFormulaing = false; //是否正在编辑公式
var detailFormulaTempAry = new Array();
var isAutoCompleteKeyDown = 0;
var existMaxTabIndex = 0; //已存在的最大 标签页序号
var existMaxMcIndex = 0; //已存在的最大 多内容序号
var isEditMoreContent = false; //当前编辑多内容面板的标示
var _tagArray_main = new Array();
var _tagArray_detail = new Array();
/**
* 单元格-存储内容类型
*/
var celltype={
"TEXT":"tx",
"FNAME":"Fname", //字段名
"FCONTENT":"Fcontent", //表单内容
"NNAME":"Nname", //节点名称
"NADVICE":"Nadvice", //流转意见
"IMAGE":"image", //图片
"DETAIL":"dt", //明细表
"DE_TITLE":"de_title", //表头标识
"DE_TAIL":"de_tail", //表尾标识
"DE_BTN":"de_btn", //明细按钮
"LINKTEXT":"lktxt", //链接
"TAB":"tab", //Tab页
"MC":"morecontent", //多内容
"BR":"br", //换行
"PORTAL":"portal", //门户元素
"IFRAME":"iframe", //iframe区域
"SCANCODE":"scancode", //扫描码
"INVOICESCAN":"invoiceScan", //发票扫描
"SUMFNAME":"SumFname", //合计字段标签
"SUMFCONTENT":"SumFcontent", //合计字段
"DE_CHECKALL":"de_checkall",//选中所有
"DE_CHECKSINGLE":"de_checksingle", //选中单行
"DE_SERIALNUM":"de_serialnum", //序号
"DE_SERIALTITLE":"de_serialtitle", //序号标签
};
//保存方法转换etype
function transformerEtype(etype){
if(etype === celltype.TEXT) //文本
return "1";
else if(etype === celltype.FNAME) //字段名
return "2";
else if(etype === celltype.FCONTENT)//表单内容
return "3";
else if(etype === celltype.NNAME) //节点名
return "4";
else if(etype === celltype.NADVICE) //流转意见
return "5";
else if(etype === celltype.IMAGE) //图片
return "6";
else if(etype === celltype.DETAIL) //明细
return "7";
else if(etype === celltype.DE_TITLE)//表头标识
return "8";
else if(etype === celltype.DE_TAIL) //表尾标识
return "9";
else if(etype === celltype.DE_BTN) //明细增删按妞
return "10";
else if(etype === celltype.LINKTEXT)//链接
return "11";
else if(etype === celltype.TAB) //标签页
return "12";
else if(etype === celltype.MC) //多内容
return "13";
else if(etype === celltype.BR) //换行符
return "14";
else if(etype === celltype.PORTAL) //门户元素
return "15";
else if(etype === celltype.IFRAME) //iframe区域
return "16";
else if(etype === celltype.SCANCODE)//扫描码
return "17";
else if(etype === celltype.SUMFNAME)
return "18";
else if(etype === celltype.SUMFCONTENT)
return "19";
else if(etype === celltype.DE_CHECKALL)
return "20";
else if(etype === celltype.DE_CHECKSINGLE)
return "21";
else if(etype === celltype.DE_SERIALNUM)
return "22";
else if(etype === celltype.INVOICESCAN)
return "23";
else if(etype === celltype.DE_SERIALTITLE)
return "24";
}
//恢复的时候反向转换etype
function reverseTransformerEtype(etype){
if(etype === "1") //文本
return celltype.TEXT;
else if(etype === "2") //字段名
return celltype.FNAME;
else if(etype === "3") //表单内容
return celltype.FCONTENT;
else if(etype === "4") //节点名
return celltype.NNAME;
else if(etype === "5") //流转意见
return celltype.NADVICE;
else if(etype === "6") //图片
return celltype.IMAGE;
else if(etype === "7") //明细
return celltype.DETAIL;
else if(etype === "8") //表头标识
return celltype.DE_TITLE;
else if(etype === "9") //表尾标识
return celltype.DE_TAIL;
else if(etype === "10") //明细增删按妞
return celltype.DE_BTN;
else if(etype === "11")
return celltype.LINKTEXT;
else if(etype === "12")
return celltype.TAB;
else if(etype === "13")
return celltype.MC;
else if(etype === "14")
return celltype.BR;
else if(etype === "15")
return celltype.PORTAL;
else if(etype === "16")
return celltype.IFRAME;
else if(etype === "17")
return celltype.SCANCODE;
else if(etype === "18")
return celltype.SUMFNAME;
else if(etype === "19")
return celltype.SUMFCONTENT;
else if(etype === "20")
return celltype.DE_CHECKALL;
else if(etype === "21")
return celltype.DE_CHECKSINGLE;
else if(etype === "22")
return celltype.DE_SERIALNUM;
else if(etype === "23")
return celltype.INVOICESCAN;
else if(etype === "24")
return celltype.DE_SERIALTITLE;
}
/**
* 单元格为字段时,字段类型(控制图片)
*/
var controltype={
"TEXT":"text",
"SELECT":"select",
"BROWSER":"browser",
"CHECKBOX":"checkbox",
"DATE":"date",
"TIME":"time",
"AFFIX":"affix",
"LINK":"link",
"TEXTAREA":"textarea",
"RADIO":"radio",
"POSITION":"position"
};
function transControlType(_fieldtype, _fieldtypedetail){
var _controltype = "";
if(_fieldtype==="3"){
if(_fieldtypedetail==="2")
_controltype = controltype.DATE;
else if(_fieldtypedetail==="19")
_controltype = controltype.TIME;
else
_controltype=controltype.BROWSER;
}else if(_fieldtype==="1")
_controltype=controltype.TEXT;
else if(_fieldtype==="2")
_controltype=controltype.TEXTAREA;
else if(_fieldtype==="4")
_controltype=controltype.CHECKBOX;
else if(_fieldtype==="5")
_controltype=controltype.SELECT;
else if(_fieldtype==="6")
_controltype=controltype.AFFIX;
else if(_fieldtype==="7")
_controltype=controltype.LINK;
else if(_fieldtype==="8")
_controltype=controltype.RADIO;
else if(_fieldtype==="9")
_controltype=controltype.POSITION;
return _controltype;
}
/**
* 单元格检索下拉div
*/
function showAutoCompleteDiv(autoCompleteHtml){
var gcEditingInput = jQuery("textArea[gcuielement=gcEditingInput]");
//如果页面已存在,那么不再往下处理;
isAutoCompleteKeyDown = 0;
gcEditingInput.parent("div").find(".ac_results").remove();
if(!!autoCompleteHtml){
var autoCompleteDiv = $("<div style=\"width:175px\"></div>");
var autoCompleteDiv_html = $("<ul>"+autoCompleteHtml+"</ul>");
autoCompleteDiv.html(autoCompleteDiv_html);
autoCompleteDiv.addClass("ac_results");
gcEditingInput.parent("div").append(autoCompleteDiv);
gcEditingInput.parent("div").find(".ac_results ul li").eq(0).addClass("selected"); //默认选中第一个
gcEditingInput.parent("div").find(".ac_results ul li").bind("mousedown",function(evt){
var targetid = "";
if($(this).attr("_fieldid"))
targetid |=$(this).attr("_fieldid");
if($(this).attr("_nodeid"))
targetid |= $(this).attr("_nodeid");
var flag = $(this).attr("_flag");
var _txt = $(this).text();
var _fieldtype,_fieldtypedetail;
if(flag === celltype.FCONTENT){
_fieldtype = $(this).attr("_fieldtype");
_fieldtypedetail = $(this).attr("_fieldtypedetail");
}
var fieldhave = getFieldAttrHave(targetid,flag);
if(!!fieldhave){
gcEditingInput.val("");
gcEditingInput.parent("div").find(".ac_results").remove();
}else{
setExcelBxValue(evt,targetid,flag,_txt,_fieldtype,_fieldtypedetail);
gcEditingInput.val(_txt);
}
});
gcEditingInput.unbind("keydown",autoCompleteKeyDown);
gcEditingInput.bind("keydown",autoCompleteKeyDown);
}
}
//绑定事件
function autoCompleteKeyDown(e){
var ctrlKey = e.ctrlKey,
shiftKey = e.shiftKey,
altKey = e.altKey,
metaKey = e.metaKey,
modifyKey = ctrlKey || shiftKey || altKey || metaKey,
keyCode = e.keyCode;
if(!modifyKey){
if(keyCode == 37 || keyCode == 38 || keyCode == 39 || keyCode== 40)
isAutoCompleteKeyDown ++;
if(keyCode == 38 || keyCode == 40 ){
var gcEditingInput = jQuery("textArea[gcuielement=gcEditingInput]");
var currentTarget = gcEditingInput.parent("div").find(".ac_results ul li.selected");
currentTarget.removeClass("selected");
if(keyCode == 40 ){ //向下
var nextTarget = currentTarget.next();
if(!nextTarget || nextTarget.length == 0)
gcEditingInput.parent("div").find(".ac_results ul li").eq(0).addClass("selected");
else
nextTarget.addClass("selected");
}else if(keyCode == 38){ //向上
var prevTarget = currentTarget.prev();
if(!prevTarget || prevTarget.length == 0)
gcEditingInput.parent("div").find(".ac_results ul li").eq(7).addClass("selected");
else
prevTarget.addClass("selected");
}
e.preventDefault();
e.stopPropagation();
}
}
}
/*
* 右边拖拽后 / 双击 单元格赋值 和联想输入时
* @param
* targetid 字段或者节点ID
* flag 字段或者节点
* txt 列表文本值
* _fieldtype 大类型
* _fieldtypedetail 小类型
*/
function setExcelBxValue(e, targetid, flag, txt, _fieldtype, _fieldtypedetail){
if(baseOperate.judgeRangeHasAreaFace("hover")){
window.top.Dialog.confirm(_excel_reminder_4, function(){
setExcelBxValueFun(e, targetid, flag, txt, _fieldtype, _fieldtypedetail);
});
}else{
setExcelBxValueFun(e, targetid, flag, txt, _fieldtype, _fieldtypedetail);
}
}
function setExcelBxValueFun(e, targetid, flag, txt, _fieldtype, _fieldtypedetail){
var sheet = getCurrentSheet();
var c = sheet.getActiveColumnIndex();
var r = sheet.getActiveRowIndex();
var sel = sheet.getSelections()[0];
if(sel.row == undefined || sel.col === undefined) //如果拖动没有拖到单元格内,直接return掉;
return;
if(isEditMoreContent && c != 0) //多字段面板只允许设置第一列
return;
var fieldhave = getFieldAttrHave(targetid,flag);
if(!!fieldhave)
return;
baseOperate.autoExtendRowColFace(sheet, r, c);
setFieldAttrHave(targetid, flag, 1);
var _controltype = "";
var imgsrc = "";
if(flag === celltype.FCONTENT){ //处理字段相关(字段属性、字段类型、图片)
//设置字段属性
var setfieldattr = getFieldAttr(targetid);
if(wfinfo.layouttype == "1" || wfinfo.nodetype == "3"){ //打印模式、归档节点
setfieldattr = "1";
}else{
if(isDetail==="on"){
if($("#dtladd").is(":checked") || $("#dtledit").is(":checked")){
if(setfieldattr == "0")
setfieldattr = "2";
}else{
setfieldattr = "1";
}
}else{
if(setfieldattr == "0")
setfieldattr = "2";
if((targetid == -1 || targetid == -10) && setfieldattr == "2")
setfieldattr = "3";
}
}
//获取字段图标
if(targetid == -1)
_fieldtype = "1";
else if(targetid == -4)
_fieldtype = "2";
else if(targetid == -9)
_fieldtype = "1";
else if(targetid == -2 || targetid == -3 || targetid == -5)
_fieldtype = "8";
_controltype = transControlType(_fieldtype, _fieldtypedetail);
if(_controltype===controltype.LINK || _controltype===controltype.POSITION)
setfieldattr = 1;
//设置隐藏域
setFieldAttr(targetid, setfieldattr);
if(_controltype != "")
imgsrc = "/workflow/exceldesign/image/controls/"+_controltype+setfieldattr+"_wev8.png";
}else if(flag === celltype.SUMFCONTENT){
imgsrc = "/workflow/exceldesign/image/shortBtn/detail/detailSumField_wev8.png";
}
//判断是覆盖单元格/扩充成多字段
var dataobj = getCurrentDataObj();
var celltext = sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).text();
var opertarget = judgeCellOperTarget(dataobj, celltext, r, c);
var uuid = guid();//生成唯一的uuid
if(opertarget === 1){ //替换单元格内容
restoreCellProperties("", r+","+c);
sheet.setIsProtected(true);
setCellTextImage(sheet, r, c, txt, imgsrc);
var cell = {};
cell.efieldid = targetid;
if(_controltype != "")
cell.efieldtype = _controltype;
cell.uuid = uuid;
setCellProperties(r+","+c, flag, cell);
//控制操作权限
baseOperate.controlOperLimitsFace(r, c);
sheet.setSelection(r, c, 1, 1); //解决添加后直接删除无效问题
}else{
var mcCellArr = new Array();
if(opertarget === 2){ //合并内容成多字段
var curCellObj = $.extend(true, {}, dataobj.ecs[r+","+c]);
delete dataobj.ecs[r+","+c];
formulaOperate.deleteCellFormulaFace(r+","+c, globalData.getCacheValue("symbol"));
curCellObj.celltext = celltext.replace("(fx)", "");
curCellObj.imgsrc = sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport).backgroundImage();
curCellObj._style = sheet.getStyle(r, c, $.wijmo.wijspread.SheetArea.viewport);
mcCellArr.push(curCellObj);
}
var addCellObj = {};
addCellObj.etype = flag;
addCellObj.efieldid = targetid;
if(_controltype != "")
addCellObj.efieldtype = _controltype;
addCellObj.celltext = txt;
addCellObj.imgsrc = imgsrc;
addCellObj.uuid = uuid;
if(imgsrc !== ""){
addCellObj._style = new $.wijmo.wijspread.Style();
addCellObj._style.textIndent = 2.5;
}
mcCellArr.push(addCellObj);
mcOperate.operMoreContentFace(opertarget, mcCellArr);
}
}
/**
* 获取单元格操作标示、
* 1:替换单元格内容
* 2:合并内容变成多字段单元格
* 3:将内容追加到多内容面板中
*/
function judgeCellOperTarget(dataobj, celltext, row, col){
if(isAutoExtendMoreContent && isDetail !== "on" && !isEditMoreContent && jQuery.trim(celltext) !== ""){
if(dataobj.ecs && dataobj.ecs[row+","+col]){
var etype = dataobj.ecs[row+","+col].etype;
if(etype === celltype.TEXT || etype === celltype.FNAME || etype === celltype.FCONTENT
||etype === celltype.NNAME || etype === celltype.NADVICE || etype === celltype.LINKTEXT)
return 2;
else if(etype === celltype.MC)
return 3;
}
}
return 1;
}
/**
* 还原属性、清除缓存等
*/
function restoreCellProperties(symbol, cellid, needRetain){
if(typeof needRetain === "undefined")
needRetain = false;
if(symbol === ""){ //缺省则取当前编辑面板标示
if(isEditMoreContent)
symbol = jQuery("input#mcpoint").val();
else
symbol = globalData.getCacheValue("symbol");
}
if(!globalData.hasCache(symbol))
return;
formulaOperate.deleteCellFormulaFace(cellid, symbol); //单元格内容变更自动清除公式
var dataobj = globalData.getCacheValue(symbol);
if(!dataobj.ecs || !dataobj.ecs[cellid])
return;
var etype = dataobj.ecs[cellid].etype;
if(etype === celltype.DE_TITLE || etype === celltype.DE_TAIL
|| etype === celltype.DE_BTN || etype === celltype.DE_CHECKALL
|| etype === celltype.DE_CHECKSINGLE || etype === celltype.DE_SERIALNUM || etype === celltype.DE_SERIALTITLE){
$(".excelHeadContent").find("[name='"+etype+"']").addClass("shortBtn").removeClass("shortBtn_disabled");
}else if(etype === celltype.FNAME || etype === celltype.FCONTENT || etype === celltype.NNAME
|| etype === celltype.NADVICE || etype === celltype.SUMFNAME || etype === celltype.SUMFCONTENT){ //字段及节点,还原存在的属性
setFieldAttrHave(dataobj.ecs[cellid].efieldid, etype, 0);
}else if(etype === celltype.DETAIL){ //明细表,还原存在的属性及删除缓存
var detailid = dataobj.ecs[cellid].edetail;
if(!needRetain){ //合并单元格时保留
delete dataobj.ecs[cellid].edetail;
globalData.removeCache(detailid);
globalSheet.removeCache(detailid+"_sheet");
delete haveDetailMap[detailid];
}
}else if(etype === celltype.TAB && symbol === "main"){ //标签页,删除缓存
if(!needRetain){ //合并单元格时保留
tabOperate.deleteTabCache(dataobj.ecs[cellid].tab);
}
delete dataobj.ecs[cellid].tab;
}else if(etype === celltype.MC){ //多内容
mcOperate.deleteMcCache(dataobj.ecs[cellid].mcpoint);
delete dataobj.ecs[cellid].mcpoint;
}else if(etype === celltype.PORTAL || etype === celltype.IFRAME || etype === celltype.SCANCODE || etype === celltype.INVOICESCAN){
if(etype === celltype.PORTAL && dataobj.ecs[cellid].jsonparam && dataobj.ecs[cellid].jsonparam.hpid)
insertOperate.deletePortalElmFace(dataobj.ecs[cellid].jsonparam.hpid);
delete dataobj.ecs[cellid].jsonparam;
}
}
//用于生成uuid
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
/**
* 设置数据列属性
* @param bxid 【单元格ID】
* @param type 【数据列属性对象】
*/
function setCellProperties(bxid, type, cell_pro, symbol) {
if(typeof symbol == "undefined"){
if(isEditMoreContent)
symbol = jQuery("input#mcpoint").val();
else
symbol = globalData.getCacheValue("symbol");
}
if(!globalData.hasCache(symbol))
return;
var dataobj = globalData.getCacheValue(symbol);
if(!!!dataobj.ecs[bxid])
dataobj.ecs[bxid] = {};
dataobj.ecs[bxid].id = bxid;
if(type != "")
dataobj.ecs[bxid].etype = type;
var cell_obj = dataobj.ecs[bxid];
if(!!cell_pro){
if(cell_pro.efieldid){
cell_obj.efieldid = cell_pro.efieldid;
cell_obj.efieldtype = cell_pro.efieldtype;
}
if(cell_pro.uuid)
cell_obj.uuid = cell_pro.uuid;
if(cell_pro.edetail)
cell_obj.edetail = cell_pro.edetail;
if(cell_pro.enumbric)
cell_obj.enumbric = cell_pro.enumbric;
if(cell_pro.financial)
cell_obj.financial = cell_pro.financial;
if(cell_pro.formula)
cell_obj.formula = cell_pro.formula;
if(cell_pro.tab)
cell_obj.tab = cell_pro.tab;
if(cell_pro.mcpoint)
cell_obj.mcpoint = cell_pro.mcpoint;
if(cell_pro.brsign)
cell_obj.brsign = cell_pro.brsign;
if(cell_pro.attrs)
cell_obj.attrs = cell_pro.attrs;
if(cell_pro.jsonparam)
cell_obj.jsonparam = cell_pro.jsonparam;
}
}
/**
* 设置单元格内容/图片
*/
function setCellTextImage(sheet, r, c, celltext, cellimg){
sheet.isPaintSuspended(true);
var cell = sheet.getCell(r, c, $.wijmo.wijspread.SheetArea.viewport);
cell.value(celltext);
cell.wordWrap(true);
if(!!cellimg){
cell.backgroundImage(cellimg);
cell.backgroundImageLayout($.wijmo.wijspread.ImageLayout.None);
cell.textIndent(2.5);
}else{
cell.backgroundImage(null);
cell.textIndent(0);
}
sheet.isPaintSuspended(false);
}
/**
* 获取单元格字段图片
*/
function getCellFieldImage(cellobj, fieldattr){
var bgimage= "";
try{
var efieldid = parseInt(cellobj.efieldid); //字段ID
if(typeof fieldattr == "undefined")
fieldattr = getFieldAttr(efieldid);
if(fieldattr == 0){
bgimage = "/workflow/exceldesign/image/controls/fieldNotShow_wev8.png";
}else{
if(efieldid == -4) //签字意见字段只读
return "/workflow/exceldesign/image/controls/textarea1_wev8.png";
if(efieldid == -9) //打印次数字段只读
return "/workflow/exceldesign/image/controls/text1_wev8.png";
if(efieldid == -1 && fieldattr == 2) //标题字段可编辑则必填
fieldattr = 3;
if(wfinfo.layouttype === "1" || wfinfo.nodetype === "3") //打印和归档图片置灰
fieldattr = 1;
if(cellobj.efieldtype===controltype.LINK)
fieldattr = 1;
if(!!cellobj.financial){
if(cellobj.financial.indexOf("2-") > -1)
bgimage = "/workflow/exceldesign/image/controls/finance"+fieldattr+"_wev8.png";
else if(cellobj.financial == "3")
bgimage = "/workflow/exceldesign/image/controls/financeUpper_wev8.png";
else if(cellobj.financial == "4")
bgimage = "/workflow/exceldesign/image/controls/thousands_wev8.png";
}else{
bgimage = "/workflow/exceldesign/image/controls/"+cellobj.efieldtype+fieldattr+"_wev8.png";
}
}
}catch(e){}
return bgimage;
}
//loading效果
function __displayloaddingblock(target) {
try {
var pTop= parent.document.body.offsetHeight/2+parent.document.body.scrollTop - 50 + jQuery(".e8_boxhead", parent.document).height()/2 ;
var pLeft= parent.document.body.offsetWidth/2 - (217/2);
jQuery("#submitloaddingdiv").css({"top":pTop, "left":pLeft, "display":"inline-block;"});
if(target === "show"){
jQuery("#submitloaddingdiv").show();
jQuery("#submitloaddingdiv_out").show();
}else if(target === "hide"){
jQuery("#submitloaddingdiv").hide();
jQuery("#submitloaddingdiv_out").hide();
}
} catch (e) {}
}
//控制头部插入标签页权限
function controlInsertTab(){
if(globalData.getCacheValue("symbol") === "main"){
jQuery("table.s_insert").find("[name='tabpage']").show();
}else{
jQuery("table.s_insert").find("[name='tabpage']").hide();
}
}
//明细表移动
function moveDetailUl(flag){
var obj=$("ul.detail_ul");
var ul_left=parseInt(obj.css("left"));
var li_width=76;
if(flag==='left'){
if(ul_left>=-10) return;
obj.css("left",(ul_left+li_width)+"px");
}else if(flag==='right'){
var excess_width=(obj.find("li").size()-5)*li_width;
if(ul_left<=-excess_width) return;
obj.css("left",(ul_left-li_width)+"px");
}
}
//缩放属性窗口
function shrinkClick(){
var obj=jQuery(".shrinkBtn");
var ss = jQuery("#excelDiv").wijspread("spread");
if(obj.hasClass("hideShrinkBtn")){ //隐藏属性窗口
unbindShrinkEvent();
jQuery(".excelSet").hide();
obj.removeClass("hideShrinkBtn").addClass("showShrinkBtn");
$("div.excelBody").css("width",($(window).width()-10)+"px");
}else if(obj.hasClass("showShrinkBtn")){ //展开属性窗口
bindShrinkEvent();
jQuery(".excelSet").show();
obj.removeClass("showShrinkBtn").addClass("hideShrinkBtn");
$("div.excelBody").css("width",($(window).width()-230)+"px");
}
ss._doResize();
}
function bindShrinkEvent(){
$(".shrinkBtn").css("top",(($(".excelSet").height()-$(".shrinkBtn").height())/2+130)+"px")
.css("right",$(".excelSet").width()+"px");
$(".excelSet").add(".shrinkBtn").bind("mousemove",function(){
$(".shrinkBtn").show();
}).bind("mouseout",function(){
$(".shrinkBtn").hide();
});
}
function unbindShrinkEvent(){
$(".shrinkBtn").css("top",(($(".excelSet").height()-$(".shrinkBtn").height())/2+130)+"px")
.css("right","0px").show();
$(".excelSet").add(".shrinkBtn").unbind("mousemove").unbind("mouseout");
}
//在模板tab中的iframe 点击编辑切换tab
function changeTab4SameModeid(){
var currentTab = jQuery(".excel_opitem").parent(".nav").find(".current");
var formatTab = currentTab.next();
currentTab.removeClass("current");
formatTab.addClass("current");
jQuery(".excelHeadContent").children("table").hide();
jQuery(".excelBody").show();
jQuery(".excelHeadBG").show();
jQuery(".excelSet").show();
jQuery(".moduleContainer").hide();
jQuery(".excelHeadContent").children(".s_format").show();
}
function setFormatrushNor(){
jQuery(".excelHeadContent").find("div[name=formatrush]").attr("down","");
jQuery(".excelHeadContent").find("div[name=formatrush]").removeClass("shortBtnHover");
}
function compareObject(o1,o2){
if(typeof o1 != typeof o2)return false;
if(typeof o1 == 'object'){
for(var o in o1){
if(typeof o2[o] == 'undefined')return false;
if(!compareObject(o1[o],o2[o]))return false;
}
return true;
}else if(typeof o1 == 'function'){
return true;
}else{
return o1 === o2;
}
}
//检查 服务器是否断开 ,明细先不检测了
function checkServer(func,param){
if(isDetail === "on"){
func(param);
}else{
jQuery.ajax({
type:"POST",
url:"/workflow/exceldesign/excelCheckServer.jsp",
timeout:10000,
success:function(res){
//...;
func(param);
return true;
},
error:function(XMLHttpRequest, textStatus, errorThrown){
window.top.Dialog.confirm("你目前已与服务器断开连接了,是否需要保存到本地?",function(){
var allsheetJson = formOperate.saveLayoutWindowFace("export");
storage.clear();
storage.setItem(storageKey, allsheetJson);
parentDialog.close();
},function(){
parentDialog.close();
});
return false;
}
});
}
}
function judgeDesignHasModify(){
var hasModify = false;
try{
var str1 = "", str2 = "";
if(isDetail === "on"){
str1 = formOperate.saveDetailWindowFace(detailIdenty,"save2Confirm");
if(parentWin_Main.globalData.hasCache("detail_"+detailIdenty))
str2 = parentWin_Main.globalData.getCacheValue("detail_"+detailIdenty)
}else{
str1 = formOperate.saveLayoutWindowFace("save2Confirm");
str2 = getDataJson();
}
if(str1 != ""){
if(str2 == ""){
hasModify = true;
}else{
if(isDetail === "on"){
str1 = "{"+str1+"}";
str2 = "{"+str2+"}";
}
var str1Json = JSON.parse(str1);
var str2Json = JSON.parse(str2);
var issame = false;
if(isDetail === "on")
issame = compareObject(str1Json["detail_"+detailIdenty], str2Json["detail_"+detailIdenty]);
else
issame = compareObject(str1Json.eformdesign.etables, str2Json.eformdesign.etables);
//交换位置再比较一次,针对只对模板进行删除操作
if(issame){
if(isDetail === "on")
issame = compareObject(str2Json["detail_"+detailIdenty], str1Json["detail_"+detailIdenty]);
else
issame = compareObject(str2Json.eformdesign.etables, str1Json.eformdesign.etables);
}
hasModify = !issame;
}
}
}catch(e){
}
return hasModify;
}
//关闭前提醒
function closeDesignWin(ct){
if(judgeDesignHasModify()){
window.top.Dialog.confirm("模板内容尚未保存,确定离开吗?", function(){
parentDialog.close();
});
}else{
parentDialog.close();
}
}
//保存过的模板在外部重新设置字段属性,外部字段属性不影响模板,然再保存,模板中的属性覆盖外部字段属性的设置
var haveDetailMap = {}; //表格中已插入的明细表集合
var fieldAttrHaveMap = {}; //表格中已插入的字段集合
/**
* 异步初始化全局变量
*/
function initGlobalData(){
var wfid=$("#wfid").val();
var formid=$("#formid").val();
var nodeid=$("#nodeid").val();
var isbill=$("#isbill").val();
var layouttype=$("#layouttype").val();
if(mainFields==null){
jQuery.ajax({
type:"POST",
url:"excelAjaxData.jsp?src=getMainFields&wfid="+wfid+"&formid="+formid+"&nodeid="+nodeid+"&isbill="+isbill+"&layouttype="+layouttype,
success:function(res){
mainFields=eval('('+res+')');
}
});
}
if(detailFields==null){
jQuery.ajax({
type:"POST",
url:"excelAjaxData.jsp?src=getDetailFields&wfid="+wfid+"&formid="+formid+"&nodeid="+nodeid+"&isbill="+isbill,
success:function(res){
detailFields=eval('('+res+')');
}
});
}
if(WfNodes==null){
jQuery.ajax({
type:"POST",
url:"excelAjaxData.jsp?src=getWfNodes&wfid="+wfid+"&formid="+formid+"&nodeid="+nodeid+"&isbill="+isbill,
success:function(res){
WfNodes=eval('('+res+')');
}
});
}
if(fieldsClassify == null){
jQuery.ajax({
type:"post",
url:"excelAjaxData.jsp?src=getFieldClassify&formid="+formid+"&isbill="+isbill,
success:function(res){
fieldsClassify = eval('('+res+')');
jQuery("input#fileFieldids").val(fieldsClassify.fileFieldids);
jQuery("input#inputFieldids").val(fieldsClassify.inputFieldids);
jQuery("input#especialFieldids").val(fieldsClassify.especialFieldids);
jQuery("input#dateFields").val(fieldsClassify.dateFields);
jQuery("input#shuziFieldids").val(fieldsClassify.shuziFieldids);
jQuery("input#zhengshuFields").val(fieldsClassify.zhengshuFields);
jQuery("input#locationFields").val(fieldsClassify.locationFields);
}
});
}
}
/**
* 编辑表单信息,编辑完后异步刷新模板字段信息
*/
function editFormInfo(){
//var url = "/workflow/form/addDefineForm.jsp?dialog=1&formid="+wfinfo.formid;
var url = "/spa/workflow/static4engine/engine.html#/main/workflowengine/form/formSet/edidForm?formId="+wfinfo.formid;
//if(wfinfo.isbill == "0")
url += "&isBill=" + wfinfo.isbill;
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
dialog.Width = $(window.top).width()-60;
dialog.Height = $(window.top).height()-80;
dialog.Modal = true;
dialog.Title = SystemEnv.getHtmlNoteName(4679, readCookie("languageidweaver"));
dialog.URL = url;
dialog.isIframe=false;
dialog.closeHandle = function(){
mainFields = null;
detailFields = null;
fieldsClassify = null;
initGlobalData();
tabChangeExpend('mf');
//刷新模板字段隐藏域及字段单元格值
refreshTemplateFieldsInfo();
};
dialog.show();
}
/**
* 新建表单字段
*/
function addFormField(){
var dlg=new window.top.Dialog();//定义Dialog对象
dlg.currentWindow=window;
dlg.Model=true;
dlg.maxiumnable=false;
dlg.Width=636;
dlg.Height=460;
//dlg.URL="/workflow/field/addfield0.jsp?formid="+jQuery("#formid").val()+"&dialog=1&fromWFCode=exceldesign";
dlg.URL="/spa/workflow/static4engine/engine.html#/main/workflowengine/form/formSet/editFieldContent?formId="+jQuery("#formid").val()+"&isRoute=true&isBill=1&fromWFCode=exceldesign";
dlg.Title="添加字段";
dlg.callbackfun = function(paramobj,datas){
if(datas){
if(datas.returnValue=="success"){
mainFields=null;
detailFields=null;
fieldsClassify = null;
initGlobalData();
tabChangeExpend('mf');
if(datas.curfieldid != null && datas.tableIndex != null)
appendAddFieldHiddenAttr(datas.curfieldid, datas.fieldlabelname, datas.tableIndex);
}
}
}
dlg.show();
}
/**
* 异步刷新模板字段隐藏域及字段单元格值
*/
function refreshTemplateFieldsInfo(){
if(mainFields == null || detailFields == null){
window.setTimeout(refreshTemplateFieldsInfo, 100);
return;
}
//更新隐藏域(字段新增、更新过名字、删除等)
var hiddenarea = jQuery("div#hiddenAttrDiv");
var nullfieldname = "$_$null$_$";
hiddenarea.find("input[name^=fieldattr]").not("[name^=fieldattr-]").attr("fieldname", nullfieldname);
var mfields = mainFields.tabValue;
for(var i=0; i<mfields.length; i++){
var fieldid = mfields[i].fieldid;
if(parseInt(fieldid) < 0) continue;
var fieldname = mfields[i].fieldname;
var fieldObj = hiddenarea.find("input#fieldattr"+fieldid);
if(fieldObj.size() == 0) //新增字段
appendAddFieldHiddenAttr(fieldid, fieldname, -1);
else
fieldObj.attr("fieldname", fieldname);
}
for(var detailkey in detailFields){
var detailindex = parseInt(detailkey.replace("detail_",""))-1;
var dfields = detailFields[detailkey];
for(var i=0; i<dfields.length; i++){
var fieldid = dfields[i].fieldid;
var fieldname = dfields[i].fieldname;
var fieldObj = hiddenarea.find("input#fieldattr"+fieldid);
if(fieldObj.size() == 0) //新增字段
appendAddFieldHiddenAttr(fieldid, fieldname, detailindex);
else
fieldObj.attr("fieldname", fieldname);
}
}
hiddenarea.find("input[name^=fieldattr][fieldname="+nullfieldname+"]").each(function(){
var delfieldid = jQuery(this).attr("name").replace("fieldattr", "");
hiddenarea.find("input#fieldattr"+delfieldid).remove();
hiddenarea.find("input#fieldsql"+delfieldid).remove();
hiddenarea.find("input#caltype"+delfieldid).remove();
hiddenarea.find("input#othertype"+delfieldid).remove();
hiddenarea.find("input#transtype"+delfieldid).remove();
hiddenarea.find("input#datasourceid"+delfieldid).remove();
jQuery("div.fieldlist").find("div#field_"+delfieldid).remove();
});
//更新字段单元格
var sheet = getCurrentSheet();
var dataobj = getCurrentDataObj();
sheet.isPaintSuspended(true);
for(var cellid in dataobj.ecs){ //刷新当前面板单元格字段名称
var cellobj = dataobj.ecs[cellid];
formOperate.refreshFieldCellTextImgFace(sheet, cellobj);
}
sheet.isPaintSuspended(false);
}
//扩充新增字段的隐藏域
function appendAddFieldHiddenAttr(addfieldid, fieldname, tableindex){
var hiddenDivObj = jQuery("#hiddenAttrDiv");
hiddenDivObj.append('<input type="hidden" id="fieldattr'+addfieldid+'" fieldname="'+fieldname+'" nodetype="'+tableindex+'" name="fieldattr'+addfieldid+'" value="0" />');
hiddenDivObj.append('<input type="hidden" id="fieldsql'+addfieldid+'" name="fieldsql'+addfieldid+'" value="" />');
hiddenDivObj.append('<input type="hidden" id="caltype'+addfieldid+'" name="caltype'+addfieldid+'" value="0" />');
hiddenDivObj.append('<input type="hidden" id="othertype'+addfieldid+'" name="othertype'+addfieldid+'" value="0" />');
hiddenDivObj.append('<input type="hidden" id="transtype'+addfieldid+'" name="transtype'+addfieldid+'" value="0" />');
hiddenDivObj.append('<input type="hidden" id="datasourceid'+addfieldid+'" name="datasourceid'+addfieldid+'" />');
var fieldlistObj = jQuery("div.fieldlist#labellist"+tableindex); //字段属性需要的对象
fieldlistObj.append('<div id="field_'+addfieldid+'" ondblclick="javascript:cool_webcontrollabel(this);">'+fieldname+'</div>');
}
// ***********************************************************************
// 函数名 :checkMaxLength(TD9084)
// 机能概要 :对指定字符串按字节长截取,超过时给出提示,超过部分去除
// 参数说明 :obj 输入框对象
// 注意:对象的maxlength、alt须设定,alt为信息内容
// 返回值 :
// ***********************************************************************
function checkMaxLength(obj){
var tmpvalue = obj.value;
if(!tmpvalue){
if($(obj).parent().find("img"))
$(obj).parent().find("img").show();
}else{
if($(obj).parent().find("img"))
$(obj).parent().find("img").hide();
}
var size = obj.maxLength;
if(realLength(tmpvalue) > size){
window.top.Dialog.alert(obj.alt);
while(true){
tmpvalue = tmpvalue.substring(0,tmpvalue.length-1);
if(realLength(tmpvalue)<=size){
obj.value = tmpvalue;
return;
}
}
}
}
/*
* Function: 取字符串字节长度 Document by by 2007-3-9
*/
function realLength(str) {
var j=0;
for (var i=0;i<=str.length-1;i++) {
j=j+1;
if ((str.charCodeAt(i))>127) {
j=j+1;
}
}
return j;
}
/**
* tableHead绑定click、初始化加载
*/
function operTableHead(){
$(".tableHead").children("div[name]").click(function(){
if($(this).is(".current"))
return;
$(".tableHead").children("div").removeClass("current");
$(this).addClass("current");
tabChangeExpend($(this).attr("name"));
});
//默认选择字段Tab
tabChangeExpend('mf');
}
/**
* tab切换事件
*/
function tabChangeExpend(obj_name){
jQuery("[name='searchVal']").val("");
var _tbody=$(".tableBody tbody");
if(obj_name === "mf"){
//避免mainFields异步未初始化完成
if(mainFields==null){
window.setTimeout(function(){
tabChangeExpend(obj_name);
},100);
return;
}
var _html=getMainFieldHtml(1);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
_tbody.find(".thead td").eq(0).text(SystemEnv.getHtmlNoteName(5216));
_tbody.find(".thead td").eq(1).text(SystemEnv.getHtmlNoteName(5217));
$(".addmf").show();
jQuery(".nodeMarkGroup").hide();
}else if(obj_name === "wn"){
//避免WfNodes异步未初始化完成
if(WfNodes==null){
window.setTimeout(function(){
tabChangeExpend(obj_name);
},100);
return;
}
jQuery(".nodeMarkGroup").show();
jQuery('select[name="markGroup"]').val("0");
jQuery("select[name='markGroup']").selectbox("change","0");
var _html=getNodeHtml(1);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
_tbody.find(".thead td").eq(0).text(SystemEnv.getHtmlNoteName(5218));
_tbody.find(".thead td").eq(1).text(SystemEnv.getHtmlNoteName(5219));
$(".addmf").hide();
}
addMiddleBorder();
bindTrEvent();
}
/**
* 搜索字段、节点
*/
function searchTable(){
var obj_name=$(".tableHead").find("div.current").attr("name");
var searchVal=$("[name='searchVal']").val();
if(searchVal.length>0){
searchVal=searchVal.toLowerCase();
}
var _tbody=$(".tableBody tbody");
if(obj_name==="mf"){
var _html=getMainFieldHtml(1,searchVal);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
}else if(obj_name==="wn"){
var _html=getNodeHtml(1,searchVal);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
}
addMiddleBorder();
bindTrEvent();
}
function changeMarkGroup(){
jQuery("[name='searchVal']").val("");
var value = jQuery('select[name="markGroup"]').val();
var _tbody=$(".tableBody tbody");
var _html = '';
if(value == 1){
_html=getNodeHtml(1,false,true);
jQuery(".tableSearch").hide();
} else {
_html=getNodeHtml(1);
jQuery(".tableSearch").show();
}
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
addMiddleBorder();
bindTrEvent();
}
/**
* tr绑定事件
*/
function bindTrEvent(){
//注册拖动、双击事件
$(".tableBody").find("table tr td").not(".thead td").find("a").draggable({
appendTo:"body",
helper:"clone",
cursor:"default",
zIndex:999999,
drag:function(e){
//拖动时,需要跟右键一样,寻找单元格准确位置
baseOperate.mouseLocateCellFace(e, "drag");
},
stop:function(e){
var targetid = "";
if($(this).attr("_fieldid"))
targetid |=$(this).attr("_fieldid");
if($(this).attr("_nodeid"))
targetid |= $(this).attr("_nodeid");
var flag = $(this).attr("_flag");
var _txt = $(this).text();
var _fieldtype,_fieldtypedetail;
if(flag === celltype.FCONTENT){
_fieldtype = $(this).attr("_fieldtype");
_fieldtypedetail = $(this).attr("_fieldtypedetail");
}
setExcelBxValue(e,targetid,flag,_txt,_fieldtype,_fieldtypedetail);
}
}).click(function(e){
var targetid = "";
if($(this).attr("_fieldid"))
targetid |=$(this).attr("_fieldid");
if($(this).attr("_nodeid"))
targetid |= $(this).attr("_nodeid");
var flag = $(this).attr("_flag");
var _txt = $(this).text();
var _fieldtype = $(this).attr("_fieldtype");
var _fieldtypedetail = $(this).attr("_fieldtypedetail");
setExcelBxValue(e,targetid,flag,_txt,_fieldtype,_fieldtypedetail);
});
var _multiLangConfig = [
{label:"<img src='/images/ecology8/simplized_wev8.png' style='vertical-align:middle;'/>",languageId:7,name:"zhcn"},
{label:"<img src='/images/ecology8/en_wev8.png' style='vertical-align:middle;'/>",languageId:8,name:"en"},
{label:"<img src='/images/ecology8/tranditional_wev8.png' style='vertical-align:middle;'/>",languageId:9,name:"twcn"}
];
$(".tableBody").find("table tr[name=_fieldtrinexceldesign]").hover(function(event){
$(".tableBody").find("table tr[name=_fieldtrinexceldesign]").removeClass("current");
$(".tableBody").find("table tr[name=_fieldtrinexceldesign]").children().find("div[name=editfieldImg]").remove();
var obj = this;
if(!$(obj).is(".current"))
$(obj).addClass("current");
var editimg = $("<div name=editfieldImg style=position:absolute;cursor:pointer;><img width=16 height=16 src='/workflow/exceldesign/image/rightBtn/edit2_wev8.png' ></div>");
$(this).children().eq(1).append(editimg);
var _ow = obj.offsetWidth;
var _oh = obj.offsetHeight;
editimg.css("top",($(obj).offset().top + (_oh/2-8))+"px");
editimg.css("left",($(obj).offset().left + _ow -24) +"px");
$(obj).attr("target","no");
editimg.on("click",function(){
$(obj).attr("target","on");
$(obj).addClass("current");
$("div[name=editfieldDiv]").find("[name=fieldid],#cnlabel,#enlabel,#twlabel").val("");
$("div[name=editfieldDiv]").show();
$(".tableBody").find("table tr[name=_fieldtrinexceldesign]").children().find("div[name=editfieldImg]").remove();
$("div[name=editfieldDiv]").css("top",(0-$(".tableBody").children("table").height())+"px");
$("div[name=editfieldDiv1]").css("height",($(".tableBody").children("table").height())+"px");
$("div[name=editfieldDiv]").find("div[name=editfieldCry]").css("top",(obj.offsetTop+obj.offsetHeight)+"px");
var formid=$("#formid").val();
var isbill = $("#isbill").val();
var fieldid = $(obj).children().eq(1).children("a").attr("_fieldid");
$("div[name=editfieldDiv]").find("[name=fieldid]").val(fieldid);
$.ajax({
url : "/workflow/exceldesign/excelGetFieldOperat.jsp",
type : "post",
data : {formid:formid,isbill:isbill,fieldid:fieldid,method:"getfield",isDetail:isDetail},
dataType:"JSON",
success : function do4Success(msg){
msg = jQuery.trim(msg);
if(!msg)return;
var result = JSON.parse(msg);
$("div[name=editfieldDiv]").find("#cnlabel").val(result._cn);
$("div[name=editfieldDiv]").find("#enlabel").val(result._en);
$("div[name=editfieldDiv]").find("#twlabel").val(result._tw);
}
});
});
},function(){
var obj = this;
if($(obj).attr("target") === "on") return;
$(obj).removeClass("current");
$(this).children().find("div[name=editfieldImg]").remove();
});
}
function saveEditFieldName(){
var formid=$("#formid").val();
var isbill=$("#isbill").val();
var _cn = $("div[name=editfieldDiv]").find("#cnlabel").val();
var _en = $("div[name=editfieldDiv]").find("#enlabel").val();
var _tw = $("div[name=editfieldDiv]").find("#twlabel").val();
var fieldid = $("div[name=editfieldDiv]").find("[name=fieldid]").val();
if(!_cn){ window.top.Dialog.alert("必要信息不完整!");return;}
$.ajax({
url : "/workflow/exceldesign/excelGetFieldOperat.jsp",
type : "post",
data : {formid:formid,isbill:isbill,fieldid:fieldid,method:"savefield",_cn:_cn,_en:_en,_tw:_tw},
dataType:"JSON",
success : function do4Success(msg){
msg = jQuery.trim(msg);
if(!msg) return;
jQuery("div[name=editfieldDiv]").hide();
jQuery(".tableBody").find("a[_flag='Fname'][_fieldid='"+fieldid+"'] span").text(_cn);
var FContentObj = jQuery(".tableBody").find("a[_flag='Fcontent'][_fieldid='"+fieldid+"']");
FContentObj.attr("title",_cn+"(ID:"+fieldid+")");
FContentObj.find("span").text(_cn);
if(isDetail === "on"){
jQuery(".tableBody").find("tr[name='_sumfield']").find("a[_fieldid='"+fieldid+"']").text(_cn+"(合计)");
jQuery("input#fieldattr"+fieldid, parentWin_Main.document).attr("fieldname", _cn);
//解决字段名称编辑后-返回-再打开名称未被修改Bug
parentWin_Main.detailFields=null;
parentWin_Main.initGlobalData();
}else{
jQuery("input#fieldattr"+fieldid).attr("fieldname", _cn);
}
var dataobj = getCurrentDataObj();
var sheet = getCurrentSheet();
if(dataobj && dataobj.ecs){
for(var cellid in dataobj.ecs){
var cellobj = dataobj.ecs[cellid];
if(cellobj.efieldid+"" === fieldid+""){
var ar = cellobj.id.split(",")[0];
var ac = cellobj.id.split(",")[1];
if(cellobj.etype === celltype.FNAME || cellobj.etype === celltype.FCONTENT){
if(cellobj.etype === celltype.FCONTENT && cellobj.formula)
sheet.getCell(ar, ac, $.wijmo.wijspread.SheetArea.viewport).value(_cn+" (fx)");
else
sheet.getCell(ar, ac, $.wijmo.wijspread.SheetArea.viewport).value(_cn);
}else if(isDetail === "on" && (cellobj.etype === celltype.SUMFNAME || cellobj.etype === celltype.SUMFCONTENT)){
sheet.getCell(ar, ac, $.wijmo.wijspread.SheetArea.viewport).value(_cn+"(合计)");
}
}
}
}
}
});
}
function cancelEditFieldName(){
$("div[name=editfieldDiv]").hide();
}
/**
* 解析JSON,拼接主字段的html
* @param {} flag 1为右侧选择框;2为单元格下拉字段名;3为单元格下拉表单内容
* @param {} fieltVal 过滤值
*/
function getMainFieldHtml(flag,filterVal){
var _html='';
var j=0;
var tabValue=mainFields.tabValue;
for(var i=0;i<tabValue.length;i++){
var fieldid=tabValue[i].fieldid;
var fieldname=tabValue[i].fieldname;
var fieldnamepy=tabValue[i].fieldnamepy;
var fieldtype=tabValue[i].fieldtype;
var fieldtypedetail=tabValue[i].fieldtypedetail;
if(!!filterVal){
if(fieldname.toLowerCase().indexOf(filterVal)==-1&&fieldnamepy.toLowerCase().indexOf(filterVal)==-1){
continue;
}
}
if(flag===1){
var havecss1 = "";
if(fieldAttrHaveMap["Fname+"+fieldid] === "1")
havecss1 = "style=\"color:#aeaeae;\"";
var havecss2 = "";
if(fieldAttrHaveMap["Fcontent+"+fieldid] === "1")
havecss2 = "style=\"color:#aeaeae;\"";
if(fieldid>0)
_html += '<tr name="_fieldtrinexceldesign"><td class="rightBorder">';
else
_html += '<tr><td class="rightBorder">';
_html += '<a _flag="Fname" '+havecss1+' _fieldid="'+fieldid+'">';
_html += '<span>'+fieldname+'</span></a></td>';
_html += '<td><a _flag="Fcontent" '+havecss2+' _fieldid="'+fieldid+'" title="'+fieldname+'(ID:'+fieldid+')" _fieldtype="'+fieldtype+'" _fieldtypedetail="'+fieldtypedetail+'">';
_html += '<span>'+fieldname+'</span></a></td>';
_html += '</tr>';
}else{
j++;
if(j===9) break;
var className=(j%2==1?"ac_even":"ac_odd");
var _flag='';
if(flag===2) _flag="Fname";
if(flag===3) _flag="Fcontent";
_html += '<li class="'+className+'" title="'+fieldname+'" _flag="'+_flag+'" _fieldid="'+fieldid+'"';
if(flag===3)
_html += ' _fieldtype="'+fieldtype+'" _fieldtypedetail="'+fieldtypedetail+'"'
_html += ">"+fieldname+'</li>';
}
}
return _html;
}
/**
* 解析JSON,拼接节点的html
* @param {} flag 1为右侧选择框;2为单元格下拉节点名称;3为单元格下拉流转意见
* @param {} fieltVal 过滤值
*/
function getNodeHtml(flag,filterVal,markGroup){
var _html='';
var j=0;
var nodes=WfNodes.nodes;
for(var i=0;i<nodes.length;i++){
var nodeid=nodes[i].nodeid;
var nodename=nodes[i].nodename;
var nodenamepy=nodes[i].nodenamepy;
var nodenameSign=nodes[i].nodenameSign;
if(!!filterVal){
if(nodename.toLowerCase().indexOf(filterVal)==-1&&nodenamepy.toLowerCase().indexOf(filterVal)==-1){
continue;
}
}
var belongGroup = nodeid == "-1" || nodeid == "-2" || nodeid == "-3";
if((!markGroup && belongGroup) || (markGroup && !belongGroup))
continue;
if(nodenameSign === undefined){
nodenameSign = nodename;
}
if(flag===1){
var havecss1 = "";
var havecss2 = "";
if(fieldAttrHaveMap["Nname+"+nodeid] === "1")
havecss1 = "style=\"color:#aeaeae;\"";
if(fieldAttrHaveMap["Nadvice+"+nodeid] === "1")
havecss2 = "style=\"color:#aeaeae;\"";
_html += '<tr><td class="rightBorder">';
_html += '<a _flag="Nname" '+havecss1+' _nodeid="'+nodeid+'">'+nodename+'</a></td>';
_html += '<td><a _flag="Nadvice" '+havecss2+' _nodeid="'+nodeid+'">'+nodenameSign+'</a></td>';
_html += '</tr>';
}else{
j++;
if(j===9) break;
var className=(j%2==1?"ac_even":"ac_odd");
var _flag='';
if(flag===2) _flag="Nname";
if(flag===3) _flag="Nadvice";
_html += '<li class="'+className+'" title="'+nodename+'" _flag="'+_flag+'" _nodeid="'+nodeid+'">';
_html += nodename+'</li>';
}
}
return _html;
}
/**
* 设置字段属性(0:不显示,1:显示,2:可编辑,3:必填)
*/
function setFieldAttr(fieldid,fieldattr){
if(isDetail === "on")
$("#fieldattr"+fieldid, parentWin_Main.document).val(fieldattr);
else
$("#fieldattr"+fieldid).val(fieldattr);
}
function resetFieldAttrHaveMap(){
if(!!fieldAttrHaveMap){
fieldAttrHaveMap = {};
$(".tableBody").find("a[_flag=Fname],a[_flag=Fcontent],a[_flag=Nname],a[_flag=Nadvice]").removeAttr("style");
$("input[id^=fieldattr]").removeAttr("havefname").removeAttr("havefcontent");
}
}
function setFieldAttrHave(fieldid,type,ishave){
if(type === celltype.FNAME || type === celltype.FCONTENT || type === celltype.SUMFNAME || type === celltype.SUMFCONTENT){
var _fieldattrObj = $("#fieldattr"+fieldid);
if(isDetail === "on")
_fieldattrObj = $("#fieldattr"+fieldid, parentWin_Main.document);
var _fieldObj = $("[_flag="+type+"][_fieldid="+fieldid+"]");
if(ishave == 0){
_fieldattrObj.removeAttr("have"+type);
if(type === celltype.SUMFNAME || type === celltype.SUMFCONTENT)
_fieldObj.css("color","#ff0000");
else
_fieldObj.css("color","#464646");
delete fieldAttrHaveMap[type+"+"+fieldid];
}else if(ishave == 1){
_fieldattrObj.attr("have"+type, ishave);
if(type === celltype.SUMFNAME || type === celltype.SUMFCONTENT)
_fieldObj.css("color","#ffa6a1");
else
_fieldObj.css("color","#aeaeae");
fieldAttrHaveMap[type+"+"+fieldid] = "1";
}
}else if(type === celltype.NNAME || type === celltype.NADVICE){
var _nodeObj = $("[_flag="+type+"][_nodeid="+fieldid+"]");
if(ishave == 0){
_nodeObj.css("color","#464646").removeAttr("have"+type);
delete fieldAttrHaveMap[type+"+"+fieldid];
}else if(ishave == 1){
var belongGroup = fieldid == "-1" || fieldid == "-2" || fieldid == "-3";
if(belongGroup){
_nodeObj.css("color","#aeaeae").attr("have"+type,ishave);
fieldAttrHaveMap[type+"+"+fieldid] = "1";
}
}
}
}
function getFieldAttrHave(fieldid, type){
if(type === celltype.FNAME || type === celltype.FCONTENT || type === celltype.SUMFNAME || type === celltype.SUMFCONTENT){
var _fieldattrObj = $("#fieldattr"+fieldid);
if(isDetail === "on")
_fieldattrObj = $("#fieldattr"+fieldid, parentWin_Main.document);
return _fieldattrObj.attr("have"+type);
}else if(type === celltype.NNAME || type === celltype.NADVICE){
var key = type+"+"+fieldid;
return key in fieldAttrHaveMap ? fieldAttrHaveMap[key] : 0;
}
}
function judgeFieldExist(fieldid){
if(isDetail === "on"){
if($("#hiddenAttrDiv #fieldattr"+fieldid, parentWin_Main.document).size() > 0)
return true;
}else{
if($("#hiddenAttrDiv #fieldattr"+fieldid).size() > 0)
return true;
}
return false;
}
function getFieldName(fieldid){
if(isDetail === "on"){
return $("#fieldattr"+fieldid, parentWin_Main.document).attr("fieldname");
}else{
return $("#fieldattr"+fieldid).attr("fieldname");
}
}
/**
* 获取隐藏域字段属性(0:不显示,1:显示,2:可编辑,3:必填)
*/
function getFieldAttr(fieldid){
if(isDetail === "on"){
return $("#fieldattr"+fieldid, parentWin_Main.document).val();
}else{
return $("#fieldattr"+fieldid).val();
}
}
/**
* 获取字段禁止手动编辑属性
*/
function getFieldOnlyShowAttr(fieldid){
if(isDetail === "on"){
return $("#fieldonlyshow"+fieldid, parentWin_Main.document).val();
}else{
return $("#fieldonlyshow"+fieldid).val();
}
}
/**
* 隐藏域get/set方法
*/
function getDataJson(){
return $("#datajson").text();
}
/**
* 隐藏域get/set方法
*/
function getDataJsonFormula(){
return $("#datajsonFormula").text();
}
function getSingInputJson(){
return $("#signInputJson").text();
}
function getSheetJson(){
return $("#pluginjson").text();
}
function getDetailNum(){
return $("#detailnum").val();
}
function setCodeHtml(scripts){
$("#scripts").val(scripts);
}
function getCodeHtml(){
return $("#scripts").val();
}
/**
* 表单提交后台保存
*/
function saveLayout(){
if(wfinfo.layouttype === "0" && wfinfo.isactive === "1"){
//将模板中不存在的字段属性全部置为不显示
jQuery("#hiddenAttrDiv").find("[id^=fieldattr]").each(function(){
var nodetype = parseInt($(this).attr("nodetype"));
if($(this).val() !== "0"){
if(nodetype === -1){ //主表字段根据隐藏域属性判断
if($(this).attr("havefcontent") != "1")
$(this).val("0");
}else{ //明细表可能未打开就保存,故从缓存判断
var detail_symbol = "detail_"+(nodetype+1);
if(globalData.hasCache(detail_symbol)){
var detail_datajson_str = globalData.getCacheValue(detail_symbol);
var field_str = "\"etype\":\"3\",\"field\":\""+$(this).attr("id").replace("fieldattr","")+"\"";
if(detail_datajson_str.indexOf(field_str) == -1)
$(this).val("0");
}else{
$(this).val("0");
}
}
}
});
//明细表未放在模板中,取消勾选允许新增明细/必须新增明细等配置项
jQuery("input[type='hidden'][name^=detailgroupattr]").each(function(){
var detail_idx = jQuery(this).attr("name").replace("detailgroupattr","");
var detail_symbol = "detail_"+(parseInt(detail_idx)+1);
if(!globalData.hasCache(detail_symbol)){
var new_val = jQuery(this).val().replaceAll("1", "0");
jQuery(this).val(new_val);
}
});
}
$("#LayoutForm").attr("action","excelLayoutSave.jsp?operation=saveExcel").attr("target","_self").attr("enctype","multipart/form-data");
$("#LayoutForm").submit();
}
/**
* 表单预览功能
*/
function preViewLayout(){
$("#LayoutForm").attr("action","excelPreView.jsp").attr("target","_blank");
$("#LayoutForm").submit();
}
/*********明细表右侧属性页面引用的JS***********/
/**
* 明细表加载字段
*/
function loadDetailTable(idx){
var _tbody=$(".tableBody tbody");
//避免detailFields异步未初始化完成
if(parentWin_Main.detailFields==null){
window.setTimeout(function(){
loadDetailTable(idx);
},100);
return;
}
var _html=getDetailFieldHtml(1,'',idx);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
addMiddleBorder();
bindTrEvent();
}
/**
* 搜索明细表字段
*/
function searchDetailTable(idx){
var searchVal=$("[name='searchVal']").val();
if(searchVal.length>0){
searchVal=searchVal.toLowerCase();
}
var _tbody=$(".tableBody tbody");
var _html=getDetailFieldHtml(1,searchVal,idx);
_tbody.find("tr[class!='thead']").remove();
_tbody.append(_html);
addMiddleBorder();
bindTrEvent();
}
/**
* 添加属性table的中间线
*/
function addMiddleBorder(){
if($(".tableBody table").height()<$(".tableBody").height()){
var diff=$(".tableBody").height()-$(".tableBody table").height();
$(".tableBody table").append('<tr style="height:'+diff+'px"><td class="rightBorder"></td><td></td></tr>');
}
}
/**
* 解析JSON,拼接对应明细字段的html
* @param {} flag 1为右侧选择框;2为单元格下拉字段名;3为单元格下拉表单内容
* @param {} fieltVal 过滤值
* @param {} detailIndex 所属明细表,从1开始
*/
function getDetailFieldHtml(flag,filterVal,detailIndex){
var _html='';
var j=0;
var detailValue=parentWin_Main.detailFields["detail_"+detailIndex];
for(var i=0;i<detailValue.length;i++){
var fieldid=detailValue[i].fieldid;
var fieldname=detailValue[i].fieldname;
var fieldnamepy=detailValue[i].fieldnamepy;
var fieldtype=detailValue[i].fieldtype;
var fieldtypedetail=detailValue[i].fieldtypedetail;
if(!!filterVal){
if(fieldname.toLowerCase().indexOf(filterVal)==-1&&fieldnamepy.toLowerCase().indexOf(filterVal)==-1){
continue;
}
}
if(flag===1){
var _fieldattrobj = $("#fieldattr"+fieldid, parentWin_Main.document);
var havecss1 = "";
if(fieldAttrHaveMap["Fname+"+fieldid] === "1")
havecss1 = "style=\"color:#aeaeae;\"";
else //解决明细未点返回保存,而是点关闭按钮后,隐藏域里的属性任然在的问题
_fieldattrobj.removeAttr("haveFname");
var havecss2 = "";
if(fieldAttrHaveMap["Fcontent+"+fieldid] === "1")
havecss2 = "style=\"color:#aeaeae;\"";
else
_fieldattrobj.removeAttr("haveFcontent");
_html += '<tr name="_fieldtrinexceldesign"><td class="rightBorder">';
_html += '<a _flag="Fname" '+havecss1+' _fieldid="'+fieldid+'">';
_html += '<span>'+fieldname+'</span></a></td>';
_html += '<td><a _flag="Fcontent" '+havecss2+' _fieldid="'+fieldid+'" title="'+fieldname+'(ID:'+fieldid+')" _fieldtype="'+fieldtype+'" _fieldtypedetail="'+fieldtypedetail+'">';
_html += '<span>'+fieldname+'</span></a></td>';
_html += '</tr>';
//生成合计字段TR
var issumfield = detailValue[i].issumfield;
if(!!issumfield && issumfield == "y"){
var color1 = "#ff0000";
if(fieldAttrHaveMap["SumFname+"+fieldid] === "1")
color1 = "#ffa6a1";
else
_fieldattrobj.removeAttr("haveSumFname");
var color2 = "#ff0000";
if(fieldAttrHaveMap["SumFcontent+"+fieldid] === "1")
color2 = "#ffa6a1";
else
_fieldattrobj.removeAttr("haveSumFcontent");
_html += '<tr name="_sumfield" class="belSeniorSet" ';
if(!detailOperate.hasOpenSeniorSet())
_html += ' style="display:none" ';
_html += '><td class="rightBorder">';
_html += '<a _flag="SumFname" class="hoverred" style="color:'+color1+';" _fieldid="'+fieldid+'">'+fieldname+'(合计)</a></td>';
_html += '<td><a _flag="SumFcontent" class="hoverred" style="color:'+color2+';" _fieldid="'+fieldid+'">'+fieldname+'(合计)</a></td>';
_html += '</tr>';
}
}else{
j++;
if(j===9) break;
var className=(j%2==1?"ac_even":"ac_odd");
var _flag='';
if(flag===2) _flag="Fname";
if(flag===3) _flag="Fcontent";
_html += '<li class="'+className+'" title="'+fieldname+'" _flag="'+_flag+'" _fieldid="'+fieldid+'"';
if(flag===3)
_html += ' _fieldtype="'+fieldtype+'" _fieldtypedetail="'+fieldtypedetail+'"';
_html += ">"+fieldname+'</li>';
}
}
return _html;
}
/**
* 返回时获得明细权限
*/
function getGroupAttr(){
var groupattr="";
if($("#dtladd").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtledit").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtldel").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlhide").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtldef").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlned").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlmul").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlprintserial").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlallowscroll").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlpagingshow").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlmobileallowscroll").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if($("#dtlmobilecardedit").attr("checked")){
groupattr += "1";
}else{
groupattr += "0";
}
if(!!$("#dtl_defrow").val()){
groupattr += "*"+$("#dtl_defrow").val();
}else{
groupattr += "*0";
}
return groupattr;
}
function onNotEdit(obj){
if($(obj).is(":checked"))
$(".excelHeadContent").find("div[name=canwrite],div[name=required]").addClass("shortBtn_disabled").removeClass("shortBtn");
else
$(".excelHeadContent").find("div[name=canwrite],div[name=required]").addClass("shortBtn").removeClass("shortBtn_disabled");
}
function changeInputState(obj,inputName){
var inputobj=$("input[name='"+inputName+"']");
if(obj.checked){
inputobj.attr("disabled",false);
}else{
inputobj.attr("disabled",true);
}
}
function checkChange(){
var obj=$("#dtladd")
if(obj.attr("checked")){
jQuery("[name=dtlned]").attr("disabled",false).next().removeClass("jNiceCheckbox_disabled").addClass("jNiceCheckbox");
jQuery("[name=dtlmul]").attr("disabled",false).next().removeClass("jNiceCheckbox_disabled").addClass("jNiceCheckbox");
}else{
jQuery("[name=dtlned]").attr("disabled",true).attr("checked",false).next().removeClass("jNiceCheckbox").removeClass("jNiceChecked").addClass("jNiceCheckbox_disabled");
jQuery("[name=dtlmul]").attr("disabled",true).attr("checked",false).next().removeClass("jNiceCheckbox").removeClass("jNiceChecked").addClass("jNiceCheckbox_disabled");
}
}
function linkhelp(){
var url = "http://www.e-cology.com.cn/formmode/apps/ktree/viewdocument.jsp?newDate=1432796806228&versionid=1&functionid=20837&tabid=2";
window.open(url);
}
//Input只能输入数字
function ItemCount_KeyPress() {
var evt = getEvent();
var keyCode = evt.which ? evt.which : evt.keyCode;
if(!((keyCode>=48) && (keyCode<=57))){
if(evt.keyCode){
evt.keyCode = 0;evt.returnValue=false;
} else {
evt.which = 0;evt.preventDefault();
}
}
}
function getEvent() {
if (window.ActiveXObject) {
return window.event;// 如果是ie
}
func = getEvent.caller;
while (func != null) {
var arg0 = func.arguments[0];
if (arg0) {
if ((arg0.constructor == Event || arg0.constructor == MouseEvent)
|| (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
return arg0;
}
}
func = func.caller;
}
return null;
}
function checkRequired(obj,spanid){
var tmpvalue = obj.value;
while(tmpvalue.indexOf(" ") >= 0){
tmpvalue = tmpvalue.replace(" ", "");
}
if(tmpvalue != ""){
while(tmpvalue.indexOf("\r\n") >= 0){
tmpvalue = tmpvalue.replace("\r\n", "");
}
if(tmpvalue != ""){
$(obj).siblings("#"+spanid).html("");
}else{
$(obj).siblings("#"+spanid).html("<IMG src='/images/BacoError_wev8.gif' align=absMiddle>");
}
}else{
$(obj).siblings("#"+spanid).html("<IMG src='/images/BacoError_wev8.gif' align=absMiddle>");
}
}