@bit-sun/business-component 3.1.9 → 3.2.0-alpha.1
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/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.esm.js +1061 -12
- package/dist/index.js +1062 -10
- package/dist/utils/requestUtils.d.ts +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +46 -1
- package/src/components/Business/SearchSelect/index.md +58 -0
- package/src/components/Business/SearchSelect/utils.ts +1 -1
- 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/RenderCompItem.tsx +28 -0
- package/src/components/Solution/RuleComponent/index.js +10 -1
- package/src/components/Solution/RuleComponent/ruleFiled.js +118 -0
- package/src/utils/requestUtils.ts +6 -2
- package/src/utils/utils.ts +22 -0
package/dist/utils/utils.d.ts
CHANGED
|
@@ -29,3 +29,5 @@ export declare const noEmptyArr: (obj: any) => boolean;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const randomString: (len?: any) => string;
|
|
31
31
|
export declare const createUniqID: (length: any) => string;
|
|
32
|
+
export declare const handleConvertResponse: (items: any, total: number) => object;
|
|
33
|
+
export declare const noEmptyArray: (targetObj: any) => boolean;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType, orgType, nodeType, personDataSourceType } from './common';
|
|
4
4
|
import { getDictionarySource, getDictionaryTextByValue, loadSelectSource, handleHiddenFields, handleHiddenFieldsRequest, getFieldIndex } from './utils';
|
|
5
|
-
import { handleTextOverflow, tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
|
|
5
|
+
import { handleTextOverflow, tableColumnsImage, handleTooltip } from '@/components/Business/BsSulaQueryTable/utils';
|
|
6
6
|
import { getSkuImg } from '@/utils/TableUtils';
|
|
7
7
|
import { getEmployeeCode } from '@/utils/LocalstorageUtils';
|
|
8
8
|
import { Image } from 'antd';
|
|
@@ -2158,5 +2158,50 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
|
|
|
2158
2158
|
}
|
|
2159
2159
|
}
|
|
2160
2160
|
|
|
2161
|
+
// 价格项选择器
|
|
2162
|
+
if(type === 'priceItem') {
|
|
2163
|
+
requestConfig = {
|
|
2164
|
+
url: `${prefixUrl.selectPrefix}/priceType`,
|
|
2165
|
+
filter: 'qp-code,name-orGroup,like', // 过滤参数
|
|
2166
|
+
mappingTextField: 'name',
|
|
2167
|
+
mappingTextShowKeyField: 'code',
|
|
2168
|
+
mappingValueField: 'code',
|
|
2169
|
+
otherParams: {
|
|
2170
|
+
'qp-enabled-eq': true, // true启用 false禁用
|
|
2171
|
+
sorter: 'desc-id'
|
|
2172
|
+
}, // 默认参数
|
|
2173
|
+
sourceName: 'priceCode',
|
|
2174
|
+
...requestConfigProp,
|
|
2175
|
+
}
|
|
2176
|
+
tableSearchForm = [
|
|
2177
|
+
{ name: 'qp-code-like', label: '代码' },
|
|
2178
|
+
{ name: 'qp-name-like', label: '名称' },
|
|
2179
|
+
]
|
|
2180
|
+
modalTableProps = {
|
|
2181
|
+
modalTableTitle: '选择价格项',
|
|
2182
|
+
tableSearchForm,
|
|
2183
|
+
tableColumns: [
|
|
2184
|
+
{
|
|
2185
|
+
title: '代码',
|
|
2186
|
+
dataIndex: 'code',
|
|
2187
|
+
},
|
|
2188
|
+
{
|
|
2189
|
+
title: '名称',
|
|
2190
|
+
dataIndex: 'name',
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
title: '创建时间',
|
|
2194
|
+
dataIndex: 'createTime',
|
|
2195
|
+
render: (text: any) => handleTooltip(text, true),
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
title: '创建人',
|
|
2199
|
+
dataIndex: 'createUserName',
|
|
2200
|
+
},
|
|
2201
|
+
],
|
|
2202
|
+
...modalTableBusProps
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2161
2206
|
return { modalTableProps, requestConfig, needModalTable };
|
|
2162
2207
|
}
|
|
@@ -1509,4 +1509,62 @@ export default () => {
|
|
|
1509
1509
|
```
|
|
1510
1510
|
|
|
1511
1511
|
|
|
1512
|
+
## 价格项选择器 Select-PRCICE_ITEM-001
|
|
1513
|
+
|
|
1514
|
+
```tsx
|
|
1515
|
+
import React, { useState } from 'react';
|
|
1516
|
+
import { Tabs } from 'antd';
|
|
1517
|
+
import {BusinessSearchSelect} from '../../../index.ts';
|
|
1518
|
+
|
|
1519
|
+
const { TabPane } = Tabs;
|
|
1520
|
+
|
|
1521
|
+
export default () => {
|
|
1522
|
+
const selectProps = {
|
|
1523
|
+
// mode: 'multiple',
|
|
1524
|
+
// maxTagCount: 1,
|
|
1525
|
+
// disabled: true
|
|
1526
|
+
}
|
|
1527
|
+
const selectPropsMultiple = {
|
|
1528
|
+
mode: 'multiple',
|
|
1529
|
+
maxTagCount: 1,
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
const [ tabKey, setTabKey ] = useState('single')
|
|
1533
|
+
const [value, setValue] = useState(selectProps?.mode ? [] : null);
|
|
1534
|
+
|
|
1535
|
+
const props = {
|
|
1536
|
+
value,
|
|
1537
|
+
onChange: (value: any) => {
|
|
1538
|
+
console.log(value)
|
|
1539
|
+
setValue(value)
|
|
1540
|
+
},
|
|
1541
|
+
selectProps,
|
|
1542
|
+
selectBusinessType: 'priceItem',
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
const onTabChange = (key) => {
|
|
1546
|
+
setTabKey(key)
|
|
1547
|
+
setValue(key === 'single' ? null: [])
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
return (
|
|
1551
|
+
<div>
|
|
1552
|
+
<Tabs onChange={onTabChange} activeKey={tabKey}>
|
|
1553
|
+
<TabPane tab='单选' key='single'>
|
|
1554
|
+
{tabKey === 'single' && (
|
|
1555
|
+
<BusinessSearchSelect {...props} />
|
|
1556
|
+
)}
|
|
1557
|
+
</TabPane>
|
|
1558
|
+
<TabPane tab='多选' key='multiple'>
|
|
1559
|
+
{tabKey === 'multiple' && (
|
|
1560
|
+
<BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
|
|
1561
|
+
)}
|
|
1562
|
+
</TabPane>
|
|
1563
|
+
</Tabs>
|
|
1564
|
+
</div>
|
|
1565
|
+
);
|
|
1566
|
+
};
|
|
1567
|
+
```
|
|
1568
|
+
|
|
1569
|
+
|
|
1512
1570
|
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -88,7 +88,7 @@ const handleDefaultPrefixUrl = (type: string) => {
|
|
|
88
88
|
case 'inventoryOrg2': case 'purchaseOrg': case 'salesOrg': case 'employee2': case 'role': case 'person':
|
|
89
89
|
result = '/user';
|
|
90
90
|
break;
|
|
91
|
-
case 'deliveryMode': case 'ruleTemplate':
|
|
91
|
+
case 'deliveryMode': case 'ruleTemplate': case 'priceItem':
|
|
92
92
|
result = '/basic';
|
|
93
93
|
break;
|
|
94
94
|
default:
|
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
|
+
});
|