|
@@ -97,6 +97,8 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -97,6 +97,8 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
97
|
type,
|
97
|
type,
|
98
|
} = props;
|
98
|
} = props;
|
99
|
const [searchValue, setSearchValue] = useState('');
|
99
|
const [searchValue, setSearchValue] = useState('');
|
|
|
100
|
+ const [mExpandedKeys, setMExpandedKeys] = useState(expandedKeys);
|
|
|
101
|
+ const [isExpand, setIsExpand] = useState(true);
|
100
|
|
102
|
|
101
|
// const [form] = Form.useForm()
|
103
|
// const [form] = Form.useForm()
|
102
|
//判断数组是否只有一个子节点
|
104
|
//判断数组是否只有一个子节点
|
|
@@ -130,6 +132,12 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -130,6 +132,12 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
130
|
}
|
132
|
}
|
131
|
return true;
|
133
|
return true;
|
132
|
};
|
134
|
};
|
|
|
135
|
+
|
|
|
136
|
+ const handleTree = (id: any) => {
|
|
|
137
|
+ setIsExpand(true);
|
|
|
138
|
+ handleAddTree(id);
|
|
|
139
|
+ };
|
|
|
140
|
+
|
133
|
const typeDis = !!type;
|
141
|
const typeDis = !!type;
|
134
|
const columns = [
|
142
|
const columns = [
|
135
|
{
|
143
|
{
|
|
@@ -249,7 +257,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -249,7 +257,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
249
|
value={[
|
257
|
value={[
|
250
|
{
|
258
|
{
|
251
|
mappingValues: text?.mappingValues || [],
|
259
|
mappingValues: text?.mappingValues || [],
|
252
|
- // disabled: disabled,
|
260
|
+ disabled: record.disabled,
|
253
|
valuesObj: record.valuesObj || [],
|
261
|
valuesObj: record.valuesObj || [],
|
254
|
params: { appCode: 'appCode', useId: true },
|
262
|
params: { appCode: 'appCode', useId: true },
|
255
|
// valueOptions: getValueOptions(nodeData),
|
263
|
// valueOptions: getValueOptions(nodeData),
|
|
@@ -363,7 +371,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -363,7 +371,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
363
|
component={SubNodeIcon}
|
371
|
component={SubNodeIcon}
|
364
|
/>
|
372
|
/>
|
365
|
}
|
373
|
}
|
366
|
- onClick={() => handleAddTree(record.id)}
|
374
|
+ onClick={() => handleTree(record.id)}
|
367
|
/>
|
375
|
/>
|
368
|
)}
|
376
|
)}
|
369
|
|
377
|
|
|
@@ -380,7 +388,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -380,7 +388,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
380
|
type={'qx-icon-delete'}
|
388
|
type={'qx-icon-delete'}
|
381
|
/>
|
389
|
/>
|
382
|
}
|
390
|
}
|
383
|
- onClick={() => handleDelete(record)}
|
391
|
+ onClick={(e) => handleDelete(e, record)}
|
384
|
/>
|
392
|
/>
|
385
|
)}
|
393
|
)}
|
386
|
</Space>
|
394
|
</Space>
|
|
@@ -614,6 +622,15 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -614,6 +622,15 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
614
|
}, [visible]);
|
622
|
}, [visible]);
|
615
|
|
623
|
|
616
|
useEffect(() => {
|
624
|
useEffect(() => {
|
|
|
625
|
+ setMExpandedKeys(expandedKeys);
|
|
|
626
|
+ // if (visible) {
|
|
|
627
|
+ // if (data.length == 0) {
|
|
|
628
|
+ // handleAdd('');
|
|
|
629
|
+ // }
|
|
|
630
|
+ // }
|
|
|
631
|
+ }, [expandedKeys]);
|
|
|
632
|
+
|
|
|
633
|
+ useEffect(() => {
|
617
|
const value = cloneDeep(data);
|
634
|
const value = cloneDeep(data);
|
618
|
const expandedArray: any = [];
|
635
|
const expandedArray: any = [];
|
619
|
(value || []).map((_item: ParamDesignModel) => {
|
636
|
(value || []).map((_item: ParamDesignModel) => {
|
|
@@ -779,6 +796,24 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -779,6 +796,24 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
779
|
setMidData(_data);
|
796
|
setMidData(_data);
|
780
|
};
|
797
|
};
|
781
|
|
798
|
|
|
|
799
|
+ const onModalExpand = (data, e, onExpand) => {
|
|
|
800
|
+ setIsExpand(false);
|
|
|
801
|
+ // console.log('data', data)
|
|
|
802
|
+ // console.log('mExpandedKeys', mExpandedKeys)
|
|
|
803
|
+ const index = mExpandedKeys.indexOf(data.id);
|
|
|
804
|
+ if (index > -1) {
|
|
|
805
|
+ mExpandedKeys.splice(index, 1);
|
|
|
806
|
+ setMExpandedKeys(mExpandedKeys);
|
|
|
807
|
+ } else {
|
|
|
808
|
+ mExpandedKeys.push(data.id);
|
|
|
809
|
+ setMExpandedKeys(mExpandedKeys);
|
|
|
810
|
+ }
|
|
|
811
|
+
|
|
|
812
|
+ setTimeout(() => {
|
|
|
813
|
+ onExpand(data, e);
|
|
|
814
|
+ }, 400);
|
|
|
815
|
+ };
|
|
|
816
|
+
|
782
|
const RenderTitle = (
|
817
|
const RenderTitle = (
|
783
|
<div>
|
818
|
<div>
|
784
|
高级参数设计器
|
819
|
高级参数设计器
|
|
@@ -798,7 +833,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -798,7 +833,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
798
|
</Tooltip>
|
833
|
</Tooltip>
|
799
|
</div>
|
834
|
</div>
|
800
|
);
|
835
|
);
|
801
|
-
|
|
|
802
|
return (
|
836
|
return (
|
803
|
<>
|
837
|
<>
|
804
|
<Modal
|
838
|
<Modal
|
|
@@ -898,7 +932,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -898,7 +932,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
898
|
expandable={{
|
932
|
expandable={{
|
899
|
defaultExpandAllRows: true,
|
933
|
defaultExpandAllRows: true,
|
900
|
childrenColumnName: 'child',
|
934
|
childrenColumnName: 'child',
|
901
|
- expandedRowKeys: expandedKeys,
|
935
|
+ expandedRowKeys: isExpand ? mExpandedKeys : false,
|
902
|
expandIcon: ({ expanded, onExpand, record }) =>
|
936
|
expandIcon: ({ expanded, onExpand, record }) =>
|
903
|
record.child && record.child.length > 0 && expanded ? (
|
937
|
record.child && record.child.length > 0 && expanded ? (
|
904
|
<>
|
938
|
<>
|
|
@@ -906,7 +940,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -906,7 +940,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
906
|
<QxBaseIcon
|
940
|
<QxBaseIcon
|
907
|
className={'table-expanded'}
|
941
|
className={'table-expanded'}
|
908
|
type={'qx-caret-down'}
|
942
|
type={'qx-caret-down'}
|
909
|
- onClick={(e) => onExpand(record, e)}
|
943
|
+ onClick={(e) => onModalExpand(record, e, onExpand)}
|
910
|
/>
|
944
|
/>
|
911
|
</>
|
945
|
</>
|
912
|
) : record.child && record.child.length > 0 && !expanded ? (
|
946
|
) : record.child && record.child.length > 0 && !expanded ? (
|
|
@@ -915,7 +949,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
|
@@ -915,7 +949,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { |
915
|
<QxBaseIcon
|
949
|
<QxBaseIcon
|
916
|
className={'table-expanded-change'}
|
950
|
className={'table-expanded-change'}
|
917
|
type={'qx-caret-down'}
|
951
|
type={'qx-caret-down'}
|
918
|
- onClick={(e) => onExpand(record, e)}
|
952
|
+ onClick={(e) => onModalExpand(record, e, onExpand)}
|
919
|
/>
|
953
|
/>
|
920
|
</>
|
954
|
</>
|
921
|
) : record.disabled ? (
|
955
|
) : record.disabled ? (
|