@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
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { request } from 'umi';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { handleRequestHeader } from '../../../../../utils/requestUtils';
|
|
4
|
+
import { handleConvertResponse, judgeIsEmpty } from '../../../../../utils/utils';
|
|
5
|
+
import { formatListName } from './helps';
|
|
6
|
+
/**
|
|
7
|
+
* 删掉查询条件的qp- 和 -eq等
|
|
8
|
+
* @param {object} data
|
|
9
|
+
* @return {object}
|
|
10
|
+
* */
|
|
11
|
+
export function deleteQuerySymbol(data) {
|
|
12
|
+
const result = {};
|
|
13
|
+
|
|
14
|
+
Object.keys(data).map((item) => {
|
|
15
|
+
const newKey = deleteQuerySymbolSingle(item);
|
|
16
|
+
result[newKey] = data[item];
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function deleteQuerySymbolSingle(key) {
|
|
23
|
+
return key.replace(/(qp-|-\w+)/g, '');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 把{G1001F1001:123} 换成 {G1001:{F1001: 123}}
|
|
27
|
+
export function convertToMapByKey(data) {
|
|
28
|
+
const result = {};
|
|
29
|
+
|
|
30
|
+
Object.keys(data).map((item) => {
|
|
31
|
+
const groupCode = item.match(/G\d+/);
|
|
32
|
+
const fieldCode = item.match(/F\d+/);
|
|
33
|
+
if (groupCode?.length > 0 && fieldCode?.length > 0) {
|
|
34
|
+
if (result[groupCode]) {
|
|
35
|
+
result[groupCode][fieldCode] = data[item];
|
|
36
|
+
} else if (!result[groupCode]) {
|
|
37
|
+
result[groupCode] = {
|
|
38
|
+
[fieldCode]: data[item],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 去掉查询表格的qp- -eq -in,与普通表格一样的格式
|
|
48
|
+
* @param{string} prop 键
|
|
49
|
+
* @param{boolean} flag 是不是查询表格
|
|
50
|
+
* */
|
|
51
|
+
export function convertProp(prop, flag) {
|
|
52
|
+
return flag
|
|
53
|
+
? prop
|
|
54
|
+
?.replace(/(G\d+)/, '')
|
|
55
|
+
?.replace('qp-', '')
|
|
56
|
+
?.replace('-eq', '')
|
|
57
|
+
?.replace('-in', '')
|
|
58
|
+
?.replace('-like', '')
|
|
59
|
+
: prop;
|
|
60
|
+
}
|
|
61
|
+
// 获取元数据,是表格中列的数据来源
|
|
62
|
+
export async function getMetaData(id) {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
request('/basic/entityProperty/listNoPage', {
|
|
65
|
+
params: {
|
|
66
|
+
'qp-entityId-eq': id,
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
.then((res) => {
|
|
70
|
+
resolve(res.data);
|
|
71
|
+
})
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
console.log(error, 'error');
|
|
74
|
+
reject([]);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 获取数据
|
|
80
|
+
export const remoteFetch = (requestConfig,coloumns) => {
|
|
81
|
+
return {
|
|
82
|
+
url: '/basic/function/sendRequest',
|
|
83
|
+
method: 'post',
|
|
84
|
+
convertParams({ params }) {
|
|
85
|
+
const { sorter, ...paramsTemp } = params;
|
|
86
|
+
|
|
87
|
+
const queryParams = {
|
|
88
|
+
...requestConfig.params,
|
|
89
|
+
...requestConfig.body,
|
|
90
|
+
..._.omit(paramsTemp, ['filters', 'current']),
|
|
91
|
+
...(paramsTemp?.filters || {}),
|
|
92
|
+
...{ currentPage: paramsTemp?.currentPage || paramsTemp.current || 1 },
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// 清除值为空的
|
|
96
|
+
Object.keys(queryParams).forEach((itemKey) => {
|
|
97
|
+
if (judgeIsEmpty(queryParams[itemKey])) {
|
|
98
|
+
delete queryParams[itemKey];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
path: requestConfig.url,
|
|
104
|
+
httpMethod: requestConfig?.method?.toUpperCase(),
|
|
105
|
+
serviceName: requestConfig.serviceName,
|
|
106
|
+
requestBody: JSON.stringify(queryParams),
|
|
107
|
+
header: handleRequestHeader().headers,
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
converter({ data }) {
|
|
111
|
+
return {
|
|
112
|
+
...handleConvertResponse(handleList(data,coloumns), handleListToTal(data)),
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// 值类型
|
|
119
|
+
export function handleValueType(value, valueType) {
|
|
120
|
+
if (valueType === 20) {
|
|
121
|
+
return Number(value);
|
|
122
|
+
} else {
|
|
123
|
+
return value + '';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function handleList(data, coloumns) {
|
|
128
|
+
const resultList = Array.isArray(data)? data: Array.isArray(data?.list)
|
|
129
|
+
? data.list : Array.isArray(data?.items) ? data.items: []
|
|
130
|
+
return formatListName(resultList,coloumns);
|
|
131
|
+
}
|
|
132
|
+
export function handleListToTal(data) {
|
|
133
|
+
return Array.isArray(data) ? data.length : data.total || data.totalCount;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 路径
|
|
137
|
+
export function convertPath(path, formData) {
|
|
138
|
+
const matchedGF = path.match(/G\d+F\d+/g);
|
|
139
|
+
const matchedJavaCode = path.match(/{\w+\.\w+}/g);
|
|
140
|
+
let url = path;
|
|
141
|
+
if (!matchedGF && !matchedJavaCode) return url;
|
|
142
|
+
if (matchedGF?.length) {
|
|
143
|
+
matchedGF.map((item) => {
|
|
144
|
+
const group = item.match(/G\d+/);
|
|
145
|
+
const field = item.match(/F\d+/);
|
|
146
|
+
const replaceValue = formData?.[group]?.[field] || formData?.[field];
|
|
147
|
+
url = url.replace(item, replaceValue);
|
|
148
|
+
});
|
|
149
|
+
} else if (matchedJavaCode?.length) {
|
|
150
|
+
matchedJavaCode.map((item) => {
|
|
151
|
+
let group, field;
|
|
152
|
+
try {
|
|
153
|
+
const val = item.replace(/[{}]/g, '').split('.');
|
|
154
|
+
group = val[0];
|
|
155
|
+
field = val[1];
|
|
156
|
+
} catch (e) {}
|
|
157
|
+
if (group && field) {
|
|
158
|
+
const replaceValue = formData?.[group]?.[field] || formData?.[field];
|
|
159
|
+
url = url.replace(item, replaceValue);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return url;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 组装数据接口请求
|
|
167
|
+
export function assembleRequest(
|
|
168
|
+
customSelectorConfig,
|
|
169
|
+
{ isSearchForm, newestFormData, searchFormData },
|
|
170
|
+
) {
|
|
171
|
+
const functionInfo =
|
|
172
|
+
customSelectorConfig?.businessFunction?.functionInfo?.actionList?.[0];
|
|
173
|
+
const requestTemplate = functionInfo?.requestTemplate;
|
|
174
|
+
if (!functionInfo || !requestTemplate) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const isGet = requestTemplate.method.toLowerCase() === 'get';
|
|
178
|
+
const requestBodyName = isGet ? 'params' : 'data';
|
|
179
|
+
let params = requestTemplate.param;
|
|
180
|
+
try {
|
|
181
|
+
params = JSON.parse(requestTemplate.param);
|
|
182
|
+
} catch (e) {}
|
|
183
|
+
let path = requestTemplate.path;
|
|
184
|
+
|
|
185
|
+
let requestBody = isGet ? params : requestTemplate.requestBody;
|
|
186
|
+
|
|
187
|
+
if (!isSearchForm) {
|
|
188
|
+
// 非查询表格,普通表格的数据组装
|
|
189
|
+
path = convertPath(requestTemplate.path, newestFormData);
|
|
190
|
+
requestBody = convertBody(requestBody, newestFormData);
|
|
191
|
+
} else if (isSearchForm) {
|
|
192
|
+
// 查询表格数据组装,key会带有qp- 和 -eq,并且转换成map的数据格式
|
|
193
|
+
const newSearchFormData = convertToMapByKey(
|
|
194
|
+
deleteQuerySymbol(searchFormData),
|
|
195
|
+
);
|
|
196
|
+
path = convertPath(requestTemplate.path, newSearchFormData);
|
|
197
|
+
requestBody = convertBody(requestBody, newSearchFormData);
|
|
198
|
+
}
|
|
199
|
+
const requestConfig = {
|
|
200
|
+
url: path,
|
|
201
|
+
method: requestTemplate.method,
|
|
202
|
+
headers: requestTemplate.header,
|
|
203
|
+
[requestBodyName]: requestBody,
|
|
204
|
+
serviceName: functionInfo.serviceName || requestTemplate?.serviceName,
|
|
205
|
+
};
|
|
206
|
+
return requestConfig;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 请求体
|
|
210
|
+
function convertBody(param, formData) {
|
|
211
|
+
const keys = Object.keys(param || {});
|
|
212
|
+
if (!keys.length) return {};
|
|
213
|
+
const result = {};
|
|
214
|
+
keys.map((key) => {
|
|
215
|
+
const matchedGF = param[key].match(/G\d+F\d+/)?.[0];
|
|
216
|
+
const matchedJavaCode = param[key].match(/{\w+\.\w+}/)?.[0];
|
|
217
|
+
if (matchedGF) {
|
|
218
|
+
const group = matchedGF.match(/G\d+/);
|
|
219
|
+
const field = matchedGF.match(/F\d+/);
|
|
220
|
+
// 有值才赋值 【当formData中的值key是GxxxFxxx形式时】
|
|
221
|
+
if (formData?.[group]?.[field] && formData[group][field] !== '') {
|
|
222
|
+
if (Array.isArray(formData[group][field])) {
|
|
223
|
+
result[key] = formData[group][field].join(',');
|
|
224
|
+
} else {
|
|
225
|
+
result[key] = formData[group][field];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// 有值才赋值 【当formData中的值key是Fxxx形式时】
|
|
229
|
+
if (formData?.[field] && formData[field] !== '') {
|
|
230
|
+
if (Array.isArray(formData[field])) {
|
|
231
|
+
result[key] = formData[field].join(',');
|
|
232
|
+
} else {
|
|
233
|
+
result[key] = formData[field];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} else if (matchedJavaCode) {
|
|
237
|
+
let group, field;
|
|
238
|
+
try {
|
|
239
|
+
[group, field] = matchedJavaCode.replace(/[{}]/g).split('.');
|
|
240
|
+
} catch (e) {}
|
|
241
|
+
if (formData?.[group]?.[field] && formData[group][field] !== '') {
|
|
242
|
+
if (Array.isArray(formData[group][field])) {
|
|
243
|
+
result[key] = formData[group][field].join(',');
|
|
244
|
+
} else {
|
|
245
|
+
result[key] = formData[group][field];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
if (param[key] !== '') {
|
|
250
|
+
result[key] = param[key];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getDictionarySource } from '../../../../../utils/utils';
|
|
2
|
+
|
|
3
|
+
// 处理表头
|
|
4
|
+
export const getColumnItem= ({item}: any) => {
|
|
5
|
+
const ites: any = {
|
|
6
|
+
title: item.name,
|
|
7
|
+
key: item.code,
|
|
8
|
+
render: ({text, record}: any) => {
|
|
9
|
+
const showText = record?.[`${item.code}_Name`] || text
|
|
10
|
+
return showText;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 处理列展示类型基础数据
|
|
15
|
+
if(item.choiceType == 20) {
|
|
16
|
+
// 数据字典
|
|
17
|
+
let dictionaryCode;
|
|
18
|
+
try {
|
|
19
|
+
if (JSON.parse(item.info||'{}').dictionaryCode) {
|
|
20
|
+
dictionaryCode = JSON.parse(item.info||'{}').dictionaryCode;
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.log('error', e);
|
|
24
|
+
}
|
|
25
|
+
ites.sourceList = dictionaryCode && getDictionarySource(dictionaryCode)||[]
|
|
26
|
+
}
|
|
27
|
+
if(item.choiceType == 10) {
|
|
28
|
+
// 自定义枚举值
|
|
29
|
+
let enumeration: any;
|
|
30
|
+
try {
|
|
31
|
+
if (JSON.parse(item.info||'{}').enumeration) {
|
|
32
|
+
enumeration = JSON.parse(item.info||'{}').enumeration;
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.log('error', e);
|
|
36
|
+
}
|
|
37
|
+
ites.sourceList = enumeration && Object.keys(enumeration).map((key) => ({ value: key, text: enumeration[key] }))||[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return ites
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const formatListName = (list: any, columns: any) => {
|
|
44
|
+
if(!list?.length) return [];
|
|
45
|
+
if(!columns?.length) return list; // 下拉框无需格式化
|
|
46
|
+
|
|
47
|
+
return list.map((item: any) => {
|
|
48
|
+
let resultItem = {...item};
|
|
49
|
+
// 弹窗table编码展示名称
|
|
50
|
+
const column = columns.filter((col: any) => Object.keys(item)?.includes(col.key) && col?.sourceList?.length)||[];
|
|
51
|
+
Array.isArray(column) && column?.length && column.forEach(element => {
|
|
52
|
+
if(element?.sourceList) {
|
|
53
|
+
resultItem[`${element.key}_Name`] = element?.sourceList.find((source: any) => source.value == item[element.key])?.text;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return resultItem
|
|
57
|
+
})
|
|
58
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Button, Input, Select } from 'antd';
|
|
4
|
+
import CustomSelectorModal from './CustomSelectorModal';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { convertProp } from './function';
|
|
7
|
+
import { noEmptyArray } from '../../../../../utils/utils';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
export default (props: any) => {
|
|
11
|
+
const showType = useMemo(() => {
|
|
12
|
+
return props?.customSelectorConfig?.extraData?.showType || 'modalTable';
|
|
13
|
+
}, [props]);
|
|
14
|
+
|
|
15
|
+
const [modalConfig, setModalConfig] = useState({
|
|
16
|
+
visible: false,
|
|
17
|
+
onShow: () => {
|
|
18
|
+
setModalConfig({
|
|
19
|
+
...modalConfig,
|
|
20
|
+
visible: true,
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
onCancel: () => {
|
|
24
|
+
setModalConfig({
|
|
25
|
+
...modalConfig,
|
|
26
|
+
visible: false,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const [fieldSource, setFieldSource] = useState([]);
|
|
32
|
+
const [allListData, setAllListData] = useState([]);
|
|
33
|
+
|
|
34
|
+
const customRef = useRef();
|
|
35
|
+
const prop = convertProp(props?.ctx?.name, props.isSearchForm);
|
|
36
|
+
const fieldMapping = props.customSelectorConfig?.fieldMapping || [];
|
|
37
|
+
const fieldMappingItem = fieldMapping.find(
|
|
38
|
+
(item: any) => item.codeMappingTo === prop,
|
|
39
|
+
);
|
|
40
|
+
const echoLabel = props.customSelectorConfig?.extraData?.echoLabel;
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (props.source && noEmptyArray(props.source)) {
|
|
44
|
+
const source = props?.source || [];
|
|
45
|
+
if (source?.[0] === true) {
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
customRef?.current?.refreshSelectSource();
|
|
48
|
+
} else if (source?.[0] === false) {
|
|
49
|
+
//@ts-ignore
|
|
50
|
+
customRef?.current?.refreshSelectSource(true);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [props.source]);
|
|
54
|
+
|
|
55
|
+
const setFieldValue = (key: string, value: any,sourceList?: any) => {
|
|
56
|
+
props?.ctx?.form?.setFieldValue?.(key, value);
|
|
57
|
+
props?.onChange?.(value,sourceList)
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onChange = (value: any) => {
|
|
61
|
+
if (!value) return;
|
|
62
|
+
const dataItem =
|
|
63
|
+
allListData.filter((item) =>
|
|
64
|
+
Array.isArray(value)
|
|
65
|
+
? value.includes(
|
|
66
|
+
item?.[fieldMappingItem?.codeMappingFrom || echoLabel],
|
|
67
|
+
)
|
|
68
|
+
: item?.[fieldMappingItem?.codeMappingFrom || echoLabel] == value,
|
|
69
|
+
) || [];
|
|
70
|
+
if (showType === 'modalTable') {
|
|
71
|
+
const rowData = props?.selectProps?.multipleForQuery
|
|
72
|
+
? dataItem
|
|
73
|
+
: dataItem?.[0] || {};
|
|
74
|
+
//@ts-ignore
|
|
75
|
+
customRef?.current?.handleOk(rowData, false);
|
|
76
|
+
} else {
|
|
77
|
+
setFieldValue(props.ctx?.name, value,fieldSource);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const multipleForQuery = props?.selectProps?.multipleForQuery;
|
|
82
|
+
const isView = props?.ctx?.mode == 'view'
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div style={{ display: 'flex' }}>
|
|
86
|
+
<Select
|
|
87
|
+
{...props?.selectProps}
|
|
88
|
+
showSearch={true}
|
|
89
|
+
optionFilterProp={'label'}
|
|
90
|
+
placeholder="请选择"
|
|
91
|
+
onChange={onChange}
|
|
92
|
+
options={fieldSource}
|
|
93
|
+
value={(!props?.ctx?.form && props?.value) || props?.ctx?.form?.getFieldValue(props.id)}
|
|
94
|
+
disabled={isView || props.disabled}
|
|
95
|
+
mode={multipleForQuery ? 'multiple' : undefined}
|
|
96
|
+
allowClear={props?.allowClear}
|
|
97
|
+
onClear={() => setFieldValue(props.ctx?.name, multipleForQuery?[]:'',fieldSource)}
|
|
98
|
+
/>
|
|
99
|
+
{showType === 'modalTable' && (
|
|
100
|
+
<Button
|
|
101
|
+
type="primary"
|
|
102
|
+
style={{
|
|
103
|
+
width: '30px',
|
|
104
|
+
display: 'flex',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
}}
|
|
108
|
+
onClick={() => {
|
|
109
|
+
modalConfig.onShow();
|
|
110
|
+
}}
|
|
111
|
+
disabled={props.disabled}
|
|
112
|
+
>
|
|
113
|
+
<SearchOutlined className="site-form-item-icon" />
|
|
114
|
+
</Button>
|
|
115
|
+
)}
|
|
116
|
+
<CustomSelectorModal
|
|
117
|
+
ref={customRef}
|
|
118
|
+
{...modalConfig}
|
|
119
|
+
{...props}
|
|
120
|
+
showType={showType}
|
|
121
|
+
fieldSource={fieldSource}
|
|
122
|
+
setFieldSource={setFieldSource}
|
|
123
|
+
setFieldValue={setFieldValue}
|
|
124
|
+
setAllListData={setAllListData}
|
|
125
|
+
ismultiple={multipleForQuery}
|
|
126
|
+
></CustomSelectorModal>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
fullDateFormat
|
|
13
13
|
} from './util';
|
|
14
14
|
import InnerSelect from './InnerSelect';
|
|
15
|
+
import CustomSelector from './CustomPlugin/CustomSelector';
|
|
15
16
|
const { RangePicker } = DatePicker;
|
|
16
17
|
export default function RenderCompItem(props:any){
|
|
17
18
|
const { regularDataList,ites, showValue, handleEdit,disabled } = props;
|
|
@@ -684,6 +685,33 @@ export default function RenderCompItem(props:any){
|
|
|
684
685
|
/>
|
|
685
686
|
)) ||
|
|
686
687
|
null}
|
|
688
|
+
{/* 单选/多选 自定义选择器 */}
|
|
689
|
+
{((ites?.inputType === 20 || ites?.inputType === 30) &&
|
|
690
|
+
ites?.choiceType === 40 && (
|
|
691
|
+
<CustomSelector
|
|
692
|
+
selectProps={{
|
|
693
|
+
style: styleCommon,
|
|
694
|
+
placeholder: '请选择',
|
|
695
|
+
...(ites?.inputType === 30
|
|
696
|
+
? {
|
|
697
|
+
mode: 'multiple',
|
|
698
|
+
maxTagCount: 1,
|
|
699
|
+
multipleForQuery: true
|
|
700
|
+
}
|
|
701
|
+
: {}),
|
|
702
|
+
getPopupContainer: () => document.body,
|
|
703
|
+
}}
|
|
704
|
+
ctx={ { name: ites.code }}
|
|
705
|
+
isSearchForm={true}
|
|
706
|
+
customSelectorConfig={others?.customSelectorConfig || {}}
|
|
707
|
+
disabled={disabled}
|
|
708
|
+
value={showValue(ites.code)}
|
|
709
|
+
onChange={(value) => {
|
|
710
|
+
handleEdit(ites.code, value);
|
|
711
|
+
}}
|
|
712
|
+
/>
|
|
713
|
+
)) ||
|
|
714
|
+
null}
|
|
687
715
|
{/* 表达式 */}
|
|
688
716
|
{ites?.inputType === 40 && (
|
|
689
717
|
<div style={{ display: 'flex' }}>
|
|
@@ -153,6 +153,9 @@ class RuleObjectComponent extends Component {
|
|
|
153
153
|
dataChoiceBusinessType: element.choiceType,
|
|
154
154
|
dataInputBusinessType: element.inputType,
|
|
155
155
|
info: element.info,
|
|
156
|
+
otherMainInfo: {
|
|
157
|
+
customSelectorConfig: element.customSelectorConfig
|
|
158
|
+
}
|
|
156
159
|
};
|
|
157
160
|
if (element?.propertyList?.length) {
|
|
158
161
|
child.children = this.parseChildTreeData(
|
|
@@ -224,6 +227,9 @@ class RuleObjectComponent extends Component {
|
|
|
224
227
|
dataChoiceBusinessType: element.choiceType,
|
|
225
228
|
dataInputBusinessType: element.inputType,
|
|
226
229
|
info: element.info,
|
|
230
|
+
otherMainInfo: {
|
|
231
|
+
customSelectorConfig: element.customSelectorConfig
|
|
232
|
+
}
|
|
227
233
|
};
|
|
228
234
|
if (element.propertyList) {
|
|
229
235
|
child.children = this.parseChildTreeData(
|
|
@@ -751,6 +757,8 @@ class RuleObjectComponent extends Component {
|
|
|
751
757
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
752
758
|
{/* todo */}
|
|
753
759
|
<TreeSelect
|
|
760
|
+
showSearch
|
|
761
|
+
treeNodeFilterProp="title"
|
|
754
762
|
value={itemDetail.elementId}
|
|
755
763
|
disabled={disabled}
|
|
756
764
|
onChange={(value, name, nodeInfo) => {
|
|
@@ -819,6 +827,7 @@ class RuleObjectComponent extends Component {
|
|
|
819
827
|
propertyCode={getPropertyCode(itemDetail.propertyPath)}
|
|
820
828
|
// propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
|
|
821
829
|
relateDatas={relateDatas}
|
|
830
|
+
others={currentTreeItem?.otherMainInfo}
|
|
822
831
|
values={itemDetail.params || []}
|
|
823
832
|
valueNames={itemDetail.paramNames || []}
|
|
824
833
|
callback={(newValues, newValueNames) => {
|
|
@@ -1521,13 +1530,13 @@ class RuleObjectComponent extends Component {
|
|
|
1521
1530
|
<div className={'base_rule_content'}>
|
|
1522
1531
|
{headerButtonComponentFun?headerButtonComponentFun(this.handleAddRule): (
|
|
1523
1532
|
<div
|
|
1524
|
-
disabled={disabled}
|
|
1525
1533
|
style={{
|
|
1526
1534
|
display: onlyOneRule ? 'none' : 'block',
|
|
1527
1535
|
}}
|
|
1528
1536
|
className={'base_rule_line_title'}
|
|
1529
1537
|
>
|
|
1530
1538
|
<Button
|
|
1539
|
+
disabled={disabled}
|
|
1531
1540
|
onClick={this.handleAddRule}
|
|
1532
1541
|
className={'base_rule_btn_style'}
|
|
1533
1542
|
type="link"
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BusinessTreeSearchSelect,
|
|
14
14
|
BsCascader
|
|
15
15
|
} from '../../../index';
|
|
16
|
+
import CustomSelector from './CustomPlugin/CustomSelector';
|
|
16
17
|
const { RangePicker } = DatePicker;
|
|
17
18
|
|
|
18
19
|
export default class RuleField extends Component {
|
|
@@ -23,6 +24,7 @@ export default class RuleField extends Component {
|
|
|
23
24
|
dataTypeCode: '',
|
|
24
25
|
dataChoiceBusinessType: '',
|
|
25
26
|
dataInputBusinessType: '',
|
|
27
|
+
others: {},
|
|
26
28
|
fieldValues: [],
|
|
27
29
|
thresholdQuery: {},
|
|
28
30
|
thresholdList: [],
|
|
@@ -36,6 +38,7 @@ export default class RuleField extends Component {
|
|
|
36
38
|
dataTypeCode,
|
|
37
39
|
dataChoiceBusinessType,
|
|
38
40
|
dataInputBusinessType,
|
|
41
|
+
others,
|
|
39
42
|
options,
|
|
40
43
|
values,
|
|
41
44
|
initialThresholdQuery,
|
|
@@ -54,6 +57,7 @@ export default class RuleField extends Component {
|
|
|
54
57
|
dataTypeCode,
|
|
55
58
|
dataChoiceBusinessType,
|
|
56
59
|
dataInputBusinessType,
|
|
60
|
+
others,
|
|
57
61
|
fieldValues: [...values],
|
|
58
62
|
options,
|
|
59
63
|
},
|
|
@@ -114,6 +118,11 @@ export default class RuleField extends Component {
|
|
|
114
118
|
dataInputBusinessType: nextProps.dataInputBusinessType,
|
|
115
119
|
});
|
|
116
120
|
}
|
|
121
|
+
if (nextProps.others != this.props.others) {
|
|
122
|
+
this.setState({
|
|
123
|
+
others: nextProps.others,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
117
126
|
// if (nextProps.selectOperation != this.props.selectOperation) {
|
|
118
127
|
// this.setState({
|
|
119
128
|
// options: nextProps.options
|
|
@@ -271,6 +280,9 @@ export default class RuleField extends Component {
|
|
|
271
280
|
queryIdentify,
|
|
272
281
|
disabled,
|
|
273
282
|
customerWidth,
|
|
283
|
+
itemDetail={},
|
|
284
|
+
others={},
|
|
285
|
+
propertyCode,
|
|
274
286
|
} = this.props;
|
|
275
287
|
const { thresholdList } = this.state;
|
|
276
288
|
const styleCommon = {
|
|
@@ -2307,6 +2319,112 @@ export default class RuleField extends Component {
|
|
|
2307
2319
|
);
|
|
2308
2320
|
}
|
|
2309
2321
|
}
|
|
2322
|
+
// 自定义选择器
|
|
2323
|
+
if (dataChoiceBusinessType == 40) {
|
|
2324
|
+
if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
|
|
2325
|
+
return (
|
|
2326
|
+
<>
|
|
2327
|
+
<CustomSelector
|
|
2328
|
+
selectProps={{
|
|
2329
|
+
style: styleCommon,
|
|
2330
|
+
placeholder: '请选择',
|
|
2331
|
+
...(dataInputBusinessType === 12
|
|
2332
|
+
? {
|
|
2333
|
+
mode: 'multiple',
|
|
2334
|
+
maxTagCount: 1,
|
|
2335
|
+
multipleForQuery: true
|
|
2336
|
+
}
|
|
2337
|
+
: {}),
|
|
2338
|
+
getPopupContainer: () => document.body,
|
|
2339
|
+
}}
|
|
2340
|
+
ctx={ {name: propertyCode || itemDetail?.propertyPath }}
|
|
2341
|
+
isSearchForm={true}
|
|
2342
|
+
customSelectorConfig={others?.customSelectorConfig || {}}
|
|
2343
|
+
disabled={disabled}
|
|
2344
|
+
value={values[0]}
|
|
2345
|
+
onChange={(value,sourceList) => {
|
|
2346
|
+
if (dataInputBusinessType === 12) {
|
|
2347
|
+
values[0] = value?.map?.((i) => i)||[];
|
|
2348
|
+
valueNames[0] = sourceList?.filter(s => s.value == value)?.map(i=> i.label || '')||[];
|
|
2349
|
+
} else {
|
|
2350
|
+
const vLabel = sourceList?.find(s => s.value == value)?.label
|
|
2351
|
+
values[0] = value?[value]:[];
|
|
2352
|
+
valueNames[0] = vLabel?[vLabel]:[];
|
|
2353
|
+
}
|
|
2354
|
+
callback(values, valueNames);
|
|
2355
|
+
}}
|
|
2356
|
+
/>
|
|
2357
|
+
<span>~</span>
|
|
2358
|
+
<CustomSelector
|
|
2359
|
+
selectProps={{
|
|
2360
|
+
style: styleCommon,
|
|
2361
|
+
placeholder: '请选择',
|
|
2362
|
+
...(dataInputBusinessType === 12
|
|
2363
|
+
? {
|
|
2364
|
+
mode: 'multiple',
|
|
2365
|
+
maxTagCount: 1,
|
|
2366
|
+
multipleForQuery: true
|
|
2367
|
+
}
|
|
2368
|
+
: {}),
|
|
2369
|
+
getPopupContainer: () => document.body,
|
|
2370
|
+
}}
|
|
2371
|
+
ctx={ {name: propertyCode || itemDetail?.propertyPath }}
|
|
2372
|
+
isSearchForm={true}
|
|
2373
|
+
customSelectorConfig={others?.customSelectorConfig || {}}
|
|
2374
|
+
disabled={disabled}
|
|
2375
|
+
value={values[1]}
|
|
2376
|
+
onChange={(value,sourceList) => {
|
|
2377
|
+
if (dataInputBusinessType === 12) {
|
|
2378
|
+
values[1] = value?.map?.((i) => i)||[];
|
|
2379
|
+
valueNames[1] = sourceList?.filter(s => s.value == value)?.map(i=> i.label || '')||[];
|
|
2380
|
+
} else {
|
|
2381
|
+
const vLabel = sourceList?.find(s => s.value == value)?.label
|
|
2382
|
+
values[1] = value?[value]:[];
|
|
2383
|
+
valueNames[1] = vLabel?[vLabel]:[];
|
|
2384
|
+
}
|
|
2385
|
+
callback(values, valueNames);
|
|
2386
|
+
}}
|
|
2387
|
+
/>
|
|
2388
|
+
</>
|
|
2389
|
+
);
|
|
2390
|
+
} else {
|
|
2391
|
+
const currentValue = dataInputBusinessType === 12 ?
|
|
2392
|
+
values?.map((s,vIndex)=> ({key: s, label: valueNames[vIndex]}))||[]
|
|
2393
|
+
: values[0]&&{key:values[0],label:valueNames[0]}||{}
|
|
2394
|
+
return (
|
|
2395
|
+
<CustomSelector
|
|
2396
|
+
selectProps={{
|
|
2397
|
+
style: styleCommon,
|
|
2398
|
+
placeholder: '请选择',
|
|
2399
|
+
...(dataInputBusinessType === 12
|
|
2400
|
+
? {
|
|
2401
|
+
mode: 'multiple',
|
|
2402
|
+
maxTagCount: 1,
|
|
2403
|
+
multipleForQuery: true
|
|
2404
|
+
}
|
|
2405
|
+
: {}),
|
|
2406
|
+
getPopupContainer: () => document.body,
|
|
2407
|
+
}}
|
|
2408
|
+
ctx={ {name: propertyCode || itemDetail?.propertyPath }}
|
|
2409
|
+
isSearchForm={true}
|
|
2410
|
+
customSelectorConfig={others?.customSelectorConfig || {}}
|
|
2411
|
+
disabled={disabled}
|
|
2412
|
+
value={currentValue}
|
|
2413
|
+
onChange={(value,sourceList) => {
|
|
2414
|
+
if (dataInputBusinessType === 12) {
|
|
2415
|
+
values = value?.map?.((i) => i)||[];
|
|
2416
|
+
valueNames = sourceList?.filter(s => s.value == value)?.map(i=> i.label || '')||[];
|
|
2417
|
+
} else {
|
|
2418
|
+
const vLabel = sourceList?.find(s => s.value == value)?.label
|
|
2419
|
+
values = value?[value]:[];
|
|
2420
|
+
valueNames = vLabel?[vLabel]:[];
|
|
2421
|
+
}
|
|
2422
|
+
callback(values, valueNames);
|
|
2423
|
+
}}
|
|
2424
|
+
/>
|
|
2425
|
+
);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2310
2428
|
} else {
|
|
2311
2429
|
if (
|
|
2312
2430
|
dataTypeCode == 22 ||
|