@bit-sun/business-component 4.0.0-alpha.3 → 4.0.2
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 -0
- package/.fatherrc.ts +5 -0
- package/.gitlab-ci.yml +179 -0
- package/.prettierignore +7 -0
- package/.prettierrc +11 -0
- package/.umirc.ts +74 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/index.d.ts +1 -0
- package/dist/components/Common/ParagraphCopier/index.d.ts +8 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +3 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.d.ts +2 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1901 -639
- package/dist/index.js +1903 -636
- package/dist/utils/requestUtils.d.ts +1 -0
- package/dist/utils/utils.d.ts +3 -0
- package/docs/index.md +21 -0
- package/package.json +9 -14
- package/src/assets/32.svg +28 -0
- package/src/assets/addIcon.svg +18 -0
- package/src/assets/allfunc.svg +28 -0
- package/src/assets/arrowRight.svg +25 -0
- package/src/assets/arrow_top.png +0 -0
- package/src/assets/arrow_top.svg +18 -0
- package/src/assets/btn-delete.svg +30 -0
- package/src/assets/btn-edit.svg +20 -0
- package/src/assets/btn-more.svg +18 -0
- package/src/assets/btn-submit.svg +20 -0
- package/src/assets/caidan.svg +12 -0
- package/src/assets/close.svg +26 -0
- package/src/assets/closeicon.png +0 -0
- package/src/assets/drag.svg +17 -0
- package/src/assets/exportFail.svg +38 -0
- package/src/assets/exportProcessing.svg +29 -0
- package/src/assets/exportSuccess.svg +35 -0
- package/src/assets/exportlogo.png +0 -0
- package/src/assets/fixed-left-active.svg +12 -0
- package/src/assets/fixed-left.svg +16 -0
- package/src/assets/fixed-right-active.svg +12 -0
- package/src/assets/fixed-right.svg +16 -0
- package/src/assets/guanbi.svg +16 -0
- package/src/assets/icon-quanping.svg +16 -0
- package/src/assets/icon-shezhi.svg +18 -0
- package/src/assets/label_icon_bottom.svg +26 -0
- package/src/assets/list-no-img.svg +22 -0
- package/src/assets/morentouxiang-32.svg +24 -0
- package/src/assets/right.png +0 -0
- package/src/assets/scanning.svg +25 -0
- package/src/assets/upExport.svg +23 -0
- package/src/assets/xinglan-icon-out.png +0 -0
- package/src/common/ENUM.ts +41 -0
- package/src/components/Business/AddSelectBusiness/index.md +398 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +1116 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +38 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +243 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +385 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +286 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +75 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +171 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +65 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +154 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +73 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +163 -0
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -0
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -0
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +9 -0
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +172 -0
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +161 -0
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +76 -0
- package/src/components/Business/BsLayouts/index.less +80 -0
- package/src/components/Business/BsLayouts/index.tsx +1602 -0
- package/src/components/Business/BsLayouts/service.ts +11 -0
- package/src/components/Business/BsLayouts/utils.tsx +205 -0
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -0
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -0
- package/src/components/Business/BsSulaQueryTable/index.less +228 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +817 -0
- package/src/components/Business/BsSulaQueryTable/setting.tsx +937 -0
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -0
- package/src/components/Business/BsSulaQueryTable/utils.tsx +709 -0
- package/src/components/Business/CommodityEntry/index.md +84 -0
- package/src/components/Business/CommodityEntry/index.tsx +82 -0
- package/src/components/Business/CommonAlert/index.less +0 -0
- package/src/components/Business/CommonAlert/index.tsx +23 -0
- package/src/components/Business/CommonGuideWrapper/index.less +156 -0
- package/src/components/Business/CommonGuideWrapper/index.md +61 -0
- package/src/components/Business/CommonGuideWrapper/index.tsx +108 -0
- package/src/components/Business/DetailPageWrapper/index.less +89 -0
- package/src/components/Business/DetailPageWrapper/index.tsx +306 -0
- package/src/components/Business/DetailPageWrapper/utils.tsx +166 -0
- package/src/components/Business/HomePageWrapper/index.less +36 -0
- package/src/components/Business/HomePageWrapper/index.md +45 -0
- package/src/components/Business/HomePageWrapper/index.tsx +130 -0
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +823 -0
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +206 -0
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -0
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -0
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -0
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -0
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -0
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -0
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -0
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -0
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -0
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -0
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -0
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -0
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -0
- package/src/components/Business/JsonQueryTable/function.ts +62 -0
- package/src/components/Business/JsonQueryTable/index.less +17 -0
- package/src/components/Business/JsonQueryTable/index.md +328 -0
- package/src/components/Business/JsonQueryTable/index.tsx +534 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -0
- package/src/components/Business/JsonQueryTable/static.ts +450 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +2207 -0
- package/src/components/Business/SearchSelect/common.ts +134 -0
- package/src/components/Business/SearchSelect/index.md +1570 -0
- package/src/components/Business/SearchSelect/index.tsx +55 -0
- package/src/components/Business/SearchSelect/utils.ts +125 -0
- package/src/components/Business/StateFlow/index.less +131 -0
- package/src/components/Business/StateFlow/index.md +60 -0
- package/src/components/Business/StateFlow/index.tsx +30 -0
- package/src/components/Business/TreeSearchSelect/index.md +239 -0
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -0
- package/src/components/Business/TreeSearchSelect/utils.ts +115 -0
- package/src/components/Business/columnSettingTable/columnSetting.tsx +869 -0
- package/src/components/Business/columnSettingTable/index.less +253 -0
- package/src/components/Business/columnSettingTable/index.md +373 -0
- package/src/components/Business/columnSettingTable/index.tsx +235 -0
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +232 -0
- package/src/components/Business/columnSettingTable/utils.tsx +88 -0
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -0
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -0
- package/src/components/Business/moreTreeTable/index.less +100 -0
- package/src/components/Business/moreTreeTable/index.md +448 -0
- package/src/components/Business/moreTreeTable/index.tsx +387 -0
- package/src/components/Business/moreTreeTable/utils.ts +127 -0
- package/src/components/Common/ExtendedCollapse/ExtendedPanel.tsx +51 -0
- package/src/components/Common/ExtendedCollapse/index.less +33 -0
- package/src/components/Common/ExtendedCollapse/index.md +136 -0
- package/src/components/Common/ExtendedCollapse/index.tsx +25 -0
- package/src/components/Common/ParagraphCopier/index.md +81 -0
- package/src/components/Common/ParagraphCopier/index.tsx +56 -0
- package/src/components/Common/Section/index.md +120 -0
- package/src/components/Common/Section/index.module.less +16 -0
- package/src/components/Common/Section/index.tsx +70 -0
- package/src/components/Functional/AccessWrapper/index.tsx +34 -0
- package/src/components/Functional/AddSelect/helps.ts +81 -0
- package/src/components/Functional/AddSelect/index.less +367 -0
- package/src/components/Functional/AddSelect/index.md +155 -0
- package/src/components/Functional/AddSelect/index.tsx +1072 -0
- package/src/components/Functional/AuthButton/index.tsx +15 -0
- package/src/components/Functional/BillEntry/index.less +371 -0
- package/src/components/Functional/BillEntry/index.md +39 -0
- package/src/components/Functional/BillEntry/index.tsx +771 -0
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -0
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -0
- package/src/components/Functional/BsAntdSula/index.ts +2 -0
- package/src/components/Functional/DataImport/index.less +63 -0
- package/src/components/Functional/DataImport/index.md +44 -0
- package/src/components/Functional/DataImport/index.tsx +782 -0
- package/src/components/Functional/DataValidation/index.less +63 -0
- package/src/components/Functional/DataValidation/index.md +52 -0
- package/src/components/Functional/DataValidation/index.tsx +788 -0
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -0
- package/src/components/Functional/EllipsisTooltip/index.js +36 -0
- package/src/components/Functional/EllipsisTooltip/index.md +30 -0
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -0
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +65 -0
- package/src/components/Functional/QueryMutipleInput/index.less +37 -0
- package/src/components/Functional/QueryMutipleInput/index.md +33 -0
- package/src/components/Functional/QueryMutipleInput/index.tsx +129 -0
- package/src/components/Functional/SearchSelect/index.less +121 -0
- package/src/components/Functional/SearchSelect/index.md +141 -0
- package/src/components/Functional/SearchSelect/index.tsx +1041 -0
- package/src/components/Functional/SearchSelect/utils.ts +3 -0
- package/src/components/Functional/TreeSearchSelect/index.md +47 -0
- package/src/components/Functional/TreeSearchSelect/index.tsx +224 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +358 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +255 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +58 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +129 -0
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -0
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +743 -0
- package/src/components/Solution/RuleComponent/index.d.ts +29 -0
- package/src/components/Solution/RuleComponent/index.js +1614 -0
- package/src/components/Solution/RuleComponent/index.less +247 -0
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +2587 -0
- package/src/components/Solution/RuleComponent/services.ts +13 -0
- package/src/components/Solution/RuleComponent/util.js +143 -0
- package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -0
- package/src/components/Solution/RuleSetter/baseRule.tsx +394 -0
- package/src/components/Solution/RuleSetter/function.ts +437 -0
- package/src/components/Solution/RuleSetter/index.less +221 -0
- package/src/components/Solution/RuleSetter/index.tsx +208 -0
- package/src/components/Solution/RuleSetter/service.js +276 -0
- package/src/index.ts +46 -0
- package/src/plugin/TableColumnSetting/index.less +247 -0
- package/src/plugin/TableColumnSetting/index.md +50 -0
- package/src/plugin/TableColumnSetting/index.tsx +725 -0
- package/src/plugin/TableColumnSetting/utils.ts +19 -0
- package/src/styles/bsDefault.less +32 -12
- package/src/utils/CheckOneUser/index.md +39 -0
- package/src/utils/CheckOneUser/index.ts +52 -0
- package/src/utils/CustomLoginInfo.ts +55 -0
- package/src/utils/LocalstorageUtils.ts +134 -0
- package/src/utils/TableUtils.less +52 -0
- package/src/utils/TableUtils.tsx +691 -0
- package/src/utils/auth.ts +39 -0
- package/src/utils/businessUtils.ts +434 -0
- package/src/utils/checkUtils.ts +39 -0
- package/src/utils/constant.ts +38 -0
- package/src/utils/enumConfig.ts +17 -0
- package/src/utils/getFormMode.js +12 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/request.ts +53 -0
- package/src/utils/requestUtils.ts +197 -0
- package/src/utils/serialize.js +7 -0
- package/src/utils/utils.ts +267 -0
- package/src/utils/xlsxUtil.tsx +146 -0
- package/tsconfig.json +29 -0
- package/typings.d.ts +5 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 功能组件
|
|
7
|
+
order: 0
|
|
8
|
+
title: 树型选择器
|
|
9
|
+
order: 4
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## TreeSearchSelect
|
|
13
|
+
|
|
14
|
+
部门选择器Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { TreeSearchSelect } from '../../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
|
|
22
|
+
const [value, setValue] = useState();
|
|
23
|
+
|
|
24
|
+
const props = {
|
|
25
|
+
mode: 'create',
|
|
26
|
+
remoteSource: {
|
|
27
|
+
url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
|
|
28
|
+
initialParams: { 'orgViewCode': 'administrative-organization-view' },
|
|
29
|
+
resKeyValue: ['code', 'name'],
|
|
30
|
+
},
|
|
31
|
+
value,
|
|
32
|
+
isChoose: false, // 控制是否父节点可选中,默认不可选中
|
|
33
|
+
treeCheckable: true,
|
|
34
|
+
onChange: (v) => {
|
|
35
|
+
setValue(v)
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<TreeSearchSelect {...props} />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { TreeSelect, Tooltip, Tag } from 'antd';
|
|
3
|
+
import request from '@/utils/request';
|
|
4
|
+
import { stringify } from 'querystring';
|
|
5
|
+
import _ from "lodash"
|
|
6
|
+
import { judgeIsRequestSuccess } from '@/utils/requestUtils';
|
|
7
|
+
|
|
8
|
+
const TreeSearchSelect = (props: any) => {
|
|
9
|
+
const [treeData, setTreeData] = useState([]);
|
|
10
|
+
const {
|
|
11
|
+
ctx, // ctx中有自己的name
|
|
12
|
+
value,
|
|
13
|
+
valueName, // 当labelInValue为true时,值为null
|
|
14
|
+
onChange,
|
|
15
|
+
onChangeName, // 当labelInValue为true时,此函数无意义,故无需传
|
|
16
|
+
placeholder,
|
|
17
|
+
remoteSource,
|
|
18
|
+
initialValue,
|
|
19
|
+
treeCheckable = false,
|
|
20
|
+
showSearch = true,
|
|
21
|
+
maxTagCount = 1,
|
|
22
|
+
multiple = false,
|
|
23
|
+
isChoose = false, // 默认父节点不可选;传true则不限制
|
|
24
|
+
rootDisabled = false, // 默认根节点可选
|
|
25
|
+
mode,
|
|
26
|
+
getPopupContainer,
|
|
27
|
+
labelInValue = false,
|
|
28
|
+
showArrow = true,
|
|
29
|
+
allowClear = true,
|
|
30
|
+
showCheckedStrategy = props?.treeCheckStrictly ? TreeSelect.SHOW_ALL : TreeSelect.SHOW_PARENT,
|
|
31
|
+
style = { width: '100%' },
|
|
32
|
+
getTreeData,
|
|
33
|
+
disabled,
|
|
34
|
+
...restProps
|
|
35
|
+
} = props;
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
url,
|
|
39
|
+
headers,
|
|
40
|
+
paramsKey = 'qp-name-like',
|
|
41
|
+
resKeyValue = ['id', 'name'],
|
|
42
|
+
initialParams = {},
|
|
43
|
+
treeChildrenRoom = 'children',// 树状结构的子集容器 默认为 'children'
|
|
44
|
+
specialBracket = false
|
|
45
|
+
} = remoteSource;
|
|
46
|
+
|
|
47
|
+
const mapSearchTree = (treeDataItem: any) => {
|
|
48
|
+
const haveChildren = Array.isArray(treeDataItem[treeChildrenRoom]) && treeDataItem[treeChildrenRoom].length > 0; // 盘算是否为父节点
|
|
49
|
+
const isRoot = treeDataItem?.id == '0'; // 判断是否为根节点
|
|
50
|
+
return {
|
|
51
|
+
title: specialBracket
|
|
52
|
+
? `【${treeDataItem[resKeyValue[0]]}】${treeDataItem[resKeyValue[1]]}`
|
|
53
|
+
: treeDataItem[resKeyValue[1]],
|
|
54
|
+
key: treeDataItem[resKeyValue[0]],
|
|
55
|
+
value: treeDataItem[resKeyValue[0]],
|
|
56
|
+
parentId: treeDataItem.parent,
|
|
57
|
+
data: { ...treeDataItem },
|
|
58
|
+
isLeaf: !haveChildren,
|
|
59
|
+
disabled: isDisabled(haveChildren, isRoot),
|
|
60
|
+
children: haveChildren ? treeDataItem[treeChildrenRoom].map((i: any) => mapSearchTree(i)) : [],
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const isDisabled = (isParent: boolean, isRoot: boolean) => {
|
|
65
|
+
if (isChoose) {
|
|
66
|
+
if (rootDisabled && isRoot) {
|
|
67
|
+
return rootDisabled
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return isParent;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* 实时查询 但是目前用的直接是完整数据源, 所以没有使用 */
|
|
75
|
+
const handleSearch = (q: string) => {
|
|
76
|
+
const paramsData = {
|
|
77
|
+
[`${paramsKey}`]: q,
|
|
78
|
+
...initialParams,
|
|
79
|
+
}
|
|
80
|
+
request.get(`${url}?${stringify(paramsData)}`, {headers}).then(async (res: any) => {
|
|
81
|
+
const resData = res?.data || [];
|
|
82
|
+
let coverData;
|
|
83
|
+
|
|
84
|
+
if (judgeIsRequestSuccess(resData)) {
|
|
85
|
+
const { data } = resData;
|
|
86
|
+
if (remoteSource.converter) {
|
|
87
|
+
coverData = await remoteSource.converter({ data: [data] })
|
|
88
|
+
} else {
|
|
89
|
+
const dataList = (data && Array.isArray(data)) ? data : (data && [data] || []);
|
|
90
|
+
coverData = dataList.length && dataList.map((ites: any) => mapSearchTree(ites)) || [];
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
coverData = []
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setTreeData(coverData);
|
|
97
|
+
ctx?.form?.setFieldSource(ctx.name, coverData);
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const formatData = (value: any) => {
|
|
102
|
+
if (labelInValue) {
|
|
103
|
+
const formatResult = multiple||treeCheckable ? value.map((i: any) => ({...i, key: i.value})) : { ...value, key: value?.value };
|
|
104
|
+
return formatResult
|
|
105
|
+
} else {
|
|
106
|
+
const formatResult = multiple||treeCheckable ? value.map((i: any) => (i?.value || i)) : (_.get(value?.[0], 'value') || value)
|
|
107
|
+
return formatResult
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const parallelData = (data: any,result: any) => {
|
|
112
|
+
data.forEach((i: any) => {
|
|
113
|
+
result.push(i);
|
|
114
|
+
if (i[treeChildrenRoom]) {
|
|
115
|
+
parallelData(i[treeChildrenRoom], result);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
const getSelectItem = (tData: any,selectValue: any) => {
|
|
121
|
+
const handleList = tData||[];
|
|
122
|
+
let result = [];
|
|
123
|
+
if(labelInValue) {
|
|
124
|
+
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
125
|
+
if(handleList.some((s: any) => s.key == i.value)){
|
|
126
|
+
return handleList.find((s: any) => s.key == i.value)
|
|
127
|
+
}
|
|
128
|
+
}) || []) : (handleList?.find((s: any) => s.key == selectValue?.value)||{})
|
|
129
|
+
} else {
|
|
130
|
+
const cValue = _.get(selectValue?.[0], 'value', selectValue);
|
|
131
|
+
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
132
|
+
if(handleList.some((s: any) => s.key == i)){
|
|
133
|
+
return handleList.find((s: any) => s.key == i)
|
|
134
|
+
}
|
|
135
|
+
}) || []) : (handleList?.find((s: any) => s.key == cValue)||{})
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const handleChange = (data: any, dataName: any) => {
|
|
141
|
+
const handleData = formatData(data);
|
|
142
|
+
// 获取选中树节点当条数据,并返回给调用业务
|
|
143
|
+
const parallelTreeData = parallelData(treeData,[])
|
|
144
|
+
const currentItem = getSelectItem(parallelTreeData,data)
|
|
145
|
+
onChange(handleData,data,currentItem,parallelTreeData);
|
|
146
|
+
onChangeName && onChangeName(dataName);
|
|
147
|
+
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
148
|
+
ctx?.form?.setFieldValue(ctx.name, handleData);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
handleSearch(initialValue);
|
|
153
|
+
}, []);
|
|
154
|
+
|
|
155
|
+
const maxTagPlaceholder = (selectedValues: any) => {
|
|
156
|
+
const onClose = (e: any,item: any) => {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value): JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
159
|
+
const newValueName = labelInValue ? null: JSON.parse(JSON.stringify(valueName)).filter((i: any) => i !== item.label)
|
|
160
|
+
handleChange(newValue, newValueName);
|
|
161
|
+
}
|
|
162
|
+
return (
|
|
163
|
+
<Tooltip title={selectedValues.map((i: any) => (
|
|
164
|
+
<Tag
|
|
165
|
+
closable={true}
|
|
166
|
+
onClose={(e) => onClose(e,i)}
|
|
167
|
+
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
168
|
+
>
|
|
169
|
+
{i.label}
|
|
170
|
+
</Tag>
|
|
171
|
+
))}>
|
|
172
|
+
{`+ ${selectedValues?.length}`}
|
|
173
|
+
</Tooltip>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const getShowStr = () => {
|
|
178
|
+
const isMultiple = multiple || treeCheckable
|
|
179
|
+
const kongValue = '无';
|
|
180
|
+
const parallelTreeData = parallelData(treeData,[])
|
|
181
|
+
const currentItem = getSelectItem(parallelTreeData,value); // 得到选中的数据项
|
|
182
|
+
if(isMultiple) {
|
|
183
|
+
return currentItem?.map((i: any) => i?.['title']).join(',') || kongValue
|
|
184
|
+
}
|
|
185
|
+
return valueName || currentItem?.['title'] || kongValue
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const isShouldShowStr = (disabled || mode==='view' || ctx?.mode === 'view') && ctx
|
|
189
|
+
return (
|
|
190
|
+
<div className={'tree_search_select'}>
|
|
191
|
+
{isShouldShowStr ? (
|
|
192
|
+
<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
193
|
+
{getShowStr()}
|
|
194
|
+
</div>
|
|
195
|
+
): (
|
|
196
|
+
<TreeSelect
|
|
197
|
+
{...restProps}
|
|
198
|
+
treeCheckable={treeCheckable}
|
|
199
|
+
maxTagCount={maxTagCount}
|
|
200
|
+
showSearch={showSearch}
|
|
201
|
+
style={style}
|
|
202
|
+
value={value}
|
|
203
|
+
dropdownStyle={{ maxHeight: 400, maxWidth: 100, overflow: 'auto' }}
|
|
204
|
+
treeData={treeData}
|
|
205
|
+
placeholder={placeholder}
|
|
206
|
+
allowClear={allowClear}
|
|
207
|
+
labelInValue={labelInValue}
|
|
208
|
+
showArrow={showArrow}
|
|
209
|
+
showCheckedStrategy={showCheckedStrategy}
|
|
210
|
+
treeNodeFilterProp={'title'}
|
|
211
|
+
treeDefaultExpandAll
|
|
212
|
+
multiple={multiple} // 支持多选(当设置 treeCheckable 时自动变为 true)
|
|
213
|
+
maxTagPlaceholder={maxTagPlaceholder}
|
|
214
|
+
onChange={handleChange}
|
|
215
|
+
disabled={disabled || mode==='view' || ctx?.mode === 'view'}
|
|
216
|
+
getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || document.body}
|
|
217
|
+
>
|
|
218
|
+
</TreeSelect>
|
|
219
|
+
)}
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export default TreeSearchSelect;
|
package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx
ADDED
|
@@ -0,0 +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
|
+
});
|