@bit-sun/business-component 4.2.0-alpha.7 → 4.2.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export { default as EllipsisTooltip } from './components/Functional/EllipsisTool
33
33
  export * from './components/Functional/BsAntdSula/index';
34
34
  export { default as RuleComponent } from './components/Solution/RuleComponent';
35
35
  export { default as RuleSetter } from './components/Solution/RuleSetter';
36
+ export { default as RenderCompItem } from './components/Solution/RuleComponent/RenderCompItem';
36
37
  export { processDetailButtonsVisible as processDetailButtonsVisible } from './components/Business/DetailPageWrapper';
37
38
  export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
38
39
  export { default as Section } from './components/Common/Section';
package/dist/index.esm.js CHANGED
@@ -40734,4 +40734,4 @@ var SystemLog = function SystemLog(_ref) {
40734
40734
  });
40735
40735
  };
40736
40736
 
40737
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, ModalUtils, index$6 as MoreTreeTable, ParagraphCopier, PropertySelector, QueryMutipleInput, QueryMutipleSearchSelect, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, SystemLog, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, _coverToParallel as coverToParallel, createUniqID, downloadExcel, ergodicMenuRoutes, formContainerAndItemLayout, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, processDetailButtonsVisible, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
40737
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, ModalUtils, index$6 as MoreTreeTable, ParagraphCopier, PropertySelector, QueryMutipleInput, QueryMutipleSearchSelect, RenderCompItem, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, SystemLog, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, _coverToParallel as coverToParallel, createUniqID, downloadExcel, ergodicMenuRoutes, formContainerAndItemLayout, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, processDetailButtonsVisible, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
package/dist/index.js CHANGED
@@ -40789,6 +40789,7 @@ exports.ParagraphCopier = ParagraphCopier;
40789
40789
  exports.PropertySelector = PropertySelector;
40790
40790
  exports.QueryMutipleInput = QueryMutipleInput;
40791
40791
  exports.QueryMutipleSearchSelect = QueryMutipleSearchSelect;
40792
+ exports.RenderCompItem = RenderCompItem;
40792
40793
  exports.RuleComponent = RuleObjectComponent;
40793
40794
  exports.RuleSetter = index$7;
40794
40795
  exports.SearchSelect = SearchSelect;
@@ -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` 方法导出
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.0-alpha.7",
3
+ "version": "4.2.0-alpha.8",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -0,0 +1,189 @@
1
+ # RenderCompItem 组件说明文档
2
+
3
+ `RenderCompItem` 是一个通用的表单控件渲染组件,它根据传入的配置对象 (`ites`) 动态渲染不同类型的 Ant Design 表单组件或业务封装组件。
4
+
5
+ ## 1. 组件引入
6
+
7
+ ```typescript
8
+ import RenderCompItem from '@/components/Solution/RuleComponent/RenderCompItem';
9
+ ```
10
+
11
+ ## 2. Props 参数说明
12
+
13
+ | 参数名 | 类型 | 必填 | 说明 |
14
+ | --- | --- | --- | --- |
15
+ | `ites` | `object` | 是 | 核心配置对象,决定渲染什么组件(见下文详解) |
16
+ | `showValue` | `(code: string, type?: string) => any` | 是 | 获取组件当前值的回调函数 |
17
+ | `handleEdit` | `(code: string, value: any) => void` | 是 | 组件值发生变化时的回调函数 |
18
+ | `disabled` | `boolean` | 否 | 是否禁用组件 |
19
+ | `regularDataList` | `array` | 否 | 用于表达式 (`Formula`) 组件的数据源列表 |
20
+ | `others` | `object` | 否 | 扩展属性(目前主要用于 `CustomSelector` 的配置,**注意:源码中可能未正确解构此参数,使用自定义选择器时需检查**) |
21
+
22
+ ## 3. `ites` 配置详解
23
+
24
+ `ites` 对象通过 `inputType`、`valueType` 和 `choiceType` 的组合来决定渲染的具体组件。
25
+
26
+ ### 3.1 基础输入类 (`inputType: 10`)
27
+
28
+ 当 `inputType` 为 `10` 时,根据 `valueType` 区分:
29
+
30
+ | valueType | 组件类型 | 说明 | 对应 Antd 组件 |
31
+ | --- | --- | --- | --- |
32
+ | `21` | 文本输入 | 默认字符串输入 | `Input` |
33
+ | `22` | 小数输入 | 保留2位小数 | `InputNumber` |
34
+ | `23` | 整数输入 | 整数,无小数 | `InputNumber` |
35
+ | `24` | 布尔开关 | Switch 开关 | `Switch` |
36
+ | `32` | 日期时间 | 选择日期和时间 | `DatePicker` (showTime) |
37
+ | `40` | 时间范围 | 选择时间范围 | `RangePicker` (showTime) |
38
+ | `41` | 日期 | 仅选择日期 | `DatePicker` |
39
+
40
+ ### 3.2 选择类 (`inputType: 20 | 30`)
41
+
42
+ * `inputType: 20`: 单选
43
+ * `inputType: 30`: 多选
44
+
45
+ 根据 `choiceType` 区分具体业务组件:
46
+
47
+ | choiceType | 组件类型 | 说明 | 数据源/依赖 |
48
+ | --- | --- | --- | --- |
49
+ | `10` | 枚举选择 | 静态选项 | 需提供 `ites.enumeration` 对象 (key-value) |
50
+ | `20` | 数据字典 | 字典选择 | 需提供 `ites.dictionaryCode` |
51
+ | `110` | 物理仓 | 业务选择器 | `BusinessSearchSelect` (physicalWarehouse) |
52
+ | `120` | 逻辑仓 | 业务选择器 | `BusinessSearchSelect` (realWarehouse) |
53
+ | `130` | 虚拟仓 | 业务选择器 | `BusinessSearchSelect` (virtualWarehouse) |
54
+ | `140` | 渠道仓 | 业务选择器 | `BusinessSearchSelect` (channelWarehouse) |
55
+ | `150` | SPU | 业务选择器 | `BusinessSearchSelect` (spuCommodity) |
56
+ | `160` | SKU | 业务选择器 | `BusinessSearchSelect` (skuCommodity) |
57
+ | `190` | 省市区 | 级联选择 | `BsCascader` |
58
+ | `210` | 行政组织 | 树形选择 | `BusinessTreeSearchSelect` (department) |
59
+ | `220` | 采购组织 | 树形选择 | `BusinessTreeSearchSelect` (purchase-organization) |
60
+ | `230` | 销售组织 | 树形选择 | `BusinessTreeSearchSelect` (sales-organization) |
61
+ | `240` | 供应商 | 业务选择器 | `BusinessSearchSelect` (supplier2) |
62
+ | `250` | 客户 | 业务选择器 | `BusinessSearchSelect` (customer2) |
63
+ | `260` | 店铺 | 业务选择器 | `BusinessSearchSelect` (shopFile2) |
64
+ | `270` | 员工 | 业务选择器 | `BusinessSearchSelect` (employee2) |
65
+ | `280` | 库存组织 | 树形选择 | `BusinessTreeSearchSelect` (stock-organization) |
66
+ | `290` | 结算组织 | 树形选择 | `BusinessTreeSearchSelect` (settle-organization) |
67
+ | `310` / `311`| 配送方式 | 业务选择器 | `BusinessSearchSelect` (deliveryMode) |
68
+ | `360` | 角色 | 业务选择器 | `BusinessSearchSelect` (role) |
69
+ | `410` | 品牌 | 业务选择器 | `BusinessSearchSelect` (brand) |
70
+ | `420` | 类目 | 树形选择 | `BusinessTreeSearchSelect` (background-category) |
71
+ | `40` | 自定义 | 自定义组件 | `CustomSelector` (依赖 `others.customSelectorConfig`) |
72
+
73
+ ### 3.3 表达式 (`inputType: 40`)
74
+
75
+ 渲染 `Formula` 组件,用于配置计算公式。依赖 `regularDataList` 作为变量源。
76
+
77
+ ## 4. 使用示例
78
+
79
+ ```tsx
80
+ import React, { useState } from 'react';
81
+ import RenderCompItem from './RenderCompItem';
82
+
83
+ const Demo = () => {
84
+ const [formData, setFormData] = useState<any>({});
85
+
86
+ // 模拟数据回显
87
+ const showValue = (code: string) => {
88
+ return formData[code];
89
+ };
90
+
91
+ // 模拟数据更新
92
+ const handleEdit = (code: string, value: any) => {
93
+ console.log('Update:', code, value);
94
+ setFormData((prev: any) => ({ ...prev, [code]: value }));
95
+ };
96
+
97
+ // 配置项示例:文本输入
98
+ const inputConfig = {
99
+ code: 'userName',
100
+ inputType: 10,
101
+ valueType: 21,
102
+ defaultValue: '张三'
103
+ };
104
+
105
+ // 配置项示例:静态下拉选择
106
+ const selectConfig = {
107
+ code: 'status',
108
+ inputType: 20, // 单选
109
+ choiceType: 10, // 枚举
110
+ enumeration: {
111
+ '1': '启用',
112
+ '0': '禁用'
113
+ }
114
+ };
115
+
116
+ // 配置项示例:SKU 选择器 (多选)
117
+ const skuSelectConfig = {
118
+ code: 'skuCodes',
119
+ inputType: 30, // 多选
120
+ choiceType: 160, // SKU 选择器
121
+ };
122
+
123
+ // 配置项示例:数据字典选择 (单选)
124
+ const dictSelectConfig = {
125
+ code: 'warehouseType',
126
+ inputType: 20, // 单选
127
+ choiceType: 20, // 数据字典
128
+ dictionaryCode: 'SC0001' // 传入字典编码,组件会自动请求接口获取字典数据
129
+ };
130
+
131
+ return (
132
+ <div>
133
+ <div style={{ marginBottom: 20 }}>
134
+ <label>用户名:</label>
135
+ <RenderCompItem
136
+ ites={inputConfig}
137
+ showValue={showValue}
138
+ handleEdit={handleEdit}
139
+ regularDataList={[]}
140
+ />
141
+ </div>
142
+
143
+ <div style={{ marginBottom: 20 }}>
144
+ <label>状态:</label>
145
+ <RenderCompItem
146
+ ites={selectConfig}
147
+ showValue={showValue}
148
+ handleEdit={handleEdit}
149
+ regularDataList={[]}
150
+ />
151
+ </div>
152
+
153
+ <div style={{ marginBottom: 20 }}>
154
+ <label>商品SKU:</label>
155
+ <RenderCompItem
156
+ ites={skuSelectConfig}
157
+ showValue={showValue}
158
+ handleEdit={handleEdit}
159
+ regularDataList={[]}
160
+ />
161
+ </div>
162
+
163
+ <div>
164
+ <label>仓库类型(数据字典):</label>
165
+ <RenderCompItem
166
+ ites={dictSelectConfig}
167
+ showValue={showValue}
168
+ handleEdit={handleEdit}
169
+ regularDataList={[]}
170
+ />
171
+ </div>
172
+ </div>
173
+ );
174
+ };
175
+
176
+ export default Demo;
177
+ ```
178
+
179
+ ## 5. 依赖说明
180
+
181
+ 该组件依赖以下项目内部组件和库:
182
+ * `antd`
183
+ * `bssula` (request)
184
+ * `@/components/Functional/BsAntdSula` (BsCascader)
185
+ * `@/index` (BusinessSearchSelect, BusinessTreeSearchSelect)
186
+ * 内部组件: `./Formula`, `./InnerSelect`, `./CustomPlugin/CustomSelector`
187
+ * 工具函数: `../../../utils/utils`
188
+
189
+ 使用前请确保相关依赖已安装且路径正确。
package/src/index.ts CHANGED
@@ -43,6 +43,7 @@ export { default as EllipsisTooltip} from './components/Functional/EllipsisToolt
43
43
  export * from './components/Functional/BsAntdSula/index';
44
44
  export { default as RuleComponent} from './components/Solution/RuleComponent';
45
45
  export { default as RuleSetter} from './components/Solution/RuleSetter';
46
+ export { default as RenderCompItem} from './components/Solution/RuleComponent/RenderCompItem';
46
47
 
47
48
  export { processDetailButtonsVisible as processDetailButtonsVisible } from './components/Business/DetailPageWrapper';
48
49