@bit-sun/business-component 4.2.1-alpha.8 → 4.2.1-alpha.8-longya
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/SearchSelect/currentPageFilter.d.ts +41 -0
- package/dist/components/Functional/SearchSelect/pagination.d.ts +3 -3
- package/dist/index.esm.js +688 -418
- package/dist/index.js +688 -418
- package/docs/error-record.md +9 -0
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.tsx +78 -7
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +64 -14
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +1 -1
- package/src/components/Functional/AddSelect/helps.ts +2 -0
- package/src/components/Functional/AddSelect/index.less +17 -0
- package/src/components/Functional/AddSelect/index.tsx +54 -9
- package/src/components/Functional/SearchSelect/currentPageFilter.ts +135 -0
- package/src/components/Functional/SearchSelect/index.less +16 -0
- package/src/components/Functional/SearchSelect/index.md +0 -2
- package/src/components/Functional/SearchSelect/index.tsx +87 -71
- package/src/components/Functional/SearchSelect/pagination.ts +4 -4
- package/src/components/Solution/RuleComponent/ruleFiled.js +176 -155
|
@@ -138,6 +138,22 @@
|
|
|
138
138
|
height: calc(100vh - 235px); // modal弹窗760 调整为700 适应小屏
|
|
139
139
|
overflow: hidden;
|
|
140
140
|
}
|
|
141
|
+
.search_select_current_page_filter_column {
|
|
142
|
+
min-width: 140px;
|
|
143
|
+
|
|
144
|
+
.ant-table-filter-column {
|
|
145
|
+
min-width: 108px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.ant-table-column-title {
|
|
149
|
+
min-width: 64px;
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ant-table-filter-trigger {
|
|
154
|
+
flex: 0 0 32px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
141
157
|
.ant-modal-footer {
|
|
142
158
|
.ant-btn.ant-btn-default {
|
|
143
159
|
color: @primary-color;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useState, useEffect,
|
|
2
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
4
|
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs, Empty, DatePicker } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
@@ -19,6 +19,7 @@ import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
|
19
19
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
20
20
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
21
21
|
import ItemPropertySelector from '@/components/Business/ItemPropertySelector';
|
|
22
|
+
import { buildCurrentPageFilterColumns, markCurrentPageFilterByDataIndex } from './currentPageFilter';
|
|
22
23
|
|
|
23
24
|
const { Option } = Select;
|
|
24
25
|
|
|
@@ -53,7 +54,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
53
54
|
mappingTextField = 'name',
|
|
54
55
|
mappingTextShowKeyField,
|
|
55
56
|
mappingValueField = 'code',
|
|
56
|
-
mappingOutputField,
|
|
57
57
|
mappingTextShowTextField,
|
|
58
58
|
init = false,// 是否初始请求,默认初始不请求,查询需要限制录入4位数以上支持模糊查询
|
|
59
59
|
extralHeaders = {},// 额外请求头参数
|
|
@@ -65,7 +65,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
65
65
|
isQuery = false, // 是否是查询条件
|
|
66
66
|
requestType = 'get', // 自定义弹窗时候的查询方式 如果是post 并且需要所有参数都放在body里 需要设置此参数 && 兼容之前逻辑
|
|
67
67
|
} = rCTemp || {};
|
|
68
|
-
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,
|
|
68
|
+
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
69
69
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
70
70
|
|
|
71
71
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -108,30 +108,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
108
108
|
const sDisabled = disabled || (isHaveDependency && !!!isHaveDValue() && !isQuery);
|
|
109
109
|
|
|
110
110
|
const [items, setItems] = useState([]);
|
|
111
|
-
const selectedRecordsRef = useRef<any[]>([]);
|
|
112
|
-
const [, refreshSelectedRecords] = useState(0);
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* 使用记录标识维护选中状态,同时保留原有表单业务值。
|
|
116
|
-
*/
|
|
117
|
-
const getSelectedRecords = () => {
|
|
118
|
-
if (!mappingOutputField || !value) return [];
|
|
119
|
-
const outputValues = selectMode ? value : [value];
|
|
120
|
-
const codes = new Set((Array.isArray(outputValues) ? outputValues : [outputValues]).map((item: any) => labelInValue ? item?.value ?? item?.key : item));
|
|
121
|
-
return [...codes].flatMap((code: any) => {
|
|
122
|
-
const cached = selectedRecordsRef.current.filter((item: any) => item[mappingOutputField] === code);
|
|
123
|
-
return cached.length ? cached : items.filter((item: any) => item[mappingOutputField] === code).slice(0, 1);
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const getIdentityValue = () => {
|
|
128
|
-
if (!mappingOutputField) return value;
|
|
129
|
-
const keys = getSelectedRecords().map((item: any) => labelInValue
|
|
130
|
-
? { key: item[mappingValueField], value: item[mappingValueField], label: item[mappingTextField] }
|
|
131
|
-
: item[mappingValueField]);
|
|
132
|
-
if (!keys.length) return value;
|
|
133
|
-
return selectMode ? keys : keys[0];
|
|
134
|
-
};
|
|
135
111
|
const [selectOpen, setSelectOpen] = useState(false);
|
|
136
112
|
const [isMaxTagsOpen, setIsMaxTagsOpen] = useState(false);
|
|
137
113
|
const [scrollPage, setScrollPage] = useState(1);
|
|
@@ -174,11 +150,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
174
150
|
const [tablePagination, setTablePagination] = useState(tableInitPagination)
|
|
175
151
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
176
152
|
const [selectedRows, setSelectedRows] = useState([]);
|
|
153
|
+
const selectedLookupVersion = useRef(0);
|
|
177
154
|
const [checkedAll, setCheckedAll] = useState(false)
|
|
178
155
|
const [indeterminate, setIndeterminate] = useState(false)
|
|
179
156
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
180
157
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
181
158
|
const [tableShowColumns, setTabletShowColumns] = useState(handleTableColumns(modalTableProps?.tableColumns)); // 默认展示表头-modalTableProps?.tableColumns
|
|
159
|
+
const [currentPageFilters, setCurrentPageFilters] = useState({});
|
|
182
160
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
183
161
|
const [modalSearched, setModalSearched]=useState(false);
|
|
184
162
|
|
|
@@ -224,7 +202,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
224
202
|
const getData = (params = {}, type = 1,callback?: any) => {
|
|
225
203
|
if (!requestConfig) return;
|
|
226
204
|
|
|
227
|
-
setFetching(true)
|
|
205
|
+
if (type !== 3) setFetching(true)
|
|
228
206
|
|
|
229
207
|
// 处理dependence参数
|
|
230
208
|
const fixedParam = {};
|
|
@@ -234,7 +212,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
234
212
|
if(fixedParamVal) {
|
|
235
213
|
fixedParam[item] = fixedParamVal;
|
|
236
214
|
// 解决依赖项在弹窗中回显/更改(如果不能更改,传参fixedparamsDisabled为true即可)
|
|
237
|
-
if(type == 2
|
|
215
|
+
if(type == 2) {
|
|
238
216
|
const fixedChangeParamVal = form.getFieldValue(item);
|
|
239
217
|
let isDependenceValueChange = false;
|
|
240
218
|
let dependenceValue = fixedParamVal;
|
|
@@ -267,7 +245,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
267
245
|
...fixedParam,
|
|
268
246
|
...params,
|
|
269
247
|
};
|
|
270
|
-
if (isNil(queryParams[selectParamsKey])&&searchValue?.length) {
|
|
248
|
+
if (type !== 3 && isNil(queryParams[selectParamsKey])&&searchValue?.length) {
|
|
271
249
|
queryParams[selectParamsKey] = searchValue?.trim?.();
|
|
272
250
|
}
|
|
273
251
|
|
|
@@ -289,17 +267,20 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
289
267
|
getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
|
|
290
268
|
}
|
|
291
269
|
|
|
292
|
-
if (!url || !getRequest)
|
|
270
|
+
if (!url || !getRequest) {
|
|
271
|
+
if (type !== 3) setFetching(false);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
293
274
|
|
|
294
275
|
getRequest.then((result: any) => {
|
|
295
|
-
setFetching(false)
|
|
276
|
+
if (type !== 3) setFetching(false)
|
|
296
277
|
result = result.data;
|
|
297
278
|
if (judgeIsRequestError(result)) {
|
|
298
279
|
message.error(result.msg);
|
|
299
280
|
return;
|
|
300
281
|
}
|
|
301
282
|
const res = result.data;
|
|
302
|
-
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value
|
|
283
|
+
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams, needTopSelectedSource });
|
|
303
284
|
|
|
304
285
|
if(callback) {
|
|
305
286
|
callback(source)
|
|
@@ -308,12 +289,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
308
289
|
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
309
290
|
setSelectDataSource(source,(Number(res?.total || res?.totalCount || source.length)))
|
|
310
291
|
} else {
|
|
292
|
+
setCurrentPageFilters({});
|
|
311
293
|
setTableData(source)
|
|
312
294
|
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)) })
|
|
313
295
|
}
|
|
314
296
|
}
|
|
315
297
|
})
|
|
316
|
-
.catch((err) => { setFetching(false) });
|
|
298
|
+
.catch((err) => { if (type !== 3) setFetching(false) });
|
|
317
299
|
}
|
|
318
300
|
|
|
319
301
|
const SelectScroll = e => {
|
|
@@ -439,15 +421,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
439
421
|
setTablePagination({ ...tableInitPagination, pageSize: cachedPageSize, current: 1 });
|
|
440
422
|
|
|
441
423
|
setIsModalVisible(true);
|
|
442
|
-
if (mappingOutputField) {
|
|
443
|
-
const records = getSelectedRecords();
|
|
444
|
-
setSelectedRowKeys(records.map((item: any) => item[mappingValueField]));
|
|
445
|
-
setSelectedRows(records);
|
|
446
|
-
setPopValue(records);
|
|
447
|
-
setIndeterminate(!!records.length && records.length < itemsTotal);
|
|
448
|
-
setCheckedAll(!!itemsTotal && records.length === itemsTotal);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
424
|
// 回显
|
|
452
425
|
if (value) {
|
|
453
426
|
if (selectMode) {
|
|
@@ -464,6 +437,19 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
464
437
|
setPopValue(labelInValue ? [{ value: value.key, text: value.label }] : [{ value: value }]);
|
|
465
438
|
}
|
|
466
439
|
}
|
|
440
|
+
/** 根据已选值查询完整记录,更新弹窗右侧的回显列。 */
|
|
441
|
+
const selectedValues = selectMode ? getShowValue(value) : value == null ? [] : [value];
|
|
442
|
+
const selectedKeys = selectedValues.map((item: any) => labelInValue ? (item?.key ?? item?.value) : item).filter((key: any) => key !== null && key !== undefined && key !== '');
|
|
443
|
+
const lookupKey = requestConfig?.filterInit?.endsWith?.('-in')
|
|
444
|
+
? requestConfig.filterInit
|
|
445
|
+
: `qp-${mappingValueField}-in`;
|
|
446
|
+
const lookupVersion = ++selectedLookupVersion.current;
|
|
447
|
+
if (selectedKeys.length && url) {
|
|
448
|
+
getData({ [lookupKey]: selectedKeys.join(','), pageSize: Math.max(selectedKeys.length, tableInitPageSize), currentPage: 1 }, 3, (source: any[]) => {
|
|
449
|
+
if (lookupVersion !== selectedLookupVersion.current) return;
|
|
450
|
+
setSelectedRows((previous: any[]) => previous.map((row: any) => source.find((item: any) => String(item.value) === String(row.value)) || row));
|
|
451
|
+
});
|
|
452
|
+
}
|
|
467
453
|
};
|
|
468
454
|
|
|
469
455
|
const handleSelectOver = (selectedValue: any) => {
|
|
@@ -528,17 +514,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
528
514
|
};
|
|
529
515
|
|
|
530
516
|
const formaData = (value: any, source: any) => {
|
|
531
|
-
if (mappingOutputField) {
|
|
532
|
-
selectedRecordsRef.current = value;
|
|
533
|
-
refreshSelectedRecords((current: number) => current + 1);
|
|
534
|
-
}
|
|
535
517
|
if (labelInValue) {
|
|
536
518
|
const getFromat = (format, val) => format.map(({key,value})=> ({[key]:val[value]}))
|
|
537
|
-
const formatResult = value.map((i: any) => (Object.assign({ key: i[
|
|
538
|
-
onChange(selectMode ?
|
|
519
|
+
const formatResult = value.map((i: any) => (Object.assign({ key: i[mappingValueField] || i.key, label: i[mappingTextField] || i.label, value: i[mappingValueField] || i.value }, ...getFromat(returnFormat, i))))
|
|
520
|
+
onChange(selectMode ? formatResult : formatResult[0], value,source)
|
|
539
521
|
} else {
|
|
540
|
-
const formatResult = selectMode ? value.map((i: any) =>
|
|
541
|
-
onChange(
|
|
522
|
+
const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
|
|
523
|
+
onChange(formatResult, value,source)
|
|
542
524
|
}
|
|
543
525
|
};
|
|
544
526
|
|
|
@@ -546,6 +528,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
546
528
|
form.resetFields();
|
|
547
529
|
setTableFormParams({});
|
|
548
530
|
setTableData([]);
|
|
531
|
+
setCurrentPageFilters({});
|
|
549
532
|
setTablePagination(tableInitPagination);
|
|
550
533
|
setSelectedRowKeys([]);
|
|
551
534
|
setSelectedRows([]);
|
|
@@ -554,6 +537,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
554
537
|
};
|
|
555
538
|
|
|
556
539
|
const handleCancel = () => {
|
|
540
|
+
selectedLookupVersion.current += 1;
|
|
557
541
|
clearModalTable();
|
|
558
542
|
setIsModalVisible(false);
|
|
559
543
|
};
|
|
@@ -582,6 +566,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
582
566
|
const pageSize = normalizeSearchSelectModalPageSize(tablePagination?.pageSize);
|
|
583
567
|
setModalSearched(true);
|
|
584
568
|
setTableFormParams(params);
|
|
569
|
+
setCurrentPageFilters({});
|
|
585
570
|
getData({ ...params, pageSize, currentPage: 1 }, 2, null);
|
|
586
571
|
}
|
|
587
572
|
|
|
@@ -589,6 +574,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
589
574
|
const pageSize = normalizeSearchSelectModalPageSize(tablePagination?.pageSize);
|
|
590
575
|
form.resetFields();
|
|
591
576
|
setTableFormParams({});
|
|
577
|
+
setCurrentPageFilters({});
|
|
592
578
|
getData({ pageSize, currentPage: 1 }, 2)
|
|
593
579
|
}
|
|
594
580
|
|
|
@@ -596,9 +582,15 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
596
582
|
setCollapsed(!collapsed);
|
|
597
583
|
};
|
|
598
584
|
|
|
599
|
-
const handleTableChange = (pagination) => {
|
|
585
|
+
const handleTableChange = (pagination, filters, sorter, extra) => {
|
|
586
|
+
if (extra?.action === 'filter') {
|
|
587
|
+
setCurrentPageFilters(filters || {});
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
600
591
|
const pageSize = normalizeSearchSelectModalPageSize(pagination.pageSize);
|
|
601
592
|
setSearchSelectModalPageSize(pageSize);
|
|
593
|
+
setCurrentPageFilters({});
|
|
602
594
|
getData({ ...tableFormParams, pageSize, currentPage: pagination.current }, 2)
|
|
603
595
|
}
|
|
604
596
|
|
|
@@ -818,14 +810,47 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
818
810
|
const x = tableList?.length ? 82 : 28; // 无数据没有分页,有数据计算减去:分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
|
|
819
811
|
const oSY = `calc(100vh - ${tableBoxHeighth}px - ${x}px)`;
|
|
820
812
|
const mTB = `calc(50vh - ${tableBoxHeighth/2}px - ${x/2}px - 40px)`
|
|
813
|
+
const currentColumns = buildCurrentPageFilterColumns(
|
|
814
|
+
markCurrentPageFilterByDataIndex(tableShowColumns),
|
|
815
|
+
tableList,
|
|
816
|
+
currentPageFilters,
|
|
817
|
+
type !== 'noPage',
|
|
818
|
+
);
|
|
819
|
+
// 无 width 的列在固定 scroll.x 下会被挤没;先兜底宽度再按列宽求和
|
|
820
|
+
const DEFAULT_COLUMN_WIDTH = 120;
|
|
821
|
+
const columnsWithWidth = currentColumns.map((col: any) => {
|
|
822
|
+
if (typeof col?.width === 'number' && col.width > 0) {
|
|
823
|
+
return col;
|
|
824
|
+
}
|
|
825
|
+
if (typeof col?.width === 'string') {
|
|
826
|
+
const parsed = parseFloat(col.width);
|
|
827
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
828
|
+
return { ...col, width: parsed };
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return { ...col, width: DEFAULT_COLUMN_WIDTH };
|
|
832
|
+
});
|
|
833
|
+
const sumColumnScrollX = (columns: any[], extraWidth = 0) => {
|
|
834
|
+
const sum = (columns || []).reduce(
|
|
835
|
+
(total: number, col: any) => total + (Number(col?.width) || DEFAULT_COLUMN_WIDTH),
|
|
836
|
+
extraWidth,
|
|
837
|
+
);
|
|
838
|
+
return sum > extraWidth ? sum : undefined;
|
|
839
|
+
};
|
|
840
|
+
const tableScrollX = modalTableProps.overScrollX
|
|
841
|
+
|| sumColumnScrollX(columnsWithWidth, rowSelection ? 60 : 0)
|
|
842
|
+
|| true;
|
|
821
843
|
return (
|
|
822
844
|
<div style={{ height: `calc(100vh - ${tableBoxHeighth}px)` }}>
|
|
823
845
|
<Table
|
|
824
846
|
bordered
|
|
825
847
|
size="middle"
|
|
826
848
|
rowSelection={rowSelection}
|
|
827
|
-
columns={
|
|
849
|
+
columns={columnsWithWidth}
|
|
828
850
|
dataSource={tableList}
|
|
851
|
+
getPopupContainer={(triggerNode) =>
|
|
852
|
+
modalTableProps?.getFilterPopupContainer?.(triggerNode) || document.body
|
|
853
|
+
}
|
|
829
854
|
{...type=='noPage'?{
|
|
830
855
|
pagination: { ...initPagination,showSizeChanger: false },
|
|
831
856
|
locale: {
|
|
@@ -841,7 +866,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
841
866
|
}}
|
|
842
867
|
rowKey={mappingValueField}
|
|
843
868
|
scroll={{
|
|
844
|
-
x:
|
|
869
|
+
x: tableScrollX,
|
|
845
870
|
y: modalTableProps.overScrollY || oSY,
|
|
846
871
|
}}
|
|
847
872
|
onRow={(record) => {
|
|
@@ -882,7 +907,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
882
907
|
}
|
|
883
908
|
|
|
884
909
|
const onDeselect = (...arg) => {
|
|
885
|
-
const oldSelect =
|
|
910
|
+
const oldSelect = formatSelectedValue(value);
|
|
886
911
|
const deRecord = arg[1];
|
|
887
912
|
const srs = oldSelect.filter((s: any) => s.value != deRecord?.value)
|
|
888
913
|
onSelectClick(srs, items,false)
|
|
@@ -906,7 +931,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
906
931
|
}
|
|
907
932
|
}
|
|
908
933
|
const renderTable = (dataSource) => {
|
|
909
|
-
const currentSRKs = getCurrentSRKs(selectMode,labelInValue,
|
|
934
|
+
const currentSRKs = getCurrentSRKs(selectMode,labelInValue,value)
|
|
910
935
|
const renderSource = getRenderSource(currentSRKs,items)
|
|
911
936
|
|
|
912
937
|
return (
|
|
@@ -921,7 +946,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
921
946
|
selectedRowKeys: currentSRKs,
|
|
922
947
|
preserveSelectedRowKeys: true, // 避免搜索之后 没有了选中前的数据 保证sks的正确性
|
|
923
948
|
onChange: (sks, srs) => {
|
|
924
|
-
const oldSelect =
|
|
949
|
+
const oldSelect = formatSelectedValue(value);
|
|
925
950
|
let tmpSelectedRows = oldSelect.concat(srs).filter(item => item != undefined);
|
|
926
951
|
let realSrs = sks.map(key => tmpSelectedRows.filter(item => item.value == key)[0]).filter(item => item != undefined)
|
|
927
952
|
onSelectClick(realSrs, dataSource,false)
|
|
@@ -932,7 +957,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
932
957
|
event.stopPropagation();
|
|
933
958
|
event.nativeEvent.stopImmediatePropagation();
|
|
934
959
|
|
|
935
|
-
const oldSelect =
|
|
960
|
+
const oldSelect = formatSelectedValue(value);
|
|
936
961
|
const newSelect = [JSON.parse(JSON.stringify(record))];
|
|
937
962
|
const srs = getRealStr(oldSelect,newSelect,record);
|
|
938
963
|
onSelectClick(srs,dataSource,false)
|
|
@@ -962,15 +987,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
962
987
|
);
|
|
963
988
|
}
|
|
964
989
|
|
|
965
|
-
/**
|
|
966
|
-
* 折叠标签移除记录时,先按内部标识更新选中项,再回传业务值。
|
|
967
|
-
*/
|
|
968
|
-
const onRemoveIdentityTag = (remainingValue: any) => {
|
|
969
|
-
const keys = getCurrentSRKs(selectMode, labelInValue, remainingValue);
|
|
970
|
-
const records = getSelectedRecords().filter((item: any) => keys.includes(item[mappingValueField]));
|
|
971
|
-
onSelectClick(records, items, false);
|
|
972
|
-
};
|
|
973
|
-
|
|
974
990
|
const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
|
|
975
991
|
return (
|
|
976
992
|
<div className={'search_select'}>
|
|
@@ -985,8 +1001,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
985
1001
|
</div>
|
|
986
1002
|
) : (
|
|
987
1003
|
isShouldShowStr ?
|
|
988
|
-
(<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value
|
|
989
|
-
{getShowStr({viewShowValueStr, labelInValue, selectMode, value
|
|
1004
|
+
(<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
1005
|
+
{getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
|
|
990
1006
|
</div>) :
|
|
991
1007
|
<div
|
|
992
1008
|
className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
|
|
@@ -994,7 +1010,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
994
1010
|
>
|
|
995
1011
|
<Select
|
|
996
1012
|
labelInValue={labelInValue}
|
|
997
|
-
value={
|
|
1013
|
+
value={value}
|
|
998
1014
|
onChange={onchange}
|
|
999
1015
|
onClear={onClear}
|
|
1000
1016
|
onDeselect={onDeselect}
|
|
@@ -1015,7 +1031,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
1015
1031
|
onPopupScroll={SelectScroll}
|
|
1016
1032
|
style={{ width: 'calc(100%)' }}
|
|
1017
1033
|
placeholder="请选择"
|
|
1018
|
-
maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:{labelInValue}, onChange
|
|
1034
|
+
maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:{labelInValue}, onChange, value, setIsMaxTagsOpen })}
|
|
1019
1035
|
onSearch={(v) => onSearchChange(v)}
|
|
1020
1036
|
{...(needModalTable ? {
|
|
1021
1037
|
suffixIcon: <div className={`search_select_expand_button ${(sDisabled)?'search_select_expand_button_disabled':''}`} onClick={showModal}><SearchOutlined /></div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const SEARCH_SELECT_MODAL_DEFAULT_PAGE_SIZE =
|
|
1
|
+
export const SEARCH_SELECT_MODAL_DEFAULT_PAGE_SIZE = 200;
|
|
2
2
|
|
|
3
|
-
export const SEARCH_SELECT_MODAL_PAGE_SIZE_OPTIONS = [10, 20, 50, 100, 500, 1000];
|
|
3
|
+
export const SEARCH_SELECT_MODAL_PAGE_SIZE_OPTIONS = [10, 20, 50, 100, 200, 300, 500, 1000];
|
|
4
4
|
|
|
5
5
|
export const SEARCH_SELECT_MODAL_PAGE_SIZE_CACHE_KEY = 'businessComponentSearchSelectPageSize';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* 规范化选择器弹窗分页大小,缓存异常时统一回退到默认条数。
|
|
9
9
|
*
|
|
10
10
|
* @param pageSize 待校验的分页大小
|
|
11
11
|
* @returns 合法的分页大小
|
|
@@ -20,7 +20,7 @@ export const normalizeSearchSelectModalPageSize = (pageSize: unknown): number =>
|
|
|
20
20
|
/**
|
|
21
21
|
* 读取所有选择器弹窗共用的分页大小。
|
|
22
22
|
*
|
|
23
|
-
* @returns
|
|
23
|
+
* @returns 缓存中的分页大小,无有效缓存时返回默认条数
|
|
24
24
|
*/
|
|
25
25
|
export const getSearchSelectModalPageSize = (): number => {
|
|
26
26
|
if (typeof window === 'undefined') {
|