productionScheduleTree.js
73.8 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
/* eslint-disable */
/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
import React, { Component } from 'react';
import { DownOutlined, LoadingOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
import { Form, Icon } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import { Modal, Layout, Spin, Card, Row, Col, message, Tree, Switch, Pagination } from 'antd-v4'; // Switch Select, Tabs,
import styles from '@/index.less';
import selfstyles from '@/components/productionMainPlan/index.less';
import * as commonFunc from '@/components/Common/commonFunc';
import CommonBase from '@/components/Common/CommonBase';
import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
import CommonProductionPlanTreeEvent from '@/components/Common/CommonProductionPlanTreeEvent';
import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
import MoveUp from '@/assets/processUp.svg';
import MoveDown from '@/assets/processDown.svg';
import DisableMoveUp from '@/assets/disableprocessUp.svg';
import DisableMoveDown from '@/assets/disableprocessDown.svg';
import MoveTop from '@/assets/processTop.svg';
import DisableMoveTop from '@/assets/disableprocessTop.svg';
import MoveBottom from '@/assets/processBottom.svg';
import DisableMoveBottom from '@/assets/disableprocessBottom.svg';
import ChangeMachine from '@/assets/plan/change.png';
import DisableChangeMachine from '@/assets/plan/change_1.png';
import SetSave from '@/assets/plan/save.png';
import DisableSetSave from '@/assets/plan/save_1.png';
import SetLock from '@/assets/plan/lock.png';
import DisableSetLock from '@/assets/plan/lock_1.png';
import SetOverExec from '@/assets/plan/over.png';
import DisableSetOverExec from '@/assets/plan/over_1.png';
import ShowGantt from '@/assets/gantt.svg';
import DisableShowGantt from '@/assets/disablegantt.svg';
import ShowCheckModel from '@/assets/plan/check.png';
import DisableShowCheckModel from '@/assets/plan/check_1.png';
import ShowTimer from '@/assets/plan/cal.png';
import DisableShowTimer from '@/assets/plan/cal_1.png';
import ShowList from '@/assets/list.svg';
import DisableShowList from '@/assets/disablelist.svg';
import Reset from '@/assets/reset.svg';
import DisableReset from '@/assets/disablereset.svg';
import * as commonUtils from '@/utils/utils';
import ShowType from '@/components/Common/CommonComponent';
import commonConfig from '@/utils/config';
import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
import Gantt from '@/components/Charts/Gantt';
import * as commonServices from '@/services/services';
import CommonListSelect from '@/components/Common/CommonListSelect';
import SearchComponent from '@/components/Common/SearchComponent';
import tab from '@/routes/tab/tab';
import GanttStyles from './index.less';
import moment from 'moment';
const { TreeNode } = Tree;
const { Header, Content, Sider } = Layout;
class ProductionSchedule extends Component {
constructor(props) {
super(props);
this.state = {
isRender: 0,
treeData: [],
pageSize: 20,
pageNum: 1,
expandAll: true,
expandedTreeKeys: [],
checkModelStatus: false,
defaultKey: 'unset',
slideFlag: localStorage.getItem('treeSlide_' + this.props.sModelsId) ? +localStorage.getItem('treeSlide_' + this.props.sModelsId) : 0,
};
this.treeDiv = null;
this.requested = false
this.bMachine = false;
if (props && props.app && props.app.currentPane && props.app.currentPane.copyTo && props.app.currentPane.copyTo.sWorkCenterName) {
this.bMachine = true
}
this.showSetMachine = false;
this.form = {};
}
componentWillReceiveProps(props) {
if (props.slaveInfoSelectedRowKeys && props.slaveSelectedData && (props.slaveInfoSelectedRowKeys.length || props.slaveSelectedData.length)) {
this.showSetMachine = true;
} else {
this.showSetMachine = false;
}
if (props.app && props.app.currentPane && props.app.currentPane.copyTo && props.app.currentPane.copyTo.treeKey) {
if (this.state.defaultKey === 'unset') {
this.setState({
defaultKey: [props.app.currentPane.copyTo.treeKey]
});
}
}
if (Array.isArray(this.state.defaultKey) && props.treeData.length && props.app.currentPane.copyTo.treeKey && !this.requested) {
let selectedItem = '';
props.treeData.forEach(item => {
if (item.children) {
item.children.forEach(item2 => {
if (item2.sId + item2.sWorkCenterId == props.app.currentPane.copyTo.treeKey) {
selectedItem = item2;
}
})
}
})
this.handleTabsCallback(selectedItem);
this.requested = true;
}
if (this.state.expandedTreeKeys.length === 0 && this.state.expandAll) {
const arr = [];
props.treeData.forEach((item) => {
arr.push(item.sId + item.sWorkCenterId);
});
this.setState({
expandedTreeKeys: arr,
});
}
}
shouldComponentUpdate(nextProps) {
const { slaveColumn, masterConfig } = nextProps;
return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
}
onDoubleClick = (name, record) => {
if (this.props.onDoubleClick !== undefined) {
this.props.onDoubleClick(record);
}
};
onRowClick = (name, record, bRowClick) => {
const { slaveData } = this.props;
let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
if (name === 'slave') {
if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
const keys = [];
keys.push(record.sSlaveId);
slaveSelectedRowKeys = keys;
const sIds = record.sSlaveId.split('-');
slaveInfoSelectedRowKeys.push(...sIds);
} else {
const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
if (indexKey === -1) {
slaveSelectedRowKeys.push(record.sSlaveId);
const sIds = record.sSlaveId.split('-');
slaveInfoSelectedRowKeys.push(...sIds);
sIds.forEach((item) => {
const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
if (iIndex === -1) {
slaveInfoSelectedRowKeys.push(item);
}
});
} else if (indexKey !== -1) {
if (!bRowClick) {
slaveSelectedRowKeys.splice(indexKey, 1);
}
const sIds = record.sSlaveId.split('-');
sIds.forEach((item) => {
const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
if (!bRowClick) {
slaveInfoSelectedRowKeys.splice(index, 1);
}
});
}
}
} else if (name === 'slaveInfo') {
if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
const keys = [];
keys.push(record.sId);
slaveInfoSelectedRowKeys = keys;
const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
if (commonUtils.isNotEmptyArr(slaveDataNews)) {
slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
}
} else {
const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
if (indexKey === -1) {
slaveInfoSelectedRowKeys.push(record.sId);
const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
if (commonUtils.isNotEmptyArr(slaveDataNews)) {
const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
if (iIndex === -1) {
slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
}
}
} else if (indexKey !== -1) {
slaveInfoSelectedRowKeys.splice(indexKey, 1);
const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
if (commonUtils.isNotEmptyArr(slaveDataNews)) {
const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
slaveSelectedRowKeys.splice(iIndex, 1);
} else {
let bdel = true;
for (const sId of sSlaveIds) {
if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
bdel = false;
break;
}
}
if (bdel) {
const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
slaveSelectedRowKeys.splice(iIndex, 1);
}
}
}
}
}
}
let machineEnabled = false;
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
if (processSlave.length === slaveSelectedRowKeys.length) {
machineEnabled = true;
}
}
const { sModelsId } = this.props;
commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
commonUtils.setStoreDropDownData(sModelsId, 'master', 'sWorkCenterId', []);
this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
};
onRowMouseEnter= (name, record) => { // recor
if (this.timerSelectRowChange) {
clearTimeout(this.timerSelectRowChange);
}
this.timerSelectRowChange = setTimeout(() => {
this.props.onSaveState({
rowHoverSid: record.sSlaveId,
});
// console.log('=====record', record);
// this.handleSelectRowChange(this.props.name, [record[this.rowKey]]);
}, 150);
}
onRowMouseLeave= () => {
if (this.timerSelectRowChange) {
this.props.onSaveState({
rowHoverSid: '',
});
clearTimeout(this.timerSelectRowChange);
}
}
onCloseChangeMachine = () => {
const { masterData } = this.props;
delete masterData.tStartDate;
delete masterData.iSplitNum;
delete masterData.bSplit;
this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sWorkCenterId: '', sMachineId: '', sTeamId: '' } });
}
onPageChange = (pageNum) => {
this.setState({
pageNum,
});
}
onTableSelectRowChange = (name, selectedRowKeys) => {
const { slaveData, slaveSelectedRowKeys, slaveInfoConfig } = this.props;
if (name === 'slave') {
const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
const slaveInfoSelectedRowKeys = [];
/* 找到勾选掉的Id */
let oldSelectRowkeys = []; /* 取消勾选行 */
if(commonUtils.isEmptyObject(slaveInfoConfig) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
oldSelectRowkeys = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item)); // 历史数据中删除的数据
if(commonUtils.isNotEmptyArr(oldSelectRowkeys) ) { /* 单层表格时 */
oldSelectRowkeys.forEach((oldSelectRowkey) => {
if(commonUtils.isNotEmptyObject(oldSelectRowkey) && oldSelectRowkey.includes('sDivRow')) { /* 找到勾选掉的sDivRow汇总行 */
const slaveRemoveData = slaveData.filter(item => item.sDivRowParentId === oldSelectRowkey);
if(commonUtils.isNotEmptyArr(slaveRemoveData)) {
slaveRemoveData.forEach((itemChild) => {
const indexKey = selectedRowKeys.indexOf(itemChild.sSlaveId);
if(indexKey > -1) {
selectedRowKeys.splice(indexKey, 1);
}
});
}
} else {
const indexKey = selectedRowKeys.indexOf(oldSelectRowkey);
if(indexKey > -1) {
selectedRowKeys.splice(indexKey, 1);
}
}
});
}
}
if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
selectedRowKeys.forEach((selectedRow) => {
const sIds = selectedRow.split('-');
slaveInfoSelectedRowKeys.push(...sIds);
if (commonUtils.isEmptyObject(slaveInfoConfig) && commonUtils.isEmptyArr(oldSelectRowkeys)) { /* 单层结构 sDivRow控制 */
if (commonUtils.isNotEmptyObject(selectedRow) && selectedRow.includes('sDivRow')) {
const slaveChildData = slaveData.filter(item => item.sDivRowParentId === selectedRow);
if (commonUtils.isNotEmptyArr(slaveChildData)) {
slaveChildData.forEach((itemChild) => {
const indexKey = selectedRowKeys.indexOf(itemChild.sSlaveId);
if (indexKey === -1) {
selectedRowKeys.push(itemChild.sSlaveId);
}
});
}
}
}
});
}
addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
addState.slaveSelectedRowKeys = selectedRowKeys;
this.props.onSaveState({ ...addState });
} else {
this.props.onTableSelectRowChange(name, selectedRowKeys);
}
// let record = {};
// let key;
// if (name === 'slave') {
// if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length === 1) {
// key = selectedRowKeys[0];
// } else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveSelectedRowKeys.length === 1) {
// key = slaveSelectedRowKeys[0];
// } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length > slaveSelectedRowKeys.length) {
// key = selectedRowKeys.filter(item => !slaveSelectedRowKeys.includes(item))[0];
// } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length < slaveSelectedRowKeys.length) {
// key = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
// }
// record = tableData.filter(item => key === item.sSlaveId)[0];
// this.onRowClick(name, record);
// } else if (name === 'slaveInfo') {
// if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length === 1) {
// key = selectedRowKeys[0];
// } else if (commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveInfoSelectedRowKeys.length === 1) {
// key = slaveInfoSelectedRowKeys[0];
// } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length > slaveInfoSelectedRowKeys.length) {
// key = selectedRowKeys.filter(item => !slaveInfoSelectedRowKeys.includes(item))[0];
// } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length < slaveInfoSelectedRowKeys.length) {
// key = slaveInfoSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
// }
// record = tableData.filter(item => key === item.sId)[0];
// this.onRowClick(name, record);
// } else {
// this.props.onTableSelectRowChange(name, selectedRowKeys);
// }
};
onTreeExpandChange = () => {
const oldState = this.state.expandAll;
const arr = [];
if (!oldState) {
this.props.treeData.forEach((item) => {
arr.push(item.sId + item.sProcessId + item.iOrder);
});
}
this.setState({
expandAll: !oldState,
expandedTreeKeys: arr,
});
}
onTreeExpand = (e) => {
this.setState({
expandedTreeKeys: e,
});
}
/** 处理选择行发生改变s */
handleTableFilterData = (name, data, record) => {
/* 外置处理业务 */
if (name === 'slave') {
let slaveInfoDataNew = [];
if (commonUtils.isNotEmptyArr(data)) {
slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
}
return slaveInfoDataNew;
}
};
// 根据配置解析拼接具体参数
handleProParams = (sKey, arr) => {
const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
if (commonUtils.isNotEmptyArr(keyData)) {
const addState = {};
addState.key = sKey;
const val = [];
keyData.forEach((currData) => {
const currVal = {};
arr.forEach((filed) => {
currVal[`${filed}`] = currData[`${filed}`];
});
val.push(currVal);
});
addState.value = val;
return addState;
} else {
return undefined;
}
};
/* 甘特图数据改变出发事件 */
logDataUpdate = (type, action, item, id) => {
const { charGanttData } = this.props;
/* 记录更新的数据 */
if (action === 'update') {
if (commonUtils.isNotEmptyArr(charGanttData)) {
const { data } = charGanttData;
if (commonUtils.isNotEmptyArr(data) && data.length > 0) {
const iIndex = data.findIndex(child => child.id === id);
if (iIndex > -1) {
if (commonUtils.isNotEmptyObject(item.start_date)) {
data[iIndex].start_date = item.start_date;
}
if (commonUtils.isNotEmptyObject(item.end_date)) {
data[iIndex].end_date = item.end_date;
}
charGanttData.tasks.data = data;
this.props.onSaveState({ charGanttData });
}
}
}
}
const text = item && item.text ? ` (${item.text})` : '';
let message = `${type} ${action}: ${id} ${text}`;
if (type === 'link' && action !== 'delete') {
message += ` ( source: ${item.source}, target: ${item.target} )`;
}
this.addMessage(message);
}
logTaskUpdate = (id, mode, task) => {
const text = task && task.text ? ` (${task.text})` : '';
const message = `Task ${mode}: ${id} ${text}`;
this.addMessage(message);
}
logLinkUpdate = (id, mode, link) => {
let message = `Link ${mode}: ${id}`;
if (link) {
message += ` ( source: ${link.source}, target: ${link.target} )`;
this.addMessage(message);
}
}
addMessage = (message) => {
const maxLogLength = 5;
const newMessate = { message };
const messages = [
];
messages.push(newMessate);
if (messages.length > maxLogLength) {
messages.length = maxLogLength;
}
this.props.onSaveState({ messages });
}
sortData = (tempData) => {
tempData.sort((g1, g2) => {
return g1.iOrder - g2.iOrder;
});
return tempData;
};
/* 控制排序 */
orderData = (e, name, type) => {
const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
let { [`${name}Data`]: currentData } = this.props;
if (name === 'slave') {
if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
return;
}
if (commonUtils.isEmptyArr(currentData)) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
return;
}
const tempData = [];
for (const sId of tableselectedRowKeys) {
let index = 0;
const tableDataIndex = currentData.findIndex(item => item.sId === sId);
if (tableDataIndex > -1) {
const tableDataRow = JSON.parse(JSON.stringify(currentData[tableDataIndex]));
if(commonUtils.isNotEmptyObject(tableDataRow)) {
const iSelectedOrder = tableDataRow.iOrder + index + 100;
const row = {...tableDataRow, iSelectedOrder : iSelectedOrder }
tempData.push(row);
}
}
index +=1;
}
const tempNew = commonUtils.isNotEmptyArr(tempData) ? JSON.parse(JSON.stringify(tempData)) : [];
if (commonUtils.isEmptyArr(tempNew)) {
message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
return;
}
const len = currentData.length;
currentData = this.orderNum(currentData);
const newLen = tempNew.length;
let num = 0.01;/* 循环增加体 */
let targetiOrder = -1;
if (type === 1) { /* 上移 */
const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
if (iIndex === 0) {
if (newLen === 1) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
return;
} else {
targetiOrder = 0;
}
} else if (iIndex === 1 && currentData[0].sDivRowNew) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
return;
} else {
targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
}
} else if (type === 2) { /* 下移 */
const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
if (iIndex === len - 1) {
if (newLen === 1) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
return;
} else {
targetiOrder = currentData[iIndex].iOrder;
}
} else {
targetiOrder = currentData[iIndex + 1].iOrder;
}
} else if (type === 0) { /* 置顶 */
const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
if (iIndex === 0) {
if (newLen === 1) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
return;
} else {
targetiOrder = currentData[iIndex].iOrder;
}
} else if (iIndex === 1 && currentData[0].sDivRowNew) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoTop'));/* 无需置顶 */
return;
} else if (currentData[0].sDivRowNew) { /* 如果顶层有分割 */
targetiOrder = currentData[1].iOrder - 1;
} else {
targetiOrder = currentData[0].iOrder - 1;
}
} else if (type === 3) { /* 置底 */
const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
if (iIndex === len - 1) {
if (newLen === 1) {
message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
return;
} else {
targetiOrder = currentData[iIndex].iOrder;
}
} else {
targetiOrder = currentData[len - 1].iOrder + 1;
}
}
tempNew.forEach((item) => {
const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
num += 0.01;
});
currentData = this.sortData(currentData);
currentData = this.orderNum(currentData);
const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
const slavePagination = { ...slavePaginationOld };
slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
} else if (name === 'slaveInfo') {
const { slaveData, slaveSelectedRowKeys, masterData }= this.props;
if(commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.error('请选择一行数据!');
return;
}
if(commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(masterData)) {
const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId) && commonUtils.isEmptyObject(item.sDivRowNew)); /* 找不是sDivRow的选中行第一条 */
if (iIndex > -1) {
masterData.sMachineId = slaveData[iIndex].sMachineId;
masterData.sMachineName = slaveData[iIndex].sMachineName;
masterData.sWorkCenterId = slaveData[iIndex].sWorkCenterId;
masterData.sWorkCenterName = slaveData[iIndex].sWorkCenterName;
}
}
this.props.onSaveState({ isChangeMachine: true, masterData });
}
};
/* 自定义排序号 */
orderNum = (tableData) => {
const {slaveColumn} = this.props;
tableData.forEach((item, index) => {
item.iOrder = index + 1;
item.handleType = 'update';
});
/* 移动后 重新计算分割间隔条数及用时逻辑 */
const returnFilterData = tableData.filter(item => commonUtils.isNotEmptyObject(item.sDivRowNew) && item.sDivRowNew !=='');
if (commonUtils.isNotEmptyArr(returnFilterData)) {
returnFilterData.forEach((tableDataRow, index) => {
/* 找到白班与晚班区间的汇总条数与工时 */
let startIndex = 0; /* 找到开始下标 */
let endindex = 0; /* 找到结束下标 */
let sliceData =[];
startIndex = tableData.findIndex(item => item.sId === returnFilterData[index].sId);
if(index +1 < returnFilterData.length) {
endindex = tableData.findIndex(item => item.sId === returnFilterData[index + 1].sId);
}
if(index === returnFilterData.length -1) {
endindex = tableData.length;
}
if(startIndex < endindex) {
sliceData= tableData.slice(startIndex + 1, endindex);
}
let num = 0;
let dTime = 0;
let dPlateQty = 0; /* 付版 */
let dProcessQty = 0;
let endTime;
/* 找到第二个字段 */
const scheduleShow = ['16508090850002295893127095467000'].includes(this.props?.sModelsId);
let timeSName = 'dHour1';
if (scheduleShow) timeSName = 'dSumHour';
if(commonUtils.isNotEmptyArr(sliceData)) {
num = sliceData.length;
sliceData.forEach((item) => {
if (commonUtils.isNotEmptyNumber(item[timeSName])) {
dTime += item[timeSName];
dPlateQty += item.dPlateQty;
dProcessQty += item.dProcessQty;
if (item?.tEndDate) {
let value = item.tEndDate;
if (endTime) {
value = moment.max(moment(endTime), moment(item.tEndDate));
}
endTime = value;
}
const iSrcIndex = tableData.findIndex(itemReturn => itemReturn.sSlaveId === item.sSlaveId); /* 汇总的每行上都加newRow的sSlaveId作为父级Id */
if(iSrcIndex > -1) {
tableData[iSrcIndex] = {...tableData[iSrcIndex], sDivRowParentId : tableDataRow.sSlaveId, sDivRowTmp : tableDataRow.sDivRowNew}
}
}
});
let sCount = '';
if(num > 0) {
sCount += 'F'+ num + '单';
}
if(dProcessQty > 0) {
sCount += ' - '+ dProcessQty;
}
if(sliceData[0].sType === "1" && !scheduleShow) {
sCount += ' - ' + dPlateQty +'付版';
}
if(dTime > 0) {
if (scheduleShow) {
sCount += ' - ' + Math.floor(dTime / 24) + "d" + (dTime % 24).toFixed(2) + 'h';
} else {
sCount += ' - ' + (dTime/60).toFixed(2) + 'h';
};
}
if (endTime) {
sCount += ' - ' + moment(endTime).format('MM月DD日');
}
const sFileName = commonUtils.isNotEmptyArr(slaveColumn) && slaveColumn.length > 2 ? slaveColumn[1].dataIndex : '';
if(sCount && sFileName) {
const addState ={};
addState[sFileName] = tableDataRow.sDivRowNew + sCount;
tableData[startIndex] = {...tableData[startIndex] , ...addState}
}
}
});
}
return tableData;
};
/* 切换甘特图/列表视图 */
changeGantt = (e, type) => {
let bGantt = false;
if (type === 'gantt') {
const { slaveFilterCondition } = this.props;
bGantt = true;
/* 调用获取甘特图数据 */
const chart = {};
chart.sProcedureName = 'Sp_Process_CommonGtChar';
chart.paramsMap = {
};
this.props.onGanttChar(chart, slaveFilterCondition).finally(() => {
this.props.onSaveState({ pageLoading: false });
});
} else if (type === 'list') {
bGantt = false;
}
this.props.onSaveState({ bGantt });
};
/* 切换稽查列表 */
changeCheckModel= async (e, type) => {
if (type === 'checkModel') {
if (this.state.checkModelStatus) {
return;
}
this.setState({
checkModelStatus: true
})
const { slaveFilterCondition } = this.props;
/* 调用获取甘特图数据 */
const chart = {};
chart.sProcedureName = 'Sp_Manufacture_GetAPSstate';
chart.paramsMap = {
};
await this.props.onCheckModel(chart, slaveFilterCondition);
this.setState({
checkModelStatus: false
})
}
};
/* 弹出重算时间弹窗 */
showTimerModal= (e, type) => {
if (type === 'changeTimer') {
this.props.onChangeTimerPro();
}
};
/* 侧边保存 */
showSave= (e, type) => {
if (type === 'save') {
this.props.onSaveState({
pageLoading: true,
});
setTimeout(async() => {
this.props.onSubmit(); /* 调用保存 */
}, 500);
}
};
/* 侧边保存 */
showLock= (e, type) => {
if (type === 'lock') {
this.props.onShowLockPro();
}
};
showLock= (e, type) => {
if (type === 'lock') {
this.props.onShowLockPro();
}
};
showOverExec= (e, type) => {
if (this.props.onShowOverExecPro) {
this.props.onShowOverExecPro();
}
};
/** 处理选择行发生改变 */
// handleTableFilterData = (name, data, record) => {
// /* 外置处理业务 */
// if (name === 'slave') {
// let slaveInfoDataNew = '';
// slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
// return slaveInfoDataNew;
// }
// };
/** 处理card点击事件 */
handleTabsCallback = (child) => {
// if (commonUtils.isNotEmptyArr(this.props.teamData)) {
// child.cardSelectedColor = '#fff7e6';
// const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
// const teamDataNew = this.props.teamData;
// teamDataNew.forEach((item, index) => {
// if (index !== iIndex) { item.cardSelectedColor = ''; }
// });
// }
// this.props.onSaveState({ Loading: true });
this.props.onTabsCallback(child);
};
toggleSlide = () => {
let flag = this.state.slideFlag ? 0 : 1;
localStorage.setItem('treeSlide_' + this.props.sModelsId, flag);
this.setState({
slideFlag: flag
})
}
handleSlideToggle = () => {
if (this.state.slideFlag) {
this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'block';
const originWidth = this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + 10}px)`;
this.toggleSlide();
} else {
this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'none';
this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100%)`;
this.toggleSlide();
}
}
resetTreeKey = () => {
this.setState({
defaultKey: 'selected'
})
}
setBMachine = (flag) => {
this.bMachine = flag
}
componentDidMount() {
if (!this.state.slideFlag) {
this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'block';
const originWidth = this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + 10}px)`;
} else {
this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'none';
this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100%)`;
}
}
// handleGanttChar = async (ganttChart) => {
// const { token, sModelsId, formRoute, slaveFilterCondition } = this.props;
// let charGanttData = {};
// const value = {
// sProName: ganttChart.sProcedureName,
// paramsMap: ganttChart.prodParamsMap,
// bFilter: slaveFilterCondition,
// };
// const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
// const { data: returnData } = await commonServices.postValueService(token, value, url);
// console.log('returnData', returnData);
// if (returnData.code === 1) {
// const { dataset } = returnData;
// if (commonUtils.isNotEmptyObject(dataset)) {
// const outData = returnData.dataset.rows[0].dataSet.outData[0];
// if (outData.sCode === -1) {
// message.error(outData.sReturn);
// } else {
// charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
// }
// }
// } else {
// message.error(returnData.msg);
// }
// console.log('charGanttData', charGanttData);
// this.props.onSaveState({ charGanttData });
// };
// renderCards = (data) => {
// let showInfo = '';
// data.map((item) => {
// showInfo += (
// <Col span={4}>
// <Card title={item.sTeamName} bordered={false}>
// {item.sTeamName} {item.dHour} {'30%'}
// </Card>
// </Col>
// );
// });
// return showInfo;
// }
render() {
const { pageLoading, treeLoading } = this.props;
return (
<div className="product-plan-info-box">
<Spin spinning={pageLoading || treeLoading} style={{ height: '100%' }}>
<div ref={(ref) => this.treeDiv = ref} style={{ height: '100%' }}>
<ProductionScheduleComponent
style={{ height: '100%' }}
{...this.props}
{...this.state}
treeDiv={this.treeDiv}
toggleSlide={this.toggleSlide }
handleSlideToggle={this.handleSlideToggle}
bMachine={this.bMachine}
showSetMachine={this.showSetMachine}
setBMachine={this.setBMachine}
filterCondition={this.filterCondition}
onTableFilterData={this.handleTableFilterData}
onRowClick={this.onRowClick}
onDoubleClick={this.onDoubleClick}
resetTreeKey={this.resetTreeKey}
onRowMouseEnter={this.onRowMouseEnter}
onRowMouseLeave={this.onRowMouseLeave}
orderData={this.orderData}
onTreeExpand={this.onTreeExpand}
onPageChange={this.onPageChange}
changeGantt={this.changeGantt}
onCheckModel={this.changeCheckModel}
onChangeTimer={this.changeTimer}
onShowTimerModal={this.showTimerModal}
onShowSave ={this.showSave}
onShowLock ={this.showLock}
onShowOverExec ={this.showOverExec}
onCloseChangeMachine={this.onCloseChangeMachine}
onTabsCallback={this.handleTabsCallback}
onTableSelectRowChange={this.onTableSelectRowChange}
onTreeExpandChange={this.onTreeExpandChange}
onDataUpdated={this.logDataUpdate}
onTaskUpdated={this.logTaskUpdate}
onLinkUpdated={this.logLinkUpdate}
treeData={this.props.treeData}
refreshTreeData={this.props.refreshTreeData}
/>
</div>
</Spin>
</div>
);
}
}
const ProductionScheduleComponent = Form.create({
mapPropsToFields(props) {
const { masterData } = props;
const obj = commonFunc.mapPropsToFields(masterData, Form);
return obj;
},
})((props) => {
const {
form, onReturnForm, app, masterData, slaveData, slaveSelectedRowKeys, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate, bGantt, charGanttData, messages, slavePageSize, workOutsideSize, workOutConfirmSize,
Loading, treeData, defaultSid, treeChild, pageSize, pageNum, onPageChange, sortEnabled, workOutsideColumn, workOutConfirmColumn, onTreeExpandChange, expandAll, onTreeExpand, expandedTreeKeys, gdsjurisdiction,
} = props;
const moveEnabled = commonUtils.isNotEmptyArr(slaveSelectedRowKeys);
/* 回带表单s */
onReturnForm(form);
// const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
const pagination = {
pageSize: commonConfig.pageSize,
...slavePagination,
size: 'large',
pageSizeOptions: commonConfig.pageSizeOptions,
// showQuickJumper: true,
hideOnSinglePage: false,
showSizeChanger: true,
current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
};
const paginationSlave = {
pageSize: commonUtils.isNotEmptyNumber(slavePageSize) && slavePageSize !== 0 ? slavePageSize : commonConfig.pageSize,
...slavePagination,
size: 'large',
pageSizeOptions: commonConfig.pageSizeOptions,
// showQuickJumper: true,
hideOnSinglePage: false,
showSizeChanger: true,
current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
};
const paginationWorkOutside = {
pageSize: commonUtils.isNotEmptyNumber(workOutsideSize) && workOutsideSize !== 0 ? workOutsideSize : commonConfig.pageSize,
...slavePagination,
size: 'large',
pageSizeOptions: commonConfig.pageSizeOptions,
// showQuickJumper: true,
hideOnSinglePage: false,
showSizeChanger: true,
current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
};
const paginationWorkOutConfirm = {
pageSize: commonUtils.isNotEmptyNumber(workOutConfirmSize) && workOutConfirmSize !== 0 ? workOutConfirmSize : commonConfig.pageSize,
...slavePagination,
size: 'large',
pageSizeOptions: commonConfig.pageSizeOptions,
// showQuickJumper: true,
hideOnSinglePage: false,
showSizeChanger: true,
current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
};
const width = '18px';
const height = '18px';
const moveUp = {
title: '上移',
width: { width },
height: { height },
img: <img src={MoveUp} alt="上移" width="24px" height="24px" />,
disableimg: <img src={DisableMoveUp} alt="上移" width="24px" height="24px" />,
};
const moveDown = {
title: '下移',
width: { width },
height: { height },
img: <img src={MoveDown} alt="下移" width="24px" height="24px" />,
disableimg: <img src={DisableMoveDown} alt="下移" width="24px" height="24px" />,
};
const moveTop = {
title: '置顶',
width: { width },
height: { height },
img: <img src={MoveTop} alt="置顶" width="24px" height="24px" />,
disableimg: <img src={DisableMoveTop} alt="置顶" width="24px" height="24px" />,
};
const moveBottom = {
title: '置底',
width: { width },
height: { height },
img: <img src={MoveBottom} alt="置底" width="24px" height="24px" />,
disableimg: <img src={DisableMoveBottom} alt="置底" width="24px" height="24px" />,
};
const changeMachine = {
title: '更换机台',
width: { width },
height: { height },
img: <img src={ChangeMachine} alt="更换机台" style={{ width: '24px' }} />,
disableimg: <img src={DisableChangeMachine} alt="更换机台" style={{ width: '24px' }} />,
};
const slideSave = {
title: '侧边保存',
width: { width },
height: { height },
img: <img src={SetSave} alt="保存" style={{ width: '24px' }} />,
disableimg: <img src={DisableSetSave} alt="保存" style={{ width: '24px' }} />,
};
const slideLock = {
title: '侧边锁定',
width: { width },
height: { height },
img: <img src={SetLock} alt="锁定" style={{ width: '24px' }} />,
disableimg: <img src={DisableSetLock} alt="锁定" style={{ width: '24px' }} />,
};
const slideOverExec = {
title: '侧边超能力',
width: { width },
height: { height },
img: <img src={SetOverExec} alt="超能力" style={{ width: '24px' }} />,
disableimg: <img src={DisableSetOverExec} alt="超能力" style={{ width: '24px' }} />,
};
const showGantt = {
title: '查看Gantt',
width: { width },
height: { height },
img: <img src={ShowGantt} alt="更换机台" width="24px" height="24px" />,
disableimg: <img src={DisableShowGantt} alt="更换机台" width="24px" height="24px" />,
};
const showCheckModel = {
title: '齐套稽查',
width: { width },
height: { height },
img: <img src={ShowCheckModel} alt="齐套稽查" width="24px" height="24px" />,
disableimg: <img src={DisableShowCheckModel} alt="齐套稽查" width="24px" height="24px" />,
};
const showTimer = {
title: '重算时间',
width: { width },
height: { height },
img: <img src={ShowTimer} alt="重算时间" width="24px" height="24px" />,
disableimg: <img src={DisableShowTimer} alt="重算时间" width="24px" height="24px" />,
};
const showList = {
title: '查看列表',
width: { width },
height: { height },
img: <img src={ShowList} alt="更换机台" width="24px" height="24px" />,
disableimg: <img src={DisableShowList} alt="更换机台" width="24px" height="24px" />,
};
const resetSearch = {
title: '重置搜索',
width: { width },
height: { height },
img: <img src={Reset} alt="重置搜索" width="24px" height="24px" />,
disableimg: <img src={DisableReset} alt="重置搜索" width="24px" height="24px" />,
};
const addProps = {};
//
// 前端假分页数据
// let tablePageData = commonBusiness.getTableTypes('slave', props).data;
// if (tablePageData) {
// tablePageData = commonBusiness.getTableTypes('slave', props).data.slice(pageSize * (pageNum - 1), pageSize * pageNum);
// }
// 从表原始数据
const tableProps = {
...commonBusiness.getTableTypes('slave', props),
// onTableFilterData: props.onTableFilterData,
bMutiSelect1: true,
tableProps: {
rowKey: 'sSlaveId',
pagination: paginationSlave,
sortSelf: true,
onRow: (record) => {
return {
onClick: () => { props.onRowClick('slave', record, true); },
// onDoubleClick: () => { props.onDoubleClick('slave', record); },
// onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
// onMouseLeave: () => { props.onRowMouseLeave('slave',record); },
};
},
onChange: props.onTitleChange.bind(this, 'slave'),
},
rowHoverSid : props.rowHoverSid,
clearArray: props.clearArray,
};
const workOutsideProps = {
...commonBusiness.getTableTypes('slave', props),
onTableFilterData: props.onTableFilterData,
bMutiSelect1: true,
tableProps: {
rowKey: 'sSlaveId',
pagination: paginationWorkOutside,
sortSelf: true,
onRow: (record) => {
return {
onClick: () => { props.onRowClick('slave', record, true); },
onDoubleClick: () => { props.onDoubleClick('slave', record); },
// onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
};
},
onChange: props.onTitleChange.bind(this, 'slave'),
},
headerColumn: workOutsideColumn,
clearArray: props.clearArray,
};
const workOutConfirmProps = {
...commonBusiness.getTableTypes('slave', props),
onTableFilterData: props.onTableFilterData,
bMutiSelect1: true,
tableProps: {
rowKey: 'sSlaveId',
pagination: paginationWorkOutConfirm,
sortSelf: true,
onRow: (record) => {
return {
onClick: () => { props.onRowClick('slave', record, true); },
onDoubleClick: () => { props.onDoubleClick('slave', record); },
// onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
};
},
onChange: props.onTitleChange.bind(this, 'slave'),
},
headerColumn: workOutConfirmColumn,
clearArray: props.clearArray,
};
const tableInfoProps = {
...commonBusiness.getTableTypes('slaveInfo', props),
bMutiSelect1: true,
tableProps: {
rowKey: 'sId',
pagination,
planLoadingSate,
onRow: (record) => {
return {
onClick: () => { props.onRowClick('slaveInfo', record); },
onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
// onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
};
},
onChange: props.onTitleChange.bind(this, 'slaveInfo'),
},
// data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
};
let zoom = {};
zoom.scale = 'Minutes';
zoom.step = '10'; /* 间隔 */
if (commonUtils.isNotEmptyObject(charGanttData)) {
zoom = charGanttData.zoom;
}
const ganttProps = {
// ...commonBusiness.getGanttTypes('slave', props),
tasks: commonUtils.isNotEmptyObject(charGanttData) ? charGanttData : {}, /* 甘特图数据源 */
zoom: commonUtils.isNotEmptyObject(zoom) ? zoom : {},
onDataUpdated: props.onDataUpdated,
};
const gridStyle = {
width: '100%',
textAlign: 'left',
};
const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
const setSave = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'setSave')) ? commonFunc.showMessage(app.commonConst, 'setSave') : '保存';/* 保存 */
const setLock = commonFunc.showMessage(app.commonConst, 'setLock') ? commonFunc.showMessage(app.commonConst, 'setLock') : '锁定';/* 锁定 */
const setOverExec = commonFunc.showMessage(app.commonConst, 'setOverExec') ? commonFunc.showMessage(app.commonConst, 'setOverExec') :'超能力';/* 超 */
// const resetSearchEnabled = clearArray.length > 0;
const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
const resetSearchEnabled = true;
// const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineName'); /* 以sMachineName */
/* 根据权限控制 */
let bSetTop = true; /* 置顶 */
let bSetDown = true; /* 置底 */
let bSetUp = true; /* 上移 */
let bSetBottom = true; /* 下移 */
let bSetMachine = true; /* 更换机台
// let bResetSearch = true; */
let bSetList = true; /* 显示列表 */
let bSetGantt = true; /* 显示甘特图 */
let bSetCheckModel = true; /* 齐套稽查 */
let bSetTimer = true; /* 改变时间 */
let bSetOverExec = true; /* 超能力 */
let bSetSave = true; /* 保存 */
let bSetLock = true; /* 锁定 */
if (commonUtils.isNotEmptyArr(gdsjurisdiction)){
bSetTop = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetTop') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetDown = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetDown') === -1 ? true : false;
bSetUp = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetUp') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetBottom = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetBottom') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetMachine = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetMachine') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetList = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetList') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetGantt = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetGantt') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetCheckModel = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetCheckModel') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetTimer = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetTimer') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetSave = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetSave') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetOverExec = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetOverExec') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
bSetLock = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetLock') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
}
const machineShowTypeProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineName,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
const teamShowTypeProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const iWorkCenterIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sWorkCenterName');
// if(commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(masterData) && commonUtils.isEmptyObject(masterData.sMachineId)) {
// const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId) && commonUtils.isEmptyObject(item.sDivRowNew)); /* 找不是sDivRow的选中行第一条 */
// if (iIndex > -1) {
// if (slaveData[iIndex] && slaveData[iIndex].sMachineId) {
// masterData.sMachineId = slaveData[iIndex].sMachineId;
// masterData.sMachineName = slaveData[iIndex].sMachineName;
// masterData.sWorkCenterId = slaveData[iIndex].sWorkCenterId;
// masterData.sWorkCenterName = slaveData[iIndex].sWorkCenterName;
// }
// }
// }
const workCenterProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iWorkCenterIndex > -1 ? masterConfig.gdsconfigformslave[iWorkCenterIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sWorkCenterName,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
const startShowTypeProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
const splitShowTypeProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
const splitNumShowTypeProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
const iProcessSyQtyIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'dProcessSyQty');
/* 剩余数量 */
const iProcessSyQtyProps = {
app,
record: masterData,
name: 'master',
form: props.form,
formId: sModelsId,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
getDateFormat: props.getDateFormat,
onChange: props.onChange,
showConfig: iProcessSyQtyIndex > -1 ? masterConfig.gdsconfigformslave[iProcessSyQtyIndex] : {},
formItemLayout: {},
enabled: true,
dataValue: commonUtils.isEmptyObject(masterData) ? 0 : masterData.dProcessSyQty,
bTable: false,
onFilterDropDownData: props.onFilterDropDownData,
};
let searchWorkSchedule = {};
let workScheduleConfig = {};
let searchWorkTitle = '';
if (commonUtils.isNotEmptyObject(props.workScheduleConfig)) {
workScheduleConfig = props.workScheduleConfig;
searchWorkTitle = workScheduleConfig.sActiveName;
const sWorkOrderId = commonUtils.isNotEmptyObject(props.workScheduleRecord) ? props.workScheduleRecord.sWorkOrderId : '';
searchWorkSchedule = {
app: {
...props.app,
currentPane: {
name: 'workSchedule',
config: workScheduleConfig,
conditonValues: props.getSqlCondition(workScheduleConfig),
title: workScheduleConfig.sActiveName,
route: '/indexPage/commonList',
formRoute: '/indexPage/commonList',
formId: workScheduleConfig.sActiveId,
key: sModelsId + workScheduleConfig.sId,
sModelsType: 'search/workSchedule',
bFilterProName: 'p_sWorkOrderId_pro',
bFilterProValue: sWorkOrderId,
// select: props.onSelect,
// selectCancel: props.onSelectCancel,
},
},
dispatch: props.dispatch,
content: props.content,
id: new Date().getTime().toString(),
realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
bNotShowBtn: true,
rowSelection: null,
};
}
let searchWorkMaterialsStatus = {};
let workMaterialsStatusConfig = {};
let searchMaterialsStatusTitle = '';
if (commonUtils.isNotEmptyObject(props.workMaterialsStatusConfig)) {
workMaterialsStatusConfig = props.workMaterialsStatusConfig;
searchMaterialsStatusTitle = workScheduleConfig.sActiveName;
// const sWorkOrderId = commonUtils.isNotEmptyObject(props.workMaterialsStatusRecord) ? props.workMaterialsStatusRecord.sWorkOrderId : '';
searchWorkMaterialsStatus = {
app: {
...props.app,
currentPane: {
name: 'workSchedule',
config: workMaterialsStatusConfig,
conditonValues: props.getSqlCondition(workMaterialsStatusConfig),
title: workScheduleConfig.sActiveName,
route: '/indexPage/commonList',
formRoute: '/indexPage/commonList',
formId: workMaterialsStatusConfig.sActiveId,
key: sModelsId + workMaterialsStatusConfig.sId,
sModelsType: 'search/workSchedule',
bFilterProName: 'p_sWorkOrderId_pro',
// bFilterProValue: sWorkOrderId,
// select: props.onSelect,
// selectCancel: props.onSelectCancel,
},
},
dispatch: props.dispatch,
content: props.content,
id: new Date().getTime().toString(),
realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
bNotShowBtn: true,
rowSelection: null,
};
}
/* 历史日产量 */
let sHistoryQtyProps = {};
let sHistoryQtyConfig = {};
let sHistoryQtyTitle = '';
if (commonUtils.isNotEmptyObject(props.sHistoryQtyConfig)) {
sHistoryQtyConfig = props.sHistoryQtyConfig;
sHistoryQtyTitle = sHistoryQtyConfig.sActiveName;
const sHistoryQtyRecord = props.sHistoryQtyRecord;
sHistoryQtyProps = {
app: {
...props.app,
currentPane: {
name: 'workSchedule',
config: workScheduleConfig,
conditonValues: props.getSqlCondition(sHistoryQtyConfig, 'slave', sHistoryQtyRecord),
title: sHistoryQtyConfig.sActiveName,
route: '/indexPage/commonList',
formRoute: '/indexPage/commonList',
formId: sHistoryQtyConfig.sActiveId,
key: sModelsId + sHistoryQtyConfig.sId,
sModelsType: 'search/sHistoryQty',
},
},
dispatch: props.dispatch,
content: props.content,
id: new Date().getTime().toString(),
realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
bNotShowBtn: true,
rowSelection: null,
};
}
let selectedRowKey = {};
if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
selectedRowKey = teamSelectedRowKeys[0];
}
let teamDataNum = 0;
if (commonUtils.isNotEmptyArr(props.teamData)) {
// 取得导航按钮的行数
if (props.teamData.length % 8 === 0) {
teamDataNum = (props.teamData.length / 8);
} else {
teamDataNum = Math.ceil(props.teamData.length / 8);
}
}
const handleTreeOnSelect = (keys, e) => {
window.vlistNewSearh = true;
props.resetTreeKey();
props.setBMachine(e.node.sType == "machine")
const child = e.selectedNodes.length ? e.node.props.dataRef : false;
if (child) {
props.onTabsCallback(child);
onPageChange(1);
}
};
const renderTreeNodes = (data, pid) =>
data.map((item, index) => {
if (item.children) {
return (
<TreeNode
title={
<div className={`${item.sType}-node`}>
{item.sShowName}
{item.dHour ? <span className="hour-info">{item.dHour}</span> : ''}
{(item.dSumProductionReportQty && item.dHour) ? <span className="hour-info">/</span> : ''}
{item.dSumProductionReportQty ? <span className="hour-info">{item.dSumProductionReportQty}</span> : ''}
</div>
}
key={item.sId + item.sWorkCenterId}
dataRef={{ ...item, pid: pid || 0 }}
>
{renderTreeNodes(item.children, item.sId)}
</TreeNode>
);
}
return <TreeNode title={
<div className={`${item.sType}-node`}>
{item.sShowName}
{item.dHour ? <span className="hour-info">{item.dHour}</span> : ''}
{(item.dSumProductionReportQty && item.dHour) ? <span className="hour-info">/</span> : ''}
{item.dSumProductionReportQty ? <span className="hour-info">{item.dSumProductionReportQty}</span> : ''}
</div>
} dataRef={{ ...item, pid: pid || 0 }} {...item} key={item.sId + item.sWorkCenterId} />;
});
const handleResizeLayout = (e) => {
const originX = e.pageX;
const originWidth = props.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
let offset = 0;
window.onmousemove = function (e2) {
offset = e2.pageX - originX;
props.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.width = `${originWidth + offset}px`;
props.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + offset + 10}px)`;
};
window.onmouseup = function () {
window.onmousemove = null;
window.onmousemove = null;
localStorage.setItem('customProductionScheduleTreeWidth_' + props.sModelsId, originWidth + offset + 10);
};
};
let customWidth = 224;
if (localStorage.getItem('customProductionScheduleTreeWidth_' + props.sModelsId) !== '') {
customWidth = localStorage.getItem('customProductionScheduleTreeWidth_' + props.sModelsId);
}
const renderTable = () => {
let res = '';
if (treeChild.sType === 'workoutsid') {
res = (<StaticEditTable {...workOutsideProps} className="subForm" slaveInfo={props.slaveInfoConfig ? tableInfoProps : undefined} skipSlaveInfo={props.slaveInfoConfig ? false: true} setExpandedRowRender={props.slaveInfoConfig ? "Y" : 'N'} />);
} else if (treeChild.sType === 'workoutconfirm') {
res = (<StaticEditTable {...workOutConfirmProps} className="subForm" slaveInfo={props.slaveInfoConfig ? tableInfoProps : undefined} skipSlaveInfo={props.slaveInfoConfig ? false: true} setExpandedRowRender={props.slaveInfoConfig ? "Y" : 'N'} />);
} else {
res = (<StaticEditTable {...tableProps} className="subForm" slaveInfo={props.slaveInfoConfig ? tableInfoProps : undefined} skipSlaveInfo={props.slaveInfoConfig ? false: true} setExpandedRowRender={props.slaveInfoConfig ? "Y" : 'N'}/>);
}
return res;
};
/* 增加Modal按钮样式 */
const okProps = {};
if (props.loadingTimer !== undefined) {
// okProps.disabled = !props.bChangeTimerEnable;
okProps.loading = props.loadingTimer;
}
return (
<Form style={{ height: '100%' }}>
<Layout style={{ height: '100%' }} className="xly-productionPlan-list productionScheduleTree">
<Header className={styles.header} style={{ backgroundColor: 'rgb(100, 100, 100)' }}>
<Toolbar {...props} className="billBtnGroup" style={{ backgroundColor: '#646464', color: 'rgb(255,255,255)' }} />
</Header>
<Layout className={styles.clayout} style={{ height: '100%' }} >
<div className="search-container">
<SearchComponent {...props} />
</div>
<div className="productionScheduleTree-container">
<div className="productionScheduleTree-sider" style={{ width: `${customWidth}px`, marginRight: '10px' }}>
<div className="resize-controller" onMouseDown={handleResizeLayout} />
<div className="productionScheduleTree-sider-title">
<Icon type={expandAll ? 'minus-square' : 'plus-square'} className="control-icon" onClick={onTreeExpandChange} />
<span>工作中心</span>
</div>
<div className="productionScheduleTree-sider-content">
{
props.slideFlag == 0 && treeData.length > 0 && (
<Tree
showLine
onSelect={handleTreeOnSelect}
onExpand={onTreeExpand}
// selectedKeys={[treeChild.sId + treeChild.sProcessId + treeChild.iOrder]}
selectedKeys={Array.isArray(props.defaultKey) ? props.defaultKey : [treeChild.sId + treeChild.sWorkCenterId]}
defaultExpandAll={expandAll}
expandedKeys={expandedTreeKeys}
>
{renderTreeNodes(treeData)}
</Tree>
)
}
</div>
</div>
<div className="productionScheduleTree-content" style={{ width: props.slideFlag == 0 ? `calc(100% - ${customWidth}px - 10px)` : `calc(100%)` }}>
<Layout style={{marginLeft: 0}} className={['processList', 'processListTable'].join(' ')}>
<Sider className="process">
<a onClick={props.handleSlideToggle}>
{props.slideFlag == 0 && <MenuFoldOutlined style={{ fontSize: '20px', color: '#08c', position: 'relative', left: '4px' }} />}
{props.slideFlag == 1 && <MenuUnfoldOutlined style={{ fontSize: '20px', color: '#08c', position: 'relative', left: '4px' }} />}
</a>
<a title={setResetSearch} {...addProps} onClick={resetSearchEnabled ? e => props.onResetTableSearch() : null}>{ resetSearchEnabled ? resetSearch.img : resetSearch.disableimg}</a>
{ bSetTop ? <a title={setTop} {...addProps} onClick={moveEnabled && sortEnabled ? e => props.orderData(e, 'slave', 0) : null}>{ moveEnabled && sortEnabled ? moveTop.img : moveTop.disableimg}</a> : '' }
{ bSetUp ? <a title={setUp} {...addProps} onClick={moveEnabled && sortEnabled ? e => props.orderData(e, 'slave', 1) : null}>{ moveEnabled && sortEnabled ? moveUp.img : moveUp.disableimg }</a> : ''}
{ bSetDown ? <a title={setDown} {...addProps} onClick={moveEnabled && sortEnabled ? e => props.orderData(e, 'slave', 2) : null}>{moveEnabled && sortEnabled ? moveDown.img : moveDown.disableimg }</a> : ''}
{ bSetBottom ? <a title={setBottom} {...addProps} onClick={moveEnabled && sortEnabled ? e => props.orderData(e, 'slave', 3) : null}>{moveEnabled && sortEnabled ? moveBottom.img : moveBottom.disableimg }</a> : ''}
{ bSetMachine ? <a title={setMachine} {...addProps} onClick={props.showSetMachine ? e => props.orderData(e, 'slaveInfo', 0) : null}>{props.showSetMachine ? changeMachine.img : changeMachine.disableimg }</a> : ''}
{ bSetSave ? <a title={setSave} {...addProps} onClick={ e =>props.onShowSave(e, 'save', 0)}>{slideSave.img}</a> : ''}
{ bSetLock ? <a title={setLock} {...addProps} onClick={commonUtils.isEmptyObject(props.sortedInfo) ? e => props.onShowLock(e, 'lock', 0) : null}>{commonUtils.isEmptyObject(props.sortedInfo) ? slideLock.img : slideLock.disableimg }</a> : ''}
{ bSetTimer ?
<a title="重算时间" {...addProps} onClick={commonUtils.isEmptyObject(props.sortedInfo) ? e => props.onShowTimerModal(e, 'changeTimer') : null}>{commonUtils.isEmptyObject(props.sortedInfo) ? showTimer.img : showTimer.disableimg }</a>
: ''}
{ bSetOverExec ? <a title={setOverExec} {...addProps} onClick={commonUtils.isEmptyObject(props.sortedInfo) ? e => props.onShowOverExec(e, 'overExec', 0) : null}>{commonUtils.isEmptyObject(props.sortedInfo) ? slideOverExec.img : slideOverExec.disableimg }</a> : ''}
{ bSetCheckModel ?<a title="齐套稽查" {...addProps} onClick={commonUtils.isEmptyObject(props.sortedInfo) && props.bMachine ? e => props.onCheckModel(e, 'checkModel') : null}>
{props.checkModelStatus ?
<LoadingOutlined style={{ fontSize: 16 }} spin></LoadingOutlined> : commonUtils.isEmptyObject(props.sortedInfo) && props.bMachine ? showCheckModel.img : showCheckModel.disableimg
}
</a> : ''}
{ bSetList ? <a title="查看列表" {...addProps} onClick={props.bGantt ? e => props.changeGantt(e, 'list', 0) : null}>{props.bGantt ? showList.img : showList.disableimg }</a> : ''}
{ bSetGantt ?<a title="查看甘特图" {...addProps} onClick={props.bMachine && !props.bGantt ? e => props.changeGantt(e, 'gantt', 0) : null}>{props.bMachine && !props.bGantt ? showGantt.img : showGantt.disableimg }</a> : ''}
</Sider>
{
bGantt && commonUtils.isNotEmptyObject(charGanttData) ?
<Content style={{ height: 'calc( 100vh - 230px )' }} className={GanttStyles.ganttList} >
{/* <StaticEditTable {...tableProps} tableBelone="list" /> */}
<div className="gantt-container" style={{ width: '100vm', height: '100%' }} >
<Gantt {...ganttProps} />
</div>
</Content> :
<Content
className="xly-normal-list productPlan"
style={{paddingRight: '0px'}}
>
<div className={`tree-pagination-container ${(tableProps.data && tableProps.data.length) <= 1 ? 'tree-pagination-container-nopage' : ''}`}>
{ renderTable() }
{/* <div className="pagination-item"> */}
{/* <Pagination simple pageSize={pageSize} onChange={onPageChange} current={pageNum} defaultCurrent={1} total={tableProps.data ? tableProps.data.length : 1} /> */}
{/* </div> */}
</div>
</Content>
}
</Layout>
</div>
</div>
</Layout>
{
props.isChangeMachine ?
<AntdDraggableModal
width={500}
title="换机台"
visible={props.isChangeMachine}
onCancel={props.onCloseChangeMachine}
onOk={props.onChangeMachine}
okButtonProps={commonUtils.isNotEmptyObject(masterData) && (commonUtils.isNotEmptyStr(masterData.sMachineId) || (masterData.bSplit && commonUtils.isNotEmptyStr(masterData.iSplitNum))) ? { disabled: false } : { disabled: true }}
>
{ commonUtils.isEmptyObject(masterConfig) || iWorkCenterIndex < 0 ? '' : <ShowType {...workCenterProps} /> }
{ commonUtils.isEmptyObject(masterConfig) || iMachineIndex < 0 ? '' : <ShowType {...machineShowTypeProps} /> }
{ commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...teamShowTypeProps} /> }
{/* { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...startShowTypeProps} /> } */}
{ commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...splitShowTypeProps} /> }
{ commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData) && masterData.bSplit ? <ShowType {...splitNumShowTypeProps} /> : '' }
{ commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData) && masterData.bSplit && iProcessSyQtyIndex > -1 ? <ShowType {...iProcessSyQtyProps} /> : '' }
</AntdDraggableModal>
: ''
}
{
props.changeTimerVisible ?
<AntdDraggableModal
width={500}
title="重算时间"
visible
onCancel={props.onCloseModel.bind(this, 'changeTimerVisible')}
onOk={props.onChangeTimerPro}
okButtonProps={okProps}
>
{ commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...startShowTypeProps} showTime /> }
</AntdDraggableModal>
: ''
}
{
props.workScheduleVisible ?
<AntdDraggableModal
className="workScheduleModal"
width={1300}
title={commonUtils.isEmptyObject(searchWorkSchedule) ? searchWorkTitle : searchWorkSchedule.app.currentPane.title}
visible
onCancel={props.onCloseModel.bind(this, 'workScheduleVisible')}
onSaveState={props.onSaveState}
footer={null}
>
<CommonListSelect {...searchWorkSchedule} />
</AntdDraggableModal> : null
}
{
props.sHistoryQtyVisible ?
<AntdDraggableModal
className="workScheduleModal"
width={1300}
title={commonUtils.isEmptyObject(sHistoryQtyTitle) ? sHistoryQtyTitle : sHistoryQtyProps.app.currentPane.title}
visible
onCancel={props.onCloseModel.bind(this, 'sHistoryQtyVisible')}
onSaveState={props.onSaveState}
footer={null}
>
<CommonListSelect {...sHistoryQtyProps} />
</AntdDraggableModal> : null
}
</Layout>
</Form>
);
});
export default CommonBase(CommonProductionPlanTreeEvent(ProductionSchedule));