@bit-sun/business-component 4.0.12-alpha.3 → 4.0.12-alpha.30
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/Business/PropertyModal/index.d.ts +23 -0
- package/dist/components/Business/PropertyModal/mockData.d.ts +10 -0
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +4 -0
- package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +4 -0
- package/dist/components/Functional/QueryMutipleSelect/index.d.ts +5 -0
- package/dist/components/Functional/SearchSelect/utils.d.ts +16 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +2012 -883
- package/dist/index.js +2011 -880
- package/package.json +3 -3
- package/src/components/Business/BsSulaQueryTable/index.md +113 -20
- package/src/components/Business/BsSulaQueryTable/index.tsx +109 -7
- package/src/components/Business/PropertyModal/index.less +58 -0
- package/src/components/Business/PropertyModal/index.md +33 -0
- package/src/components/Business/PropertyModal/index.tsx +271 -0
- package/src/components/Business/PropertyModal/mockData.ts +160 -0
- package/src/components/Business/PropertyModal/propertyGroup.tsx +205 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +55 -3
- package/src/components/Business/SearchSelect/index.md +3 -4
- package/src/components/Business/SearchSelect/index.tsx +4 -1
- package/src/components/Business/columnSettingTable/components/TableSumComponent.tsx +25 -0
- package/src/components/Business/columnSettingTable/components/style.less +25 -0
- package/src/components/Business/columnSettingTable/index.md +5 -8
- package/src/components/Business/columnSettingTable/index.tsx +3 -28
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +116 -37
- package/src/components/Functional/QueryMutipleSelect/index.less +117 -0
- package/src/components/Functional/QueryMutipleSelect/index.md +41 -0
- package/src/components/Functional/QueryMutipleSelect/index.tsx +242 -0
- package/src/components/Functional/SearchSelect/index.less +40 -2
- package/src/components/Functional/SearchSelect/index.tsx +84 -283
- package/src/components/Functional/SearchSelect/utils.tsx +400 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +93 -93
- package/src/index.ts +2 -0
- package/src/styles/bsDefault.less +0 -1
- package/src/components/Functional/SearchSelect/utils.ts +0 -38
|
@@ -2,13 +2,43 @@
|
|
|
2
2
|
@primary-color: #005cff;
|
|
3
3
|
|
|
4
4
|
.search_select {
|
|
5
|
+
// 选择器 隐藏滚动条 横向滑动
|
|
6
|
+
.ant-select-selector{
|
|
7
|
+
height: 24px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
.ant-select-selection-overflow{
|
|
10
|
+
height: 40px;
|
|
11
|
+
flex-wrap: nowrap;
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
}
|
|
14
|
+
.ant-select-selection-overflow-item {
|
|
15
|
+
align-self: auto;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
5
18
|
&_show {
|
|
6
19
|
display: flex;
|
|
7
20
|
|
|
21
|
+
.ant-select-dropdown {
|
|
22
|
+
top: 24px !important;
|
|
23
|
+
width: calc(141%) !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
// 下拉框清除图标位置调整
|
|
9
27
|
.ant-select-clear {
|
|
10
28
|
right: 33px;
|
|
11
29
|
}
|
|
30
|
+
|
|
31
|
+
// 解决多选宽度不够 滑动会白一块的问题
|
|
32
|
+
.ant-select-multiple.ant-select-show-arrow .ant-select-selector, .ant-select-multiple.ant-select-allow-clear .ant-select-selector {
|
|
33
|
+
padding-right: 28px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&_show.search_select_show_list {
|
|
38
|
+
.ant-select-dropdown {
|
|
39
|
+
top: 24px !important;
|
|
40
|
+
width: calc(100% + 110px) !important;
|
|
41
|
+
}
|
|
12
42
|
}
|
|
13
43
|
|
|
14
44
|
&_expand_button {
|
|
@@ -20,7 +50,6 @@
|
|
|
20
50
|
cursor: pointer;
|
|
21
51
|
font-size: 14px;
|
|
22
52
|
font-weight: bolder;
|
|
23
|
-
background: #fafafa;
|
|
24
53
|
|
|
25
54
|
span {
|
|
26
55
|
position: absolute;
|
|
@@ -32,6 +61,8 @@
|
|
|
32
61
|
&_expand_button:hover {
|
|
33
62
|
background-color: @primary-color;
|
|
34
63
|
color: #fff;
|
|
64
|
+
border-top-right-radius: 2px;
|
|
65
|
+
border-bottom-right-radius: 2px;
|
|
35
66
|
}
|
|
36
67
|
&_expand_button_disabled:hover {
|
|
37
68
|
background-color: transparent;
|
|
@@ -128,7 +159,6 @@
|
|
|
128
159
|
background-color: #fff;
|
|
129
160
|
.ant-form {
|
|
130
161
|
padding: 0;
|
|
131
|
-
overflow: hidden;
|
|
132
162
|
display: flex;
|
|
133
163
|
align-items: flex-start;
|
|
134
164
|
|
|
@@ -282,3 +312,11 @@
|
|
|
282
312
|
height: 300px !important;
|
|
283
313
|
}
|
|
284
314
|
}
|
|
315
|
+
|
|
316
|
+
.searchSelectMaxTagToolTip {
|
|
317
|
+
.ant-tooltip-inner {
|
|
318
|
+
max-height: 72px;
|
|
319
|
+
overflow-x: auto;
|
|
320
|
+
padding: 0px;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -4,13 +4,13 @@ import { useDebounceFn } from 'ahooks';
|
|
|
4
4
|
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
6
|
import request from '@/utils/request';
|
|
7
|
-
import { stringify } from 'querystring';
|
|
8
7
|
import _, { escapeRegExp, isNil, values } from "lodash"
|
|
9
8
|
import './index.less';
|
|
10
|
-
import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
11
|
-
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth } from './utils';
|
|
9
|
+
import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
|
|
10
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder } from './utils';
|
|
12
11
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
13
12
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
|
+
import PropertySelector from '@/components/Business/PropertyModal';
|
|
14
14
|
|
|
15
15
|
const { Option } = Select;
|
|
16
16
|
|
|
@@ -27,12 +27,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
27
27
|
sourceName,
|
|
28
28
|
needModalTable = true,
|
|
29
29
|
getPopupContainer = undefined,
|
|
30
|
+
highestPopContainer = undefined,
|
|
30
31
|
fieldComponent,
|
|
31
32
|
onSaveCallback,
|
|
32
33
|
selectBusinessType,
|
|
33
34
|
} = props;
|
|
34
35
|
const {
|
|
35
36
|
url,
|
|
37
|
+
method = 'get',
|
|
36
38
|
otherParams,// 默认参数
|
|
37
39
|
isMap,
|
|
38
40
|
fixedparameter,
|
|
@@ -69,9 +71,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
69
71
|
listHeight: 160,
|
|
70
72
|
optionLabelProp: "label",
|
|
71
73
|
autoClearSearchValue: false,
|
|
72
|
-
placement: '
|
|
74
|
+
placement: 'bottomRight'
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
|
|
77
|
+
const pathname = window.location.href;
|
|
78
|
+
var pattern = /(action|create|edit|view)/
|
|
79
|
+
const isFormPage = pathname.match(pattern)?.length > 0;
|
|
80
|
+
|
|
81
|
+
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
|
|
75
82
|
const tableInitPagination = { ...initPagination, total: 0, current: 1 }
|
|
76
83
|
const disabled = noOperate || selectProps?.disabled || props?.disabled;
|
|
77
84
|
const isHaveDependency = fixedparameter && fieldValToParam && ctx;
|
|
@@ -87,6 +94,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
87
94
|
|
|
88
95
|
const [items, setItems] = useState([]);
|
|
89
96
|
const [selectOpen, setSelectOpen] = useState(false);
|
|
97
|
+
const [isMaxTagsOpen, setIsMaxTagsOpen] = useState(false);
|
|
90
98
|
const [scrollPage, setScrollPage] = useState(1);
|
|
91
99
|
const [itemsTotal, setItemsTotal] = useState(0);
|
|
92
100
|
const [fetching, setFetching] = useState(false);
|
|
@@ -211,105 +219,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
211
219
|
}
|
|
212
220
|
|
|
213
221
|
// 数组对象处理,对带有特殊标记的name进行处理
|
|
214
|
-
|
|
215
|
-
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
|
216
|
-
const element = params[key];
|
|
217
|
-
if (element && key.indexOf('*number*') >= 0) {
|
|
218
|
-
const dataParams = key.split('*number*');
|
|
219
|
-
dataParams.forEach((value, index) => {
|
|
220
|
-
params[value] = element[index];
|
|
221
|
-
});
|
|
222
|
-
delete params[key];
|
|
223
|
-
} else if (element && key.indexOf('*address*') >= 0) {
|
|
224
|
-
const dataParams = key.split('*address*');
|
|
225
|
-
dataParams.forEach((value, index) => {
|
|
226
|
-
params[value] = element.PCDCode[index];
|
|
227
|
-
});
|
|
228
|
-
delete params[key];
|
|
229
|
-
} else if (element && key.indexOf('*costType*') >= 0) {
|
|
230
|
-
const dataParams = key.split('*costType*');
|
|
231
|
-
// eslint-disable-next-line prefer-destructuring
|
|
232
|
-
params[dataParams[0]] = element[1];
|
|
233
|
-
delete params[key];
|
|
234
|
-
} else if (element && key.indexOf('*fullDate*') >= 0) {
|
|
235
|
-
const dataParams = key.split('*fullDate*');
|
|
236
|
-
dataParams.forEach((value, index) => {
|
|
237
|
-
if (index === 0) {
|
|
238
|
-
params[value] = moment(element[index])
|
|
239
|
-
.millisecond(0)
|
|
240
|
-
.second(0)
|
|
241
|
-
.minute(0)
|
|
242
|
-
.hour(0)
|
|
243
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
244
|
-
} else {
|
|
245
|
-
params[value] = moment(element[index])
|
|
246
|
-
.millisecond(59)
|
|
247
|
-
.second(59)
|
|
248
|
-
.minute(59)
|
|
249
|
-
.hour(23)
|
|
250
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
delete params[key];
|
|
254
|
-
} else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
|
|
255
|
-
const dataParams = key.split('*checkBox*');
|
|
256
|
-
if (element) {
|
|
257
|
-
params[dataParams[0]] = 0
|
|
258
|
-
}
|
|
259
|
-
delete params[key];
|
|
260
|
-
} else if (element && key.indexOf('*cascader*') >= 0) {
|
|
261
|
-
const dataParams = key.split('*cascader*');
|
|
262
|
-
params[dataParams[0]] = element[element.length - 1]
|
|
263
|
-
delete params[key];
|
|
264
|
-
} else if (element && key.indexOf('*date*') >= 0) {
|
|
265
|
-
const dataParams = key.split('*date*')
|
|
266
|
-
dataParams.forEach((value, index) => {
|
|
267
|
-
if (index === 0) {
|
|
268
|
-
params[value] = moment(element[index])
|
|
269
|
-
.format('YYYY-MM-DD');
|
|
270
|
-
} else {
|
|
271
|
-
params[value] = moment(element[index])
|
|
272
|
-
.format('YYYY-MM-DD');
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
delete params[key];
|
|
276
|
-
} else if (element && key.indexOf('*multiInput') >= 0) {
|
|
277
|
-
let name = '',
|
|
278
|
-
value = element['value'];
|
|
279
|
-
if (value.indexOf(',') >= 0) {
|
|
280
|
-
name = `qp-${element['name']}-in`;
|
|
281
|
-
} else {
|
|
282
|
-
name = `qp-${element['name']}-like`;
|
|
283
|
-
}
|
|
284
|
-
params[name] = value;
|
|
285
|
-
delete params[key];
|
|
286
|
-
}
|
|
287
|
-
else if (element && key.indexOf('*') >= 0) {
|
|
288
|
-
const dataParams = key.split('*');
|
|
289
|
-
dataParams.forEach((value, index) => {
|
|
290
|
-
params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
|
|
291
|
-
});
|
|
292
|
-
delete params[key];
|
|
293
|
-
} else if (element && key.indexOf('_selectNumberRange') >= 0) { // key = xxxxx_selectNumberRange qp-xxxxx-gt
|
|
294
|
-
const dataParams = key.split('_selectNumberRange')[0]
|
|
295
|
-
if (params[key][0] === 'range') {
|
|
296
|
-
if (params[key][1][0]) {
|
|
297
|
-
params[`qp-${dataParams}-ge`] = params[key][1][0]
|
|
298
|
-
}
|
|
299
|
-
if (params[key][1][1]) {
|
|
300
|
-
params[`qp-${dataParams}-le`] = params[key][1][1]
|
|
301
|
-
}
|
|
302
|
-
} else {
|
|
303
|
-
params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
|
|
304
|
-
}
|
|
305
|
-
delete params[key]
|
|
306
|
-
} else if (Array.isArray(element)) {
|
|
307
|
-
params[key] = element.join(',');
|
|
308
|
-
} else if (element == null || element === undefined || String(element).trim() === '') {
|
|
309
|
-
delete params[key]
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
222
|
+
handleParams(params)
|
|
313
223
|
|
|
314
224
|
const queryParams = {
|
|
315
225
|
pageSize,
|
|
@@ -321,13 +231,18 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
321
231
|
if (isNil(queryParams[selectParamsKey])) {
|
|
322
232
|
queryParams[selectParamsKey] = searchValue;
|
|
323
233
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
.
|
|
234
|
+
|
|
235
|
+
let getRequest;
|
|
236
|
+
const methodName = method?.toLocaleLowerCase();
|
|
237
|
+
if(['post','patch','put'].includes(methodName)) {
|
|
238
|
+
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
239
|
+
} else {
|
|
240
|
+
getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!url || !getRequest) return;
|
|
244
|
+
|
|
245
|
+
getRequest.then((result: any) => {
|
|
331
246
|
setFetching(false)
|
|
332
247
|
result = result.data;
|
|
333
248
|
if (judgeIsRequestError(result)) {
|
|
@@ -335,71 +250,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
335
250
|
return;
|
|
336
251
|
}
|
|
337
252
|
const res = result.data;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
source = Object.keys(res).map((d, i) => {
|
|
341
|
-
return {
|
|
342
|
-
text: Object.values(res)[i],
|
|
343
|
-
value: d,
|
|
344
|
-
};
|
|
345
|
-
});
|
|
346
|
-
} else {
|
|
347
|
-
const keys = res.list ? 'list' : 'items';
|
|
348
|
-
source = res
|
|
349
|
-
? res[keys]
|
|
350
|
-
? res[keys].map((item: any, index: number) => {
|
|
351
|
-
let textShowText = item[mappingTextField]
|
|
352
|
-
if (mappingTextShowTextField) {
|
|
353
|
-
textShowText = []
|
|
354
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
355
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
356
|
-
textShowText.push(item[r])
|
|
357
|
-
})
|
|
358
|
-
} else {
|
|
359
|
-
textShowText = item[mappingTextShowTextField]
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if(!item?.children?.length) {delete item?.children};
|
|
363
|
-
return {
|
|
364
|
-
...item,
|
|
365
|
-
text: specialBracket
|
|
366
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
367
|
-
: item[mappingTextField],
|
|
368
|
-
textShowText,
|
|
369
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
370
|
-
value: item[mappingValueField],
|
|
371
|
-
keyIndex: index + 1,
|
|
372
|
-
};
|
|
373
|
-
})
|
|
374
|
-
: Array.isArray(res) &&
|
|
375
|
-
res?.map((item: Record<string, any>, index: number) => {
|
|
376
|
-
let textShowText = item[mappingTextField]
|
|
377
|
-
if (mappingTextShowTextField) {
|
|
378
|
-
textShowText = []
|
|
379
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
380
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
381
|
-
textShowText.push(item[r])
|
|
382
|
-
})
|
|
383
|
-
} else {
|
|
384
|
-
textShowText = item[mappingTextShowTextField]
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
if(!item?.children?.length) {delete item?.children};
|
|
388
|
-
return {
|
|
389
|
-
...item,
|
|
390
|
-
text: specialBracket
|
|
391
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
392
|
-
: item[mappingTextField],
|
|
393
|
-
textShowText,
|
|
394
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
395
|
-
value: item[mappingValueField],
|
|
396
|
-
keyIndex: index + 1,
|
|
397
|
-
};
|
|
398
|
-
})
|
|
399
|
-
: [];
|
|
400
|
-
}
|
|
401
|
-
// 数据源 不可以有重复key
|
|
402
|
-
source = Array.isArray(source) ? _.uniqBy(source, 'value') : [];
|
|
253
|
+
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams });
|
|
254
|
+
|
|
403
255
|
if(callback) {
|
|
404
256
|
callback(source)
|
|
405
257
|
} else {
|
|
@@ -468,7 +320,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
468
320
|
}, [value]);
|
|
469
321
|
|
|
470
322
|
useEffect(() => {
|
|
471
|
-
makeUniqueValue();
|
|
323
|
+
setUniqueValue(makeUniqueValue());
|
|
472
324
|
}, [resultSourceKey])
|
|
473
325
|
|
|
474
326
|
useEffect(() => {
|
|
@@ -531,19 +383,20 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
531
383
|
const handleSelectOver = (selectedValue: any) => {
|
|
532
384
|
if (selectedValue?.length) {
|
|
533
385
|
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
534
|
-
|
|
386
|
+
const source = _.uniqBy(items.concat(selectedValue), 'value')
|
|
387
|
+
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
388
|
+
setSelectDataSource(source,source?.length)
|
|
535
389
|
formaData(selectedValue, source);
|
|
536
390
|
} else {
|
|
537
391
|
const formatResult = selectMode ? [] : null
|
|
538
392
|
onChange(formatResult, selectedValue)
|
|
539
393
|
}
|
|
540
394
|
}
|
|
541
|
-
const handleOk = (
|
|
542
|
-
const pValue = sValue || popvalue
|
|
395
|
+
const handleOk = () => {
|
|
543
396
|
// 按钮保存可传入
|
|
544
397
|
if(onSaveCallback) {
|
|
545
398
|
setConfirmLoading(true)
|
|
546
|
-
onSaveCallback(
|
|
399
|
+
onSaveCallback(popvalue).then(res => {
|
|
547
400
|
if(true) {
|
|
548
401
|
// 成功信息可以在调用处处理 即resolve({messageSuccessBackInfo: { needThrowSuccess: false } })、resolve({messageSuccessBackInfo: { needThrowSuccess: true, successMessage: '已保存' } })
|
|
549
402
|
let initSuccessMessage = '保存成功'
|
|
@@ -566,19 +419,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
566
419
|
setConfirmLoading(false)
|
|
567
420
|
})
|
|
568
421
|
} else {
|
|
569
|
-
handleSelectOver(
|
|
422
|
+
handleSelectOver(popvalue)
|
|
570
423
|
handleCancel();
|
|
571
424
|
}
|
|
572
425
|
};
|
|
573
426
|
|
|
574
|
-
// 更新选中数据位置
|
|
575
|
-
const updateSelectDataSource = (selectedValues) => {
|
|
576
|
-
const nSource = _.uniqBy(selectedValues.concat(items), 'value')
|
|
577
|
-
ctx?.form?.setFieldSource(resultSourceKey, nSource)
|
|
578
|
-
setSelectDataSource(nSource,nSource?.length)
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// 下拉框 / 弹窗 选中数据之后 最终都会执行此函数
|
|
582
427
|
const formaData = (value: any, source: any) => {
|
|
583
428
|
if (labelInValue) {
|
|
584
429
|
const formatResult = value.map((i: any) => ({ key: i[mappingValueField] || i.key, label: i[mappingTextField] || i.label, value: i[mappingValueField] || i.value }))
|
|
@@ -626,12 +471,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
626
471
|
|
|
627
472
|
const onSearchTable = () => {
|
|
628
473
|
const params = form.getFieldsValue();
|
|
629
|
-
|
|
630
|
-
// const isHaveParams = params && Object.keys(params).filter(item => params[item]).length > 0;
|
|
631
474
|
setModalSearched(true);
|
|
632
|
-
|
|
633
475
|
setTableFormParams(params);
|
|
634
|
-
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
476
|
+
getData({ ...params, pageSize: tableInitPageSize }, 2, null);
|
|
635
477
|
}
|
|
636
478
|
|
|
637
479
|
const onResetTable = () => {
|
|
@@ -647,30 +489,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
647
489
|
const handleTableChange = (pagination) => {
|
|
648
490
|
getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
|
|
649
491
|
}
|
|
650
|
-
const LightHeightOption = (props) => {
|
|
651
|
-
const {
|
|
652
|
-
filterTxt, text,
|
|
653
|
-
} = props
|
|
654
|
-
const heightLightTxt = (text, heightTxt) => {
|
|
655
|
-
if (heightTxt === '') {
|
|
656
|
-
return text
|
|
657
|
-
}
|
|
658
|
-
const searchString = escapeRegExp(heightTxt);
|
|
659
|
-
// 前面filterOption 不区分大小写,这里用i
|
|
660
|
-
const regexp = new RegExp(searchString, 'gi')
|
|
661
|
-
return text.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
|
|
662
|
-
}
|
|
663
|
-
return (
|
|
664
|
-
<Tooltip title={text}>
|
|
665
|
-
<div ref={(nodeElement) => {
|
|
666
|
-
if (nodeElement) {
|
|
667
|
-
nodeElement.innerHTML = heightLightTxt(text, filterTxt)
|
|
668
|
-
}
|
|
669
|
-
}}
|
|
670
|
-
/>
|
|
671
|
-
</Tooltip>
|
|
672
|
-
)
|
|
673
|
-
}
|
|
674
492
|
|
|
675
493
|
// 扁平化二维数组的方法
|
|
676
494
|
const mapRows = params => {
|
|
@@ -693,7 +511,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
693
511
|
|
|
694
512
|
// 单选 默认直接选中 不需要确定 配置了modalRadioNeedFooter就需要确定
|
|
695
513
|
if(!selectMode && !modalTableProps?.modalRadioNeedFooter) {
|
|
696
|
-
|
|
514
|
+
handleSelectOver(selectRows)
|
|
515
|
+
handleCancel();
|
|
697
516
|
}
|
|
698
517
|
|
|
699
518
|
setSelectedRowKeys(sksResult)
|
|
@@ -703,13 +522,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
703
522
|
setCheckedAll(selectRows.length === tablePagination?.total);
|
|
704
523
|
}
|
|
705
524
|
|
|
706
|
-
// 生成唯一值
|
|
707
|
-
const makeUniqueValue = () => {
|
|
708
|
-
const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
|
|
709
|
-
setUniqueValue(generateUnitKey);
|
|
710
|
-
return generateUnitKey;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
525
|
const rowSelection = {
|
|
714
526
|
type: selectMode ? 'checkbox' : 'radio',
|
|
715
527
|
selectedRowKeys,
|
|
@@ -810,6 +622,28 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
810
622
|
</Col>
|
|
811
623
|
);
|
|
812
624
|
}
|
|
625
|
+
if (i?.field?.type === 'proppertySelector') {
|
|
626
|
+
return (
|
|
627
|
+
<Col span={ColSpan} key={i.name}>
|
|
628
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
629
|
+
<PropertySelector
|
|
630
|
+
/>
|
|
631
|
+
</Form.Item>
|
|
632
|
+
</Col>
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
if (i?.field?.type === 'multipleQuerySearchSelect') {
|
|
636
|
+
return (
|
|
637
|
+
<Col span={ColSpan} key={i.name}>
|
|
638
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
639
|
+
<QueryMutipleSearchSelect {...i.field.props} onValueChange={(value) => {
|
|
640
|
+
form.setFieldsValue({
|
|
641
|
+
[i.name]: value
|
|
642
|
+
})}} />
|
|
643
|
+
</Form.Item>
|
|
644
|
+
</Col>
|
|
645
|
+
);
|
|
646
|
+
}
|
|
813
647
|
|
|
814
648
|
// 默认type是input
|
|
815
649
|
return (
|
|
@@ -830,14 +664,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
830
664
|
return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
|
|
831
665
|
}
|
|
832
666
|
|
|
833
|
-
// const queryFieldsDom = <SearchItemTable
|
|
834
|
-
// ref={searchTableRef}
|
|
835
|
-
// setShowSearchFields={setShowSearchFields||[]}
|
|
836
|
-
// showSearchFields={showSearchFields||[]}
|
|
837
|
-
// datasource={modalTableProps?.tableSearchForm || []}
|
|
838
|
-
// bsTableCode={bsTableCode}
|
|
839
|
-
// />
|
|
840
|
-
|
|
841
667
|
const renderShowTable = (tableList, type) => {
|
|
842
668
|
const tableBoxHeighth = getTableHeigth(modalTableProps?.tableSearchForm);
|
|
843
669
|
const oSY = `calc(100vh - ${tableBoxHeighth}px - 82px)`; // 分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
|
|
@@ -850,7 +676,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
850
676
|
columns={tableShowColumns}
|
|
851
677
|
dataSource={tableList}
|
|
852
678
|
{...type=='noPage'?{
|
|
853
|
-
pagination: initPagination,
|
|
679
|
+
pagination: { ...initPagination,showSizeChanger: false },
|
|
854
680
|
locale: {
|
|
855
681
|
emptyText: '暂无已选结果',
|
|
856
682
|
}
|
|
@@ -886,10 +712,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
886
712
|
{ label: `已选(${selectedRowKeys?.length || 0})`, key: 'selected', children: renderShowTable(selectedRows?.map((s,index)=> ({...s,keyIndex:index+1}))||[],'noPage') },
|
|
887
713
|
];
|
|
888
714
|
|
|
889
|
-
const resetSelectDataSource = () => {
|
|
715
|
+
const resetSelectDataSource = (isClear=false) => {
|
|
890
716
|
setSearchValue('');
|
|
891
717
|
// 有关联值 不需要清空下拉框数据 也不需要重新去请求了
|
|
892
|
-
if(isHaveDependency) return;
|
|
718
|
+
if(!isClear && isHaveDependency) return; // 清空时需要放开:级联首次回之后,清空数据需要重新查询下拉框的值
|
|
893
719
|
clearSelectDataSource();
|
|
894
720
|
init && run('init')
|
|
895
721
|
}
|
|
@@ -901,11 +727,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
901
727
|
formaData([], items);
|
|
902
728
|
onChangeSelectedKeys([], [])
|
|
903
729
|
// 重置下拉框数据源
|
|
904
|
-
resetSelectDataSource();
|
|
730
|
+
resetSelectDataSource(true);
|
|
905
731
|
}
|
|
906
732
|
|
|
907
733
|
const onDeselect = (...arg) => {
|
|
908
|
-
const oldSelect =
|
|
734
|
+
const oldSelect = formatSelectedValue(value);
|
|
909
735
|
const deRecord = arg[1];
|
|
910
736
|
const srs = oldSelect.filter((s: any) => s.value != deRecord?.value)
|
|
911
737
|
onSelectClick(srs, items,false)
|
|
@@ -916,13 +742,22 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
916
742
|
}
|
|
917
743
|
|
|
918
744
|
const onDropdownVisibleChange = (visible) => {
|
|
745
|
+
// 阻止maxTagPlaceholder点击事件触发下拉框展示事件
|
|
746
|
+
if(isMaxTagsOpen && !selectOpen) return;
|
|
747
|
+
|
|
919
748
|
setSelectOpen(visible);
|
|
920
749
|
// 关闭下拉框 如果首次本身就不展示数据的 没有选中数据-需要清空查询数据源; 首次展示的默认展示
|
|
921
750
|
if (!visible && !value?.length) {
|
|
922
|
-
|
|
751
|
+
setTimeout(() => {
|
|
752
|
+
// 延时 是为了避免 执行时候出现下拉框弹两次的问题-可以看到数据源从展示到显示空数据框的问题
|
|
753
|
+
resetSelectDataSource()
|
|
754
|
+
}, 200)
|
|
923
755
|
}
|
|
924
756
|
}
|
|
925
757
|
const renderTable = (dataSource) => {
|
|
758
|
+
const currentSRKs = getCurrentSRKs(selectMode,labelInValue,value)
|
|
759
|
+
const renderSource = getRenderSource(currentSRKs,items)
|
|
760
|
+
|
|
926
761
|
return (
|
|
927
762
|
<div className={`search_select_dropdown_table ${!selectMode?'search_select_dropdown_table1':''}`}>
|
|
928
763
|
<Table
|
|
@@ -932,10 +767,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
932
767
|
rowSelection: {
|
|
933
768
|
type: 'checkbox',
|
|
934
769
|
columnWidth: '24px',
|
|
935
|
-
selectedRowKeys:
|
|
770
|
+
selectedRowKeys: currentSRKs,
|
|
936
771
|
preserveSelectedRowKeys: true, // 避免搜索之后 没有了选中前的数据 保证sks的正确性
|
|
937
772
|
onChange: (sks, srs) => {
|
|
938
|
-
const oldSelect =
|
|
773
|
+
const oldSelect = formatSelectedValue(value);
|
|
939
774
|
let tmpSelectedRows = oldSelect.concat(srs).filter(item => item != undefined);
|
|
940
775
|
let realSrs = sks.map(key => tmpSelectedRows.filter(item => item.value == key)[0]).filter(item => item != undefined)
|
|
941
776
|
onSelectClick(realSrs, dataSource,false)
|
|
@@ -946,7 +781,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
946
781
|
event.stopPropagation();
|
|
947
782
|
event.nativeEvent.stopImmediatePropagation();
|
|
948
783
|
|
|
949
|
-
const oldSelect =
|
|
784
|
+
const oldSelect = formatSelectedValue(value);
|
|
950
785
|
const newSelect = [JSON.parse(JSON.stringify(record))];
|
|
951
786
|
const srs = getRealStr(oldSelect,newSelect,record);
|
|
952
787
|
onSelectClick(srs,dataSource,false)
|
|
@@ -956,7 +791,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
956
791
|
rowSelection: {
|
|
957
792
|
type: 'radio',
|
|
958
793
|
columnWidth: 0,
|
|
959
|
-
selectedRowKeys:
|
|
794
|
+
selectedRowKeys: currentSRKs,
|
|
960
795
|
},
|
|
961
796
|
onRow: (record, rowKey) => ({
|
|
962
797
|
onClick: event => {
|
|
@@ -966,7 +801,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
966
801
|
})
|
|
967
802
|
})}
|
|
968
803
|
columns={selectProps?.renderTableColumns||[]}
|
|
969
|
-
dataSource={
|
|
804
|
+
dataSource={renderSource}
|
|
970
805
|
size="middle"
|
|
971
806
|
pagination={false}
|
|
972
807
|
rowKey={mappingValueField}
|
|
@@ -976,39 +811,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
976
811
|
);
|
|
977
812
|
}
|
|
978
813
|
|
|
979
|
-
const maxTagPlaceholder = (selectedValues) => {
|
|
980
|
-
const onClose = (e: any, item: any) => {
|
|
981
|
-
e.preventDefault();
|
|
982
|
-
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)
|
|
983
|
-
onChange(newValue);
|
|
984
|
-
}
|
|
985
|
-
return (
|
|
986
|
-
<Tooltip title={selectedValues.map((i: any) => (
|
|
987
|
-
<Tag
|
|
988
|
-
closable={true}
|
|
989
|
-
onClose={(e) => onClose(e, i)}
|
|
990
|
-
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
991
|
-
>
|
|
992
|
-
{i.label}
|
|
993
|
-
</Tag>
|
|
994
|
-
))}>
|
|
995
|
-
{`+ ${selectedValues?.length}`}
|
|
996
|
-
</Tooltip>
|
|
997
|
-
)
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
const handleSelectOptionsShowValue = (specialBracket: boolean, noNeedSplit: boolean, item: object) => {
|
|
1001
|
-
let showText = Array.isArray(item.textShowText) &&
|
|
1002
|
-
item.textShowText.join(' ') || item.textShowText;
|
|
1003
|
-
if (noNeedSplit) {
|
|
1004
|
-
return item.text;
|
|
1005
|
-
} else {
|
|
1006
|
-
return specialBracket
|
|
1007
|
-
? `【${item.textShowKey || ''}】${showText}`
|
|
1008
|
-
: `${item.textShowKey || ''} ${showText}`
|
|
1009
|
-
}
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
814
|
const getShowLabelTextStr = (kongValue): string => {
|
|
1013
815
|
if (selectMode) {
|
|
1014
816
|
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
@@ -1055,7 +857,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1055
857
|
{getShowStr()}
|
|
1056
858
|
</div>) :
|
|
1057
859
|
<div
|
|
1058
|
-
className=
|
|
860
|
+
className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
|
|
1059
861
|
id={`search_select_div_${uniqueValue}`}
|
|
1060
862
|
>
|
|
1061
863
|
<Select
|
|
@@ -1065,7 +867,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1065
867
|
onClear={onClear}
|
|
1066
868
|
onDeselect={onDeselect}
|
|
1067
869
|
disabled={sDisabled}
|
|
1068
|
-
dropdownStyle={{ borderRadius: '2px', padding: '10px 2px'
|
|
870
|
+
dropdownStyle={{ borderRadius: '2px', padding: '10px 2px'}}
|
|
1069
871
|
open={selectOpen}
|
|
1070
872
|
onDropdownVisibleChange={onDropdownVisibleChange}
|
|
1071
873
|
dropdownRender={(menu) => items?.length ? renderTable(items) : menu}
|
|
@@ -1081,13 +883,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1081
883
|
onPopupScroll={SelectScroll}
|
|
1082
884
|
style={{ width: 'calc(100%)' }}
|
|
1083
885
|
placeholder="请选择"
|
|
1084
|
-
maxTagPlaceholder={maxTagPlaceholder}
|
|
886
|
+
maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:{labelInValue}, onChange, value, setIsMaxTagsOpen })}
|
|
1085
887
|
onSearch={(v) => onSearchChange(v)}
|
|
1086
888
|
{...(needModalTable ? {
|
|
1087
889
|
suffixIcon: <div className={`search_select_expand_button ${(sDisabled)?'search_select_expand_button_disabled':''}`} onClick={showModal}><SearchOutlined /></div>
|
|
1088
890
|
} : {})}
|
|
1089
891
|
{...currentSelectProps}
|
|
1090
|
-
getPopupContainer={(triggerNode) => (
|
|
892
|
+
getPopupContainer={(triggerNode) => (highestPopContainer && highestPopContainer(triggerNode)) || triggerNode.parentElement}
|
|
1091
893
|
>
|
|
1092
894
|
{items.map(item => (
|
|
1093
895
|
<Option key={item.value} label={item.text}>
|
|
@@ -1145,7 +947,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1145
947
|
<Button key="reset" onClick={onResetTable}>
|
|
1146
948
|
重置 ctrl+U
|
|
1147
949
|
</Button>
|
|
1148
|
-
{/* <div>{queryFieldsDom}</div> */}
|
|
1149
950
|
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
1150
951
|
{hasMoreQueryFields(modalTableProps) && modalTableProps?.isHorizontally
|
|
1151
952
|
? <img onClick={() => {toggleCollapsed()}} style={{
|