@bit-sun/business-component 2.2.49 → 2.3.0-alpha.2

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 (60) hide show
  1. package/dist/common/ENUM.d.ts +40 -0
  2. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +2 -2
  3. package/dist/components/Business/SearchSelect/common.d.ts +9 -1
  4. package/dist/components/Business/TreeSearchSelect/utils.d.ts +3 -1
  5. package/dist/components/Functional/AddSelect/helps.d.ts +13 -0
  6. package/dist/components/Functional/BsAntdSula/BsCascader/index.d.ts +18 -0
  7. package/dist/components/Functional/BsAntdSula/index.d.ts +1 -0
  8. package/dist/components/Solution/RuleComponent/Formula.d.ts +8 -0
  9. package/dist/components/Solution/RuleComponent/services.d.ts +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.esm.js +10845 -11311
  12. package/dist/index.js +10806 -11268
  13. package/dist/utils/LocalstorageUtils.d.ts +1 -0
  14. package/dist/utils/index.d.ts +1 -0
  15. package/dist/utils/utils.d.ts +7 -0
  16. package/package.json +2 -1
  17. package/src/common/ENUM.ts +41 -0
  18. package/src/components/Business/AddSelectBusiness/index.md +1 -0
  19. package/src/components/Business/AddSelectBusiness/index.tsx +375 -176
  20. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +1 -1
  21. package/src/components/Business/BsSulaQueryTable/index.tsx +20 -12
  22. package/src/components/Business/BsSulaQueryTable/setting.tsx +36 -16
  23. package/src/components/Business/BsSulaQueryTable/utils.tsx +31 -29
  24. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +4 -0
  25. package/src/components/Business/JsonQueryTable/index.tsx +248 -33
  26. package/src/components/Business/JsonQueryTable/static.ts +5 -5
  27. package/src/components/Business/SearchSelect/BusinessUtils.ts +37 -7
  28. package/src/components/Business/SearchSelect/common.ts +23 -1
  29. package/src/components/Business/SearchSelect/index.md +12 -2
  30. package/src/components/Business/SearchSelect/index.tsx +5 -2
  31. package/src/components/Business/TreeSearchSelect/index.md +2 -0
  32. package/src/components/Business/TreeSearchSelect/index.tsx +1 -2
  33. package/src/components/Business/TreeSearchSelect/utils.ts +7 -1
  34. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +1 -1
  35. package/src/components/Business/columnSettingTable/utils.tsx +30 -28
  36. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +1 -0
  37. package/src/components/Business/moreTreeTable/index.md +2 -2
  38. package/src/components/Business/moreTreeTable/index.tsx +24 -17
  39. package/src/components/Functional/AddSelect/helps.ts +65 -0
  40. package/src/components/Functional/AddSelect/index.tsx +13 -122
  41. package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -0
  42. package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -0
  43. package/src/components/Functional/BsAntdSula/index.ts +2 -0
  44. package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -0
  45. package/src/components/Functional/EllipsisTooltip/index.js +36 -0
  46. package/src/components/Functional/EllipsisTooltip/index.md +30 -0
  47. package/src/components/Functional/SearchSelect/index.tsx +97 -60
  48. package/src/components/Functional/TreeSearchSelect/index.tsx +44 -7
  49. package/src/components/Solution/RuleComponent/Formula.tsx +335 -0
  50. package/src/components/Solution/RuleComponent/index.d.ts +29 -0
  51. package/src/components/Solution/RuleComponent/index.js +2032 -0
  52. package/src/components/Solution/RuleComponent/index.less +230 -0
  53. package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -0
  54. package/src/components/Solution/RuleComponent/ruleFiled.js +2107 -0
  55. package/src/components/Solution/RuleComponent/services.ts +13 -0
  56. package/src/components/Solution/RuleComponent/util.js +139 -0
  57. package/src/index.ts +4 -0
  58. package/src/utils/LocalstorageUtils.ts +5 -0
  59. package/src/utils/index.ts +1 -0
  60. package/src/utils/utils.ts +29 -0
@@ -1,6 +1,6 @@
1
1
  // 此文件用于 处理业务组件 所用到的公共方法
2
2
  // @ts-nocheck
3
- import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type } from './common';
3
+ import { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType } from './common';
4
4
  import { getDictionarySource, getDictionaryTextByValue, loadSelectSource } from './utils';
5
5
  import { handleTextOverflow, tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
6
6
  import { getSkuImg } from '@/utils/TableUtils';
@@ -775,7 +775,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
775
775
  mappingTextShowKeyField: 'physicalWarehouseCode',
776
776
  mappingValueField: 'id',
777
777
  otherParams: {
778
- 'qp-isEnable-eq': 1,
778
+ ...(modalTableBusProps?.needStatusSearch?{}:{'qp-isEnable-eq': 1}),
779
779
  sorter: 'desc-id'
780
780
  }, // 默认参数
781
781
  sourceName: 'warehouseIds',
@@ -799,6 +799,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
799
799
  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
800
800
  },
801
801
  } },
802
+ ...(modalTableBusProps?.needStatusSearch?[{ name: 'qp-isEnable-eq', type: 'select', label: '物理仓状态', initialSource: getDictionarySource('SC00001') }]:[])
802
803
  ]
803
804
  Promise.all([
804
805
  loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
@@ -826,6 +827,11 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
826
827
  dataIndex: 'physicalWarehouseType',
827
828
  render: (text: number) => getDictionaryTextByValue('SC00002', text),
828
829
  },
830
+ ...(modalTableBusProps?.needStatusSearch?[{
831
+ title: '状态',
832
+ dataIndex: 'isEnable',
833
+ render: (text: number) => getDictionaryTextByValue('SC00001', text),
834
+ }]:[]),
829
835
  {
830
836
  title: '所属公司',
831
837
  dataIndex: 'companyName',
@@ -842,7 +848,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
842
848
  mappingTextShowKeyField: 'realWarehouseCode',
843
849
  mappingValueField: 'id',
844
850
  otherParams: {
845
- 'qp-isEnable-eq': 1,
851
+ ...(modalTableBusProps?.needStatusSearch?{}:{'qp-isEnable-eq': 1}),
846
852
  sorter: 'desc-id'
847
853
  }, // 默认参数
848
854
  sourceName: 'warehouseIds',
@@ -852,6 +858,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
852
858
  { name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
853
859
  { name: 'qp-realWarehouseCode-like', label: '逻辑仓编码' },
854
860
  { name: 'qp-realWarehouseType-eq', type: 'select', label: '逻辑仓类型', initialSource: getDictionarySource('SC00004') },
861
+ ...(modalTableBusProps?.needStatusSearch?[{ name: 'qp-isEnable-eq', type: 'select', label: '逻辑仓状态', initialSource: getDictionarySource('SC00001') }]:[])
855
862
  ]
856
863
  modalTableProps = {
857
864
  modalTableTitle: '选择逻辑仓',
@@ -870,6 +877,11 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
870
877
  dataIndex: 'realWarehouseType',
871
878
  render: (text: number) => getDictionaryTextByValue('SC00004', text),
872
879
  },
880
+ ...(modalTableBusProps?.needStatusSearch?[{
881
+ title: '状态',
882
+ dataIndex: 'isEnable',
883
+ render: (text: number) => getDictionaryTextByValue('SC00001', text),
884
+ }]:[]),
873
885
  ],
874
886
  ...modalTableBusProps,
875
887
  }
@@ -882,7 +894,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
882
894
  mappingTextShowKeyField: 'operationWarehouseCode',
883
895
  mappingValueField: 'operationWarehouseCode',
884
896
  otherParams: {
885
- 'qp-status-eq': 1,
897
+ ...(modalTableBusProps?.needStatusSearch?{}:{'qp-status-eq': 1}),
886
898
  sorter: 'desc-id'
887
899
  }, // 默认参数
888
900
  sourceName: 'qp-operationWarehouseCode-in',
@@ -905,6 +917,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
905
917
  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
906
918
  },
907
919
  } },
920
+ ...(modalTableBusProps?.needStatusSearch?[{ name: 'qp-status-eq', type: 'select', label: '运营仓状态', initialSource: getDictionarySource('SC00001') }]:[])
908
921
  ]
909
922
  Promise.all([
910
923
  loadSelectSource(`${prefixUrl.formSelectFix}/groupInfo/listNoPage`, { 'qp-status-eq': 1 }),
@@ -927,6 +940,11 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
927
940
  title: '运营组',
928
941
  dataIndex: 'groupName',
929
942
  },
943
+ ...(modalTableBusProps?.needStatusSearch?[{
944
+ title: '状态',
945
+ dataIndex: 'status',
946
+ render: (text: number) => getDictionaryTextByValue('SC00001', text),
947
+ }]:[]),
930
948
  ],
931
949
  ...modalTableBusProps,
932
950
  }
@@ -1312,6 +1330,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1312
1330
  { name: 'qp-name-like', label: '商店名称' },
1313
1331
  { name: 'qp-code-like', label: '商店编码' },
1314
1332
  { name: 'qp-type-in', type: 'select', label: '商店类型', initialSource: shopFile2Type },
1333
+ { name: 'qp-status-in', type: 'select', label: '商店状态', initialSource: shopFile2Status },
1315
1334
  { name: 'qp-orgCode-in', type: 'select', label: '所属销售组织', field: {
1316
1335
  type: 'select',
1317
1336
  props: {
@@ -1334,7 +1353,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1334
1353
  'qp-status-eq': 10
1335
1354
  }),
1336
1355
  ]).then((x: any)=>{
1337
- formatSource(x,0, 3, tableSearchForm);
1356
+ formatSource(x,0, 4, tableSearchForm);
1338
1357
  })
1339
1358
  modalTableProps = {
1340
1359
  modalTableTitle: '选择商店',
@@ -1353,6 +1372,11 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1353
1372
  dataIndex: 'type',
1354
1373
  render: (text: number) => shopFile2Type.find((i: any) => i.value === text)?.text,
1355
1374
  },
1375
+ {
1376
+ title: '启用状态',
1377
+ dataIndex: 'status',
1378
+ render: (text: number) => shopFile2Status.find((i: any) => i.value === text)?.text,
1379
+ },
1356
1380
  {
1357
1381
  title: '所属销售组织',
1358
1382
  dataIndex: 'orgName',
@@ -1495,8 +1519,8 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1495
1519
  mappingValueField: 'id',
1496
1520
  otherParams: {
1497
1521
  'qp-enable-eq': 10, // 启用状态 10-启用,20-禁用
1498
- 'qp-employmentType-eq': 20,
1499
- 'qp-orgViewIds-like': 'administrative-organization-view',
1522
+ 'qp-orgViewIds-like': 'administrative-organization-view', // 为了兼容 搜素所属组织机构时候需要传此参数
1523
+ ...(modalTableBusProps?.needTypeSearch?{}:{'qp-employmentType-eq': 20}), // 10外部员工;20内部员工
1500
1524
  sorter: 'desc-id'
1501
1525
  }, // 默认参数
1502
1526
  sourceName: 'employeeNumber',
@@ -1526,6 +1550,7 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1526
1550
  dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
1527
1551
  },
1528
1552
  } },
1553
+ ...(modalTableBusProps?.needTypeSearch?[{ name: 'qp-employmentType-eq', type: 'select', label: '员工类型', initialSource: employeeType }]:[]),
1529
1554
  { name: 'qp-email-like', label: '邮箱' },
1530
1555
  { name: 'qp-officeTelephone-like', label: '手机号' },
1531
1556
  ]
@@ -1559,6 +1584,11 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1559
1584
  dataIndex: 'administrativeNames',
1560
1585
  render: (text: any) => handleTextOverflow(text),
1561
1586
  },
1587
+ ...(modalTableBusProps?.needTypeSearch?[{
1588
+ title: '员工类型',
1589
+ dataIndex: 'employmentType',
1590
+ render: (text: number) => employeeType.find((i: any) => i.value === text)?.text,
1591
+ }]:[]),
1562
1592
  {
1563
1593
  title: '邮箱',
1564
1594
  dataIndex: 'email',
@@ -28,6 +28,17 @@ const shopFile2Type = [
28
28
  }
29
29
  ]
30
30
 
31
+ const shopFile2Status = [
32
+ {
33
+ text: "启用",
34
+ value: 10,
35
+ },
36
+ {
37
+ text: "禁用",
38
+ value: 20,
39
+ }
40
+ ]
41
+
31
42
  const arrivalPaySupportList = [
32
43
  {
33
44
  text: "支持",
@@ -50,4 +61,15 @@ const sharingType = [
50
61
  }
51
62
  ]
52
63
 
53
- export { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type }
64
+ const employeeType = [
65
+ {
66
+ text: "外部员工",
67
+ value: '10',
68
+ },
69
+ {
70
+ text: "内部员工",
71
+ value: '20',
72
+ }
73
+ ]
74
+
75
+ export { shopFileType, arrivalPaySupportList, sharingType, shopFile2Type, shopFile2Status, employeeType }
@@ -428,8 +428,9 @@ export default () => {
428
428
  filterInit: 'qp-id-in'
429
429
  },
430
430
  // modalTableProps: {
431
- // modalTableTitle: '选择物理仓-更改title测试',
432
- // needModalTable: false
431
+ // modalTableTitle: '选择物理仓-更改title测试',
432
+ // needModalTable: false
433
+ // needStatusSearch: true
433
434
  // },
434
435
  // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
435
436
  selectProps,
@@ -501,6 +502,9 @@ export default () => {
501
502
  // sourceName: 'warehouseIds',
502
503
  // },
503
504
  // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
505
+ // modalTableProps: {
506
+ // needStatusSearch: true
507
+ // },
504
508
  selectProps,
505
509
  selectBusinessType: 'realWarehouse',
506
510
  };
@@ -559,6 +563,9 @@ export default () => {
559
563
  setValue(value)
560
564
  },
561
565
  selectProps,
566
+ modalTableProps: {
567
+ needStatusSearch: true
568
+ },
562
569
  selectBusinessType: 'ownerWarehouse',
563
570
  };
564
571
 
@@ -1150,6 +1157,9 @@ export default () => {
1150
1157
  const props2 = {
1151
1158
  ...props,
1152
1159
  // prefixUrl: { selectPrefix: '/user/api', formSelectFix: '/user/api' },
1160
+ modalTableProps: {
1161
+ needTypeSearch: true
1162
+ },
1153
1163
  selectBusinessType: 'employee2',
1154
1164
  }
1155
1165
 
@@ -25,7 +25,7 @@ const BusinessSearchSelect = forwardRef((props: any, ref: any) => {
25
25
  needModalTable,
26
26
  modalTableProps
27
27
  }
28
- }, [props?.value, props.disabled]);
28
+ }, [props?.value, props.disabled, props.selectBusinessType]);
29
29
 
30
30
  useImperativeHandle(ref, () => ({
31
31
  getRef: () => innerRef,
@@ -48,5 +48,8 @@ export default React.memo(BusinessSearchSelect, (props, nextProps) => {
48
48
  if (props && props.disabled !== nextProps.disabled) {
49
49
  return false
50
50
  }
51
+ if (props && props.selectBusinessType !== nextProps.selectBusinessType) {
52
+ return false
53
+ }
51
54
  return true
52
- });
55
+ });
@@ -26,6 +26,8 @@ export default () => {
26
26
  const props = {
27
27
  mode: 'create',
28
28
  value,
29
+ treeCheckable: false,
30
+ rootDisabled: true,
29
31
  onChange: (v) => {
30
32
  setValue(v)
31
33
  },
@@ -7,8 +7,7 @@ const MemoTreeSearchSelect = React.memo(TreeSearchSelect)
7
7
  const BusinessTreeSearchSelect = (props: any) => {
8
8
  const businessType = props?.businessType || 'department';
9
9
 
10
- const handleBusinessProps = handleDefaultProps(businessType);
11
-
10
+ const handleBusinessProps = handleDefaultProps(businessType, props?.requestConfig);
12
11
  const currentProps = useMemo(() => {
13
12
  return {
14
13
  ...handleBusinessProps,
@@ -1,4 +1,4 @@
1
- const handleDefaultProps = (type: string) => {
1
+ const handleDefaultProps = (type: string, otherRequestConfig: {extralHeaders?: string}|undefined) => {
2
2
  let result = {};
3
3
  switch (type){
4
4
  case 'department':
@@ -7,6 +7,7 @@ const handleDefaultProps = (type: string) => {
7
7
  isChoose: true,
8
8
  remoteSource: {
9
9
  url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
10
+ headers: otherRequestConfig?.extralHeaders,
10
11
  initialParams: { 'orgViewCode': 'administrative-organization-view' },
11
12
  resKeyValue: ['code', 'name'],
12
13
  },
@@ -17,6 +18,7 @@ const handleDefaultProps = (type: string) => {
17
18
  isChoose: true,
18
19
  remoteSource: {
19
20
  url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
21
+ headers: otherRequestConfig?.extralHeaders,
20
22
  initialParams: { 'orgViewCode': 'sales-organizational-view', 'qp-status-eq': 10 }, // status: 10启用 20禁用
21
23
  resKeyValue: ['code', 'name'],
22
24
  },
@@ -27,6 +29,7 @@ const handleDefaultProps = (type: string) => {
27
29
  isChoose: true,
28
30
  remoteSource: {
29
31
  url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
32
+ headers: otherRequestConfig?.extralHeaders,
30
33
  initialParams: { 'orgViewCode': 'purchase-organizational-view', 'qp-status-eq': 10 },
31
34
  resKeyValue: ['code', 'name'],
32
35
  },
@@ -37,6 +40,7 @@ const handleDefaultProps = (type: string) => {
37
40
  isChoose: true,
38
41
  remoteSource: {
39
42
  url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
43
+ headers: otherRequestConfig?.extralHeaders,
40
44
  initialParams: { 'orgViewCode': 'stock-organizational-view', 'qp-status-eq': 10 },
41
45
  resKeyValue: ['code', 'name'],
42
46
  },
@@ -47,6 +51,7 @@ const handleDefaultProps = (type: string) => {
47
51
  isChoose: true,
48
52
  remoteSource: {
49
53
  url: `/channel-manage/tagNode/getTree/10`,
54
+ headers: otherRequestConfig?.extralHeaders,
50
55
  resKeyValue: ['code', 'name'],
51
56
  },
52
57
  };
@@ -57,6 +62,7 @@ const handleDefaultProps = (type: string) => {
57
62
  isChoose: true,
58
63
  remoteSource: {
59
64
  url: `/user/orgViewNode/common/getTreeForOrgViewAndTenant`,
65
+ headers: otherRequestConfig?.extralHeaders,
60
66
  initialParams: { 'orgViewCode': 'administrative-organization-view' },
61
67
  resKeyValue: ['code', 'name'],
62
68
  },
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import { Table as SulaTable, request } from 'bssula';
3
3
  import { Resizable } from 'react-resizable';
4
4
  import ColumnSetting from './columnSetting';
5
- import { getItemDefaultWidth, handleTextOverflow } from './utils';
5
+ import { getItemDefaultWidth } from './utils';
6
6
  import { noEmptyArray } from './utils';
7
7
  import {
8
8
  Table,
@@ -13,33 +13,35 @@ import {
13
13
  //设置queryTable默认列宽
14
14
  export const getItemDefaultWidth = (item: any) => {
15
15
  let defaultWidth = 200;
16
- let lowerCaseKey = (item.key || item.dataIndex).toLowerCase();
17
- switch (true) {
18
- case item?.title === '操作' || lowerCaseKey === 'operate':
19
- defaultWidth = 60;
20
- break;
21
- case lowerCaseKey.indexOf('number') > -1:
22
- case lowerCaseKey.indexOf('quantity') > -1:
23
- case lowerCaseKey.indexOf('amount') > -1:
24
- defaultWidth = 90;
25
- break;
26
- case (lowerCaseKey.indexOf('no') > -1):
27
- defaultWidth = 200;
28
- break;
29
- case lowerCaseKey.indexOf('code') > -1:
30
- defaultWidth = 170;
31
- break;
32
- case lowerCaseKey.indexOf('time') > -1:
33
- defaultWidth = 130;
34
- break;
35
- case lowerCaseKey.indexOf('status') > -1:
36
- defaultWidth = 100;
37
- break;
38
- case lowerCaseKey.indexOf('user') > -1:
39
- defaultWidth = 130;
40
- break;
41
- default:
42
- break;
16
+ let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
17
+ if (lowerCaseKey) {
18
+ switch (true) {
19
+ case item?.title === '操作' || lowerCaseKey === 'operate':
20
+ defaultWidth = 60;
21
+ break;
22
+ case lowerCaseKey.indexOf('number') > -1:
23
+ case lowerCaseKey.indexOf('quantity') > -1:
24
+ case lowerCaseKey.indexOf('amount') > -1:
25
+ defaultWidth = 90;
26
+ break;
27
+ case (lowerCaseKey.indexOf('no') > -1):
28
+ defaultWidth = 200;
29
+ break;
30
+ case lowerCaseKey.indexOf('code') > -1:
31
+ defaultWidth = 170;
32
+ break;
33
+ case lowerCaseKey.indexOf('time') > -1:
34
+ defaultWidth = 130;
35
+ break;
36
+ case lowerCaseKey.indexOf('status') > -1:
37
+ defaultWidth = 100;
38
+ break;
39
+ case lowerCaseKey.indexOf('user') > -1:
40
+ defaultWidth = 130;
41
+ break;
42
+ default:
43
+ break;
44
+ }
43
45
  }
44
46
  return defaultWidth;
45
47
  };
@@ -66,4 +68,4 @@ export const handleTextOverflow = (
66
68
  </span>
67
69
  </Tooltip>
68
70
  );
69
- };
71
+ };
@@ -44,6 +44,7 @@ const FixedScrollBar = ({viewPort, stickyProps}: any, ref: any) => {
44
44
  };
45
45
 
46
46
  useEffect(() => {
47
+ onContainerScroll()
47
48
  const onscroll = throttle(onContainerScroll, 50)
48
49
  container.addEventListener('scroll', onscroll)
49
50
  return () => {
@@ -22,7 +22,7 @@ export default () => {
22
22
  const colTableRef = useRef(null);
23
23
 
24
24
  let colTableData = [];
25
- for (let i = 1; i < 10001; i++) {
25
+ for (let i = 1; i < 1001; i++) {
26
26
  colTableData.push({
27
27
  '1111-1-2': '1',
28
28
  '1111-1-3': '2',
@@ -35,7 +35,7 @@ export default () => {
35
35
  'fixed2': `标题1-${i}`,
36
36
  })
37
37
  }
38
- for (let j = 1; j < 10001; j++) {
38
+ for (let j = 1; j < 1001; j++) {
39
39
  colTableData.push({
40
40
  '1111-1-2': '1',
41
41
  '1111-1-3': '2',
@@ -13,16 +13,17 @@ export default forwardRef((props, ref) => {
13
13
  colLastData: [],
14
14
  rowHeader: [],
15
15
  rowLastData: [],
16
- colHeaderWidth: 400,
17
16
  colHeaderToTop: 0,
18
17
  });
19
18
  const [colTableData, setColTableData] = useState([]); //纵向表头数据
20
19
  const [multiTableData, setMmultiTableData] = useState({}); //多表头数据
21
20
  const [viewCount, setViewCount] = useState(10); //虚拟表格每次渲染数量
22
21
  const itemWidth = 100; // 表格每一项宽度
22
+ const [realColHeaderWidth, setLeftWidth] = useState(props?.colHeaderWidth || 400);
23
23
 
24
24
  const viewPort = useRef(null);
25
- const topScrollBar = useRef(null)
25
+ const topScrollBar = useRef(null);
26
+ const leftTableRef = useRef(null);
26
27
 
27
28
  //起始渲染item
28
29
  const [startIndex, setStartIndex] = useState(0);
@@ -36,18 +37,25 @@ export default forwardRef((props, ref) => {
36
37
  const [offsetWidth, setOffset] = useState(0);
37
38
 
38
39
  useEffect(() => { //根据容器宽度计算每次渲染个数
39
- let viewPortWidth = viewPort.current.clientWidth;
40
- let defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
41
- let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
42
- setViewCount(viewCount)
40
+ setTimeout(() => {
41
+ let realLeftTableWidth = leftTableRef.current.clientWidth;
42
+ let viewPortWidth = viewPort.current.clientWidth;
43
+ let defaultTableWidth = viewPortWidth - realLeftTableWidth;
44
+ let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
45
+ setViewCount(viewCount)
46
+ setLeftWidth(realLeftTableWidth);
47
+ })
43
48
  }, [])
44
49
 
45
- const onScroll = () => {
50
+ const onScroll = (e) => {
46
51
  if(topScrollBar.current){
47
52
  topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0)
48
53
  }
49
54
  const scrollWidth = viewPort.current.scrollLeft;
50
- const startIndex = Math.floor(scrollWidth/itemWidth);
55
+ let startIndex = Math.floor(scrollWidth/itemWidth);
56
+ if ( startIndex + viewCount >= colTableData.length) {
57
+ startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
58
+ }
51
59
  const offsetWidth = startIndex * itemWidth;
52
60
  setStartIndex(startIndex);
53
61
  setOffset(offsetWidth);
@@ -66,7 +74,7 @@ export default forwardRef((props, ref) => {
66
74
 
67
75
  // 设置表头相关信息
68
76
  useEffect(() => {
69
- const { colData, rowData, colHeaderWidth=400 } = props;
77
+ const { colData, rowData } = props;
70
78
  let tableType;
71
79
  if (colData && colData.length && rowData && rowData.length) {
72
80
  tableType = 'multi-header-table';
@@ -80,7 +88,6 @@ export default forwardRef((props, ref) => {
80
88
  rowLastData: [],
81
89
  ...colHeaderData,
82
90
  ...rowHeaderData,
83
- colHeaderWidth: colHeaderWidth,
84
91
  colHeaderToTop: (rowHeader?.length || 0)*40,
85
92
  tableType: tableType
86
93
  })
@@ -93,7 +100,6 @@ export default forwardRef((props, ref) => {
93
100
  rowHeader: [],
94
101
  rowLastData: [],
95
102
  ...colHeaderData,
96
- colHeaderWidth: colHeaderWidth || 400,
97
103
  colHeaderToTop: 0,
98
104
  tableType: tableType
99
105
  })
@@ -143,7 +149,7 @@ export default forwardRef((props, ref) => {
143
149
  const {width, height, tableProps } = props;
144
150
  let tableWidth = width ? `${width}px` : '100%';
145
151
  let tableHeight = `${height || 400}px`;
146
- const rightAreaWidth = 'calc(100% - ' + `${config.colHeaderWidth}px` + ')';
152
+ const rightAreaWidth = 'calc(100% - ' + `${realColHeaderWidth}px` + ')';
147
153
  return (
148
154
  <div
149
155
  style={{width: tableWidth, height: tableHeight}}
@@ -158,7 +164,7 @@ export default forwardRef((props, ref) => {
158
164
  ref={topScrollBar}
159
165
  />
160
166
  <div style={{
161
- width: `${config.colHeaderWidth + 1 + placeholderWidth}px`,
167
+ width: `${realColHeaderWidth + placeholderWidth}px`,
162
168
  position: 'absolute',
163
169
  top: 0,
164
170
  left: 0,
@@ -168,7 +174,7 @@ export default forwardRef((props, ref) => {
168
174
  {/* -------------------------------------左上角区域--------------------------------------- */}
169
175
  <table
170
176
  style={{
171
- width: `${config.colHeaderWidth+1}px`,
177
+ width: `${realColHeaderWidth}px`,
172
178
  height: `${config.colHeaderToTop}px`,
173
179
  display: config.tableType === 'col-header-table' ? 'none' : '',
174
180
  }}
@@ -181,11 +187,12 @@ export default forwardRef((props, ref) => {
181
187
  style={{
182
188
  tableLayout:'auto',
183
189
  minWidth: '100px',
184
- width: `${config.colHeaderWidth+1}px`,
190
+ width: `${realColHeaderWidth}px`,
185
191
  top: `${config.colHeaderToTop}px`,
186
192
  left: '0px',
187
193
  position: 'sticky',
188
194
  }}
195
+ ref={leftTableRef}
189
196
  className={`${'south__west'} ${'editTable__block'} ${'table_border_style'}`}
190
197
  >
191
198
  <tbody>
@@ -225,7 +232,7 @@ export default forwardRef((props, ref) => {
225
232
  style={{
226
233
  width: '100%',
227
234
  top: 0,
228
- left: `${config.colHeaderWidth}px`,
235
+ left: `${realColHeaderWidth}px`,
229
236
  position: 'absolute',
230
237
  display: config.tableType === 'col-header-table' ? 'none' : ''
231
238
  }}
@@ -271,7 +278,7 @@ export default forwardRef((props, ref) => {
271
278
  <div
272
279
  style={{
273
280
  position: 'absolute',
274
- left: `${config.colHeaderWidth}px`,
281
+ left: `${realColHeaderWidth}px`,
275
282
  top: `${config.colHeaderToTop}px`,
276
283
  minWidth: rightAreaWidth,
277
284
  zIndex: 0,
@@ -1,3 +1,7 @@
1
+ import axios from 'axios';
2
+ import { stringify } from 'querystring';
3
+ import { message } from 'antd';
4
+
1
5
  // 下拉框数据源
2
6
  // 情况①:每条记录下拉框数据不同----查询接口每条记录返回字段,前后端约定好,用dataSourceCode记录
3
7
  // 情况②:所有查询记录共有一个数据源---选择器加载查询记录渲染给到dataSource
@@ -12,3 +16,64 @@ export const getSelectDataList = (record: any,item: any, selectKey: string) => {
12
16
  }
13
17
  return result;
14
18
  }
19
+
20
+ export const loadSelectSource = (url: string, params?: any) => {
21
+ return new Promise((resolve, reject) => {
22
+ axios
23
+ .get(`${url}?${stringify(params)}`)
24
+ .then((result: any) => {
25
+ result = result.data;
26
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
27
+ message.error(result.msg);
28
+ resolve(result);
29
+ return;
30
+ }
31
+ resolve(result);
32
+ })
33
+ .catch((err) => {
34
+ reject(err);
35
+ });
36
+ })
37
+ };
38
+
39
+ export const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
40
+ const data = reData && reData[position]?.data;
41
+ const list = Array.isArray(data) ? data :(data?.items || data?.list || data?.children || []);
42
+ const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
43
+ changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
44
+ }
45
+ // 格式化树选择器数据源
46
+ export const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
47
+ const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
48
+ return {
49
+ title: treeDataItem[resKeyValue[1]],
50
+ value: treeDataItem[resKeyValue[0]],
51
+ parentId: treeDataItem.parent,
52
+ data: { ...treeDataItem },
53
+ isLeaf: !haveChildren,
54
+ disabled: haveChildren,
55
+ children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
56
+ };
57
+ };
58
+ export const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
59
+ const data = reData && reData[position]?.data;
60
+ const formatData = (data &&
61
+ Array.isArray(data) &&
62
+ data.length &&
63
+ data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
64
+ []
65
+ changeSearchForm[changePosition].field.props.treeData = formatData;
66
+ }
67
+
68
+ export const formatFormSourceList = (x: any,loadList: any, tableSearchForm: any)=> {
69
+ loadList.forEach((i: any,index: any) => {
70
+ if(i.resType == 'list') {
71
+ const resKeyValue = i.resKeyValue || ['code', 'name']
72
+ formatSource(x,index, i.resPosition, tableSearchForm,resKeyValue)
73
+ }
74
+ if(i.resType == 'treeList') {
75
+ const resKeyValue = i.resKeyValue || ['id', 'name']
76
+ formatTreeDataSource(x,index, i.resPosition, tableSearchForm,resKeyValue)
77
+ }
78
+ })
79
+ }