@bit-sun/business-component 4.0.12-alpha.9 → 4.0.13-alpha.11

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.
Files changed (35) hide show
  1. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
  2. package/dist/components/Business/PropertyModal/index.d.ts +23 -0
  3. package/dist/components/Business/PropertyModal/mockData.d.ts +10 -0
  4. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +4 -0
  5. package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +4 -0
  6. package/dist/components/Functional/QueryMutipleSelect/index.d.ts +5 -0
  7. package/dist/components/Functional/SearchSelect/utils.d.ts +18 -1
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.esm.js +1635 -635
  10. package/dist/index.js +1632 -630
  11. package/package.json +4 -3
  12. package/src/components/Business/BsSulaQueryTable/setting.tsx +3 -3
  13. package/src/components/Business/BsSulaQueryTable/utils.tsx +6 -4
  14. package/src/components/Business/PropertyModal/index.less +58 -0
  15. package/src/components/Business/PropertyModal/index.md +33 -0
  16. package/src/components/Business/PropertyModal/index.tsx +271 -0
  17. package/src/components/Business/PropertyModal/mockData.ts +160 -0
  18. package/src/components/Business/PropertyModal/propertyGroup.tsx +205 -0
  19. package/src/components/Business/SearchSelect/BusinessUtils.tsx +60 -3
  20. package/src/components/Business/SearchSelect/index.md +4 -5
  21. package/src/components/Business/columnSettingTable/columnSetting.tsx +2 -1
  22. package/src/components/Business/columnSettingTable/components/TableSumComponent.tsx +25 -0
  23. package/src/components/Business/columnSettingTable/components/style.less +25 -0
  24. package/src/components/Business/columnSettingTable/index.tsx +3 -28
  25. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +2 -27
  26. package/src/components/Functional/DataValidation/index.tsx +1 -0
  27. package/src/components/Functional/QueryMutipleSelect/index.less +117 -0
  28. package/src/components/Functional/QueryMutipleSelect/index.md +40 -0
  29. package/src/components/Functional/QueryMutipleSelect/index.tsx +242 -0
  30. package/src/components/Functional/SearchSelect/index.less +45 -7
  31. package/src/components/Functional/SearchSelect/index.tsx +85 -303
  32. package/src/components/Functional/SearchSelect/utils.tsx +439 -0
  33. package/src/components/Solution/RuleComponent/ruleFiled.js +93 -93
  34. package/src/index.ts +2 -0
  35. package/src/components/Functional/SearchSelect/utils.ts +0 -38
@@ -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, getShowStr, handleTableColumns } 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
 
@@ -21,18 +21,21 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
21
21
  selectProps = {},
22
22
  modalTableProps = {},
23
23
  labelInValue = false,
24
- requestConfig,
24
+ needTopSelectedSource,
25
+ requestConfig:rCTemp,
25
26
  ctx,
26
27
  onlyShowStr = false,
27
28
  sourceName,
28
29
  needModalTable = true,
29
30
  getPopupContainer = undefined,
31
+ highestPopContainer = undefined,
30
32
  fieldComponent,
31
33
  onSaveCallback,
32
34
  selectBusinessType,
33
35
  } = props;
34
36
  const {
35
37
  url,
38
+ method = 'get',
36
39
  otherParams,// 默认参数
37
40
  isMap,
38
41
  fixedparameter,
@@ -49,7 +52,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
49
52
  noOperate, // 级联禁用按钮设置字段
50
53
  viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
51
54
  searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
52
- } = requestConfig || {};
55
+ } = rCTemp || {};
56
+ const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
53
57
  const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
54
58
 
55
59
  const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
@@ -69,11 +73,16 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
69
73
  listHeight: 160,
70
74
  optionLabelProp: "label",
71
75
  autoClearSearchValue: false,
72
- placement: 'bottomLeft'
76
+ placement: 'bottomRight'
73
77
  }
74
- const initPagination = { showQuickJumper: true, showSizeChanger: false, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
78
+
79
+ const pathname = window.location.href;
80
+ var pattern = /(action|create|edit|view)/
81
+ const isFormPage = pathname.match(pattern)?.length > 0;
82
+
83
+ const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
75
84
  const tableInitPagination = { ...initPagination, total: 0, current: 1 }
76
- const disabled = noOperate || selectProps?.disabled || props?.disabled;
85
+ const disabled = !!noOperate || selectProps?.disabled || props?.disabled;
77
86
  const isHaveDependency = fixedparameter && fieldValToParam && ctx;
78
87
  const isHaveDValue = () => {
79
88
  let formValueList = [];
@@ -87,6 +96,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
87
96
 
88
97
  const [items, setItems] = useState([]);
89
98
  const [selectOpen, setSelectOpen] = useState(false);
99
+ const [isMaxTagsOpen, setIsMaxTagsOpen] = useState(false);
90
100
  const [scrollPage, setScrollPage] = useState(1);
91
101
  const [itemsTotal, setItemsTotal] = useState(0);
92
102
  const [fetching, setFetching] = useState(false);
@@ -131,7 +141,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
131
141
  const [indeterminate, setIndeterminate] = useState(false)
132
142
  const [tableFormParams, setTableFormParams] = useState({});
133
143
  const [tooltipVisible, setTooltipVisible] = useState(false);
134
- const [tableShowColumns, setTabletShowColumns] = useState(modalTableProps?.tableColumns?.filter(s => typeof s.defaultSort == 'number')?.sort((a,b)=> a.defaultSort-b.defaultSort)||[]);
144
+ const [tableShowColumns, setTabletShowColumns] = useState(handleTableColumns(modalTableProps?.tableColumns)); // 默认展示表头-modalTableProps?.tableColumns
135
145
  const [confirmLoading, setConfirmLoading] = useState(false);
136
146
  const [modalSearched, setModalSearched]=useState(false);
137
147
 
@@ -211,105 +221,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
211
221
  }
212
222
 
213
223
  // 数组对象处理,对带有特殊标记的name进行处理
214
- for (const key in params) {
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
- }
224
+ handleParams(params)
313
225
 
314
226
  const queryParams = {
315
227
  pageSize,
@@ -321,13 +233,18 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
321
233
  if (isNil(queryParams[selectParamsKey])) {
322
234
  queryParams[selectParamsKey] = searchValue;
323
235
  }
324
- request
325
- .get(
326
- `${url}?${stringify(queryParams)}`,
327
- {
328
- headers: { ...extralHeaders }
329
- })
330
- .then((result: any) => {
236
+
237
+ let getRequest;
238
+ const methodName = method?.toLocaleLowerCase?.();
239
+ if(['post','patch','put'].includes(methodName)) {
240
+ getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
241
+ } else {
242
+ getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
243
+ }
244
+
245
+ if (!url || !getRequest) return;
246
+
247
+ getRequest.then((result: any) => {
331
248
  setFetching(false)
332
249
  result = result.data;
333
250
  if (judgeIsRequestError(result)) {
@@ -335,71 +252,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
335
252
  return;
336
253
  }
337
254
  const res = result.data;
338
- let source = [];
339
- if (isMap) {
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') : [];
255
+ const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams, needTopSelectedSource });
256
+
403
257
  if(callback) {
404
258
  callback(source)
405
259
  } else {
@@ -468,7 +322,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
468
322
  }, [value]);
469
323
 
470
324
  useEffect(() => {
471
- makeUniqueValue();
325
+ setUniqueValue(makeUniqueValue());
326
+ setTabletShowColumns(handleTableColumns(modalTableProps?.tableColumns));
472
327
  }, [resultSourceKey])
473
328
 
474
329
  useEffect(() => {
@@ -619,12 +474,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
619
474
 
620
475
  const onSearchTable = () => {
621
476
  const params = form.getFieldsValue();
622
-
623
- // const isHaveParams = params && Object.keys(params).filter(item => params[item]).length > 0;
624
477
  setModalSearched(true);
625
-
626
478
  setTableFormParams(params);
627
- getData({ ...params, pageSize: tableInitPageSize }, 2)
479
+ getData({ ...params, pageSize: tableInitPageSize }, 2, null);
628
480
  }
629
481
 
630
482
  const onResetTable = () => {
@@ -640,30 +492,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
640
492
  const handleTableChange = (pagination) => {
641
493
  getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
642
494
  }
643
- const LightHeightOption = (props) => {
644
- const {
645
- filterTxt, text,
646
- } = props
647
- const heightLightTxt = (text, heightTxt) => {
648
- if (heightTxt === '') {
649
- return text
650
- }
651
- const searchString = escapeRegExp(heightTxt);
652
- // 前面filterOption 不区分大小写,这里用i
653
- const regexp = new RegExp(searchString, 'gi')
654
- return text.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
655
- }
656
- return (
657
- <Tooltip title={text}>
658
- <div ref={(nodeElement) => {
659
- if (nodeElement) {
660
- nodeElement.innerHTML = heightLightTxt(text, filterTxt)
661
- }
662
- }}
663
- />
664
- </Tooltip>
665
- )
666
- }
667
495
 
668
496
  // 扁平化二维数组的方法
669
497
  const mapRows = params => {
@@ -697,13 +525,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
697
525
  setCheckedAll(selectRows.length === tablePagination?.total);
698
526
  }
699
527
 
700
- // 生成唯一值
701
- const makeUniqueValue = () => {
702
- const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
703
- setUniqueValue(generateUnitKey);
704
- return generateUnitKey;
705
- }
706
-
707
528
  const rowSelection = {
708
529
  type: selectMode ? 'checkbox' : 'radio',
709
530
  selectedRowKeys,
@@ -804,6 +625,28 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
804
625
  </Col>
805
626
  );
806
627
  }
628
+ if (i?.field?.type === 'proppertySelector') {
629
+ return (
630
+ <Col span={ColSpan} key={i.name}>
631
+ <Form.Item name={i.name} label={i.label} key={i.name}>
632
+ <PropertySelector
633
+ />
634
+ </Form.Item>
635
+ </Col>
636
+ );
637
+ }
638
+ if (i?.field?.type === 'multipleQuerySearchSelect') {
639
+ return (
640
+ <Col span={ColSpan} key={i.name}>
641
+ <Form.Item name={i.name} label={i.label} key={i.name}>
642
+ <QueryMutipleSearchSelect {...i.field.props} onValueChange={(value) => {
643
+ form.setFieldsValue({
644
+ [i.name]: value
645
+ })}} />
646
+ </Form.Item>
647
+ </Col>
648
+ );
649
+ }
807
650
 
808
651
  // 默认type是input
809
652
  return (
@@ -824,14 +667,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
824
667
  return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
825
668
  }
826
669
 
827
- // const queryFieldsDom = <SearchItemTable
828
- // ref={searchTableRef}
829
- // setShowSearchFields={setShowSearchFields||[]}
830
- // showSearchFields={showSearchFields||[]}
831
- // datasource={modalTableProps?.tableSearchForm || []}
832
- // bsTableCode={bsTableCode}
833
- // />
834
-
835
670
  const renderShowTable = (tableList, type) => {
836
671
  const tableBoxHeighth = getTableHeigth(modalTableProps?.tableSearchForm);
837
672
  const oSY = `calc(100vh - ${tableBoxHeighth}px - 82px)`; // 分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
@@ -844,7 +679,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
844
679
  columns={tableShowColumns}
845
680
  dataSource={tableList}
846
681
  {...type=='noPage'?{
847
- pagination: initPagination,
682
+ pagination: { ...initPagination,showSizeChanger: false },
848
683
  locale: {
849
684
  emptyText: '暂无已选结果',
850
685
  }
@@ -880,10 +715,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
880
715
  { label: `已选(${selectedRowKeys?.length || 0})`, key: 'selected', children: renderShowTable(selectedRows?.map((s,index)=> ({...s,keyIndex:index+1}))||[],'noPage') },
881
716
  ];
882
717
 
883
- const resetSelectDataSource = () => {
718
+ const resetSelectDataSource = (isClear=false) => {
884
719
  setSearchValue('');
885
720
  // 有关联值 不需要清空下拉框数据 也不需要重新去请求了
886
- if(isHaveDependency) return;
721
+ if(!isClear && isHaveDependency) return; // 清空时需要放开:级联首次回之后,清空数据需要重新查询下拉框的值
887
722
  clearSelectDataSource();
888
723
  init && run('init')
889
724
  }
@@ -895,11 +730,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
895
730
  formaData([], items);
896
731
  onChangeSelectedKeys([], [])
897
732
  // 重置下拉框数据源
898
- resetSelectDataSource();
733
+ resetSelectDataSource(true);
899
734
  }
900
735
 
901
736
  const onDeselect = (...arg) => {
902
- const oldSelect = value?.map(s => ({ value: s?.value||s }))||[];
737
+ const oldSelect = formatSelectedValue(value);
903
738
  const deRecord = arg[1];
904
739
  const srs = oldSelect.filter((s: any) => s.value != deRecord?.value)
905
740
  onSelectClick(srs, items,false)
@@ -910,13 +745,22 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
910
745
  }
911
746
 
912
747
  const onDropdownVisibleChange = (visible) => {
748
+ // 阻止maxTagPlaceholder点击事件触发下拉框展示事件
749
+ if(isMaxTagsOpen && !selectOpen) return;
750
+
913
751
  setSelectOpen(visible);
914
752
  // 关闭下拉框 如果首次本身就不展示数据的 没有选中数据-需要清空查询数据源; 首次展示的默认展示
915
753
  if (!visible && !value?.length) {
916
- resetSelectDataSource()
754
+ setTimeout(() => {
755
+ // 延时 是为了避免 执行时候出现下拉框弹两次的问题-可以看到数据源从展示到显示空数据框的问题
756
+ resetSelectDataSource()
757
+ }, 200)
917
758
  }
918
759
  }
919
760
  const renderTable = (dataSource) => {
761
+ const currentSRKs = getCurrentSRKs(selectMode,labelInValue,value)
762
+ const renderSource = getRenderSource(currentSRKs,items)
763
+
920
764
  return (
921
765
  <div className={`search_select_dropdown_table ${!selectMode?'search_select_dropdown_table1':''}`}>
922
766
  <Table
@@ -926,10 +770,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
926
770
  rowSelection: {
927
771
  type: 'checkbox',
928
772
  columnWidth: '24px',
929
- selectedRowKeys: labelInValue ? value?.map(s=> (s?.value||s)) : value,
773
+ selectedRowKeys: currentSRKs,
930
774
  preserveSelectedRowKeys: true, // 避免搜索之后 没有了选中前的数据 保证sks的正确性
931
775
  onChange: (sks, srs) => {
932
- const oldSelect = value?.map(s => ({ value: s?.value||s }))||[];
776
+ const oldSelect = formatSelectedValue(value);
933
777
  let tmpSelectedRows = oldSelect.concat(srs).filter(item => item != undefined);
934
778
  let realSrs = sks.map(key => tmpSelectedRows.filter(item => item.value == key)[0]).filter(item => item != undefined)
935
779
  onSelectClick(realSrs, dataSource,false)
@@ -940,7 +784,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
940
784
  event.stopPropagation();
941
785
  event.nativeEvent.stopImmediatePropagation();
942
786
 
943
- const oldSelect = value?.map(s => ({ value: s?.value||s }))||[];
787
+ const oldSelect = formatSelectedValue(value);
944
788
  const newSelect = [JSON.parse(JSON.stringify(record))];
945
789
  const srs = getRealStr(oldSelect,newSelect,record);
946
790
  onSelectClick(srs,dataSource,false)
@@ -950,7 +794,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
950
794
  rowSelection: {
951
795
  type: 'radio',
952
796
  columnWidth: 0,
953
- selectedRowKeys: labelInValue ? value?.value&&[value?.value]||[] : value&&[value]||[],
797
+ selectedRowKeys: currentSRKs,
954
798
  },
955
799
  onRow: (record, rowKey) => ({
956
800
  onClick: event => {
@@ -960,7 +804,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
960
804
  })
961
805
  })}
962
806
  columns={selectProps?.renderTableColumns||[]}
963
- dataSource={items}
807
+ dataSource={renderSource}
964
808
  size="middle"
965
809
  pagination={false}
966
810
  rowKey={mappingValueField}
@@ -970,67 +814,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
970
814
  );
971
815
  }
972
816
 
973
- const maxTagPlaceholder = (selectedValues) => {
974
- const onClose = (e: any, item: any) => {
975
- e.preventDefault();
976
- 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)
977
- onChange(newValue);
978
- }
979
- return (
980
- <Tooltip title={selectedValues.map((i: any) => (
981
- <Tag
982
- closable={true}
983
- onClose={(e) => onClose(e, i)}
984
- style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
985
- >
986
- {i.label}
987
- </Tag>
988
- ))}>
989
- {`+ ${selectedValues?.length}`}
990
- </Tooltip>
991
- )
992
- }
993
-
994
- const handleSelectOptionsShowValue = (specialBracket: boolean, noNeedSplit: boolean, item: object) => {
995
- let showText = Array.isArray(item.textShowText) &&
996
- item.textShowText.join(' ') || item.textShowText;
997
- if (noNeedSplit) {
998
- return item.text;
999
- } else {
1000
- return specialBracket
1001
- ? `【${item.textShowKey || ''}】${showText}`
1002
- : `${item.textShowKey || ''} ${showText}`
1003
- }
1004
- };
1005
-
1006
- const getShowLabelTextStr = (kongValue): string => {
1007
- if (selectMode) {
1008
- return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
1009
- }
1010
- return (value?.label || value?.text || kongValue) as string;
1011
- };
1012
- const getSelectValueText = (v: any) => {
1013
- return (items || []).filter(item => item.value === v)?.[0]?.text || v || '';
1014
- }
1015
- const getShowValueStr = (kongValue): string => {
1016
- if (selectMode) {
1017
- return Array.isArray(value) && value?.map(item => getSelectValueText(item))?.join(',') || kongValue;
1018
- }
1019
- return (getSelectValueText(value) || kongValue) as string;
1020
- }
1021
- const getShowStr = () => {
1022
- // 优先使用业务使用传入的展示
1023
- if(viewShowValueStr) return viewShowValueStr;
1024
-
1025
- const kongValue = '无'
1026
- // 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
1027
- // 再判断是单选还是多选,数据类型不同取值方式也不同
1028
- if (labelInValue) {
1029
- return getShowLabelTextStr(kongValue);
1030
- }
1031
- return getShowValueStr(kongValue);
1032
- }
1033
-
1034
817
  const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
1035
818
  return (
1036
819
  <div className={'search_select'}>
@@ -1045,11 +828,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1045
828
  </div>
1046
829
  ) : (
1047
830
  isShouldShowStr ?
1048
- (<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
1049
- {getShowStr()}
831
+ (<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
832
+ {getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
1050
833
  </div>) :
1051
834
  <div
1052
- className="search_select_show"
835
+ className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
1053
836
  id={`search_select_div_${uniqueValue}`}
1054
837
  >
1055
838
  <Select
@@ -1059,7 +842,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1059
842
  onClear={onClear}
1060
843
  onDeselect={onDeselect}
1061
844
  disabled={sDisabled}
1062
- dropdownStyle={{ borderRadius: '2px', padding: '10px 2px' }}
845
+ dropdownStyle={{ borderRadius: '2px', padding: '10px 2px'}}
1063
846
  open={selectOpen}
1064
847
  onDropdownVisibleChange={onDropdownVisibleChange}
1065
848
  dropdownRender={(menu) => items?.length ? renderTable(items) : menu}
@@ -1075,13 +858,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1075
858
  onPopupScroll={SelectScroll}
1076
859
  style={{ width: 'calc(100%)' }}
1077
860
  placeholder="请选择"
1078
- maxTagPlaceholder={maxTagPlaceholder}
861
+ maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:{labelInValue}, onChange, value, setIsMaxTagsOpen })}
1079
862
  onSearch={(v) => onSearchChange(v)}
1080
863
  {...(needModalTable ? {
1081
864
  suffixIcon: <div className={`search_select_expand_button ${(sDisabled)?'search_select_expand_button_disabled':''}`} onClick={showModal}><SearchOutlined /></div>
1082
865
  } : {})}
1083
866
  {...currentSelectProps}
1084
- getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || triggerNode.parentElement}
867
+ getPopupContainer={(triggerNode) => (highestPopContainer && highestPopContainer(triggerNode)) || triggerNode.parentElement}
1085
868
  >
1086
869
  {items.map(item => (
1087
870
  <Option key={item.value} label={item.text}>
@@ -1139,7 +922,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1139
922
  <Button key="reset" onClick={onResetTable}>
1140
923
  重置 ctrl+U
1141
924
  </Button>
1142
- {/* <div>{queryFieldsDom}</div> */}
1143
925
  <div style={{position: 'absolute',top: 0,right: 0}}>
1144
926
  {hasMoreQueryFields(modalTableProps) && modalTableProps?.isHorizontally
1145
927
  ? <img onClick={() => {toggleCollapsed()}} style={{