@bit-sun/business-component 3.1.10-alpha.1 → 3.1.10-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +5 -5
- package/.gitlab-ci.yml +179 -179
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -74
- package/README.md +27 -27
- package/dist/components/Functional/AddSelect/index.d.ts +1 -1
- package/dist/index.esm.js +485 -205
- package/dist/index.js +486 -206
- package/docs/index.md +21 -21
- package/lib/assets/drag.svg +17 -17
- package/lib/assets/exportFail.svg +37 -37
- package/lib/assets/exportProcessing.svg +28 -28
- package/lib/assets/exportSuccess.svg +34 -34
- package/lib/assets/label_icon_bottom.svg +25 -25
- package/lib/assets/upExport.svg +22 -22
- package/package.json +88 -88
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/arrow_top.svg +17 -17
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/caidan.svg +11 -11
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/exportFail.svg +37 -37
- package/src/assets/exportProcessing.svg +28 -28
- package/src/assets/exportSuccess.svg +34 -34
- package/src/assets/fixed-left-active.svg +11 -11
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right-active.svg +11 -11
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.md +398 -398
- package/src/components/Business/AddSelectBusiness/index.tsx +1116 -1116
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -112
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -193
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -10
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +163 -163
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +8 -8
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +172 -172
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1606 -1606
- package/src/components/Business/BsLayouts/service.ts +10 -10
- package/src/components/Business/BsLayouts/utils.tsx +205 -205
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +568 -566
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -5
- package/src/components/Business/BsSulaQueryTable/index.less +227 -227
- package/src/components/Business/BsSulaQueryTable/index.tsx +767 -767
- package/src/components/Business/BsSulaQueryTable/setting.tsx +890 -888
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
- package/src/components/Business/BsSulaQueryTable/utils.tsx +709 -709
- package/src/components/Business/CommodityEntry/index.md +84 -84
- package/src/components/Business/CommodityEntry/index.tsx +82 -82
- package/src/components/Business/CommonAlert/index.tsx +23 -23
- package/src/components/Business/CommonGuideWrapper/index.less +121 -121
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +94 -94
- package/src/components/Business/DetailPageWrapper/index.less +87 -87
- package/src/components/Business/DetailPageWrapper/index.tsx +327 -327
- package/src/components/Business/DetailPageWrapper/utils.tsx +166 -166
- package/src/components/Business/HomePageWrapper/index.less +33 -33
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +823 -823
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -205
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/function.ts +62 -62
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +534 -534
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/JsonQueryTable/static.ts +450 -450
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +2326 -2318
- package/src/components/Business/SearchSelect/common.ts +134 -134
- package/src/components/Business/SearchSelect/index.md +1570 -1570
- package/src/components/Business/SearchSelect/index.tsx +55 -55
- package/src/components/Business/SearchSelect/utils.ts +125 -125
- package/src/components/Business/StateFlow/index.less +130 -130
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/TreeSearchSelect/index.md +239 -239
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
- package/src/components/Business/TreeSearchSelect/utils.ts +115 -115
- package/src/components/Business/columnSettingTable/columnSetting.tsx +818 -816
- package/src/components/Business/columnSettingTable/index.less +253 -253
- package/src/components/Business/columnSettingTable/index.md +372 -372
- package/src/components/Business/columnSettingTable/index.tsx +225 -225
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +232 -232
- package/src/components/Business/columnSettingTable/utils.tsx +87 -87
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.md +448 -448
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AccessWrapper/index.tsx +33 -33
- package/src/components/Functional/AddSelect/helps.ts +81 -81
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.md +155 -155
- package/src/components/Functional/AddSelect/index.tsx +1088 -1072
- package/src/components/Functional/AuthButton/index.tsx +15 -15
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +39 -39
- package/src/components/Functional/BillEntry/index.tsx +771 -771
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +782 -782
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +52 -52
- package/src/components/Functional/DataValidation/index.tsx +788 -788
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/EllipsisTooltip/index.md +30 -30
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +65 -65
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +129 -129
- package/src/components/Functional/SearchSelect/index.less +121 -121
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +1050 -1046
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +224 -224
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +358 -358
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +255 -255
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +57 -57
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +129 -129
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +774 -774
- package/src/components/Solution/RuleComponent/index.d.ts +34 -29
- package/src/components/Solution/RuleComponent/index.js +1680 -1663
- package/src/components/Solution/RuleComponent/index.less +247 -247
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/ruleFiled.js +2695 -2695
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/components/Solution/RuleComponent/util.js +143 -143
- package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -6
- package/src/components/Solution/RuleSetter/baseRule.tsx +414 -414
- package/src/components/Solution/RuleSetter/function.ts +467 -467
- package/src/components/Solution/RuleSetter/index.less +221 -221
- package/src/components/Solution/RuleSetter/index.tsx +210 -210
- package/src/components/Solution/RuleSetter/service.js +276 -276
- package/src/index.ts +42 -42
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +725 -725
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/styles/bsDefault.less +1933 -1933
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/CustomLoginInfo.ts +55 -55
- package/src/utils/LocalstorageUtils.ts +134 -134
- package/src/utils/TableUtils.less +51 -51
- package/src/utils/TableUtils.tsx +691 -691
- package/src/utils/TreeUtils.ts +12 -12
- package/src/utils/auth.ts +38 -38
- package/src/utils/businessUtils.ts +434 -434
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/constant.ts +38 -38
- package/src/utils/enumConfig.ts +17 -17
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +21 -21
- package/src/utils/request.ts +53 -53
- package/src/utils/requestUtils.ts +197 -197
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +266 -266
- package/src/utils/xlsxUtil.tsx +145 -145
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx
CHANGED
|
@@ -1,358 +1,358 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { Button, Modal, Row } from 'antd';
|
|
3
|
-
import { QueryTable, request } from 'bssula';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { assembleRequest, getMetaData, remoteFetch, convertProp } from './function';
|
|
6
|
-
import { getColumnItem } from './helps';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
export default forwardRef((props: any, ref) => {
|
|
10
|
-
useImperativeHandle(ref, () => {
|
|
11
|
-
return {
|
|
12
|
-
handleOk,
|
|
13
|
-
refreshSelectSource,
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const prop = convertProp(props?.ctx?.name, props.isSearchForm);
|
|
18
|
-
const newFormData = props?.ctx?.form?.getFieldsValue() || {};
|
|
19
|
-
const newestFormData =
|
|
20
|
-
newFormData && Object.keys(newFormData)?.length
|
|
21
|
-
? newFormData
|
|
22
|
-
: props?.formData || {}; // 最新的formData,用来下面监听最新值的改变,做级联效果
|
|
23
|
-
const searchFormData =
|
|
24
|
-
newFormData && Object.keys(newFormData)?.length
|
|
25
|
-
? newFormData
|
|
26
|
-
: props?.formData || {}; // 如果是表格上面的查询表单情况
|
|
27
|
-
const isView = props?.ctx?.mode == 'view'
|
|
28
|
-
|
|
29
|
-
const queryTableRef = useRef(null);
|
|
30
|
-
|
|
31
|
-
const [requestConfig, setRequestConfig] = useState({} as any);
|
|
32
|
-
const [tableState, setTableState] = useState({
|
|
33
|
-
pages: {
|
|
34
|
-
page: 1,
|
|
35
|
-
limit: 20,
|
|
36
|
-
total: 0,
|
|
37
|
-
},
|
|
38
|
-
columns: [],
|
|
39
|
-
fields: [],
|
|
40
|
-
dataList: [],
|
|
41
|
-
currentQuery: {},
|
|
42
|
-
selectedLine: {},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const handleOpen = async () => {
|
|
46
|
-
const requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
47
|
-
isSearchForm: props.isSearchForm,
|
|
48
|
-
newestFormData,
|
|
49
|
-
searchFormData,
|
|
50
|
-
});
|
|
51
|
-
if (!requestConfigNew) return;
|
|
52
|
-
const metaDataId = props.customSelectorConfig?.targetMetaData?.id;
|
|
53
|
-
const metaData = await getMetaData(metaDataId);
|
|
54
|
-
const realMetaData = metaData?.filter((item: any) => item?.inputType != 1)||[]
|
|
55
|
-
const columns = realMetaData.map((item: any) => getColumnItem({ item, props }));
|
|
56
|
-
|
|
57
|
-
// tableState.columns = columns
|
|
58
|
-
const fields = realMetaData?.filter((item: any) => item.infoVo?.isQuery)
|
|
59
|
-
.map((item: any) => {
|
|
60
|
-
let name = `qp-${item.code}-eq`;
|
|
61
|
-
try {
|
|
62
|
-
if (JSON.parse(item.info).isLikeQuery) {
|
|
63
|
-
name = `qp-${item.code}-like`;
|
|
64
|
-
}
|
|
65
|
-
} catch (e) {
|
|
66
|
-
console.log('error', e);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
name,
|
|
71
|
-
label: item.name,
|
|
72
|
-
field: 'input',
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
setTableState({
|
|
76
|
-
...tableState,
|
|
77
|
-
columns,
|
|
78
|
-
fields,
|
|
79
|
-
});
|
|
80
|
-
setRequestConfig(requestConfigNew);
|
|
81
|
-
|
|
82
|
-
const initValue = (!props?.ctx?.form && props?.value?.map?.((v: any) => (v.key || v))) || props?.ctx?.form?.getFieldValue(props.id);
|
|
83
|
-
if(props?.selectProps?.multipleForQuery && !isView && initValue) {
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
queryTableRef?.current?.tableRef?.current?.bsSetSelectInfo(initValue);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const fieldMapping = props.customSelectorConfig?.fieldMapping || [];
|
|
90
|
-
const fieldMappingItem = fieldMapping.find(
|
|
91
|
-
(item: any) => item.codeMappingTo === prop,
|
|
92
|
-
);
|
|
93
|
-
const echoLabel = props.customSelectorConfig?.extraData?.echoLabel;
|
|
94
|
-
//初始获取下拉列表
|
|
95
|
-
const fetchFieldSource = (obj: any, init: any) => {
|
|
96
|
-
const { url, method, convertParams, converter } = obj;
|
|
97
|
-
const params = convertParams({ params: { pageSize: 20, currentPage: 1, ...init } });
|
|
98
|
-
|
|
99
|
-
// 容错处理
|
|
100
|
-
if (!params?.path || params?.path?.indexOf('undefined') > -1) return;
|
|
101
|
-
|
|
102
|
-
request({ url, method, params }).then((res: any) => {
|
|
103
|
-
const { list } = converter({ data: res });
|
|
104
|
-
|
|
105
|
-
const currentField = fieldMappingItem;
|
|
106
|
-
const sourceList: any[] = [];
|
|
107
|
-
const codeList: string[] = [];
|
|
108
|
-
const options = list.map((item: any) => {
|
|
109
|
-
if (currentField && echoLabel) {
|
|
110
|
-
return {
|
|
111
|
-
label: item[echoLabel],
|
|
112
|
-
value: item[currentField.codeMappingFrom],
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (echoLabel && !currentField) {
|
|
116
|
-
return {
|
|
117
|
-
label: item[echoLabel],
|
|
118
|
-
value: item[echoLabel],
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
label: item[currentField.codeMappingTo],
|
|
123
|
-
value: item[currentField.codeMappingTo],
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
options.forEach((item: any) => {
|
|
127
|
-
if (!codeList.includes(item.value)) {
|
|
128
|
-
codeList.push(item.value);
|
|
129
|
-
sourceList.push(item);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
props.setFieldSource(sourceList);
|
|
133
|
-
props.setAllListData(list || []);
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (props.visible) {
|
|
139
|
-
handleOpen();
|
|
140
|
-
}
|
|
141
|
-
}, [props.visible]);
|
|
142
|
-
|
|
143
|
-
const refreshSelectSource = (reset: any = false, init={}) => {
|
|
144
|
-
const requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
145
|
-
isSearchForm: props.isSearchForm,
|
|
146
|
-
newestFormData,
|
|
147
|
-
searchFormData,
|
|
148
|
-
});
|
|
149
|
-
const obj = remoteFetch(requestConfigNew);
|
|
150
|
-
//初始化请求下拉列表
|
|
151
|
-
fetchFieldSource(obj, init);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
const isNeedBack = props?.ctx?.mode != 'create' || props.disabled;
|
|
156
|
-
const initValue = props?.ctx?.form?.getFieldValue(props.id);
|
|
157
|
-
const formCodeKey = `${fieldMappingItem?.codeMappingFrom}`
|
|
158
|
-
const initKey = Array.isArray(initValue) && initValue?.length>1 ? `qp-${formCodeKey}-in` : `qp-${formCodeKey}-eq`;
|
|
159
|
-
const initParams = isNeedBack&&formCodeKey&&initValue ? { [initKey]: Array.isArray(initValue)? initValue.join(',') : initValue } : {};
|
|
160
|
-
refreshSelectSource(null, initParams);
|
|
161
|
-
}, []);
|
|
162
|
-
|
|
163
|
-
const remoteDataSource = useMemo(() => {
|
|
164
|
-
if (Object.keys(requestConfig).length) {
|
|
165
|
-
const obj = remoteFetch(requestConfig,tableState.columns);
|
|
166
|
-
return obj;
|
|
167
|
-
} else {
|
|
168
|
-
return {};
|
|
169
|
-
}
|
|
170
|
-
}, [requestConfig,tableState.columns]);
|
|
171
|
-
|
|
172
|
-
const rowKey = fieldMappingItem?.codeMappingFrom ?? 'id' ?? 'code'
|
|
173
|
-
const handleOk = (rowData?: any, setSource = true) => {
|
|
174
|
-
//多选数据处理
|
|
175
|
-
if (props?.selectProps?.multipleForQuery) {
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
const selectedKesys = queryTableRef?.current?.tableRef?.current?.getSelectedRowKeys()||[];
|
|
178
|
-
// @ts-ignore
|
|
179
|
-
const selectedRows = queryTableRef?.current?.tableRef?.current?.getSelectedRows()||[];
|
|
180
|
-
let realSelectedRows = selectedRows
|
|
181
|
-
if(!rowData && selectedKesys?.length!==selectedRows?.length) {
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
const dataSource = queryTableRef?.current?.tableRef?.current?.getDataSource()||[]
|
|
184
|
-
realSelectedRows = dataSource?.filter((s: any)=> selectedKesys.includes(s[rowKey]));
|
|
185
|
-
}
|
|
186
|
-
//@ts-ignore
|
|
187
|
-
const rowDataList = rowData
|
|
188
|
-
? rowData
|
|
189
|
-
: realSelectedRows;
|
|
190
|
-
|
|
191
|
-
let rowDataTemp: any = {};
|
|
192
|
-
rowDataList.forEach((item: any, index: Number) => {
|
|
193
|
-
Object.keys(item).forEach((key) => {
|
|
194
|
-
if (!Reflect.has(rowDataTemp, key)) {
|
|
195
|
-
rowDataTemp[key] = [item[key]];
|
|
196
|
-
} else {
|
|
197
|
-
rowDataTemp[key].push(item[key]);
|
|
198
|
-
//数组去重
|
|
199
|
-
rowDataTemp[key] = [...new Set(rowDataTemp[key])];
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
rowData = rowDataTemp;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
let mappings = props.customSelectorConfig.fieldMapping;
|
|
207
|
-
const values: any = {};
|
|
208
|
-
//没有映射且有echoLabel的话,默认塞入一条
|
|
209
|
-
if (
|
|
210
|
-
(!mappings || (Array.isArray(mappings) && !mappings.length)) &&
|
|
211
|
-
props.customSelectorConfig?.extraData?.echoLabel
|
|
212
|
-
) {
|
|
213
|
-
mappings.push({
|
|
214
|
-
codeMappingFrom: props.customSelectorConfig?.extraData?.echoLabel,
|
|
215
|
-
codeMappingTo: prop,
|
|
216
|
-
uuid: '',
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
mappings.map((item: any) => {
|
|
221
|
-
if (
|
|
222
|
-
props.customSelectorConfig?.extraData?.echoLabel &&
|
|
223
|
-
item.codeMappingTo === prop &&
|
|
224
|
-
rowData[props.customSelectorConfig?.extraData?.echoLabel]
|
|
225
|
-
) {
|
|
226
|
-
values[`${item.codeMappingTo}Name`] =
|
|
227
|
-
rowData[props.customSelectorConfig?.extraData?.echoLabel];
|
|
228
|
-
}
|
|
229
|
-
values[item.codeMappingTo] = rowData[item.codeMappingFrom];
|
|
230
|
-
});
|
|
231
|
-
// 表单查询项就不给其他字段赋值
|
|
232
|
-
if (!props.isSearchForm) {
|
|
233
|
-
Object.keys(values).map((key, index, list) => {
|
|
234
|
-
if (key.includes('Name')) {
|
|
235
|
-
const valueKey = key.replace('Name', '');
|
|
236
|
-
if (setSource) {
|
|
237
|
-
if (Array.isArray(values[valueKey])) {
|
|
238
|
-
const valueList: any[] = [];
|
|
239
|
-
values[valueKey].forEach((item: any, index: number) => {
|
|
240
|
-
valueList.push({
|
|
241
|
-
label: values[key][index],
|
|
242
|
-
value: values[valueKey][index],
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
props.setFieldSource(valueList);
|
|
246
|
-
} else {
|
|
247
|
-
props.setFieldSource([
|
|
248
|
-
{
|
|
249
|
-
label: values[key],
|
|
250
|
-
value: values[valueKey],
|
|
251
|
-
},
|
|
252
|
-
]);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
props?.setFieldValue?.(key, values[key]);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
} else {
|
|
260
|
-
if (setSource) {
|
|
261
|
-
if (Array.isArray(values[prop])) {
|
|
262
|
-
const valueList: any[] = [];
|
|
263
|
-
values[prop].forEach((item: any, index: number) => {
|
|
264
|
-
valueList.push({
|
|
265
|
-
label: values[`${prop}Name`][index],
|
|
266
|
-
value: values[prop][index],
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
props.setFieldSource(valueList);
|
|
270
|
-
} else {
|
|
271
|
-
props.setFieldSource([
|
|
272
|
-
{
|
|
273
|
-
label: values[`${prop}Name`],
|
|
274
|
-
value: values[prop],
|
|
275
|
-
},
|
|
276
|
-
]);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
const fieldKey = props?.ctx?.name || prop
|
|
280
|
-
props.setFieldValue(fieldKey, values[prop],props.fieldSource);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
props.onCancel();
|
|
284
|
-
//@ts-ignore
|
|
285
|
-
queryTableRef?.current?.tableRef?.current?.clearRowSelection();
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const config = useMemo(() => {
|
|
290
|
-
let returnConfig: any = {
|
|
291
|
-
size: 'small',
|
|
292
|
-
needPageHeader: false,
|
|
293
|
-
tableWrapperStyle: {},
|
|
294
|
-
isHorizontally: false,
|
|
295
|
-
rowSelection: (props?.selectProps?.multipleForQuery && !isView) ? {
|
|
296
|
-
selectedRowKeys: (!props?.ctx?.form && props?.value?.map((v: any) => (v.key || v))) || props?.ctx?.form?.getFieldValue(props.id),
|
|
297
|
-
} : false,
|
|
298
|
-
remoteDataSource,
|
|
299
|
-
fields: tableState.fields,
|
|
300
|
-
columns: tableState.columns,
|
|
301
|
-
rowKey,
|
|
302
|
-
tableProps: !isView && {
|
|
303
|
-
rowClassName: (record: any) => {
|
|
304
|
-
return record[rowKey] == ((!props?.ctx?.form && (props?.value?.key|| props?.value)) || props?.ctx?.form?.getFieldValue(props.id)) ? 'tableSelectedRow': ''
|
|
305
|
-
},
|
|
306
|
-
onRow: (record: any) => {
|
|
307
|
-
return {
|
|
308
|
-
onDoubleClick: () => {
|
|
309
|
-
handleOk(record);
|
|
310
|
-
}, //双击
|
|
311
|
-
};
|
|
312
|
-
},
|
|
313
|
-
} || {},
|
|
314
|
-
};
|
|
315
|
-
if (Object.keys(remoteDataSource).length) {
|
|
316
|
-
return returnConfig;
|
|
317
|
-
} else {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
}, [tableState, remoteDataSource]);
|
|
321
|
-
|
|
322
|
-
return (
|
|
323
|
-
<Modal
|
|
324
|
-
title=""
|
|
325
|
-
width={1300}
|
|
326
|
-
open={props.visible}
|
|
327
|
-
footer={null}
|
|
328
|
-
onCancel={() => {
|
|
329
|
-
props.onCancel();
|
|
330
|
-
}}
|
|
331
|
-
destroyOnClose
|
|
332
|
-
>
|
|
333
|
-
{config && <QueryTable ref={queryTableRef} {...config} />}
|
|
334
|
-
|
|
335
|
-
{props?.selectProps?.multipleForQuery && !isView && (
|
|
336
|
-
<Row justify="center" style={{ marginBottom: 30, marginTop: 10 }}>
|
|
337
|
-
<Button
|
|
338
|
-
type="primary"
|
|
339
|
-
style={{ marginRight: 20 }}
|
|
340
|
-
onClick={() => handleOk()}
|
|
341
|
-
>
|
|
342
|
-
提交
|
|
343
|
-
</Button>
|
|
344
|
-
<Button
|
|
345
|
-
type="default"
|
|
346
|
-
onClick={() => {
|
|
347
|
-
props.onCancel();
|
|
348
|
-
//@ts-ignore
|
|
349
|
-
queryTableRef?.current?.tableRef?.current?.clearRowSelection();
|
|
350
|
-
}}
|
|
351
|
-
>
|
|
352
|
-
取消
|
|
353
|
-
</Button>
|
|
354
|
-
</Row>
|
|
355
|
-
)}
|
|
356
|
-
</Modal>
|
|
357
|
-
);
|
|
358
|
-
});
|
|
1
|
+
import { useEffect, useMemo, useRef, useState, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import { Button, Modal, Row } from 'antd';
|
|
3
|
+
import { QueryTable, request } from 'bssula';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { assembleRequest, getMetaData, remoteFetch, convertProp } from './function';
|
|
6
|
+
import { getColumnItem } from './helps';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
export default forwardRef((props: any, ref) => {
|
|
10
|
+
useImperativeHandle(ref, () => {
|
|
11
|
+
return {
|
|
12
|
+
handleOk,
|
|
13
|
+
refreshSelectSource,
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const prop = convertProp(props?.ctx?.name, props.isSearchForm);
|
|
18
|
+
const newFormData = props?.ctx?.form?.getFieldsValue() || {};
|
|
19
|
+
const newestFormData =
|
|
20
|
+
newFormData && Object.keys(newFormData)?.length
|
|
21
|
+
? newFormData
|
|
22
|
+
: props?.formData || {}; // 最新的formData,用来下面监听最新值的改变,做级联效果
|
|
23
|
+
const searchFormData =
|
|
24
|
+
newFormData && Object.keys(newFormData)?.length
|
|
25
|
+
? newFormData
|
|
26
|
+
: props?.formData || {}; // 如果是表格上面的查询表单情况
|
|
27
|
+
const isView = props?.ctx?.mode == 'view'
|
|
28
|
+
|
|
29
|
+
const queryTableRef = useRef(null);
|
|
30
|
+
|
|
31
|
+
const [requestConfig, setRequestConfig] = useState({} as any);
|
|
32
|
+
const [tableState, setTableState] = useState({
|
|
33
|
+
pages: {
|
|
34
|
+
page: 1,
|
|
35
|
+
limit: 20,
|
|
36
|
+
total: 0,
|
|
37
|
+
},
|
|
38
|
+
columns: [],
|
|
39
|
+
fields: [],
|
|
40
|
+
dataList: [],
|
|
41
|
+
currentQuery: {},
|
|
42
|
+
selectedLine: {},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const handleOpen = async () => {
|
|
46
|
+
const requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
47
|
+
isSearchForm: props.isSearchForm,
|
|
48
|
+
newestFormData,
|
|
49
|
+
searchFormData,
|
|
50
|
+
});
|
|
51
|
+
if (!requestConfigNew) return;
|
|
52
|
+
const metaDataId = props.customSelectorConfig?.targetMetaData?.id;
|
|
53
|
+
const metaData = await getMetaData(metaDataId);
|
|
54
|
+
const realMetaData = metaData?.filter((item: any) => item?.inputType != 1)||[]
|
|
55
|
+
const columns = realMetaData.map((item: any) => getColumnItem({ item, props }));
|
|
56
|
+
|
|
57
|
+
// tableState.columns = columns
|
|
58
|
+
const fields = realMetaData?.filter((item: any) => item.infoVo?.isQuery)
|
|
59
|
+
.map((item: any) => {
|
|
60
|
+
let name = `qp-${item.code}-eq`;
|
|
61
|
+
try {
|
|
62
|
+
if (JSON.parse(item.info).isLikeQuery) {
|
|
63
|
+
name = `qp-${item.code}-like`;
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.log('error', e);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
name,
|
|
71
|
+
label: item.name,
|
|
72
|
+
field: 'input',
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
setTableState({
|
|
76
|
+
...tableState,
|
|
77
|
+
columns,
|
|
78
|
+
fields,
|
|
79
|
+
});
|
|
80
|
+
setRequestConfig(requestConfigNew);
|
|
81
|
+
|
|
82
|
+
const initValue = (!props?.ctx?.form && props?.value?.map?.((v: any) => (v.key || v))) || props?.ctx?.form?.getFieldValue(props.id);
|
|
83
|
+
if(props?.selectProps?.multipleForQuery && !isView && initValue) {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
queryTableRef?.current?.tableRef?.current?.bsSetSelectInfo(initValue);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const fieldMapping = props.customSelectorConfig?.fieldMapping || [];
|
|
90
|
+
const fieldMappingItem = fieldMapping.find(
|
|
91
|
+
(item: any) => item.codeMappingTo === prop,
|
|
92
|
+
);
|
|
93
|
+
const echoLabel = props.customSelectorConfig?.extraData?.echoLabel;
|
|
94
|
+
//初始获取下拉列表
|
|
95
|
+
const fetchFieldSource = (obj: any, init: any) => {
|
|
96
|
+
const { url, method, convertParams, converter } = obj;
|
|
97
|
+
const params = convertParams({ params: { pageSize: 20, currentPage: 1, ...init } });
|
|
98
|
+
|
|
99
|
+
// 容错处理
|
|
100
|
+
if (!params?.path || params?.path?.indexOf('undefined') > -1) return;
|
|
101
|
+
|
|
102
|
+
request({ url, method, params }).then((res: any) => {
|
|
103
|
+
const { list } = converter({ data: res });
|
|
104
|
+
|
|
105
|
+
const currentField = fieldMappingItem;
|
|
106
|
+
const sourceList: any[] = [];
|
|
107
|
+
const codeList: string[] = [];
|
|
108
|
+
const options = list.map((item: any) => {
|
|
109
|
+
if (currentField && echoLabel) {
|
|
110
|
+
return {
|
|
111
|
+
label: item[echoLabel],
|
|
112
|
+
value: item[currentField.codeMappingFrom],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (echoLabel && !currentField) {
|
|
116
|
+
return {
|
|
117
|
+
label: item[echoLabel],
|
|
118
|
+
value: item[echoLabel],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
label: item[currentField.codeMappingTo],
|
|
123
|
+
value: item[currentField.codeMappingTo],
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
options.forEach((item: any) => {
|
|
127
|
+
if (!codeList.includes(item.value)) {
|
|
128
|
+
codeList.push(item.value);
|
|
129
|
+
sourceList.push(item);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
props.setFieldSource(sourceList);
|
|
133
|
+
props.setAllListData(list || []);
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (props.visible) {
|
|
139
|
+
handleOpen();
|
|
140
|
+
}
|
|
141
|
+
}, [props.visible]);
|
|
142
|
+
|
|
143
|
+
const refreshSelectSource = (reset: any = false, init={}) => {
|
|
144
|
+
const requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
145
|
+
isSearchForm: props.isSearchForm,
|
|
146
|
+
newestFormData,
|
|
147
|
+
searchFormData,
|
|
148
|
+
});
|
|
149
|
+
const obj = remoteFetch(requestConfigNew);
|
|
150
|
+
//初始化请求下拉列表
|
|
151
|
+
fetchFieldSource(obj, init);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
const isNeedBack = props?.ctx?.mode != 'create' || props.disabled;
|
|
156
|
+
const initValue = props?.ctx?.form?.getFieldValue(props.id);
|
|
157
|
+
const formCodeKey = `${fieldMappingItem?.codeMappingFrom}`
|
|
158
|
+
const initKey = Array.isArray(initValue) && initValue?.length>1 ? `qp-${formCodeKey}-in` : `qp-${formCodeKey}-eq`;
|
|
159
|
+
const initParams = isNeedBack&&formCodeKey&&initValue ? { [initKey]: Array.isArray(initValue)? initValue.join(',') : initValue } : {};
|
|
160
|
+
refreshSelectSource(null, initParams);
|
|
161
|
+
}, []);
|
|
162
|
+
|
|
163
|
+
const remoteDataSource = useMemo(() => {
|
|
164
|
+
if (Object.keys(requestConfig).length) {
|
|
165
|
+
const obj = remoteFetch(requestConfig,tableState.columns);
|
|
166
|
+
return obj;
|
|
167
|
+
} else {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
}, [requestConfig,tableState.columns]);
|
|
171
|
+
|
|
172
|
+
const rowKey = fieldMappingItem?.codeMappingFrom ?? 'id' ?? 'code'
|
|
173
|
+
const handleOk = (rowData?: any, setSource = true) => {
|
|
174
|
+
//多选数据处理
|
|
175
|
+
if (props?.selectProps?.multipleForQuery) {
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
const selectedKesys = queryTableRef?.current?.tableRef?.current?.getSelectedRowKeys()||[];
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
const selectedRows = queryTableRef?.current?.tableRef?.current?.getSelectedRows()||[];
|
|
180
|
+
let realSelectedRows = selectedRows
|
|
181
|
+
if(!rowData && selectedKesys?.length!==selectedRows?.length) {
|
|
182
|
+
// @ts-ignore
|
|
183
|
+
const dataSource = queryTableRef?.current?.tableRef?.current?.getDataSource()||[]
|
|
184
|
+
realSelectedRows = dataSource?.filter((s: any)=> selectedKesys.includes(s[rowKey]));
|
|
185
|
+
}
|
|
186
|
+
//@ts-ignore
|
|
187
|
+
const rowDataList = rowData
|
|
188
|
+
? rowData
|
|
189
|
+
: realSelectedRows;
|
|
190
|
+
|
|
191
|
+
let rowDataTemp: any = {};
|
|
192
|
+
rowDataList.forEach((item: any, index: Number) => {
|
|
193
|
+
Object.keys(item).forEach((key) => {
|
|
194
|
+
if (!Reflect.has(rowDataTemp, key)) {
|
|
195
|
+
rowDataTemp[key] = [item[key]];
|
|
196
|
+
} else {
|
|
197
|
+
rowDataTemp[key].push(item[key]);
|
|
198
|
+
//数组去重
|
|
199
|
+
rowDataTemp[key] = [...new Set(rowDataTemp[key])];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
rowData = rowDataTemp;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let mappings = props.customSelectorConfig.fieldMapping;
|
|
207
|
+
const values: any = {};
|
|
208
|
+
//没有映射且有echoLabel的话,默认塞入一条
|
|
209
|
+
if (
|
|
210
|
+
(!mappings || (Array.isArray(mappings) && !mappings.length)) &&
|
|
211
|
+
props.customSelectorConfig?.extraData?.echoLabel
|
|
212
|
+
) {
|
|
213
|
+
mappings.push({
|
|
214
|
+
codeMappingFrom: props.customSelectorConfig?.extraData?.echoLabel,
|
|
215
|
+
codeMappingTo: prop,
|
|
216
|
+
uuid: '',
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
mappings.map((item: any) => {
|
|
221
|
+
if (
|
|
222
|
+
props.customSelectorConfig?.extraData?.echoLabel &&
|
|
223
|
+
item.codeMappingTo === prop &&
|
|
224
|
+
rowData[props.customSelectorConfig?.extraData?.echoLabel]
|
|
225
|
+
) {
|
|
226
|
+
values[`${item.codeMappingTo}Name`] =
|
|
227
|
+
rowData[props.customSelectorConfig?.extraData?.echoLabel];
|
|
228
|
+
}
|
|
229
|
+
values[item.codeMappingTo] = rowData[item.codeMappingFrom];
|
|
230
|
+
});
|
|
231
|
+
// 表单查询项就不给其他字段赋值
|
|
232
|
+
if (!props.isSearchForm) {
|
|
233
|
+
Object.keys(values).map((key, index, list) => {
|
|
234
|
+
if (key.includes('Name')) {
|
|
235
|
+
const valueKey = key.replace('Name', '');
|
|
236
|
+
if (setSource) {
|
|
237
|
+
if (Array.isArray(values[valueKey])) {
|
|
238
|
+
const valueList: any[] = [];
|
|
239
|
+
values[valueKey].forEach((item: any, index: number) => {
|
|
240
|
+
valueList.push({
|
|
241
|
+
label: values[key][index],
|
|
242
|
+
value: values[valueKey][index],
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
props.setFieldSource(valueList);
|
|
246
|
+
} else {
|
|
247
|
+
props.setFieldSource([
|
|
248
|
+
{
|
|
249
|
+
label: values[key],
|
|
250
|
+
value: values[valueKey],
|
|
251
|
+
},
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
props?.setFieldValue?.(key, values[key]);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
} else {
|
|
260
|
+
if (setSource) {
|
|
261
|
+
if (Array.isArray(values[prop])) {
|
|
262
|
+
const valueList: any[] = [];
|
|
263
|
+
values[prop].forEach((item: any, index: number) => {
|
|
264
|
+
valueList.push({
|
|
265
|
+
label: values[`${prop}Name`][index],
|
|
266
|
+
value: values[prop][index],
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
props.setFieldSource(valueList);
|
|
270
|
+
} else {
|
|
271
|
+
props.setFieldSource([
|
|
272
|
+
{
|
|
273
|
+
label: values[`${prop}Name`],
|
|
274
|
+
value: values[prop],
|
|
275
|
+
},
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const fieldKey = props?.ctx?.name || prop
|
|
280
|
+
props.setFieldValue(fieldKey, values[prop],props.fieldSource);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
props.onCancel();
|
|
284
|
+
//@ts-ignore
|
|
285
|
+
queryTableRef?.current?.tableRef?.current?.clearRowSelection();
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
const config = useMemo(() => {
|
|
290
|
+
let returnConfig: any = {
|
|
291
|
+
size: 'small',
|
|
292
|
+
needPageHeader: false,
|
|
293
|
+
tableWrapperStyle: {},
|
|
294
|
+
isHorizontally: false,
|
|
295
|
+
rowSelection: (props?.selectProps?.multipleForQuery && !isView) ? {
|
|
296
|
+
selectedRowKeys: (!props?.ctx?.form && props?.value?.map((v: any) => (v.key || v))) || props?.ctx?.form?.getFieldValue(props.id),
|
|
297
|
+
} : false,
|
|
298
|
+
remoteDataSource,
|
|
299
|
+
fields: tableState.fields,
|
|
300
|
+
columns: tableState.columns,
|
|
301
|
+
rowKey,
|
|
302
|
+
tableProps: !isView && {
|
|
303
|
+
rowClassName: (record: any) => {
|
|
304
|
+
return record[rowKey] == ((!props?.ctx?.form && (props?.value?.key|| props?.value)) || props?.ctx?.form?.getFieldValue(props.id)) ? 'tableSelectedRow': ''
|
|
305
|
+
},
|
|
306
|
+
onRow: (record: any) => {
|
|
307
|
+
return {
|
|
308
|
+
onDoubleClick: () => {
|
|
309
|
+
handleOk(record);
|
|
310
|
+
}, //双击
|
|
311
|
+
};
|
|
312
|
+
},
|
|
313
|
+
} || {},
|
|
314
|
+
};
|
|
315
|
+
if (Object.keys(remoteDataSource).length) {
|
|
316
|
+
return returnConfig;
|
|
317
|
+
} else {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
}, [tableState, remoteDataSource]);
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<Modal
|
|
324
|
+
title=""
|
|
325
|
+
width={1300}
|
|
326
|
+
open={props.visible}
|
|
327
|
+
footer={null}
|
|
328
|
+
onCancel={() => {
|
|
329
|
+
props.onCancel();
|
|
330
|
+
}}
|
|
331
|
+
destroyOnClose
|
|
332
|
+
>
|
|
333
|
+
{config && <QueryTable ref={queryTableRef} {...config} />}
|
|
334
|
+
|
|
335
|
+
{props?.selectProps?.multipleForQuery && !isView && (
|
|
336
|
+
<Row justify="center" style={{ marginBottom: 30, marginTop: 10 }}>
|
|
337
|
+
<Button
|
|
338
|
+
type="primary"
|
|
339
|
+
style={{ marginRight: 20 }}
|
|
340
|
+
onClick={() => handleOk()}
|
|
341
|
+
>
|
|
342
|
+
提交
|
|
343
|
+
</Button>
|
|
344
|
+
<Button
|
|
345
|
+
type="default"
|
|
346
|
+
onClick={() => {
|
|
347
|
+
props.onCancel();
|
|
348
|
+
//@ts-ignore
|
|
349
|
+
queryTableRef?.current?.tableRef?.current?.clearRowSelection();
|
|
350
|
+
}}
|
|
351
|
+
>
|
|
352
|
+
取消
|
|
353
|
+
</Button>
|
|
354
|
+
</Row>
|
|
355
|
+
)}
|
|
356
|
+
</Modal>
|
|
357
|
+
);
|
|
358
|
+
});
|