@bit-sun/business-component 4.2.0-alpha.3 → 4.2.0-alpha.30

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 (138) hide show
  1. package/.fatherrc.ts +1 -1
  2. package/.umirc.ts +13 -9
  3. package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
  4. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
  5. package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
  6. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
  11. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  12. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
  13. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
  14. package/dist/components/Business/BsLayouts/index.d.ts +1 -1
  15. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
  16. package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
  17. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +6 -6
  18. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
  19. package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
  20. package/dist/components/Business/CommonAlert/index.d.ts +1 -2
  21. package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
  22. package/dist/components/Business/DetailPageWrapper/index.d.ts +12 -12
  23. package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
  24. package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
  25. package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
  26. package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
  27. package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
  28. package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
  29. package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
  30. package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
  31. package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
  32. package/dist/components/Business/ImportExport/index.d.ts +14 -0
  33. package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
  34. package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
  35. package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
  36. package/dist/components/Business/ImportExport/types.d.ts +134 -0
  37. package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
  38. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
  39. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
  40. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
  41. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
  42. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
  43. package/dist/components/Business/PropertyModal/index.d.ts +1 -2
  44. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
  45. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  46. package/dist/components/Business/StateFlow/index.d.ts +1 -2
  47. package/dist/components/Business/SystemLog/index.d.ts +78 -0
  48. package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
  49. package/dist/components/Business/TrialCalculation/index.d.ts +15 -0
  50. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +6 -6
  51. package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
  52. package/dist/components/Business/columnSettingTable/index.d.ts +3 -3
  53. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +3 -3
  54. package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
  55. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
  56. package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
  57. package/dist/components/Common/Section/index.d.ts +1 -1
  58. package/dist/components/Functional/AddSelect/index.d.ts +1 -2
  59. package/dist/components/Functional/AuthButton/index.d.ts +1 -2
  60. package/dist/components/Functional/DataImport/index.d.ts +3 -3
  61. package/dist/components/Functional/DataValidation/index.d.ts +5 -5
  62. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
  63. package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
  64. package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
  65. package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
  66. package/dist/components/Functional/SearchSelect/pagination.d.ts +22 -0
  67. package/dist/components/Functional/SearchSelect/utils.d.ts +2 -3
  68. package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
  69. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
  70. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
  71. package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
  72. package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
  73. package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
  74. package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
  75. package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
  76. package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
  77. package/dist/index.d.ts +5 -0
  78. package/dist/index.esm.js +5413 -1215
  79. package/dist/index.js +5433 -1208
  80. package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
  81. package/dist/utils/TableUtils.d.ts +18 -19
  82. package/dist/utils/auth.d.ts +4 -0
  83. package/dist/utils/utils.d.ts +41 -0
  84. package/docs/error-record.md +52 -0
  85. package/docs/flow-control-readme.md +283 -0
  86. package/docs/task-records/2026-07-31-import-export-extraction.md +81 -0
  87. package/package.json +1 -1
  88. package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
  89. package/src/components/Business/BsSulaQueryTable/index.md +57 -4
  90. package/src/components/Business/BsSulaQueryTable/index.tsx +174 -10
  91. package/src/components/Business/BsSulaQueryTable/setting.tsx +6 -0
  92. package/src/components/Business/DetailPageWrapper/index.tsx +81 -1
  93. package/src/components/Business/DetailPageWrapper/readme.md +89 -0
  94. package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
  95. package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
  96. package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
  97. package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
  98. package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
  99. package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
  100. package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
  101. package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
  102. package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
  103. package/src/components/Business/ImportExport/businessFunction.ts +29 -0
  104. package/src/components/Business/ImportExport/index.md +104 -0
  105. package/src/components/Business/ImportExport/index.tsx +208 -0
  106. package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
  107. package/src/components/Business/ImportExport/services/importExport.ts +208 -0
  108. package/src/components/Business/ImportExport/services/routing.ts +21 -0
  109. package/src/components/Business/ImportExport/types.ts +180 -0
  110. package/src/components/Business/SearchSelect/BusinessUtils.tsx +713 -43
  111. package/src/components/Business/SearchSelect/index.md +2 -2
  112. package/src/components/Business/SystemLog/index.md +37 -0
  113. package/src/components/Business/SystemLog/index.tsx +87 -0
  114. package/src/components/Business/TrialCalculation/PathDisplay.less +93 -0
  115. package/src/components/Business/TrialCalculation/PathDisplay_README.md +77 -0
  116. package/src/components/Business/TrialCalculation/index.tsx +322 -0
  117. package/src/components/Business/columnSettingTable/index.tsx +7 -6
  118. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +23 -22
  119. package/src/components/Functional/AddSelect/index.tsx +95 -1
  120. package/src/components/Functional/DataValidation/index.tsx +31 -9
  121. package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -2
  122. package/src/components/Functional/SearchSelect/index.md +109 -0
  123. package/src/components/Functional/SearchSelect/index.tsx +99 -17
  124. package/src/components/Functional/SearchSelect/pagination.ts +57 -0
  125. package/src/components/Functional/SearchSelect/utils.tsx +28 -18
  126. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  127. package/src/components/Solution/RuleComponent/README.md +187 -0
  128. package/src/components/Solution/RuleComponent/RenderCompItem.tsx +9 -1
  129. package/src/components/Solution/RuleComponent/RenderCompItem_README.md +189 -0
  130. package/src/components/Solution/RuleComponent/RuleField.md +63 -0
  131. package/src/components/Solution/RuleComponent/index.js +237 -8
  132. package/src/components/Solution/RuleComponent/ruleFiled.js +46 -6
  133. package/src/components/Solution/RuleSetter/README.md +97 -0
  134. package/src/index.ts +9 -0
  135. package/src/typings/umi.d.ts +9 -0
  136. package/src/utils/LocalstorageUtils.ts +1 -1
  137. package/src/utils/auth.ts +39 -2
  138. package/src/utils/utils.ts +41 -1
@@ -38,14 +38,14 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
38
38
  } | {
39
39
  title: string;
40
40
  dataIndex: string;
41
- render: (text: any, record: any) => React.JSX.Element;
41
+ render: (text: any, record: any) => JSX.Element;
42
42
  className?: undefined;
43
43
  width?: undefined;
44
44
  } | {
45
45
  title: string;
46
46
  dataIndex: string;
47
47
  className: string;
48
- render: () => React.JSX.Element;
48
+ render: () => JSX.Element;
49
49
  width?: undefined;
50
50
  })[];
51
51
  showModal: () => void;
@@ -53,13 +53,13 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
53
53
  handleCancel: (e: React.MouseEvent<HTMLElement>) => void;
54
54
  handleTableHeadHidden: (title: string) => void;
55
55
  onSortEnd: ({ oldIndex, newIndex }: any) => void;
56
- DraggableContainer: (props: any) => React.JSX.Element;
57
- DraggableBodyRow: ({ className, style, ...restProps }: any) => React.JSX.Element;
56
+ DraggableContainer: (props: any) => JSX.Element;
57
+ DraggableBodyRow: ({ className, style, ...restProps }: any) => JSX.Element;
58
58
  onChange: (e: any, title: any) => void;
59
59
  handleReset: () => void;
60
60
  handleResetSetting: () => Promise<unknown>;
61
61
  onSearch: (e: any) => void;
62
62
  onSearchSort: (e: any) => void;
63
- render(): React.JSX.Element;
63
+ render(): JSX.Element;
64
64
  }
65
65
  export default TableColumnSetting;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import moment from 'moment';
3
2
  type mediaListType = {
4
3
  type: number;
@@ -49,24 +48,24 @@ declare const updateGuanDate: (requestParams: any, dateKeyParams?: any) => {
49
48
  };
50
49
  submit: any;
51
50
  };
52
- declare const textIcon: (type: string | number, text?: string) => React.JSX.Element | undefined;
53
- declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) => React.JSX.Element;
54
- declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) => React.JSX.Element;
55
- declare const handleTextOverflow: (text: string | undefined, width?: number) => React.JSX.Element;
56
- declare const handleTextLineFeed: (text: string | undefined, width?: number) => React.JSX.Element;
57
- declare const handleTextTooltip: (text: any) => React.JSX.Element;
58
- declare const handleTextBreakSpaces: (text: any) => React.JSX.Element;
59
- declare const handleStatusBadge: (text: any, color: any) => React.JSX.Element;
60
- declare const HandleTotalCount: (totalParams: any) => React.JSX.Element;
51
+ declare const textIcon: (type: string | number, text?: string) => JSX.Element | undefined;
52
+ declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
53
+ declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
54
+ declare const handleTextOverflow: (text: string | undefined, width?: number) => JSX.Element;
55
+ declare const handleTextLineFeed: (text: string | undefined, width?: number) => JSX.Element;
56
+ declare const handleTextTooltip: (text: any) => JSX.Element;
57
+ declare const handleTextBreakSpaces: (text: any) => JSX.Element;
58
+ declare const handleStatusBadge: (text: any, color: any) => JSX.Element;
59
+ declare const HandleTotalCount: (totalParams: any) => JSX.Element;
61
60
  declare const handleCommonTimeRender: (text: any, format?: any) => any;
62
- declare const handleTooltip: (text: any, timeTrue?: boolean) => React.JSX.Element;
63
- declare const handleTooltipHours: (text: any, timeTrue?: boolean) => React.JSX.Element;
61
+ declare const handleTooltip: (text: any, timeTrue?: boolean) => JSX.Element;
62
+ declare const handleTooltipHours: (text: any, timeTrue?: boolean) => JSX.Element;
64
63
  type tableColumnsImageType = {
65
64
  width?: number | string;
66
65
  height?: number | string;
67
66
  [key: string]: any;
68
67
  };
69
- declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) => React.JSX.Element;
68
+ declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) => JSX.Element;
70
69
  interface ColumnsEditInterfave {
71
70
  text?: string;
72
71
  record?: any;
@@ -82,7 +81,7 @@ interface ColumnsEditInterfave {
82
81
  };
83
82
  [key: string]: any;
84
83
  }
85
- declare const ColumnsEdit: (props: ColumnsEditInterfave) => React.JSX.Element;
84
+ declare const ColumnsEdit: (props: ColumnsEditInterfave) => JSX.Element;
86
85
  type UserColumnsType = {
87
86
  name: string;
88
87
  department?: string;
@@ -90,13 +89,13 @@ type UserColumnsType = {
90
89
  company?: string;
91
90
  avatar?: string;
92
91
  };
93
- declare const userColumns: (props: UserColumnsType) => React.JSX.Element;
94
- declare const userInfoCard: (props: any) => React.JSX.Element;
92
+ declare const userColumns: (props: UserColumnsType) => JSX.Element;
93
+ declare const userInfoCard: (props: any) => JSX.Element;
95
94
  declare const getItemDefaultWidth: (item: any) => number;
96
- declare const sulaTableRenderTooltip: ({ text }: any) => React.JSX.Element;
95
+ declare const sulaTableRenderTooltip: ({ text }: any) => JSX.Element;
97
96
  declare const renderNumberText: ({ text }: any) => any;
98
97
  declare const renderFixed2: (text: any) => any;
99
- declare const handleTextWarpCustom: (text: any, style?: {}) => React.JSX.Element;
98
+ declare const handleTextWarpCustom: (text: any, style?: {}) => JSX.Element;
100
99
  declare const calculateValidPeriod: (start: any, end: any) => string;
101
- declare const handleTextWarp: (text: any) => React.JSX.Element;
100
+ declare const handleTextWarp: (text: any) => JSX.Element;
102
101
  export { getSkuImg, updateGuanDate, textIcon, handleTextDoubleOrId, handleTextDouble, handleTextOverflow, handleTextLineFeed, handleTextTooltip, handleTextBreakSpaces, handleStatusBadge, HandleTotalCount, handleTooltip, handleCommonTimeRender, handleTooltipHours, tableColumnsImage, ColumnsEdit, userColumns, userInfoCard, getItemDefaultWidth, renderNumberText, sulaTableRenderTooltip, renderFixed2, handleTextWarpCustom, handleTextWarp, calculateValidPeriod };
@@ -1,3 +1,7 @@
1
+ /**
2
+ * 根据上游权限编码获取关联的导入导出业务功能编码。
3
+ */
4
+ export declare const getRelationTemplateCode: (authCode: string) => string;
1
5
  export declare const authFunc: (code: string) => any;
2
6
  export declare const handleJudgeAuthButtons: (buttonCodeArray: any[]) => true | boolean[];
3
7
  export declare const shouldUseAuth: () => boolean;
@@ -31,3 +31,44 @@ export declare const randomString: (len?: any) => string;
31
31
  export declare const createUniqID: (length: any) => string;
32
32
  export declare const handleConvertResponse: (items: any, total: number) => object;
33
33
  export declare const noEmptyArray: (targetObj: any) => boolean;
34
+ export declare const formContainerAndItemLayout: (type: string, title: any, name: string) => {
35
+ container: {
36
+ type: string;
37
+ props: {
38
+ title: any;
39
+ id: number;
40
+ level: number;
41
+ name: string;
42
+ bordered?: undefined;
43
+ isWhiteCard?: undefined;
44
+ };
45
+ };
46
+ itemLayout: {
47
+ span: number;
48
+ labelCol: {
49
+ span: number;
50
+ };
51
+ wrapperCol: {
52
+ span: number;
53
+ };
54
+ };
55
+ } | {
56
+ container: {
57
+ type: string;
58
+ props: {
59
+ title: any;
60
+ id: number;
61
+ level: number;
62
+ bordered: null;
63
+ isWhiteCard: boolean;
64
+ name: string;
65
+ };
66
+ };
67
+ itemLayout: {
68
+ wrapperCol: {
69
+ span: number;
70
+ };
71
+ span?: undefined;
72
+ labelCol?: undefined;
73
+ };
74
+ };
@@ -0,0 +1,52 @@
1
+ # 错误记录
2
+
3
+ ## 2026-07-31 导入导出组件抽取
4
+
5
+ ### 复制后直接按应用项目类型环境判断
6
+
7
+ - 现象:组件库严格构建发现可空 `serviceContext` 和对象展开重复字段错误。
8
+ - 原因:原业务项目的类型检查强度低于组件库,复制完成不等于迁移完成。
9
+ - 修正:把服务上下文改为显式必填参数;把任务默认字段放到服务响应展开之后。
10
+ - 后续规则:跨仓库迁移必须执行目标仓库完整构建,不能只依赖源仓库结果。
11
+
12
+ ### 文档整站构建不可用
13
+
14
+ - 现象:Dumi 无法解析旧组件中的 `@/` 别名、`umi` 和 `react-dom`。
15
+ - 原因:现有文档工程依赖与别名配置不完整,与本次新增模块无直接关系。
16
+ - 处理:保留失败证据并停止扩大修改范围;组件本体使用 Father 构建验证。
17
+
18
+ ### 业务项目独立类型校验不可用
19
+
20
+ - 现象:临时消费端文件在业务项目中执行独立 `tsc` 时,大量第三方声明文件出现语法错误。
21
+ - 原因:业务项目内置 TypeScript 版本无法解析当前安装的新版 `@types/node`、`@types/lodash` 等声明语法,错误未进入本次适配代码。
22
+ - 处理:删除临时验证文件,不以该命令作为完成证据;业务项目正式切换应在组件包发布并升级依赖后使用项目原构建链验证。
23
+
24
+ ## 2026-08-01 导入导出入口解析测试
25
+
26
+ ### Jest 未解析源码路径别名
27
+
28
+ - 现象:入口解析单元测试加载 `@/utils` 和 `@/utils/enumConfig` 失败,业务断言尚未执行。
29
+ - 原因:现有 `umi-test` 配置没有为 Jest 注册 `@/` 路径映射。
30
+ - 修正:本次被测工具链内部改用等价的相对路径引用,不扩大范围修改全局测试配置。
31
+ - 后续规则:新增可独立测试的底层工具时,优先使用相对路径引用同目录或固定层级依赖,避免测试结果依赖构建器专属别名。
32
+
33
+ ### 默认服务测试路径预期不完整
34
+
35
+ - 现象:默认快速导出服务测试预期缺少 `/import-export` 路径段,实际请求路径与路由工具输出不一致。
36
+ - 原因:测试断言凭接口后缀手写,没有先对照 `buildSdkUrl` 的统一前缀规则。
37
+ - 修正:按路由工具的实际输出更新断言。
38
+ - 后续规则:服务路径测试必须以现有路由构造规则为依据,禁止省略中间路径段。
39
+
40
+ ### Umi peer dependency 缺少本地类型声明
41
+
42
+ - 现象:导入宿主 `umi.request` 后,Father 构建提示找不到 `umi` 模块及类型声明。
43
+ - 原因:`umi` 仅声明为 peer dependency,本仓库安装环境没有对应运行模块和类型。
44
+ - 修正:保持 `umi` 为宿主依赖,补充最小请求类型声明,并在 Father 中显式标记为 external。
45
+ - 后续规则:组件库直接使用 peer dependency 时,必须同时验证本地类型可解析且构建产物不会打包重复运行时。
46
+
47
+ ### Distribution-front 测试命令不可用
48
+
49
+ - 现象:执行销售单导入导出目标测试时提示 `umi-test: command not found`。
50
+ - 原因:当前 `distribution-front` 本地依赖环境没有生成 `umi-test` 可执行文件。
51
+ - 处理:不下载或改动依赖,改为执行与目标测试一致的源码静态断言,并确认旧服务适配引用已清零。
52
+ - 后续规则:消费端依赖未完整安装时,不宣称测试套件通过;应明确区分正式测试结果和等价静态验证结果。
@@ -0,0 +1,283 @@
1
+ # 按钮流程控制架构与使用说明(重构版)
2
+
3
+ ## 背景
4
+ 为统一“列表页与详情页按钮显隐”的流程控制,新增了一套基于本地数据源的轻量机制,支持按业务类型、单据状态与资源编码进行控制,同时不改变既有权限与显隐表达式的使用方式。
5
+
6
+ ## 架构概览
7
+ - 核心思想:数据先标注、视图只引用,不侵入既有权限与显隐逻辑
8
+ - 统一数据源:`BUSINESS_FLOW_BUTTONS`(本地存储)
9
+ - 列表页:在 `converter` 增强每条记录,生成 `__flowAllowedMap`;权限列在生成最终 `columns` 时对 `visible` 追加流程布尔条件
10
+ - 详情页:提供 `processDetailButtonsVisible(buttons, params)` 对外方法,融合原 `visible` 与流程允许判定后返回按钮数组
11
+ - 保护策略:未传 `tradeType` 或无匹配配置时不执行任何流程控制;只控制 `controlButtons` 范围内按钮
12
+
13
+ ## 核心数据源
14
+ - 本地存储键:`BUSINESS_FLOW_BUTTONS`
15
+ - 结构:
16
+ ```json
17
+ [
18
+ {
19
+ "tradeType": 180,
20
+ "controlButtons": ["DRP_Sale_Sales_submit", "DRP_Sale_Sales_examine"],
21
+ "config": [
22
+ { "fromStatus": 1, "buttons": ["DRP_Sale_Sales_submit"] },
23
+ { "fromStatus": 25, "buttons": ["DRP_Sale_Sales_examine", "DRP_Sale_Sales_back"] }
24
+ ]
25
+ }
26
+ ]
27
+ ```
28
+ - 说明:
29
+ - `tradeType`:业务类型
30
+ - `controlButtons`:参与流程控制的按钮编码集合(控制范围);不在此集合的按钮不受流程控制影响
31
+ - `config[].fromStatus`:状态值
32
+ - `config[].buttons`:该状态下允许显示的按钮编码集合
33
+
34
+ ## 控制原则
35
+ - 未传入 `tradeType` 时,不执行任何流程控制逻辑(列表与详情一致)
36
+ - 仅对 `controlButtons` 范围内的按钮做流程控制;其他按钮不改动
37
+ - 顶部按钮:在控制范围内,保留“所有状态允许集合”中的按钮
38
+ - 列权限按钮:在控制范围内,于既有 `visible` 表达式末尾追加 `&& record.__flowAllowedMap['<code>'] == true`
39
+ - 权限不重复判断:流程控制不改动既有权限过滤(仍使用 `authFn` / `shouldUseAuth`)
40
+
41
+ ## 列表页实现
42
+ - 文件:`src/components/Business/BsSulaQueryTable/index.tsx`
43
+ - 行状态读取:
44
+ - 属性:`statusFieldPath`(可选,支持嵌套路径,如 `saleInfo.tradeStatus`)
45
+ - 未配置时自动探测:`status`、`orderStatus`、`flowStatus`、`tradeStatus`、`currentStatus`
46
+ - 数据增强(convert):
47
+ - 覆盖 `remoteDataSource.converter` 为管道:原 `converter` → 增强阶段
48
+ - 增强阶段为每条记录生成 `__flowAllowedMap`:`{ [code]: true | undefined }`
49
+ - 仅在传入 `tradeType` 且存在非空 `controlButtons` 时启用
50
+ - 列权限按钮 `visible` 合并:
51
+ - 仅在传入 `tradeType` 且存在非空控制范围时,对 `isPermissionColumn: true` 且 `render` 为数组的列追加流程布尔条件
52
+ - 合并格式:
53
+ - 原:`#{record.tradeStatus == 25}`
54
+ - 新:`#{(record.tradeStatus == 25) && (record.__flowAllowedMap['DRP_Sale_Sales_examine'] == true)}`
55
+
56
+ ## 详情页实现
57
+ - 文件:`src/components/Business/DetailPageWrapper/index.tsx`
58
+ - 入口方法(对外):
59
+ ```ts
60
+ processDetailButtonsVisible(buttons: any[], params: any): any[]
61
+ // params: { tradeType: number; fromStatus: number; 以及按钮 visible 表达式使用到的上下文 }
62
+ ```
63
+ - 行为:
64
+ - 求值原 `visible` 表达式为布尔
65
+ - 仅在传入 `tradeType` 且按钮 `code ∈ controlButtons` 时,叠加“当前 fromStatus 的允许集合”判定
66
+ - 返回 `visible` 为最终布尔值的按钮数组,直接用于渲染
67
+
68
+ ## 调试日志(列表)
69
+ - 顶部按钮:`[FlowCtrl:top]`、`[FlowCtrl:top-element]`
70
+ - 数据增强:`__flowAllowedMap` 可在表格数据中查看
71
+ - 列合并:最终 `columns` 中的按钮 `visible` 可直接检视字符串是否追加流程条件
72
+
73
+ ## 快速使用示例
74
+ - 设置数据源:
75
+ ```js
76
+ localStorage.setItem('BUSINESS_FLOW_BUTTONS', JSON.stringify([
77
+ {
78
+ tradeType: 180,
79
+ controlButtons: ['DRP_Sale_Order_edit'],
80
+ config: [
81
+ { fromStatus: 1, buttons: ['DRP_Sale_Order_edit'] },
82
+ { fromStatus: 25, buttons: [] }
83
+ ]
84
+ }
85
+ ]));
86
+ ```
87
+ - 列表组件传参:
88
+ ```tsx
89
+ <BsSulaQueryTable
90
+ tradeType={180}
91
+ statusFieldPath="saleInfo.tradeStatus"
92
+ {...otherProps}
93
+ />
94
+ ```
95
+ - 列权限列按钮(最终 `columns`):
96
+ - 原:`visible: '#{record.tradeStatus == 25}'`
97
+ - 新:内部自动生成为 `#{(record.tradeStatus == 25) && (record.__flowAllowedMap['DRP_Sale_Sales_examine'] == true)}`(仅控制范围内按钮)
98
+ - 详情页使用:
99
+ ```ts
100
+ const processed = processDetailButtonsVisible(buttons, { tradeType, fromStatus, viewMode, tradeStatus, detail, orderNo });
101
+ ```
102
+
103
+ ## 列表跳转详情(携带查询参数)
104
+ - 示例(销售单):
105
+ ```tsx
106
+ <Button
107
+ onClick={() => {
108
+ history.push({
109
+ pathname: `/sales-management/sales-slip/view/${record.id}/${record.orderNo}`,
110
+ search: `?fromStatus=${record.saleInfo.tradeStatus}`,
111
+ });
112
+ }}
113
+ type="link"
114
+ >
115
+ {text}
116
+ </Button>
117
+ ```
118
+ - 说明:
119
+ - 详情页通过查询参数 `fromStatus` 获取当前单据状态;与 `processDetailButtonsVisible` 的 `fromStatus` 对齐
120
+ - 列表需设置 `statusFieldPath: 'saleInfo.tradeStatus'` 以生成 `__flowAllowedMap`
121
+ - 建议所有“查看详情”链接统一携带 `fromStatus`,保持列表与详情流程控制的一致性
122
+
123
+ ### 详情页读取 fromStatus 并使用
124
+ ```ts
125
+ import { useLocation } from 'umi';
126
+
127
+ const { search } = useLocation();
128
+ const qs = new URLSearchParams(search);
129
+ const fromStatus = Number(qs.get('fromStatus') || '');
130
+
131
+ // 与按钮可见性处理对齐
132
+ const processed = processDetailButtonsVisible(buttons, {
133
+ tradeType: 180,
134
+ fromStatus,
135
+ // 其他上下文
136
+ });
137
+
138
+ // 传入 DetailPageWrapper(如需)
139
+ <DetailPageWrapper
140
+ actionList={processed}
141
+ tradeType={180}
142
+ fromStatus={fromStatus}
143
+ />;
144
+ ```
145
+
146
+ ## 详情页示例(重构)
147
+ 两部分:下部按钮数组 + 顶部 DetailPageWrapper 按钮。
148
+
149
+ 1) 下部按钮数组(以部分按钮为例):
150
+ ```ts
151
+ actionsRender: processDetailButtonsVisible([
152
+ {
153
+ type: 'button',
154
+ props: { type: 'primary', children: '提交' },
155
+ code: 'DRP_Sale_Sales_submit',
156
+ visible: viewMode && tradeStatus == 1,
157
+ confirm: '是否提交该销售单?',
158
+ action: [ (ctx) => { /* 提交逻辑 */ } ],
159
+ },
160
+ {
161
+ type: 'button',
162
+ props: { type: 'primary', children: '驳回' },
163
+ code: 'DRP_Sale_Sales_back',
164
+ visible: viewMode && tradeStatus == 25,
165
+ confirm: '确认驳回 ?',
166
+ action: [ { url: `/drp-ops/new/tradeSubOrder/trigger?code=${orderNo}&event=7`, method: 'POST', converter: () => { message.success('驳回成功'); refreshForm(); } } ],
167
+ },
168
+ {
169
+ type: 'button',
170
+ props: { type: 'primary', children: '审核' },
171
+ code: 'DRP_Sale_Sales_examine',
172
+ visible: viewMode && tradeStatus == 25,
173
+ action: [ (ctx) => onAuditing(detail) ],
174
+ },
175
+ // ... 其他按钮
176
+ ], {
177
+ tradeType: 180,
178
+ fromStatus: tradeStatus,
179
+ viewMode,
180
+ tradeStatus,
181
+ detail,
182
+ orderNo,
183
+ modeType,
184
+ isProcessing,
185
+ hasDeletedOnce,
186
+ })
187
+ ```
188
+
189
+ 2) 顶部 DetailPageWrapper 按钮:
190
+ ```tsx
191
+ <DetailPageWrapper
192
+ title="详情页演示"
193
+ actionList={processDetailButtonsVisible(topButtons, { tradeType, fromStatus: tradeStatus, viewMode, tradeStatus })}
194
+ tradeType={180}
195
+ fromStatus={tradeStatus}
196
+ />
197
+ ```
198
+
199
+ ## 参数说明
200
+ - 列表组件:
201
+ - `tradeType: number`(必须)
202
+ - `statusFieldPath: string`(可选,嵌套路径,如 `saleInfo.tradeStatus`)
203
+ - 详情方法 `processDetailButtonsVisible(buttons, params)`:
204
+ - `params.tradeType: number`(必须)
205
+ - `params.fromStatus: number`(必须)
206
+ - 其他上下文:`viewMode`、`tradeStatus`、`detail`、`orderNo`、`modeType`、`isProcessing`、`hasDeletedOnce` 等按需传入
207
+ - visible 格式:
208
+ - 字符串表达式:`'#{viewMode && tradeStatus == 25}'`
209
+ - 布尔或未定义:`true/false/undefined`(未定义视为 `true`)
210
+
211
+ ## tradeType 映射
212
+ - 180:销售单
213
+ - 可按业务扩展其他类型(在 `BUSINESS_FLOW_BUTTONS` 中新增对应项)
214
+
215
+ ## 初始化数据结构示例
216
+ ```js
217
+ const flowConfig = [
218
+ {
219
+ tradeType: 180,
220
+ controlButtons: ['DRP_Sale_Order_edit'],
221
+ config: [
222
+ { fromStatus: 1, buttons: ['DRP_Sale_Order_edit'] },
223
+ { fromStatus: 25, buttons: [] },
224
+ ],
225
+ },
226
+ ];
227
+ localStorage.setItem('BUSINESS_FLOW_BUTTONS', JSON.stringify(flowConfig));
228
+ ```
229
+
230
+ ### 详情页示例(重构)
231
+ 两部分:下部按钮数组 + 顶部 DetailPageWrapper 按钮。
232
+
233
+ 1) 下部按钮数组(以提交/驳回为例):
234
+ ```ts
235
+ actionsRender: processDetailButtonsVisible([
236
+ {
237
+ type: 'button',
238
+ props: { type: 'primary', children: '提交' },
239
+ code: 'DRP_Sale_Sales_submit',
240
+ visible: viewMode && tradeStatus == 1,
241
+ confirm: '是否提交该销售单?',
242
+ action: [ (ctx) => { /* 业务处理 */ } ],
243
+ },
244
+ {
245
+ type: 'button',
246
+ props: { type: 'primary', children: '驳回' },
247
+ code: 'DRP_Sale_Sales_back',
248
+ visible: viewMode && tradeStatus == 25,
249
+ confirm: '确认驳回 ?',
250
+ action: [ { url: `/drp-ops/new/tradeSubOrder/trigger?code=${orderNo}&event=7`, method: 'POST', converter: () => { message.success('驳回成功'); refreshForm(); } } ],
251
+ },
252
+ // ... 其他按钮
253
+ ], {
254
+ tradeType: 180,
255
+ fromStatus: tradeStatus,
256
+ viewMode,
257
+ tradeStatus,
258
+ detail,
259
+ orderNo,
260
+ modeType,
261
+ isProcessing,
262
+ hasDeletedOnce,
263
+ })
264
+ ```
265
+
266
+ 2) 顶部 DetailPageWrapper 按钮(保持原传参方式):
267
+ ```tsx
268
+ <DetailPageWrapper
269
+ title="详情页演示"
270
+ actionList={processDetailButtonsVisible(topButtons, { tradeType, fromStatus: tradeStatus, viewMode, tradeStatus })}
271
+ tradeType={180}
272
+ fromStatus={tradeStatus}
273
+ />
274
+ ```
275
+
276
+ ## 常见问题
277
+ - 按钮未展示且不在控制范围:流程控制不会影响非控制按钮,请确认是否是权限或原 `visible` 条件拦截
278
+ - 顶部按钮未展示:仅在控制范围内按“所有状态允许集合”过滤;不在控制范围的顶栏按钮不受影响
279
+ - 未传 `tradeType`:不会执行任何流程控制(顶栏/列表/详情均一致)
280
+
281
+ ## 变更范围
282
+ - 列表:`BsSulaQueryTable/index.tsx`(convert增强、columns合并、顶部过滤与保护)
283
+ - 详情:`DetailPageWrapper/index.tsx`(流程过滤保护)与 `processDetailButtonsVisible` 方法导出
@@ -0,0 +1,81 @@
1
+ # 导入导出组件抽取记录
2
+
3
+ 日期:2026-07-31
4
+
5
+ ## 完成标准
6
+
7
+ - 完整导入、快速导出、按模板导出、任务进度和最近任务进入 `business-component`。
8
+ - 组件库不依赖业务项目的 `@/utils`、Umi 请求实例或微前端路由实现。
9
+ - 业务项目可以注入自己的请求函数、查询条件、权限开关和任务中心跳转。
10
+ - 组件库 CJS、ESM 构建通过。
11
+
12
+ ## 抽取结果
13
+
14
+ - 新增业务组件:`src/components/Business/ImportExport`。
15
+ - 新增公开入口:`ImportExportActions`。
16
+ - 新增请求适配工厂:`createImportExportServices(request, overrides)`。
17
+ - 新增高级组件导出:`ImportWizard`、`ExportButton`、`TaskProgress`、`TaskDrawer`。
18
+ - 新增类型、路由安全校验、任务归一化和场景能力工具。
19
+ - 新增 Dumi 使用文档和业务项目接入示例。
20
+ - 样式改为 CSS Modules,避免业务页面样式污染。
21
+
22
+ ## 依赖边界
23
+
24
+ - 组件库负责:界面、弹窗、上传与校验流程、导出流程、任务轮询、最近任务。
25
+ - 业务项目负责:按钮权限、业务功能编码、当前列表条件、结果数量、请求拦截器、微前端跳转。
26
+ - 接口差异通过服务覆盖处理,不在组件内部增加项目名称判断。
27
+
28
+ ## 验证结果
29
+
30
+ - `npm run build`:CJS 和 ESM 构建通过。
31
+ - 生成的声明文件包含 `ImportExportActions` 和 `createImportExportServices`。
32
+ - 组件源码和声明文件未残留业务项目路径、`@/utils` 或 `jumpRoutePath` 依赖。
33
+
34
+ ## 发布与业务项目切换
35
+
36
+ 当前组件库版本为 `4.2.0-alpha.25`,本次未修改版本号、未发布包,也未写入不可复现的本地绝对路径依赖。销售单源码已按发布包模式切换为从 `@bit-sun/business-component` 引用,并通过 `src/services/importExport.ts` 注入业务请求实例;业务项目当前安装的 `4.2.0-alpha.26` 尚不包含新导出,需要先手动替换本地产物或升级正式发布版本。
37
+
38
+ 发布新版本后,业务项目只需:
39
+
40
+ 1. 升级 `@bit-sun/business-component`。
41
+ 2. 用业务项目已有的 `request` 创建请求适配器并传给 `createImportExportServices`。
42
+ 3. 从组件库导入 `ImportExportActions`,传入权限开关、查询条件和跳转回调。
43
+ 4. 验证完成后删除业务项目原有的 `src/components/ImportExport` 副本。
44
+
45
+ ## 受限项
46
+
47
+ `npm run docs:build` 被仓库原有文档工程问题阻断:旧组件存在 `@/` 别名、`umi`、`react-dom` 等解析失败。本次组件库产物构建不受影响;未扩大范围修改旧文档工程。
48
+
49
+ ## 2026-08-01 任务中心路由修正
50
+
51
+ - 完成标准:上游未传 `taskCenterPath` 时,任务进度和最近任务入口都使用组件默认路由;上游显式传入时,两处同时使用传入值。
52
+ - 根因:`ImportExportActions` 已声明顶层默认值,但子组件仍读取 `config.taskCenterPath`,导致默认值被绕过。
53
+ - 修正:以 `ImportExportActionsProps.taskCenterPath` 为唯一来源,统一传给 `TaskProgress` 和 `TaskDrawer`,并移除 `ImportExportConfig` 中的重复字段。
54
+ - 验证:`npm run build` 执行成功,CJS 和 ESM 构建均通过。
55
+
56
+ ## 2026-08-01 导入导出业务入口拆分
57
+
58
+ - 完成标准:导入通过 `importCode` 获取独立业务功能编码;快速导出和模板导出通过两个权限编码关联结果的“或”值共用一个导出业务功能编码。
59
+ - 数据来源:从权限菜单按钮的 `relationExcelTemplateCode` 读取业务功能编码,不再要求上游通过 `config.businessFunctionCode` 重复传入。
60
+ - 调用链:入口解析后同时用于业务功能服务解析、模板查询、导入导出任务创建和最近任务查询。
61
+ - 单元测试:入口解析测试 3 项通过,覆盖导入独立入口、快速导出入口存在、仅模板导出入口存在。
62
+ - 构建验证:`npm run build` 执行成功,CJS 和 ESM 构建均通过。
63
+
64
+ ## 2026-08-01 默认请求服务内置
65
+
66
+ - 完成标准:Umi 消费项目不传 `services` 也能使用完整导入导出服务,同时允许通过可选属性覆盖个别差异接口。
67
+ - 修正:组件库使用宿主 `umi.request` 创建默认服务;`services` 改为可选的 `Partial<ImportExportServices>`,并保留请求工厂作为扩展入口。
68
+ - 构建边界:`umi` 保持 peer dependency 并显式 external,组件包不打包重复 Umi 运行时。
69
+ - 消费端:销售单移除 `importExportServices` import、`services` 属性和无业务逻辑的服务适配文件。
70
+ - 单元测试:默认服务与局部覆盖测试 2 项、业务入口解析测试 3 项,共 5 项通过。
71
+ - 构建验证:`npm run build` 执行成功,CJS 和 ESM 构建均通过;声明文件中 `services` 为可选属性。
72
+ - 消费端验证:销售单等价源码静态断言通过;正式目标测试因本地缺少 `umi-test` 命令未执行。
73
+ - 后续处理:按用户要求删除本次新增的两个组件库测试文件,保留上述已执行结果作为历史验证记录。
74
+
75
+ ## 2026-08-03 任务中心默认跳转
76
+
77
+ - 完成标准:上游未传 `onNavigateTaskCenter` 时,任务抽屉和任务进度中的任务中心入口仍可执行默认跳转;显式传入时继续优先使用上游回调。
78
+ - 默认行为:无界子应用调用主应用注入的 `jump` 并保留任务中心页签,独立运行时打开主应用对应的 Hash 路由。
79
+ - 兼容边界:`onNavigateTaskCenter` 保持可选并作为覆盖点,`taskCenterPath` 继续支持上游修改目标路径。
80
+ - 文档:业务项目接入示例不再要求重复传入 `jumpRoutePath`,API 表补充内置默认值和覆盖说明。
81
+ - 验证:`git diff --check` 通过;`npm run build` 执行成功,CJS 和 ESM 构建均通过。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.0-alpha.3",
3
+ "version": "4.2.0-alpha.30",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -433,7 +433,7 @@ export const AddSkuSelect = (parProps: any) => {
433
433
  'ctl-withAuth': true
434
434
  },
435
435
  resType: 'list',
436
- resPosition: isNoUseItemBarcode ? 3 : 4,
436
+ resPosition: isNoUseItemBarcode ? 4 : 5,
437
437
  resKeyValue: ['id','name']
438
438
  },
439
439
  {
@@ -443,7 +443,7 @@ export const AddSkuSelect = (parProps: any) => {
443
443
  currentPage: 1,
444
444
  },
445
445
  resType: 'treeList',
446
- resPosition: isNoUseItemBarcode ? 4 : 5
446
+ resPosition: isNoUseItemBarcode ? 5 : 6
447
447
  },
448
448
  ]
449
449
  const mTpPromiseLoadList = handleFormSearchSourceLoad(initialPromiseLoadList, parProps);
@@ -486,6 +486,7 @@ export const AddSkuSelect = (parProps: any) => {
486
486
  tableColumns: mTpTableColumn,
487
487
  selectColumn: mTpSelectColumn,
488
488
  promiseLoadList: mTpPromiseLoadList,
489
+ topTablePagination: parProps?.pagination || {},
489
490
  }
490
491
 
491
492
  return (