index.js
30.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
/* eslint-disable */
import React, { Component } from "react";
import "@ant-design/compatible/assets/index.css";
import { Col, Tabs, Tooltip } from "antd-v4";
import ShowType from "@/components/Common/CommonComponent";
import AntdDraggableModal from "@/components/Common/AntdDraggableModal";
import CommonListSelectTree from "@/components/Common/CommonListSelectTree";
import * as commonBusiness from "@/components/Common/commonBusiness"; /* 单据业务功能 */
import StaticEditTable from "@/components/Common/CommonTable"; /* 可编辑表格 */
import * as commonFunc from "@/components/Common/commonFunc";
import * as commonUtils from "@/utils/utils"; /* 通用方法 */
import RGL, { WidthProvider } from "react-grid-layout";
import layoutStyle from "./index.less";
const { TabPane } = Tabs;
const ReactGridLayout = WidthProvider(RGL);
export default class CommonViewTable extends Component {
constructor(props) {
super(props);
this.state = {
openNewTabFlag: false,
commonFieldPopupVisible: false,
commonFieldPopupTbName: "name",
commonFieldPopupShowConfig: {},
randomId: commonUtils.createSid(),
activeKey: ""
// tempLayout: [], // 临时布局
// tempLayout1: [], // 临时布局
// tempLayout2: [], // 临时布局
};
this.selectedData = []; // 选中数据
this.refIds = {}; // 记录所有组件的id
this.maxTabCount = 10; // 最大tab数
for (let index = 0; index < this.maxTabCount; index++) {
const i = index === 0 ? "" : index;
this.state[`tempLayout${i}`] = [];
}
}
componentWillMount() {
this.assignmentWillProps(this.props);
}
componentDidMount() {
if (this.layoutRef) {
this.layoutRef.addEventListener(
"mousedown",
this.handleSelectMouseDownEvent
);
document.addEventListener("mouseup", this.handleSelectMouseUpEvent);
document.addEventListener("mousemove", this.handleSelectMouseMoveEvent);
document.addEventListener("copy", this.handleCopyEvent);
}
}
componentDidUpdate() {
if (this.layoutRef) {
const { x: baseX, y: baseY } = this.layoutRef.getBoundingClientRect();
this.baseX = baseX;
this.baseY = baseY;
}
}
componentWillUnmount() {
if (this.layoutRef) {
this.layoutRef.removeEventListener(
"mousedown",
this.handleSelectMouseDownEvent
);
document.removeEventListener("mouseup", this.handleSelectMouseUpEvent);
document.removeEventListener(
"mousemove",
this.handleSelectMouseMoveEvent
);
document.removeEventListener("copy", this.handleCopyEvent);
}
}
componentWillReceiveProps(nextProps) {
if (this.state.openNewTabFlag) {
const dom = document.getElementsByClassName(
`${this.state.randomId}-CommonListSelectTree`
)[0];
dom.parentElement.parentElement.style.display = "block";
this.setState({
openNewTabFlag: false
});
}
const { slaveSelectedRowKeys = [], viewDragRefreshTime = 0 } = nextProps;
const {
slaveSelectedRowKeys: slaveSelectedRowKeysOld = [],
viewDragRefreshTime: viewDragRefreshTimeOld = 0
} = this.props;
if (
JSON.stringify(slaveSelectedRowKeys) !==
JSON.stringify(slaveSelectedRowKeysOld) ||
viewDragRefreshTime !== viewDragRefreshTimeOld
) {
this.assignmentWillProps(nextProps);
}
}
assignmentWillProps = props => {
this.refIds = {};
const { slaveSelectedRowKeys = [], slaveData } = props;
const { activeKey } = this.state;
const rowKey = slaveSelectedRowKeys[0];
if (rowKey && commonUtils.isNotEmptyArr(slaveData)) {
const iIndex = slaveData.findIndex(item => item.sId === rowKey);
if (iIndex !== -1) {
const currentData = slaveData[iIndex];
const addState = {};
let firstActiveKey = "";
let firstActiveIndex = 0;
let hasCurrentActiveKey = false;
for (let index = 0; index < this.maxTabCount; index++) {
const i = index === 0 ? "" : index;
const viewRow = props[`view${i}Row`];
if (commonUtils.isNotEmptyObject(viewRow)) {
const viewConfigs = props[`view${i}Configs`];
const panelName = props[`panel${i}Name`];
const panel = currentData[panelName] || "[]";
addState[`tempLayout${i}`] = this.handleGetInitLayout(
viewConfigs,
panel
);
const tabPaneConfig = props[`tabPane${i}Config`];
if (tabPaneConfig?.key === activeKey) {
hasCurrentActiveKey = true;
}
if (!firstActiveKey && tabPaneConfig?.key) {
firstActiveKey = tabPaneConfig.key;
firstActiveIndex = index;
}
}
}
if (!hasCurrentActiveKey && firstActiveKey) {
addState.activeKey = firstActiveKey;
addState.activeIndex = firstActiveIndex;
}
this.setState({ ...addState });
}
}
};
// 初始化布局数据
handleGetInitLayout = (configs, panel) => {
if (panel === "[]") {
// 如果没有保存过布局数据
let flag = 0;
return configs.map((item, index) => {
if (index % 4 === 0 && index !== 0) {
flag++;
}
const minH =
item.sName && item.sName.includes("sParamColumnConfig") ? 2 : 1;
return {
i: item.sName,
x: (index - flag * 4) * 6,
y: flag,
w: 6,
h: minH,
minH,
minW: 1
};
});
} else {
// 如果保存过布局数据
// 判断配置数据和布局数据的sName是否一致
const arrAdd = configs.map(item => item.sName); // 新增的字段
const arrDel = []; // 删除的字段
const panelArr = JSON.parse(panel);
panelArr.forEach(({ i: sName }, index) => {
const minH = sName && sName.includes("sParamColumnConfig") ? 2 : 1;
panelArr[index].minH = minH;
panelArr[index].h = Math.max(panelArr[index].h, minH);
panelArr[index].minW = 1;
const iIndex = arrAdd.findIndex(item => item === sName);
if (iIndex !== -1) {
arrAdd.splice(iIndex, 1);
} else {
arrDel.push(sName);
}
});
if (commonUtils.isEmptyArr(arrAdd) && commonUtils.isEmptyArr(arrDel)) {
// 数据没有变化
return panelArr;
}
if (commonUtils.isNotEmptyArr(arrDel)) {
// 有删除的数据
arrDel.forEach(sName => {
const iIndex = panelArr.findIndex(item => item.i === sName);
if (iIndex !== -1) {
panelArr.splice(iIndex, 1);
}
});
}
if (commonUtils.isNotEmptyArr(arrAdd)) {
// 有新增的数据
let newY = 0; // 新增数据的开始行位置
panelArr.forEach(({ y, h }) => {
newY = Math.max(y + h, newY);
});
let flag = 0;
arrAdd.forEach((sName, index) => {
if (index % 4 === 0 && index !== 0) {
flag++;
}
const minH = sName && sName.includes("sParamColumnConfig") ? 2 : 1;
panelArr.push({
i: sName,
x: (index - flag * 4) * 6,
y: flag + newY,
w: 6,
h: minH,
minH,
minW: 1
});
});
}
return panelArr;
}
};
// 鼠标按下事件
handleSelectMouseDownEvent = e => {
const { activeKey } = this.state;
this.selectedData = [];
const oTabpane = this.layoutRef.querySelector(
".ant-tabs-tabpane:not(.ant-tabs-tabpane-hidden)"
);
this.refIds[activeKey]?.forEach(id => {
const dom = oTabpane.querySelector(`#${id}`);
if (dom) {
const oChecked = dom.querySelector(".divChecked");
oChecked ? (oChecked.style.display = "none") : "";
}
});
if (e?.target?.classList?.contains("blankPanel")) {
this.bMousedwon = true;
const { clientX, clientY } = e;
this.clientX = clientX;
this.clientY = clientY;
this.selectAreaRef.style.left = clientX - this.baseX + "px";
this.selectAreaRef.style.top = clientY - this.baseY + "px";
this.selectAreaRef.style.width = "1px";
this.selectAreaRef.style.height = "1px";
this.setState({ maskVisible: true });
}
};
// 鼠标抬起事件
handleSelectMouseUpEvent = e => {
const bMousedwonBak = this.bMousedwon;
this.bMousedwon = false;
if (bMousedwonBak) {
this.setState({ maskVisible: false });
}
};
// 鼠标移动事件
handleSelectMouseMoveEvent = e => {
if (this.bMousedwon && this.selectAreaRef) {
const { activeKey } = this.state;
const { clientX, clientY } = e;
const x1 = Math.min(clientX, this.clientX);
const x2 = Math.max(clientX, this.clientX);
const y1 = Math.min(clientY, this.clientY);
const y2 = Math.max(clientY, this.clientY);
this.selectAreaRef.style.left = x1 - this.baseX + "px";
this.selectAreaRef.style.top = y1 - this.baseY + "px";
this.selectAreaRef.style.width = x2 - x1 + "px";
this.selectAreaRef.style.height = y2 - y1 + "px";
const {
right: right1,
left: left1,
bottom: bottom1,
top: top1
} = this.selectAreaRef.getBoundingClientRect();
const selectedData = [];
const oTabpane = this.layoutRef.querySelector(
".ant-tabs-tabpane:not(.ant-tabs-tabpane-hidden)"
);
this.refIds[activeKey]?.forEach(id => {
const dom = oTabpane.querySelector(`#${id}`);
if (dom) {
const {
right: right2,
left: left2,
bottom: bottom2,
top: top2
} = dom.getBoundingClientRect();
if (
!(
right1 < left2 ||
left1 > right2 ||
bottom1 < top2 ||
top1 > bottom2
)
) {
selectedData.push(id);
dom.querySelector(".divChecked").style.display = "";
} else {
dom.querySelector(".divChecked").style.display = "none";
}
}
});
this.selectedData = selectedData;
}
};
// 复制操作
handleCopyEvent = e => {
if (commonUtils.isNotEmptyArr(this.selectedData)) {
const clipboardData = e.clipboardData;
if (!clipboardData) {
return;
}
e.preventDefault();
const { activeIndex } = this.state;
// 获取当前tab页布局
const layout = this.state[
`tempLayout${activeIndex === 0 ? "" : activeIndex}`
];
const selectedLayout = layout.filter(item =>
this.selectedData.includes(item.i)
);
const viewRow =
this.props[`view${activeIndex === 0 ? "" : activeIndex}Row`] || {};
const [minX, maxX, minY, maxY] = selectedLayout.reduce(
(result, item) => {
const { x, y, w, h } = item;
result = [
Math.min(result[0], x),
Math.max(result[1], x + w),
Math.min(result[2], y),
Math.max(result[3], y + h)
];
return result;
},
[999, 0, 999, 0]
);
const tableW = maxX - minX;
const tableH = maxY - minY;
const filledArr = [];
const tableContent = `<table><tbody>${new Array(tableH)
.fill("")
.map((_, trIndex) => {
return `<tr>${new Array(tableW)
.fill("")
.map((_, tdIndex) => {
const startX = minX + tdIndex;
const startY = minY + trIndex;
const iIndex = selectedLayout.findIndex(
item => item.x === startX && item.y === startY
);
if (iIndex !== -1) {
const { i, w, h } = selectedLayout[iIndex];
// 记录占据的单元格位置
for (let j = startX; j < startX + w; j++) {
for (let k = startY; k < startY + h; k++) {
filledArr.push(`${j}_${k}`);
}
}
const title = viewRow[i];
let value = viewRow[i.replace("sParam", "sParamDefault")];
value = value === undefined ? "" : value;
return `<td rowspan=${h}>${title}</td><td colspan=${w -
1} rowspan=${h}>${value}</td>`;
} else if (filledArr.includes(`${startX}_${startY}`)) {
return "";
} else {
return "<td></td>";
}
})
.join("")}</tr>`;
})
.join("")}</tbody></table>`;
clipboardData.setData("text/plain", tableContent);
}
};
onOpenNewTab = () => {
const dom = document.getElementsByClassName(
`${this.state.randomId}-CommonListSelectTree`
)[0];
dom.parentElement.parentElement.style.display = "none";
this.setState({
openNewTabFlag: true
});
};
handleToggle = () => {
const { expandView } = this.props;
this.props.onSaveState({ expandView: !expandView });
};
handleViewClick = (name, sName, sId) => {
this.props.onViewClick(name, sName, sId);
};
/* 字段弹窗 */
handleFieldPopupModal = (showConfig, name) => {
this.setState({
commonFieldPopupVisible: true,
commonFieldPopupTbName: name,
commonFieldPopupShowConfig: showConfig
});
};
handleSelectCommonFieldPopup = (name, selectConfig, selectData) => {
const { commonFieldPopupTbName, commonFieldPopupShowConfig } = this.state;
this.props.onSelectCommonPopup(
name,
selectConfig,
selectData,
commonFieldPopupTbName,
commonFieldPopupShowConfig
);
};
handleSelectCancel = modelVisible => {
this.setState({
[modelVisible]: false
});
};
changeLayout(oldLayout, newLayout, cover) {
if (cover) {
const ret = [];
newLayout.forEach(item => {
const oldValue = oldLayout.find(item1 => item1.i === item.i);
ret.push({
...oldValue,
x: item.x,
y: item.y,
w: item.w,
h: item.h
});
});
return ret;
} else {
const ret = oldLayout.map(item => {
const newValue = newLayout.find(item1 => item1.i === item.i);
if (newValue) {
item = {
...item,
x: newValue.x,
y: newValue.y,
w: newValue.w,
h: newValue.h
};
}
return item;
});
return ret;
}
}
handleGetLayoutH = (layout, key, defaultH = 1) => {
const config = layout.find(item => item.i === key);
if (config && config.h) {
return config.h;
} else {
return defaultH;
}
};
handleGetPanel = (index = 0) => {
const num = index === 0 ? "" : index;
const sParamType = this.props[`tabPane${num}Config`].key;
const {
enabled = false,
app,
[`table${num}Name`]: tableName,
[`tabPane${num}Config`]: tabPaneConfig,
[`panel${num}Name`]: panelName,
[`view${num}Configs`]: configs,
[`view${num}Row`]: viewRow,
[`b${sParamType}ParamTable`]: bParamTable,
[`${sParamType}ParamListConfig`]: paramListConfig,
[`${sParamType}ParamListColumn`]: paramListColumn,
[`${sParamType}ParamListData`]: paramListData
} = this.props;
const tempLayoutName = `tempLayout${num}`;
const { [tempLayoutName]: layout } = this.state;
const sTableName = `${sParamType}ParamList`;
const sTableConfig = `${sParamType}ParamListConfig`;
const sTableColumn = `${sParamType}ParamListColumn`;
const sTableData = `${sParamType}ParamListData`;
const key = "sParamColumnConfig1";
const paramListTableProps = {
...commonBusiness.getTableTypes(sTableName, {
...this.props,
[sTableConfig]: paramListConfig,
[sTableColumn]: paramListColumn,
[sTableData]: paramListData
}),
tableProps: {}
// data: paramListData1,
};
const getAutoTableHeight = () => {
const oProcessTable = document.querySelector(
`#${this.props.processTableId}`
);
if (oProcessTable) {
const oBody = oProcessTable.querySelector(".ant-table-body");
if (oBody) {
return oBody.getBoundingClientRect().height;
}
}
return "auto";
};
return (
<TabPane className={layoutStyle.tabPane} {...tabPaneConfig}>
{bParamTable &&
configs.some(item => item.sName === "sParamColumnConfig1") ? (
<div className="blankPanel">
<StaticEditTable
{...paramListTableProps}
tableProps={{
AutoTableHeight: getAutoTableHeight()
}}
setOpterationColumn="Y"
/>
</div>
) : (
<ReactGridLayout
margin={[0, 0]}
verticalCompact={false}
className="blankPanel"
layout={layout}
cols={24}
rowHeight={28}
width={700}
isDraggable={enabled}
isResizable={enabled}
onLayoutChange={newLayout => {
if (enabled) {
const tempLayoutNew = this.changeLayout(layout, newLayout);
this.props.onDataChange(
"slave",
panelName,
{ [panelName]: JSON.stringify(tempLayoutNew) },
this.props.slaveSelectedRowKeys[0],
[]
);
this.setState({
[tempLayoutName]: tempLayoutNew
});
}
}}
onResize={(_, _1, _2, _3, _4, _5) => {
clearTimeout(this.resizeTimer);
this.resizeTimer = setTimeout(() => {
if (_5?.offsetParent) {
const oLabel = _5.offsetParent.querySelector(
".ant-form-item-label"
);
if (oLabel) {
oLabel.style.flex =
_3.w > 2 ? `0 0 ${(3 * 66) / _3.w}%` : "0 0 0";
}
}
}, 200);
}}
isDroppable={enabled}
>
{bParamTable ? (
<div
key={key}
id={key}
className={enabled ? layoutStyle.editMode : ""}
style={{
display: "block",
position: "relative",
overflow: "hidden"
}}
>
<StaticEditTable
{...paramListTableProps}
setOpterationColumn="Y"
layoutH={this.handleGetLayoutH(layout, key, 2)}
/>
</div>
) : (
configs.map(child => {
const iRowNum =
child.iColValue === 1
? 6
: 1; /* 1个字段占的网格个数 ,网格总个数是24 */
const iColValue = sMemo
? 24
: child.iColValue *
iRowNum; /* 产品部要求 备注设置成一行到底 */ /* 跨度 */
const sMemo = child.sName.toLowerCase().endsWith("memo");
let enabledNew =
enabled && !child.bReadonly && !child.specialControl;
const sFormulaMemo =
child.sName.toString() === "sFormulaMemo" ? "none" : "block";
if (child.iTag === 1) {
enabledNew = false;
} else if (child.iTag === 3) {
enabledNew = true;
}
let w = 6;
let h = 1;
const iIndex = layout.findIndex(item => item.i === child.sName);
if (iIndex !== -1) {
w = layout[iIndex].w;
h = layout[iIndex].h;
}
const flexWidth = w > 2 ? (3 * 66) / w : 0;
const formItemLayout = {
labelCol: {
flex: flexWidth + "%",
style: {
color: "rgba(0, 0, 0, 0.65)",
backgroundColor: "#BFEFFF"
}
},
wrapperCol: { flex: "auto" }
};
const showTypeProps = {
className: h > 1 ? "multiLine": "",
app,
iColValue,
name: tableName,
record: viewRow,
sId: viewRow.sId,
form: this.props.form,
getSqlDropDownData: this.props.getSqlDropDownData,
getSqlCondition: this.props.getSqlCondition,
handleSqlDropDownNewRecord: this.props
.handleSqlDropDownNewRecord,
getFloatNum: this.props.getFloatNum,
onChange: this.props.onDataChange,
showConfig: { ...child, placeholder: child.showName },
formItemLayout,
textArea: sMemo,
enabled: enabledNew,
dataValue: viewRow[child.sName],
bTable: false,
bViewTable: false,
formRoute: this.props.formRoute,
onViewClick: this.handleViewClick,
onFieldDoubleClick: this.props.handleFieldDoubleClick
};
/* 如果包含sParamColumnConfig 则渲染表格,否则渲染为View */
if (child.sName && child.sName.includes("sParamColumnConfig")) {
const paramListConfigStr = child.showName;
const num = child.sName
.replace("sParamColumnConfig", "")
.trim(); /* 不同参数的表格名称,通过序号区分 */
const sParamTableName = "param" + num + "List";
const sParamTableConfig = "param" + num + "ListConfig";
const sParamTableColumn = "param" + num + "ListColumn";
const paramListConfig = commonUtils.isJSON(paramListConfigStr)
? JSON.parse(paramListConfigStr)
: {};
let paramListColumn = [];
if (commonUtils.isNotEmptyObject(paramListConfig)) {
paramListColumn = commonFunc.getHeaderConfig(
paramListConfig
);
}
const paramListTableProps = {
...commonBusiness.getTableTypes(sParamTableName, {
...this.props,
[sParamTableConfig]: paramListConfig,
[sParamTableColumn]: paramListColumn
}),
tableProps: {}
// data: [],
};
if (commonUtils.isEmptyObject(paramListTableProps.config)) {
paramListTableProps.config.gdsconfigformslave = [];
}
return (
<div
key={child.sName}
id={child.sName}
className={enabled ? layoutStyle.editMode : ""}
style={{
display: sFormulaMemo,
position: "relative",
overflow: "hidden"
}}
>
<StaticEditTable
{...paramListTableProps}
setOpterationColumn="Y"
layoutH={this.handleGetLayoutH(layout, child.sName)}
/>
</div>
);
} else {
if (
this.refIds[sParamType] &&
!this.refIds[sParamType].includes(child.sName)
) {
this.refIds[sParamType].push(child.sName);
} else {
this.refIds[sParamType] = [child.sName];
}
const showType = (
<ShowType
key={`${child.sName}_${flexWidth}`}
{...showTypeProps}
/>
);
return (
<div
key={child.sName}
id={child.sName}
className={`${enabled ? layoutStyle.editMode : ""} ${
layoutStyle.showType
}`}
style={{
display: sFormulaMemo,
position: "relative"
}}
>
{w === 1 ? (
<Tooltip placement="top" title={child.showName}>
<div>{showType}</div>
</Tooltip>
) : (
showType
)}
<div
className={`divChecked ${layoutStyle.divChecked}`}
style={{ display: "none" }}
/>
</div>
);
}
})
)}
</ReactGridLayout>
)}
</TabPane>
);
};
// 获取字段弹窗参数
getCommonFieldPopupProps() {
/* 字段弹窗功能 */
let commonFieldPopupProps = {};
let commonFieldPopupTitle = "选择弹窗";
if (commonUtils.isNotEmptyObject(this.props)) {
let commonFieldPopupConfig = {};
const { masterConfig, sModelsId } = this.props;
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(
item =>
commonUtils.isNotEmptyObject(item.sName) &&
item.sDropDownType === "popup"
);
if (iIndex > -1) {
commonFieldPopupConfig = masterConfig.gdsconfigformslave[iIndex];
commonFieldPopupTitle =
commonUtils.isNotEmptyObject(commonFieldPopupConfig) &&
commonUtils.isNotEmptyObject(commonFieldPopupConfig.sActiveName)
? commonFieldPopupConfig.sActiveName
: commonFieldPopupTitle;
commonFieldPopupProps = {
app: {
...this.props.app,
currentPane: {
name: "commonPopup",
config: commonFieldPopupConfig,
conditonValues: this.props.getSqlCondition(
commonFieldPopupConfig
),
title: commonFieldPopupTitle,
route: "/indexPage/commonList",
formRoute: "/indexPage/commonList",
formId: commonFieldPopupConfig.sActiveId,
key: sModelsId + commonFieldPopupConfig.sId,
sModelsType: "search/commonPopup",
select: this.handleSelectCommonFieldPopup,
selectCancel: this.handleSelectCancel.bind(
this,
"commonFieldPopupVisible"
)
}
},
commonFieldPopupTitle,
dispatch: this.props.dispatch,
content: this.props.content,
id: randomId,
onOpenNewTab: this.onOpenNewTab,
outerMasterData: this.props.masterData,
realizeHeight: this.props.realizeHeight /* 拖动偏移高度 */
};
}
}
}
return commonFieldPopupProps;
}
render() {
const { iColValueView, enabled = false } = this.props;
const {
commonFieldPopupVisible,
maskVisible,
randomId,
activeKey
} = this.state;
let viewRowGroup = {};
for (let index = 0; index < this.maxTabCount; index++) {
const i = index === 0 ? "" : index;
viewRowGroup = { ...viewRowGroup, ...this.props[`view${i}Row`] };
}
const commonFieldPopupProps = this.getCommonFieldPopupProps();
return commonUtils.isNotEmptyObject(viewRowGroup) ? (
<Col
span={iColValueView}
order={5}
className={`${layoutStyle.commonLayout} ${
enabled ? layoutStyle.editModeStyle : ""
}`}
style={{ marginTop: -30 }}
ref={ref => {
this.layoutRef = ref;
}}
>
<Tabs
tabBarStyle={{ margin: "0 8px" }}
activeKey={activeKey}
onTabClick={key => {
// 获取当前tab页布局
let activeIndex = 0;
for (let index = 0; index < this.maxTabCount; index++) {
const i = index === 0 ? "" : index;
const tabPaneConfig = this.props[`tabPane${i}Config`];
if (
commonUtils.isNotEmptyObject(tabPaneConfig) &&
tabPaneConfig.key === key
) {
activeIndex = tabPaneConfig.i === "" ? 0 : tabPaneConfig.i;
break;
}
}
this.setState({
activeKey: key,
activeIndex
});
}}
>
{new Array(this.maxTabCount).fill("").map((_, index) => {
const i = index === 0 ? "" : index;
const viewRow = this.props[`view${i}Row`];
if (commonUtils.isNotEmptyObject(viewRow)) {
return this.handleGetPanel(index);
} else {
return "";
}
})}
</Tabs>
{commonFieldPopupVisible ? (
<AntdDraggableModal
width={1300}
zIndex={1000}
title={commonFieldPopupProps.commonFieldPopupTitle}
visible={commonFieldPopupVisible}
onCancel={this.handleSelectCancel.bind(
this,
"commonFieldPopupVisible"
)}
footer={null}
onSaveState={this.props.onSaveState}
className={`${randomId}-CommonListSelectTree`}
>
<CommonListSelectTree {...commonFieldPopupProps} />
</AntdDraggableModal>
) : (
""
)}
<div
className={layoutStyle.mask}
style={{ display: maskVisible ? "" : "none" }}
>
<div className="maskContent">
<div
className="maskSelectArea"
ref={ref => {
this.selectAreaRef = ref;
}}
/>
</div>
</div>
</Col>
) : (
""
);
}
}