@bit-sun/business-component 4.0.13-alpha.9 → 4.2.0-alpha.0

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 (64) hide show
  1. package/.umirc.ts +21 -10
  2. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +5 -2
  3. package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -0
  4. package/dist/components/Business/ItemPropertySelector/index.d.ts +3 -0
  5. package/dist/components/Business/ModalUtils/index.d.ts +8 -0
  6. package/dist/components/Business/SearchSelect/utils.d.ts +4 -2
  7. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +3 -2
  8. package/dist/components/Business/columnSettingTable/index.d.ts +19 -2
  9. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +20 -3
  10. package/dist/components/Functional/DataValidation/index.d.ts +11 -1
  11. package/dist/components/Functional/SearchSelect/utils.d.ts +2 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.esm.js +2030 -901
  14. package/dist/index.js +2030 -900
  15. package/package.json +9 -7
  16. package/src/assets/btn-cancel.svg +3 -0
  17. package/src/assets/btn-copy.svg +3 -0
  18. package/src/assets/btn-delete.svg +2 -29
  19. package/src/assets/btn-edit.svg +2 -19
  20. package/src/assets/btn-hangUp.svg +3 -0
  21. package/src/assets/btn-print.svg +3 -0
  22. package/src/assets/btn-refresh.svg +3 -0
  23. package/src/assets/btn-unhook.svg +3 -0
  24. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +4 -3
  25. package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +0 -4
  26. package/src/components/Business/BsSulaQueryTable/index.less +5 -3
  27. package/src/components/Business/BsSulaQueryTable/index.md +45 -32
  28. package/src/components/Business/BsSulaQueryTable/index.tsx +153 -76
  29. package/src/components/Business/BsSulaQueryTable/setting.tsx +40 -10
  30. package/src/components/Business/BsSulaQueryTable/utils.tsx +15 -12
  31. package/src/components/Business/CommodityEntry/index.md +1 -1
  32. package/src/components/Business/CommodityEntry/index.tsx +11 -9
  33. package/src/components/Business/DetailPageWrapper/index.less +1 -1
  34. package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
  35. package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
  36. package/src/components/Business/HomePageWrapper/index.less +1 -1
  37. package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
  38. package/src/components/Business/JsonQueryTable/function.ts +1 -1
  39. package/src/components/Business/ModalUtils/index.tsx +45 -0
  40. package/src/components/Business/SearchSelect/BusinessUtils.tsx +284 -57
  41. package/src/components/Business/SearchSelect/index.md +4 -4
  42. package/src/components/Business/SearchSelect/utils.ts +26 -4
  43. package/src/components/Business/columnSettingTable/columnSetting.tsx +27 -11
  44. package/src/components/Business/columnSettingTable/index.less +5 -3
  45. package/src/components/Business/columnSettingTable/index.md +200 -136
  46. package/src/components/Business/columnSettingTable/index.tsx +167 -39
  47. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +178 -47
  48. package/src/components/Functional/AddSelect/index.tsx +19 -9
  49. package/src/components/Functional/BillEntry/index.less +3 -0
  50. package/src/components/Functional/DataValidation/index.md +1 -0
  51. package/src/components/Functional/DataValidation/index.tsx +138 -23
  52. package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -1
  53. package/src/components/Functional/SearchSelect/index.less +4 -0
  54. package/src/components/Functional/SearchSelect/index.tsx +61 -20
  55. package/src/components/Functional/SearchSelect/utils.tsx +13 -10
  56. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  57. package/src/components/Solution/RuleComponent/index.js +59 -1
  58. package/src/components/Solution/RuleComponent/ruleFiled.js +1 -1
  59. package/src/index.ts +1 -0
  60. package/src/plugin/TableColumnSetting/index.less +5 -3
  61. package/src/plugin/TableColumnSetting/index.tsx +4 -3
  62. package/src/styles/bsDefault.less +9 -3
  63. package/src/utils/request.ts +8 -4
  64. package/src/utils/utils.ts +11 -15
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import React, { useState, useEffect, useRef, useMemo } from 'react';
2
+ import React, { useState, useEffect, useRef, useMemo, useCallback, } from 'react';
3
3
  import { useLocation, history } from 'umi';
4
4
  import { QueryTable } from 'bssula';
5
5
  import { Menu, Tooltip, Dropdown, Table, Typography } from 'antd';
@@ -7,7 +7,7 @@ import { Resizable } from 'react-resizable';
7
7
  import { debounce } from 'lodash';
8
8
  import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
9
9
  import ENUM from '@/utils/enumConfig';
10
- import { handleBssulaColumnsSpecialParams, uuid } from '@/utils/utils';
10
+ import { handleBssulaColumnsSpecialParams, uuid, parseWidth, } from '@/utils/utils';
11
11
  import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
12
12
  import { shouldUseAuth } from '@/utils';
13
13
  import {
@@ -164,6 +164,8 @@ const ResizeableTitle = (props: any) => {
164
164
  export default (props: any) => {
165
165
  const bsTableCode = props?.tableCode || window.location.hash; //设置列字段的唯一标识
166
166
 
167
+ const rowsRef = useRef<any>(null);
168
+
167
169
  // 获取 table columns中所有的 key 防止有的地方是 dataindex
168
170
  const checkedList = useMemo(
169
171
  () =>
@@ -337,6 +339,26 @@ export default (props: any) => {
337
339
  globalDocument.webkitFullscreenElement;
338
340
  if (isFull == undefined) isFull = false;
339
341
  return isFull;
342
+ };
343
+
344
+ const getResizeShowColumns = (showColumns, ) => {
345
+ showColumns.forEach((item, index) => {
346
+ item.width = item.width || getItemDefaultWidth(item);
347
+ // handleBssulaColumnsSpecialParams(item);
348
+ item.onHeaderCell = (column) => ({
349
+ ...item,
350
+ width:
351
+ typeof column.width === 'number'
352
+ ? column.width
353
+ : parseWidth(column.width),
354
+ onResize: handleResize(index),
355
+ });
356
+ });
357
+ return showColumns;
358
+ }
359
+ const setResizeShowColumns = (showColumns: any) => {
360
+ let newShowColumns = getResizeShowColumns(showColumns);
361
+ setShowColumns([...newShowColumns]);
340
362
  }
341
363
 
342
364
  const setInitialTableInfo = (isReset) => {
@@ -370,7 +392,7 @@ export default (props: any) => {
370
392
  }
371
393
  });
372
394
  }
373
- handleBssulaColumnsSpecialParams(d);
395
+ // handleBssulaColumnsSpecialParams(d);
374
396
  });
375
397
  setCommonRenderFn(props.columns);
376
398
  const authButton = localStorage.getItem(getMenuAuthDataKey())
@@ -396,49 +418,14 @@ export default (props: any) => {
396
418
  ENUM.BROWSER_CACHE.COLUMN_CONDITION,
397
419
  );
398
420
 
399
- const parseWidth = (widthStr: string): number => {
400
- const parsedWidth = parseInt(widthStr.replace('px', ''));
401
- return isNaN(parsedWidth) ? 0 : parsedWidth;
402
- };
403
-
404
421
  let showColumns = getSettingFieldOrColumn(isReset ? [] : columnConfig, columns, 'columns');
405
-
406
- showColumns.forEach((item, index) => {
407
- item.width = item.width || getItemDefaultWidth(item);
408
- handleBssulaColumnsSpecialParams(item);
409
- item.onHeaderCell = (column) => ({
410
- ...item,
411
- width:
412
- typeof column.width === 'number'
413
- ? column.width
414
- : parseWidth(column.width),
415
- onResize: handleResize(index),
416
- });
417
- });
418
- setShowColumns([...showColumns]);
422
+ setResizeShowColumns(showColumns);
419
423
 
420
424
  let exportColumnConfig = getConfigFromlocalstorage(
421
425
  ENUM.BROWSER_CACHE.COLUMN_CONDITION,
422
426
  bsTableCodeExport,
423
427
  );
424
- let showExportColumns = getSettingFieldOrColumn(
425
- exportColumnConfig,
426
- columns,
427
- 'columns',
428
- );
429
-
430
- showExportColumns.forEach((item, index) => {
431
- item.width = item.width || getItemDefaultWidth(item);
432
- handleBssulaColumnsSpecialParams(item);
433
- item.onHeaderCell = (column) => ({
434
- ...item,
435
- width:
436
- typeof column.width === 'number'
437
- ? column.width
438
- : parseInt(column.width.replace('px', '')),
439
- onResize: handleResize(index),
440
- });
441
- });
428
+ let showExportColumns = getSettingFieldOrColumn(exportColumnConfig,columns,'columns');
442
429
  setShowExportColumns([...showExportColumns]);
443
430
  };
444
431
 
@@ -527,49 +514,97 @@ export default (props: any) => {
527
514
 
528
515
  // 处理 table 基本参数
529
516
  const setTableProps = () => {
530
- let tableProps = value.tableProps || {};
531
- tableProps = {
532
- ...tableProps,
517
+ const defaultPageSize = 20;
518
+ const baseTableProps = {
533
519
  size: value.size || 'middle',
534
- defaultPageSize: 20,
535
- pageSize: 20,
536
- initialPaging: {
537
- pagination: props?.pagination
538
- ? false
539
- : {
540
- defaultPageSize: 20,
541
- pageSize: 20,
542
- showTotal: (total: any) => `共 ${total} 条`,
543
- showQuickJumper: true,
544
- hideOnSinglePage: value.hideOnSinglePage || false,
545
-
546
- ...tableProps?.initialPaging?.pagination,
547
- },
548
- },
520
+ defaultPageSize,
521
+ pageSize: defaultPageSize,
549
522
  initialSelectedRowKeys: value.initialSelectedRowKeys || [],
550
523
  expandable: props.expandable,
551
524
  scroll: {
552
525
  x: props.overScrollX || 'max-content',
553
526
  y: props?.overScrollY || height,
554
527
  },
555
- bordered: value.bordered || true,
556
- sticky: true,
557
- rowClassName: (record: object | null | undefined, index: number) =>
558
- index % 2 === 0 ? 'table_base' : 'table_odd',
528
+ bordered: typeof value.bordered === 'boolean' ? value.bordered : true,
529
+ sticky: typeof value.sticky === 'boolean' ? value.sticky : true,
530
+ rowClassName: (record, index) => {
531
+ if (props?.rowClassName) {
532
+ return props.rowClassName(record, index);
533
+ }
534
+ if (value?.tableProps?.showStatusFields && value?.tableProps?.showStatusFields?.some(status => record?.[status] == -1)) {
535
+ return 'table_gray';
536
+ }
537
+ return index % 2 === 0 ? 'table_base' : 'table_odd';
538
+ },
559
539
  components: {
560
540
  header: {
561
541
  cell: ResizeableTitle,
562
542
  },
563
- ...tableProps?.components,
543
+ ...value.tableProps?.components,
564
544
  },
565
- ...(props.viewPagePath ? // 详情页查看地址 存在该参数时 默认列表支持双击打开
566
- {
567
- onRow: (record: any) => ({
568
- onDoubleClick: (e: any) => {
569
- history.push(eval(`\`${props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, (match: any, p: any) => `\${${p}}`)}\``));
570
- },
571
- }),
572
- } : {}),
545
+ };
546
+
547
+ const paginationConfig = props?.pagination
548
+ ? false
549
+ : {
550
+ defaultPageSize,
551
+ pageSize: defaultPageSize,
552
+ showTotal: (total) => `共 ${total} 条`,
553
+ showQuickJumper: true,
554
+ hideOnSinglePage: value.hideOnSinglePage || false,
555
+ ...value.tableProps?.initialPaging?.pagination,
556
+ };
557
+
558
+ const handleRowClick = (record) => {
559
+ const { rowKey } = value;
560
+
561
+ let newSelectedRowKeys = [...(rowsRef?.current?.selectedRowKeys || [])];
562
+ let newSelectedRows = [...(rowsRef?.current?.selectedRows || [])];
563
+
564
+ const keyIndex = newSelectedRowKeys.indexOf(record[rowKey]);
565
+ if (keyIndex > -1) {
566
+ // 如果已经选中,则取消选中
567
+ newSelectedRowKeys.splice(keyIndex, 1);
568
+ newSelectedRows.splice(keyIndex, 1);
569
+ } else {
570
+ // 如果未选中,则添加到选中列表
571
+ newSelectedRowKeys.push(record[rowKey]);
572
+ newSelectedRows.push(record);
573
+ }
574
+
575
+ rowsRef.current = {
576
+ selectedRowKeys: newSelectedRowKeys,
577
+ selectedRows: newSelectedRows,
578
+ };
579
+
580
+ // 手动调用外部传入的 onChange 函数
581
+ const { rowSelection } = value;
582
+ if (rowSelection && typeof rowSelection.onChange === 'function') {
583
+ // 直接将 record 作为数组元素传递
584
+ rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
585
+ }
586
+ };
587
+
588
+ const handleRowDoubleClick = (record) => {
589
+ console.log('handleRowDoubleClick', record);
590
+ if (props.viewPagePath) {
591
+ const path = eval(`\`${props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, (match, p) => `\${${p}}`)}\``);
592
+ history.push(path);
593
+ }
594
+ };
595
+
596
+ const tableProps = {
597
+ ...baseTableProps,
598
+ initialPaging: {
599
+ pagination: paginationConfig,
600
+ },
601
+ onRow: (record) => {
602
+ return {
603
+ onClick: () => handleRowClick(record), // 绑定行点击事件
604
+ onDoubleClick: () => handleRowDoubleClick(record), // 绑定行点击事件
605
+ };
606
+ },
607
+ ...value?.tableProps || {}
573
608
  };
574
609
 
575
610
  // @ts-ignore
@@ -715,9 +750,9 @@ export default (props: any) => {
715
750
  ...newColumns[index],
716
751
  width: size.width,
717
752
  };
718
- newColumns.forEach((d: any) => {
719
- handleBssulaColumnsSpecialParams(d);
720
- });
753
+ // newColumns.forEach((d: any) => {
754
+ // handleBssulaColumnsSpecialParams(d);
755
+ // });
721
756
  return [...newColumns];
722
757
  });
723
758
  };
@@ -747,6 +782,36 @@ export default (props: any) => {
747
782
  return cols;
748
783
  };
749
784
 
785
+ const onSelectChange = useCallback((newSelectedRowKeys: any, newSelectedRows: any) => {
786
+ const originalSelectedRowKeys = rowsRef?.current?.selectedRowKeys || [];
787
+ const originalSelectedRows = rowsRef?.current?.selectedRows || [];
788
+
789
+ // 合并新的 selectedRowKeys,去除重复项
790
+ const mergedSelectedRowKeys = [...new Set([...originalSelectedRowKeys, ...newSelectedRowKeys])];
791
+ // 合并新的 selectedRows
792
+ const rowKey = props.rowKey;
793
+ const mergedSelectedRows = mergedSelectedRowKeys.map((key) => {
794
+ const existingRow = originalSelectedRows.find((row) => row[rowKey] === key);
795
+ const newRow = newSelectedRows.find((row) => row[rowKey] === key);
796
+ return newRow || existingRow || {};
797
+ });
798
+
799
+ rowsRef.current = {
800
+ selectedRowKeys: mergedSelectedRowKeys,
801
+ selectedRows: mergedSelectedRows,
802
+ };
803
+
804
+ // 如果外部传入了 rowSelection 的 onChange 事件,调用它
805
+ if (value.rowSelection && typeof value.rowSelection.onChange === 'function') {
806
+ value.rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
807
+ }
808
+ }, [value.rowKey, value.rowSelection]);
809
+
810
+ const isObject = (value: any) => typeof value === 'object' && value!== null;
811
+ const hasValidRowSelection = (propRowSelection: any) => {
812
+ return isObject(propRowSelection) && Object.keys(propRowSelection).length > 0;
813
+ };
814
+
750
815
  const config = {
751
816
  visibleFieldsCount: 7,
752
817
  tableWrapperStyle: {
@@ -765,9 +830,21 @@ export default (props: any) => {
765
830
  span: 16,
766
831
  },
767
832
  },
768
- rowSelection: false, // 默认无多选
769
833
  ...handleTimeValue(),
770
834
  tableProps: setTableProps(),
835
+ rowSelection: value.rowSelection ? {
836
+ ...value.rowSelection,
837
+ selectedRowKeys: rowsRef?.current?.selectedRowKeys || [],
838
+ onChange: (selectedRowKeys: any, selectedRows: any) => {
839
+ rowsRef.current = {
840
+ selectedRowKeys: selectedRowKeys,
841
+ selectedRows: selectedRows,
842
+ };
843
+ if (value.rowSelection && typeof value.rowSelection.onChange === 'function') {
844
+ value.rowSelection.onChange(selectedRowKeys, selectedRows);
845
+ }
846
+ },
847
+ } : false,
771
848
  columns: [...getColumns()],
772
849
  fields: [...showSearchFields],
773
850
  ref: props.forwardedRef || refs,
@@ -890,7 +967,7 @@ export default (props: any) => {
890
967
  {/* 列设置弹出框表格 */}
891
968
  <SortableTable
892
969
  ref={sortTableRef}
893
- setShowColumns={setShowColumns}
970
+ setShowColumns={setResizeShowColumns}
894
971
  showColumn={showColumn}
895
972
  setInitialTableInfo={setInitialTableInfo}
896
973
  datasource={value?.columns || []}
@@ -48,9 +48,10 @@ class SortableTable extends React.Component {
48
48
  bsTableCode: '', //设置table 列的标识
49
49
  };
50
50
 
51
- patchUserColumnConfig = (config) => {
51
+ patchUserColumnConfig = (config: any, tableCode: any) => {
52
52
  const { appRequestConfig } = this.props;
53
53
  let that = this;
54
+ const newTableCode = tableCode || that.state.bsTableCode;
54
55
  let configvalue = config
55
56
  ? config.map((item) => ({
56
57
  key: item.key,
@@ -65,12 +66,12 @@ class SortableTable extends React.Component {
65
66
  url: handleRequestUrl('/user','/appConfig/saveUserOrder', appRequestConfig),
66
67
  method: 'POST',
67
68
  data: {
68
- code: that.state.bsTableCode,
69
+ code: newTableCode,
69
70
  detail: configvalue ? JSON.stringify(configvalue) : '',
70
71
  },
71
72
  }).then((res:any) => {
72
73
  if (judgeIsRequestSuccess(res?.data)) {
73
- this.patchConfigToLocalstorage(configvalue);
74
+ this.patchConfigToLocalstorage(configvalue, newTableCode, config);
74
75
  resolve({ status: '0' });
75
76
  } else {
76
77
  message.error('保存表头列自定义失败,请稍后尝试');
@@ -93,20 +94,22 @@ class SortableTable extends React.Component {
93
94
  return [];
94
95
  };
95
96
 
96
- patchConfigToLocalstorage = (configvalue) => {
97
+ patchConfigToLocalstorage = (configvalue, tableCode: any, newDataSource: any) => {
97
98
  const { setShowColumns, datasource = [] } = this.props;
98
99
  const { sortDataSource, bsTableCode } = this.state;
100
+
101
+ const sourceList = newDataSource || sortDataSource;
99
102
  let config =
100
103
  localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
101
104
  let configArray = JSON.parse(config);
102
105
  let currentSetting = configArray.filter(
103
- (item) => item.code === bsTableCode,
106
+ (item) => item.code === tableCode,
104
107
  );
105
108
  if (currentSetting.length) {
106
109
  currentSetting[0].detail = JSON.stringify(configvalue);
107
110
  } else {
108
111
  configArray.push({
109
- code: bsTableCode,
112
+ code: tableCode,
110
113
  detail: JSON.stringify(configvalue),
111
114
  });
112
115
  }
@@ -119,7 +122,7 @@ class SortableTable extends React.Component {
119
122
  visible: false,
120
123
  });
121
124
  if (configvalue) {
122
- setShowColumns([...sortDataSource]);
125
+ setShowColumns([...sourceList]);
123
126
  } else {
124
127
  this.setState({
125
128
  isDefaultValue: true,
@@ -140,6 +143,30 @@ class SortableTable extends React.Component {
140
143
  }
141
144
  };
142
145
 
146
+ isColumnsChange = (pre=[], next=[]) => {
147
+ const preKeyStr = pre.map(item => item.key || item.dataIndex).join(',');
148
+ const nextKeyStr = next.map(item => item.key || item.dataIndex).join(',');
149
+ return preKeyStr !== nextKeyStr;
150
+ }
151
+
152
+ // 提取逻辑到单独的方法
153
+ validateLocalStorageConfig = (datasource: any, tableCode: string) => {
154
+ let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
155
+ let configArray = JSON.parse(config);
156
+ let currentSetting = configArray.filter((item: any) => item.code === tableCode);
157
+ let configvalue = currentSetting?.[0]?.detail ? JSON.parse(currentSetting[0].detail) : [];
158
+ if (currentSetting.length === 0 || configvalue.length === 0) {
159
+ this.patchUserColumnConfig(datasource || [], tableCode);
160
+ }
161
+ }
162
+
163
+ componentWillReceiveProps(nextProps: any) {
164
+ if (this.isColumnsChange(this.props?.datasource, nextProps?.datasource)) {
165
+ //this.setInitValue(nextProps?.datasource || []);
166
+ this.validateLocalStorageConfig(nextProps?.datasource, nextProps?.bsTableCode);
167
+ }
168
+ }
169
+
143
170
  setInitValue = (isClick = false) => {
144
171
  const { datasource, showColumn }: any = this.props;
145
172
  let config = this.getConfigFromlocalstorage();
@@ -188,6 +215,8 @@ class SortableTable extends React.Component {
188
215
  const { datasource, showColumn, bsTableCode }: any = this.props;
189
216
  let config = this.getConfigFromlocalstorage();
190
217
 
218
+ this.validateLocalStorageConfig(datasource, bsTableCode);
219
+
191
220
  this.setState({
192
221
  dataSource: datasource.map((item) => {
193
222
  let innerItem = config.filter((inneritem) => {
@@ -544,7 +573,7 @@ class SortableTable extends React.Component {
544
573
  DraggableContainer = (props) => (
545
574
  <SortableBody
546
575
  useDragHandle
547
- disableAutoscroll
576
+ lockAxis='y'
548
577
  helperClass="row-dragging"
549
578
  onSortEnd={this.onSortEnd}
550
579
  {...props}
@@ -555,9 +584,9 @@ class SortableTable extends React.Component {
555
584
  const { sortDataSource } = this.state;
556
585
  // function findIndex base on Table rowKey props and should always be a right array index
557
586
  const index = sortDataSource.findIndex(
558
- (x) => x.key === restProps['data-row-key'],
587
+ (x) => (x.key||x.dataIndex) == restProps['data-row-key'],
559
588
  );
560
- return <SortableItem index={index} {...restProps} />;
589
+ return <SortableItem key={restProps['data-row-key']} index={index} {...restProps} />;
561
590
  };
562
591
 
563
592
 
@@ -918,6 +947,7 @@ class SortableTable extends React.Component {
918
947
  row: this.DraggableBodyRow,
919
948
  },
920
949
  }}
950
+ scroll={{ y: 364 }}
921
951
  />
922
952
  </div>
923
953
  </div>
@@ -242,24 +242,27 @@ export const tableColumnsImage = (
242
242
  url?: string,
243
243
  paramsObj?: tableColumnsImageType,
244
244
  ) => {
245
- // 测试使用 测试类型缩小 随时可删除 start
246
- const imgHtml = document.querySelector('.ant-image-mask-info')!;
247
- if (imgHtml) {
248
- let str = imgHtml?.innerHTML;
249
- str = str?.replace('预览', '');
250
- imgHtml.innerHTML = str;
251
- }
252
- // 测试使用 测试类型缩小 end
245
+ // 默认预览配置(修复失真问题)
246
+ const defaultPreview = {
247
+ width: "40%", // 基于视窗宽度
248
+ objectFit: 'cover'
249
+ };
253
250
 
254
251
  return (
255
252
  <>
256
253
  {url ? (
257
- <div className={`clomnsImg`}>
258
- <Image src={url} width="16px" height="16px" {...paramsObj}></Image>
254
+ <div className="clomnsImg">
255
+ <Image
256
+ src={url}
257
+ width="16px"
258
+ height="16px"
259
+ preview={defaultPreview} // 直接使用配置,避免展开运算符
260
+ {...paramsObj}
261
+ />
259
262
  </div>
260
263
  ) : (
261
- <div className={`clomnsImg2`}>
262
- <img {...paramsObj} src={noImg}></img>
264
+ <div className="clomnsImg2">
265
+ <img {...paramsObj} src={noImg} alt="无图片" />
263
266
  </div>
264
267
  )}
265
268
  </>
@@ -28,7 +28,7 @@ export default () => {
28
28
  console.log('确定操作,可获取到成功录入的商品,做一系列操作')
29
29
  console.log(resultData)
30
30
  // 一般拿到导入数据是做请求接口操作
31
- // import {request} from "bssula";
31
+ // import {request} from 'bssula';
32
32
  // request({
33
33
  // url: `/bop/api/sku/import/save`,
34
34
  // method: "POST",
@@ -34,16 +34,18 @@ const CommodityEntry = (props: any) => {
34
34
 
35
35
  const handleOk = () => {
36
36
  // 方法获取当前组件内部的数据,然后进行自身的业务操作
37
- const resultData = dataValidationRef.current?.getValidateData();
37
+ let resultData = props?.notValid ? dataValidationRef.current?.getData() : dataValidationRef.current?.getValidateData();
38
38
 
39
- if (!resultData.successData.length) {
40
- message.error("无校验通过数据,请校验数据");
41
- return;
42
- }
43
-
44
- if (resultData.failData.length) {
45
- message.error(`有${resultData.failData.length}条校验失败数据`);
46
- return;
39
+ if(!(!!props?.notValid)) {
40
+ if (!resultData.successData.length) {
41
+ message.error("无校验通过数据,请校验数据");
42
+ return;
43
+ }
44
+
45
+ if (resultData.failData.length) {
46
+ message.error(`有${resultData.failData.length}条校验失败数据`);
47
+ return;
48
+ }
47
49
  }
48
50
 
49
51
  callbackHandleOk(resultData, () => {
@@ -94,7 +94,7 @@
94
94
  align-items: center;
95
95
  gap: 2px;
96
96
  border-radius: 3px;
97
- padding: 0 10px;
97
+ padding: 0 2px;
98
98
  }
99
99
  .ant-btn-dangerous {
100
100
  background-color: #EC5246 !important;
@@ -12,6 +12,12 @@ import editIcon from '../../../assets/btn-edit.svg';
12
12
  import submitIcon from '../../../assets/btn-submit.svg';
13
13
  import deleteIcon from '../../../assets/btn-delete.svg';
14
14
  import moreIcon from '../../../assets/btn-more.svg';
15
+ import hangUpIcon from '../../../assets/btn-hangUp.svg';
16
+ import unhookIcon from '../../../assets/btn-unhook.svg';
17
+ import refreshIcon from '../../../assets/btn-refresh.svg';
18
+ import printIcon from '../../../assets/btn-print.svg';
19
+ import copyIcon from '../../../assets/btn-copy.svg';
20
+ import cancelIcon from '../../../assets/btn-cancel.svg';
15
21
  import { useLocation, formatMessage } from 'umi';
16
22
  import CommonAlert from '../CommonAlert';
17
23
  import ENUM from '@/utils/enumConfig';
@@ -30,11 +36,21 @@ interface actionItem {
30
36
  action: object;
31
37
  }
32
38
 
39
+ const iconStyle = {
40
+ width: 16,
41
+ height: 16,
42
+ };
33
43
  export const iconMap = {
34
- edit: <img src={editIcon} />,
35
- delete: <img src={deleteIcon} />,
36
- submit: <img src={submitIcon} />,
37
- more: <img src={moreIcon} />,
44
+ edit: <img src={editIcon} {...iconStyle} />,
45
+ delete: <img src={deleteIcon} {...iconStyle} />,
46
+ submit: <img src={submitIcon} {...iconStyle} />,
47
+ more: <img src={moreIcon} {...iconStyle} />,
48
+ hangUp: <img src={hangUpIcon} {...iconStyle} />,
49
+ unhook: <img src={unhookIcon} {...iconStyle} />,
50
+ refresh: <img src={refreshIcon} {...iconStyle} />,
51
+ print: <img src={printIcon} {...iconStyle} />,
52
+ copy: <img src={copyIcon} {...iconStyle} />,
53
+ cancel: <img src={cancelIcon} {...iconStyle} />,
38
54
  };
39
55
 
40
56
  export default (props: any) => {
@@ -194,6 +210,7 @@ const DetailWrapper = React.memo(
194
210
  <Button
195
211
  type={type || 'primary'}
196
212
  icon={item.icon ? iconMap[item.icon] : ''}
213
+ style={item.icon ? {} : {}}
197
214
  danger={item.name === '删除' ? true : false}
198
215
  disabled={item.disabled}
199
216
  onClick={() => {
@@ -203,13 +220,15 @@ const DetailWrapper = React.memo(
203
220
  doDetailPageAction(item.action);
204
221
  }
205
222
  }}
223
+ {...item?.buttomProps}
206
224
  >
207
225
  {item.name}
208
226
  </Button>
209
227
  );
210
228
  };
211
229
 
212
- if (visibleActions.length <= 3) {
230
+ // 可在actionList第一项设置visibleActionCount,控制按钮几个开始显示更多,默认为3
231
+ if (visibleActions.length <= (actionLists?.[0]?.visibleActionCount || 3)) {
213
232
  return visibleActions.map((item) => {
214
233
  return renderButton(item);
215
234
  });
@@ -85,7 +85,12 @@ export const getMainCrumbNameMap = (menuData) => {
85
85
 
86
86
  const flattenMenuData = (data, parent) => {
87
87
  let pNameMap = parent.nameMap ? [...parent.nameMap] : [];
88
- data.forEach((menuItem) => {
88
+ data.forEach((menuItem) => {
89
+ // 面包屑路径,增加显示一级导航路径显示
90
+ if(parent.isMenuRoot) {
91
+ const newList = (window.top||window)?.applicationList?.filter?.((app: any) => app.code === menuItem.belongAppCode) || [];
92
+ pNameMap = newList.length > 0 ? [newList[0].name] : [];
93
+ }
89
94
  let newMenuItem = {
90
95
  ...menuItem,
91
96
  nameMap: [...pNameMap, menuItem.name]
@@ -100,7 +105,7 @@ export const getMainCrumbNameMap = (menuData) => {
100
105
  };
101
106
  });
102
107
  };
103
- flattenMenuData(menuData, {});
108
+ flattenMenuData(menuData,{ isMenuRoot: true });
104
109
  return routerMap;
105
110
  }
106
111
 
@@ -1,5 +1,5 @@
1
1
  .bs_home_page_head_wrapper{
2
- height: 32px;
2
+ // 如果设置高度 需要考虑列表页引用有传提示参数alertProps情况,写死固定高度会导致提示遮挡筛选条件
3
3
  position: sticky;
4
4
  background: #fff;
5
5
  width: 100%;