@bit-sun/business-component 4.0.12-alpha.27 → 4.0.12-alpha.29
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/Functional/QueryMutipleSelect/index.d.ts +5 -0
- package/dist/components/Functional/SearchSelect/utils.d.ts +14 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1272 -997
- package/dist/index.js +1271 -995
- package/package.json +3 -3
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +31 -2
- 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 +245 -0
- package/src/components/Functional/SearchSelect/index.less +0 -1
- package/src/components/Functional/SearchSelect/index.tsx +36 -397
- package/src/components/Functional/SearchSelect/utils.tsx +401 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +85 -85
- package/src/index.ts +1 -0
- package/src/components/Functional/SearchSelect/utils.ts +0 -74
|
@@ -4,11 +4,10 @@ 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, getCurrentSRKs, getRenderSource } 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';
|
|
14
13
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
@@ -35,6 +34,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
35
34
|
} = props;
|
|
36
35
|
const {
|
|
37
36
|
url,
|
|
37
|
+
method = 'get',
|
|
38
38
|
otherParams,// 默认参数
|
|
39
39
|
isMap,
|
|
40
40
|
fixedparameter,
|
|
@@ -78,7 +78,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
78
78
|
var pattern = /(action|create|edit|view)/
|
|
79
79
|
const isFormPage = pathname.match(pattern)?.length > 0;
|
|
80
80
|
|
|
81
|
-
const initPagination = { showQuickJumper: true, showSizeChanger:
|
|
81
|
+
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
|
|
82
82
|
const tableInitPagination = { ...initPagination, total: 0, current: 1 }
|
|
83
83
|
const disabled = noOperate || selectProps?.disabled || props?.disabled;
|
|
84
84
|
const isHaveDependency = fixedparameter && fieldValToParam && ctx;
|
|
@@ -182,7 +182,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
182
182
|
}))
|
|
183
183
|
|
|
184
184
|
// 获取数据源 (type: 1下拉框 2/3弹框 不传值默认为下拉框)
|
|
185
|
-
const getData = (params = {}, type = 1,callback?: any
|
|
185
|
+
const getData = (params = {}, type = 1,callback?: any) => {
|
|
186
186
|
if (!requestConfig) return;
|
|
187
187
|
|
|
188
188
|
setFetching(true)
|
|
@@ -219,105 +219,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// 数组对象处理,对带有特殊标记的name进行处理
|
|
222
|
-
|
|
223
|
-
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
|
224
|
-
const element = params[key];
|
|
225
|
-
if (element && key.indexOf('*number*') >= 0) {
|
|
226
|
-
const dataParams = key.split('*number*');
|
|
227
|
-
dataParams.forEach((value, index) => {
|
|
228
|
-
params[value] = element[index];
|
|
229
|
-
});
|
|
230
|
-
delete params[key];
|
|
231
|
-
} else if (element && key.indexOf('*address*') >= 0) {
|
|
232
|
-
const dataParams = key.split('*address*');
|
|
233
|
-
dataParams.forEach((value, index) => {
|
|
234
|
-
params[value] = element.PCDCode[index];
|
|
235
|
-
});
|
|
236
|
-
delete params[key];
|
|
237
|
-
} else if (element && key.indexOf('*costType*') >= 0) {
|
|
238
|
-
const dataParams = key.split('*costType*');
|
|
239
|
-
// eslint-disable-next-line prefer-destructuring
|
|
240
|
-
params[dataParams[0]] = element[1];
|
|
241
|
-
delete params[key];
|
|
242
|
-
} else if (element && key.indexOf('*fullDate*') >= 0) {
|
|
243
|
-
const dataParams = key.split('*fullDate*');
|
|
244
|
-
dataParams.forEach((value, index) => {
|
|
245
|
-
if (index === 0) {
|
|
246
|
-
params[value] = moment(element[index])
|
|
247
|
-
.millisecond(0)
|
|
248
|
-
.second(0)
|
|
249
|
-
.minute(0)
|
|
250
|
-
.hour(0)
|
|
251
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
252
|
-
} else {
|
|
253
|
-
params[value] = moment(element[index])
|
|
254
|
-
.millisecond(59)
|
|
255
|
-
.second(59)
|
|
256
|
-
.minute(59)
|
|
257
|
-
.hour(23)
|
|
258
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
delete params[key];
|
|
262
|
-
} else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
|
|
263
|
-
const dataParams = key.split('*checkBox*');
|
|
264
|
-
if (element) {
|
|
265
|
-
params[dataParams[0]] = 0
|
|
266
|
-
}
|
|
267
|
-
delete params[key];
|
|
268
|
-
} else if (element && key.indexOf('*cascader*') >= 0) {
|
|
269
|
-
const dataParams = key.split('*cascader*');
|
|
270
|
-
params[dataParams[0]] = element[element.length - 1]
|
|
271
|
-
delete params[key];
|
|
272
|
-
} else if (element && key.indexOf('*date*') >= 0) {
|
|
273
|
-
const dataParams = key.split('*date*')
|
|
274
|
-
dataParams.forEach((value, index) => {
|
|
275
|
-
if (index === 0) {
|
|
276
|
-
params[value] = moment(element[index])
|
|
277
|
-
.format('YYYY-MM-DD');
|
|
278
|
-
} else {
|
|
279
|
-
params[value] = moment(element[index])
|
|
280
|
-
.format('YYYY-MM-DD');
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
delete params[key];
|
|
284
|
-
} else if (element && key.indexOf('*multiInput') >= 0) {
|
|
285
|
-
let name = '',
|
|
286
|
-
value = element['value'];
|
|
287
|
-
if (value.indexOf(',') >= 0) {
|
|
288
|
-
name = `qp-${element['name']}-in`;
|
|
289
|
-
} else {
|
|
290
|
-
name = `qp-${element['name']}-like`;
|
|
291
|
-
}
|
|
292
|
-
params[name] = value;
|
|
293
|
-
delete params[key];
|
|
294
|
-
}
|
|
295
|
-
else if (element && key.indexOf('*') >= 0) {
|
|
296
|
-
const dataParams = key.split('*');
|
|
297
|
-
dataParams.forEach((value, index) => {
|
|
298
|
-
params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
|
|
299
|
-
});
|
|
300
|
-
delete params[key];
|
|
301
|
-
} else if (element && key.indexOf('_selectNumberRange') >= 0) { // key = xxxxx_selectNumberRange qp-xxxxx-gt
|
|
302
|
-
const dataParams = key.split('_selectNumberRange')[0]
|
|
303
|
-
if (params[key][0] === 'range') {
|
|
304
|
-
if (params[key][1][0]) {
|
|
305
|
-
params[`qp-${dataParams}-ge`] = params[key][1][0]
|
|
306
|
-
}
|
|
307
|
-
if (params[key][1][1]) {
|
|
308
|
-
params[`qp-${dataParams}-le`] = params[key][1][1]
|
|
309
|
-
}
|
|
310
|
-
} else {
|
|
311
|
-
params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
|
|
312
|
-
}
|
|
313
|
-
delete params[key]
|
|
314
|
-
} else if (Array.isArray(element)) {
|
|
315
|
-
params[key] = element.join(',');
|
|
316
|
-
} else if (element == null || element === undefined || String(element).trim() === '') {
|
|
317
|
-
delete params[key]
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
222
|
+
handleParams(params)
|
|
321
223
|
|
|
322
224
|
const queryParams = {
|
|
323
225
|
pageSize,
|
|
@@ -330,114 +232,17 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
330
232
|
queryParams[selectParamsKey] = searchValue;
|
|
331
233
|
}
|
|
332
234
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
setFetching(false)
|
|
340
|
-
result = result.data;
|
|
341
|
-
if (judgeIsRequestError(result)) {
|
|
342
|
-
message.error(result.msg);
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
const res = result.data;
|
|
346
|
-
let source = [];
|
|
347
|
-
if (isMap) {
|
|
348
|
-
source = Object.keys(res).map((d, i) => {
|
|
349
|
-
return {
|
|
350
|
-
text: Object.values(res)[i],
|
|
351
|
-
value: d,
|
|
352
|
-
};
|
|
353
|
-
});
|
|
354
|
-
} else {
|
|
355
|
-
const keys = res.list ? 'list' : 'items';
|
|
356
|
-
source = res
|
|
357
|
-
? res[keys]
|
|
358
|
-
? res[keys].map((item: any, index: number) => {
|
|
359
|
-
let textShowText = item[mappingTextField]
|
|
360
|
-
if (mappingTextShowTextField) {
|
|
361
|
-
textShowText = []
|
|
362
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
363
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
364
|
-
textShowText.push(item[r])
|
|
365
|
-
})
|
|
366
|
-
} else {
|
|
367
|
-
textShowText = item[mappingTextShowTextField]
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (!item?.children?.length) { delete item?.children };
|
|
371
|
-
return {
|
|
372
|
-
...item,
|
|
373
|
-
text: specialBracket
|
|
374
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
375
|
-
: item[mappingTextField],
|
|
376
|
-
textShowText,
|
|
377
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
378
|
-
value: item[mappingValueField],
|
|
379
|
-
keyIndex: type != 1 ? ((queryParams?.currentPage - 1) * queryParams?.pageSize + index + 1) : (index + 1),
|
|
380
|
-
};
|
|
381
|
-
})
|
|
382
|
-
: Array.isArray(res) &&
|
|
383
|
-
res?.map((item: Record<string, any>, index: number) => {
|
|
384
|
-
let textShowText = item[mappingTextField]
|
|
385
|
-
if (mappingTextShowTextField) {
|
|
386
|
-
textShowText = []
|
|
387
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
388
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
389
|
-
textShowText.push(item[r])
|
|
390
|
-
})
|
|
391
|
-
} else {
|
|
392
|
-
textShowText = item[mappingTextShowTextField]
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (!item?.children?.length) { delete item?.children };
|
|
396
|
-
return {
|
|
397
|
-
...item,
|
|
398
|
-
text: specialBracket
|
|
399
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
400
|
-
: item[mappingTextField],
|
|
401
|
-
textShowText,
|
|
402
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
403
|
-
value: item[mappingValueField],
|
|
404
|
-
keyIndex: type != 1 ? ((queryParams?.currentPage - 1) * queryParams?.pageSize + index + 1) : (index + 1),
|
|
405
|
-
};
|
|
406
|
-
})
|
|
407
|
-
: [];
|
|
408
|
-
}
|
|
409
|
-
// 补充搜索项--选中的数据添加到数据源中去
|
|
410
|
-
const currentSRKs = getCurrentSRKs(selectMode, labelInValue, value)
|
|
411
|
-
if (type === 1 && currentSRKs?.length && currentSRKs?.some(s => !source?.find(r => r.value == s))) {
|
|
412
|
-
const selectedOption = items.filter(option => currentSRKs?.includes(option.value)) || [];
|
|
413
|
-
source = (source || []).concat(selectedOption)
|
|
414
|
-
}
|
|
415
|
-
// 数据源 不可以有重复key
|
|
416
|
-
source = Array.isArray(source) ? _.uniqBy(source, 'value') : [];
|
|
417
|
-
|
|
418
|
-
if (callback) {
|
|
419
|
-
callback(source)
|
|
420
|
-
} else {
|
|
421
|
-
if (type === 1) {
|
|
422
|
-
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
423
|
-
setSelectDataSource(source, (Number(res?.total || res?.totalCount || source.length)))
|
|
424
|
-
} else {
|
|
425
|
-
setTableData(source)
|
|
426
|
-
setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
})
|
|
430
|
-
.catch((err) => { setFetching(false) });
|
|
431
|
-
return;
|
|
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 }})
|
|
432
241
|
}
|
|
433
242
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
`${url}?${stringify(queryParams)}`, {
|
|
438
|
-
headers: { ...extralHeaders }
|
|
439
|
-
})
|
|
440
|
-
.then((result: any) => {
|
|
243
|
+
if (!url || !getRequest) return;
|
|
244
|
+
|
|
245
|
+
getRequest.then((result: any) => {
|
|
441
246
|
setFetching(false)
|
|
442
247
|
result = result.data;
|
|
443
248
|
if (judgeIsRequestError(result)) {
|
|
@@ -445,77 +250,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
445
250
|
return;
|
|
446
251
|
}
|
|
447
252
|
const res = result.data;
|
|
448
|
-
|
|
449
|
-
if (isMap) {
|
|
450
|
-
source = Object.keys(res).map((d, i) => {
|
|
451
|
-
return {
|
|
452
|
-
text: Object.values(res)[i],
|
|
453
|
-
value: d,
|
|
454
|
-
};
|
|
455
|
-
});
|
|
456
|
-
} else {
|
|
457
|
-
const keys = res.list ? 'list' : 'items';
|
|
458
|
-
source = res
|
|
459
|
-
? res[keys]
|
|
460
|
-
? res[keys].map((item: any, index: number) => {
|
|
461
|
-
let textShowText = item[mappingTextField]
|
|
462
|
-
if (mappingTextShowTextField) {
|
|
463
|
-
textShowText = []
|
|
464
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
465
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
466
|
-
textShowText.push(item[r])
|
|
467
|
-
})
|
|
468
|
-
} else {
|
|
469
|
-
textShowText = item[mappingTextShowTextField]
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if(!item?.children?.length) {delete item?.children};
|
|
473
|
-
return {
|
|
474
|
-
...item,
|
|
475
|
-
text: specialBracket
|
|
476
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
477
|
-
: item[mappingTextField],
|
|
478
|
-
textShowText,
|
|
479
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
480
|
-
value: item[mappingValueField],
|
|
481
|
-
keyIndex: type != 1 ? ((queryParams?.currentPage - 1) * queryParams?.pageSize + index + 1) : (index+1),
|
|
482
|
-
};
|
|
483
|
-
})
|
|
484
|
-
: Array.isArray(res) &&
|
|
485
|
-
res?.map((item: Record<string, any>, index: number) => {
|
|
486
|
-
let textShowText = item[mappingTextField]
|
|
487
|
-
if (mappingTextShowTextField) {
|
|
488
|
-
textShowText = []
|
|
489
|
-
if (Array.isArray(mappingTextShowTextField)) {
|
|
490
|
-
mappingTextShowTextField.forEach((r: any) => {
|
|
491
|
-
textShowText.push(item[r])
|
|
492
|
-
})
|
|
493
|
-
} else {
|
|
494
|
-
textShowText = item[mappingTextShowTextField]
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
if(!item?.children?.length) {delete item?.children};
|
|
498
|
-
return {
|
|
499
|
-
...item,
|
|
500
|
-
text: specialBracket
|
|
501
|
-
? `【${item[mappingValueField]}】${item[mappingTextField]}`
|
|
502
|
-
: item[mappingTextField],
|
|
503
|
-
textShowText,
|
|
504
|
-
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
505
|
-
value: item[mappingValueField],
|
|
506
|
-
keyIndex: type != 1 ? ((queryParams?.currentPage - 1) * queryParams?.pageSize + index + 1) : (index+1),
|
|
507
|
-
};
|
|
508
|
-
})
|
|
509
|
-
: [];
|
|
510
|
-
}
|
|
511
|
-
// 补充搜索项--选中的数据添加到数据源中去
|
|
512
|
-
const currentSRKs = getCurrentSRKs(selectMode,labelInValue,value)
|
|
513
|
-
if(type === 1 && currentSRKs?.length && currentSRKs?.some(s=> !source?.find(r=> r.value==s))) {
|
|
514
|
-
const selectedOption = items.filter(option => currentSRKs?.includes(option.value))||[];
|
|
515
|
-
source = (source||[]).concat(selectedOption)
|
|
516
|
-
}
|
|
517
|
-
// 数据源 不可以有重复key
|
|
518
|
-
source = Array.isArray(source) ? _.uniqBy(source, 'value') : [];
|
|
253
|
+
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams });
|
|
519
254
|
|
|
520
255
|
if(callback) {
|
|
521
256
|
callback(source)
|
|
@@ -585,7 +320,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
585
320
|
}, [value]);
|
|
586
321
|
|
|
587
322
|
useEffect(() => {
|
|
588
|
-
makeUniqueValue();
|
|
323
|
+
setUniqueValue(makeUniqueValue());
|
|
589
324
|
}, [resultSourceKey])
|
|
590
325
|
|
|
591
326
|
useEffect(() => {
|
|
@@ -736,17 +471,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
736
471
|
|
|
737
472
|
const onSearchTable = () => {
|
|
738
473
|
const params = form.getFieldsValue();
|
|
739
|
-
|
|
740
|
-
// const isHaveParams = params && Object.keys(params).filter(item => params[item]).length > 0;
|
|
741
474
|
setModalSearched(true);
|
|
742
|
-
|
|
743
|
-
let unique_params = null;
|
|
744
|
-
if (params['UNIQUE_SPEC']) {
|
|
745
|
-
unique_params = params['UNIQUE_SPEC']?.propertyList || [];
|
|
746
|
-
}
|
|
747
|
-
|
|
748
475
|
setTableFormParams(params);
|
|
749
|
-
getData({ ...params, pageSize: tableInitPageSize }, 2, null
|
|
476
|
+
getData({ ...params, pageSize: tableInitPageSize }, 2, null);
|
|
750
477
|
}
|
|
751
478
|
|
|
752
479
|
const onResetTable = () => {
|
|
@@ -762,30 +489,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
762
489
|
const handleTableChange = (pagination) => {
|
|
763
490
|
getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
|
|
764
491
|
}
|
|
765
|
-
const LightHeightOption = (props) => {
|
|
766
|
-
const {
|
|
767
|
-
filterTxt, text,
|
|
768
|
-
} = props
|
|
769
|
-
const heightLightTxt = (text, heightTxt) => {
|
|
770
|
-
if (heightTxt === '') {
|
|
771
|
-
return text
|
|
772
|
-
}
|
|
773
|
-
const searchString = escapeRegExp(heightTxt);
|
|
774
|
-
// 前面filterOption 不区分大小写,这里用i
|
|
775
|
-
const regexp = new RegExp(searchString, 'gi')
|
|
776
|
-
return text.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
|
|
777
|
-
}
|
|
778
|
-
return (
|
|
779
|
-
<Tooltip title={text}>
|
|
780
|
-
<div ref={(nodeElement) => {
|
|
781
|
-
if (nodeElement) {
|
|
782
|
-
nodeElement.innerHTML = heightLightTxt(text, filterTxt)
|
|
783
|
-
}
|
|
784
|
-
}}
|
|
785
|
-
/>
|
|
786
|
-
</Tooltip>
|
|
787
|
-
)
|
|
788
|
-
}
|
|
789
492
|
|
|
790
493
|
// 扁平化二维数组的方法
|
|
791
494
|
const mapRows = params => {
|
|
@@ -819,13 +522,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
819
522
|
setCheckedAll(selectRows.length === tablePagination?.total);
|
|
820
523
|
}
|
|
821
524
|
|
|
822
|
-
// 生成唯一值
|
|
823
|
-
const makeUniqueValue = () => {
|
|
824
|
-
const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
|
|
825
|
-
setUniqueValue(generateUnitKey);
|
|
826
|
-
return generateUnitKey;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
525
|
const rowSelection = {
|
|
830
526
|
type: selectMode ? 'checkbox' : 'radio',
|
|
831
527
|
selectedRowKeys,
|
|
@@ -936,6 +632,18 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
936
632
|
</Col>
|
|
937
633
|
);
|
|
938
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
|
+
}
|
|
939
647
|
|
|
940
648
|
// 默认type是input
|
|
941
649
|
return (
|
|
@@ -956,14 +664,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
956
664
|
return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
|
|
957
665
|
}
|
|
958
666
|
|
|
959
|
-
// const queryFieldsDom = <SearchItemTable
|
|
960
|
-
// ref={searchTableRef}
|
|
961
|
-
// setShowSearchFields={setShowSearchFields||[]}
|
|
962
|
-
// showSearchFields={showSearchFields||[]}
|
|
963
|
-
// datasource={modalTableProps?.tableSearchForm || []}
|
|
964
|
-
// bsTableCode={bsTableCode}
|
|
965
|
-
// />
|
|
966
|
-
|
|
967
667
|
const renderShowTable = (tableList, type) => {
|
|
968
668
|
const tableBoxHeighth = getTableHeigth(modalTableProps?.tableSearchForm);
|
|
969
669
|
const oSY = `calc(100vh - ${tableBoxHeighth}px - 82px)`; // 分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
|
|
@@ -976,7 +676,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
976
676
|
columns={tableShowColumns}
|
|
977
677
|
dataSource={tableList}
|
|
978
678
|
{...type=='noPage'?{
|
|
979
|
-
pagination: initPagination,
|
|
679
|
+
pagination: { ...initPagination,showSizeChanger: false },
|
|
980
680
|
locale: {
|
|
981
681
|
emptyText: '暂无已选结果',
|
|
982
682
|
}
|
|
@@ -1031,7 +731,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1031
731
|
}
|
|
1032
732
|
|
|
1033
733
|
const onDeselect = (...arg) => {
|
|
1034
|
-
const oldSelect =
|
|
734
|
+
const oldSelect = formatSelectedValue(value);
|
|
1035
735
|
const deRecord = arg[1];
|
|
1036
736
|
const srs = oldSelect.filter((s: any) => s.value != deRecord?.value)
|
|
1037
737
|
onSelectClick(srs, items,false)
|
|
@@ -1070,12 +770,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1070
770
|
selectedRowKeys: currentSRKs,
|
|
1071
771
|
preserveSelectedRowKeys: true, // 避免搜索之后 没有了选中前的数据 保证sks的正确性
|
|
1072
772
|
onChange: (sks, srs) => {
|
|
1073
|
-
|
|
1074
|
-
const oldSelect = value?.map(s => ({
|
|
1075
|
-
value: s?.value||s,
|
|
1076
|
-
key: s?.key||s,
|
|
1077
|
-
label: s?.label|| '',
|
|
1078
|
-
}))||[];
|
|
773
|
+
const oldSelect = formatSelectedValue(value);
|
|
1079
774
|
let tmpSelectedRows = oldSelect.concat(srs).filter(item => item != undefined);
|
|
1080
775
|
let realSrs = sks.map(key => tmpSelectedRows.filter(item => item.value == key)[0]).filter(item => item != undefined)
|
|
1081
776
|
onSelectClick(realSrs, dataSource,false)
|
|
@@ -1086,11 +781,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1086
781
|
event.stopPropagation();
|
|
1087
782
|
event.nativeEvent.stopImmediatePropagation();
|
|
1088
783
|
|
|
1089
|
-
const oldSelect = value
|
|
1090
|
-
value: s?.value||s,
|
|
1091
|
-
key: s?.key||s,
|
|
1092
|
-
label: s?.label|| '',
|
|
1093
|
-
}))||[];
|
|
784
|
+
const oldSelect = formatSelectedValue(value);
|
|
1094
785
|
const newSelect = [JSON.parse(JSON.stringify(record))];
|
|
1095
786
|
const srs = getRealStr(oldSelect,newSelect,record);
|
|
1096
787
|
onSelectClick(srs,dataSource,false)
|
|
@@ -1120,57 +811,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1120
811
|
);
|
|
1121
812
|
}
|
|
1122
813
|
|
|
1123
|
-
const maxTagPlaceholder = (selectedValues) => {
|
|
1124
|
-
const onClose = (e: any, item: any) => {
|
|
1125
|
-
e.preventDefault();
|
|
1126
|
-
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)
|
|
1127
|
-
onChange(newValue);
|
|
1128
|
-
}
|
|
1129
|
-
return (
|
|
1130
|
-
<Tooltip
|
|
1131
|
-
overlayClassName='searchSelectMaxTagToolTip'
|
|
1132
|
-
destroyTooltipOnHide
|
|
1133
|
-
placement="topRight"
|
|
1134
|
-
autoAdjustOverflow={false}
|
|
1135
|
-
title={(
|
|
1136
|
-
<div
|
|
1137
|
-
style={{ margin: '6px 8px 0px' }}
|
|
1138
|
-
onMouseEnter={() => {
|
|
1139
|
-
setIsMaxTagsOpen(true)
|
|
1140
|
-
}}
|
|
1141
|
-
onMouseLeave={() => {
|
|
1142
|
-
setIsMaxTagsOpen(false)
|
|
1143
|
-
}}
|
|
1144
|
-
>
|
|
1145
|
-
{selectedValues.map((i: any) => (
|
|
1146
|
-
<Tag
|
|
1147
|
-
closable={true}
|
|
1148
|
-
onClose={(e) => onClose(e, i)}
|
|
1149
|
-
style={{ margin: '0px 3px 3px 0px', background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
1150
|
-
>
|
|
1151
|
-
{i.label}
|
|
1152
|
-
</Tag>
|
|
1153
|
-
))}
|
|
1154
|
-
</div>
|
|
1155
|
-
)}
|
|
1156
|
-
>
|
|
1157
|
-
{`+ ${selectedValues?.length}`}
|
|
1158
|
-
</Tooltip>
|
|
1159
|
-
)
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
const handleSelectOptionsShowValue = (specialBracket: boolean, noNeedSplit: boolean, item: object) => {
|
|
1163
|
-
let showText = Array.isArray(item.textShowText) &&
|
|
1164
|
-
item.textShowText.join(' ') || item.textShowText;
|
|
1165
|
-
if (noNeedSplit) {
|
|
1166
|
-
return item.text;
|
|
1167
|
-
} else {
|
|
1168
|
-
return specialBracket
|
|
1169
|
-
? `【${item.textShowKey || ''}】${showText}`
|
|
1170
|
-
: `${item.textShowKey || ''} ${showText}`
|
|
1171
|
-
}
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
814
|
const getShowLabelTextStr = (kongValue): string => {
|
|
1175
815
|
if (selectMode) {
|
|
1176
816
|
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
@@ -1243,13 +883,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1243
883
|
onPopupScroll={SelectScroll}
|
|
1244
884
|
style={{ width: 'calc(100%)' }}
|
|
1245
885
|
placeholder="请选择"
|
|
1246
|
-
maxTagPlaceholder={maxTagPlaceholder}
|
|
886
|
+
maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:{labelInValue}, onChange, value, setIsMaxTagsOpen })}
|
|
1247
887
|
onSearch={(v) => onSearchChange(v)}
|
|
1248
888
|
{...(needModalTable ? {
|
|
1249
889
|
suffixIcon: <div className={`search_select_expand_button ${(sDisabled)?'search_select_expand_button_disabled':''}`} onClick={showModal}><SearchOutlined /></div>
|
|
1250
890
|
} : {})}
|
|
1251
891
|
{...currentSelectProps}
|
|
1252
|
-
getPopupContainer={(triggerNode) => (highestPopContainer && highestPopContainer()) || triggerNode.parentElement
|
|
892
|
+
getPopupContainer={(triggerNode) => (highestPopContainer && highestPopContainer(triggerNode)) || triggerNode.parentElement}
|
|
1253
893
|
>
|
|
1254
894
|
{items.map(item => (
|
|
1255
895
|
<Option key={item.value} label={item.text}>
|
|
@@ -1307,7 +947,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1307
947
|
<Button key="reset" onClick={onResetTable}>
|
|
1308
948
|
重置 ctrl+U
|
|
1309
949
|
</Button>
|
|
1310
|
-
{/* <div>{queryFieldsDom}</div> */}
|
|
1311
950
|
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
1312
951
|
{hasMoreQueryFields(modalTableProps) && modalTableProps?.isHorizontally
|
|
1313
952
|
? <img onClick={() => {toggleCollapsed()}} style={{
|