@bit-sun/business-component 4.2.1-alpha.8-aiwei → 4.2.1-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.
Files changed (131) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/.fatherrc.ts +1 -1
  3. package/.umirc.ts +13 -9
  4. package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
  5. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
  6. package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
  11. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
  12. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  13. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
  14. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
  15. package/dist/components/Business/BsLayouts/index.d.ts +1 -1
  16. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
  17. package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
  18. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +6 -6
  19. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
  20. package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
  21. package/dist/components/Business/CommonAlert/index.d.ts +1 -2
  22. package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
  23. package/dist/components/Business/DetailPageWrapper/index.d.ts +12 -12
  24. package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
  25. package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
  26. package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
  27. package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
  28. package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
  29. package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
  30. package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
  31. package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
  32. package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
  33. package/dist/components/Business/ImportExport/index.d.ts +14 -0
  34. package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
  35. package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
  36. package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
  37. package/dist/components/Business/ImportExport/types.d.ts +134 -0
  38. package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
  39. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
  40. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
  41. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
  42. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
  43. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
  44. package/dist/components/Business/PropertyModal/index.d.ts +1 -2
  45. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
  46. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  47. package/dist/components/Business/StateFlow/index.d.ts +1 -2
  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 +7 -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 +4 -4
  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 +4 -0
  78. package/dist/index.esm.js +4692 -1470
  79. package/dist/index.js +4710 -1463
  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/docs/error-record.md +52 -0
  84. package/docs/flow-control-readme.md +283 -0
  85. package/docs/task-records/2026-07-31-import-export-extraction.md +81 -0
  86. package/package.json +1 -1
  87. package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
  88. package/src/components/Business/BsSulaQueryTable/index.md +57 -4
  89. package/src/components/Business/BsSulaQueryTable/index.tsx +183 -20
  90. package/src/components/Business/DetailPageWrapper/index.tsx +81 -1
  91. package/src/components/Business/DetailPageWrapper/readme.md +89 -0
  92. package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
  93. package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
  94. package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
  95. package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
  96. package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
  97. package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
  98. package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
  99. package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
  100. package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
  101. package/src/components/Business/ImportExport/businessFunction.ts +29 -0
  102. package/src/components/Business/ImportExport/index.md +104 -0
  103. package/src/components/Business/ImportExport/index.tsx +208 -0
  104. package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
  105. package/src/components/Business/ImportExport/services/importExport.ts +208 -0
  106. package/src/components/Business/ImportExport/services/routing.ts +21 -0
  107. package/src/components/Business/ImportExport/types.ts +180 -0
  108. package/src/components/Business/SearchSelect/BusinessUtils.tsx +328 -280
  109. package/src/components/Business/SearchSelect/index.md +1 -1
  110. package/src/components/Business/TrialCalculation/PathDisplay.less +93 -0
  111. package/src/components/Business/TrialCalculation/PathDisplay_README.md +77 -0
  112. package/src/components/Business/TrialCalculation/index.tsx +322 -0
  113. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +17 -1
  114. package/src/components/Functional/AddSelect/index.tsx +3 -1
  115. package/src/components/Functional/DataValidation/index.tsx +9 -6
  116. package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -2
  117. package/src/components/Functional/SearchSelect/index.md +111 -0
  118. package/src/components/Functional/SearchSelect/index.tsx +157 -63
  119. package/src/components/Functional/SearchSelect/pagination.ts +57 -0
  120. package/src/components/Functional/SearchSelect/utils.tsx +28 -18
  121. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  122. package/src/components/Solution/RuleComponent/README.md +187 -0
  123. package/src/components/Solution/RuleComponent/RenderCompItem_README.md +189 -0
  124. package/src/components/Solution/RuleComponent/RuleField.md +63 -0
  125. package/src/components/Solution/RuleComponent/index.js +236 -8
  126. package/src/components/Solution/RuleComponent/ruleFiled.js +21 -5
  127. package/src/components/Solution/RuleSetter/README.md +97 -0
  128. package/src/index.ts +8 -1
  129. package/src/typings/umi.d.ts +9 -0
  130. package/src/utils/LocalstorageUtils.ts +1 -1
  131. package/src/utils/auth.ts +39 -2
@@ -0,0 +1,187 @@
1
+ # RuleObjectComponent 规则组件
2
+
3
+ ## 简介
4
+ `RuleObjectComponent` 是一个功能强大的规则构建器组件,支持可视化的条件组合(并且/或者逻辑嵌套)、动态参数插入、执行动作配置以及返回值配置。它广泛应用于需要灵活定义业务规则的场景。
5
+
6
+ ## 组件路径
7
+ `src/components/Solution/RuleComponent/index.js`
8
+
9
+ ## Props 属性说明
10
+
11
+ | 属性名 | 类型 | 必填 | 说明 |
12
+ |Ref | --- | --- | --- |
13
+ | regularDataList | `Array` | 是 | 规则左侧“对象”选择树的数据源。 |
14
+ | operationList | `Array` | 是 | 规则中间“操作符”下拉列表的数据源。 |
15
+ | ruleClassData | `Array` | 是 | 规则组件的核心数据模型,用于回显和存储规则配置。 |
16
+ | callBack | `Function` | 是 | 数据变更时的回调函数,返回最新的 `ruleClassData`。 |
17
+ | systemVariableList | `Array` | 否 | “插入参数”功能的数据源,允许用户选择系统变量而非固定值。 |
18
+ | initialThresholdQuery | `Object` | 否 | 用于获取规则值域(右侧输入框/选择框)的初始查询参数。 |
19
+ | ruleGroupInfo | `Object` | 否 | 规则组信息,用于规则组实例场景。 |
20
+ | ruleTypeData | `Array` | 否 | “动作”配置的数据源。 |
21
+ | ruleReturnConfig | `Array` | 否 | “返回值”配置的数据源。 |
22
+ | disabled | `Boolean` | 否 | 是否禁用(只读模式)。 |
23
+ | canDelete | `Boolean` | 否 | 是否显示删除规则按钮。 |
24
+ | onlyOneRule | `Boolean` | 否 | 是否限制为单条规则(不显示新增规则按钮)。 |
25
+ | onlyCondition | `Boolean` | 否 | 是否仅展示条件部分(隐藏动作和返回值)。 |
26
+ | onlyAction | `Boolean` | 否 | 是否仅展示动作部分。 |
27
+ | needShowInsertSQL | `Boolean` | 否 | 是否显示“插入SQL”功能按钮。 |
28
+ | headerButtonComponentFun | `Function` | 否 | 自定义头部按钮渲染函数。 |
29
+
30
+ ## 数据结构示例
31
+
32
+ ### ruleClassData 结构
33
+ ```json
34
+ [
35
+ {
36
+ "ruleName": "规则1",
37
+ "subExpression": [
38
+ {
39
+ "operationType": "logic", // logic 或 relation
40
+ "operationCode": "and", // logic时为 and/or
41
+ "subExpression": [ ... ] // 嵌套子条件
42
+ },
43
+ {
44
+ "operationType": "relation",
45
+ "elementId": "...", // 左侧对象ID
46
+ "operationCode": "...", // 操作符
47
+ "params": ["..."], // 右侧值
48
+ // 新增参数条件控制
49
+ "isReqCondition": true,
50
+ "reqConditionData": {
51
+ "reqParamName": "param1",
52
+ "dataTypeCode": "21",
53
+ "operationCode": "eq",
54
+ "params": ["value"]
55
+ }
56
+ }
57
+ ],
58
+ "extraInfo": {
59
+ "execute": [], // 动作
60
+ "response": [] // 返回值
61
+ }
62
+ }
63
+ ]
64
+ ```
65
+
66
+ ## 功能特性
67
+ 1. **多层级逻辑嵌套**:支持无限层级的“并且/或者”逻辑组合。
68
+ 2. **动态表单渲染**:根据选择的对象属性类型(`dataTypeCode`),自动渲染对应的输入组件(文本框、日期选择、业务选择器等)。
69
+ 3. **参数插入**:支持将系统变量作为条件值。
70
+ 4. **参数条件控制**:支持为特定条件配置请求参数名称、类型及校验规则。
71
+ 5. **动作与返回值**:支持配置规则命中后的执行动作及返回值。
72
+
73
+ ## 代码演示
74
+
75
+ ```tsx
76
+ import React, { useState } from 'react';
77
+ import { RuleComponent } from '../../../index';
78
+
79
+ export default () => {
80
+ const [ruleClassData, setRuleClassData] = useState([]);
81
+ const [disabled, setDisabled] = useState(false);
82
+
83
+ // 模拟规则对象数据源
84
+ const regularDataList = [
85
+ {
86
+ id: 'user_info',
87
+ name: '用户信息',
88
+ code: 'user',
89
+ valueType: 'object',
90
+ propertyList: [
91
+ { id: 'age', name: '年龄', code: 'age', valueType: '22', inputType: 11, choiceType: 10, },
92
+ { id: 'name', name: '姓名', code: 'name', valueType: '21', inputType: 11, choiceType: 10, },
93
+ ]
94
+ },
95
+ {
96
+ id: 'order_info',
97
+ name: '订单信息',
98
+ code: 'order',
99
+ valueType: 'object',
100
+ propertyList: [
101
+ { id: 'amount', name: '金额', code: 'amount', valueType: '22', inputType: 11, choiceType: 10, },
102
+ ]
103
+ }
104
+ ];
105
+
106
+ // 模拟操作符数据源
107
+ const operationList = [
108
+ {
109
+ code: '21', // 字符串
110
+ operationList: [
111
+ { code: 'eq', name: '等于' },
112
+ { code: 'cn', name: '包含' },
113
+ ]
114
+ },
115
+ {
116
+ code: '22', // 数值
117
+ operationList: [
118
+ { code: 'eq', name: '等于' },
119
+ { code: 'gt', name: '大于' },
120
+ { code: 'lt', name: '小于' },
121
+ ]
122
+ }
123
+ ];
124
+
125
+ // 模拟系统变量
126
+ const systemVariableList = [
127
+ { code: 'sys_uid', name: '当前用户ID' },
128
+ { code: 'sys_time', name: '当前时间' },
129
+ ];
130
+
131
+ const handleSave = () => {
132
+ console.log('保存规则数据:', JSON.stringify(ruleClassData, null, 2));
133
+ alert('规则数据已输出到控制台,请查看!');
134
+ };
135
+
136
+ return (
137
+ <div style={{ background: '#f0f2f5', padding: 20, width: '1200px' }}>
138
+ <div style={{ marginBottom: 16, textAlign: 'right' }}>
139
+ <button
140
+ onClick={() => setDisabled(!disabled)}
141
+ style={{
142
+ backgroundColor: '#faad14',
143
+ color: '#fff',
144
+ border: 'none',
145
+ padding: '6px 15px',
146
+ borderRadius: '2px',
147
+ cursor: 'pointer',
148
+ marginRight: '10px'
149
+ }}
150
+ >
151
+ {disabled ? '启用编辑' : '禁用编辑'}
152
+ </button>
153
+ <button
154
+ onClick={handleSave}
155
+ style={{
156
+ backgroundColor: '#1890ff',
157
+ color: '#fff',
158
+ border: 'none',
159
+ padding: '6px 15px',
160
+ borderRadius: '2px',
161
+ cursor: 'pointer'
162
+ }}
163
+ >
164
+ 保存规则
165
+ </button>
166
+ </div>
167
+ <RuleComponent
168
+ regularDataList={regularDataList}
169
+ operationList={operationList}
170
+ ruleClassData={ruleClassData}
171
+ needShowInsertSQL={true}
172
+ needShowReqCondition={true}
173
+ systemVariableList={systemVariableList}
174
+ disabled={disabled}
175
+ callBack={(newData) => {
176
+ console.log('Rule Changed:', newData);
177
+ setRuleClassData([...newData]);
178
+ }}
179
+ />
180
+ <div style={{ marginTop: 20 }}>
181
+ <h4>当前规则数据:</h4>
182
+ <pre>{JSON.stringify(ruleClassData, null, 2)}</pre>
183
+ </div>
184
+ </div>
185
+ );
186
+ };
187
+ ```
@@ -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
+ 使用前请确保相关依赖已安装且路径正确。
@@ -0,0 +1,63 @@
1
+ # RuleField 规则字段组件
2
+
3
+ ## 简介
4
+ `RuleField` 是 `RuleObjectComponent` 内部使用的核心子组件,主要负责根据规则配置的**数据类型**和**操作符**,动态渲染出合适的输入控件(如输入框、下拉框、日期选择器、业务选择器等)。
5
+
6
+ ## 组件路径
7
+ `src/components/Solution/RuleComponent/ruleFiled.js`
8
+
9
+ ## Props 属性说明
10
+
11
+ | 属性名 | 类型 | 说明 |
12
+ | --- | --- | --- |
13
+ | selectOperation | `String` | 当前选中的操作符编码(如 `eq`, `in`, `be` 等)。 |
14
+ | dataTypeCode | `String` | 数据类型编码(21:字符串, 22:数值, 41:日期, 32:日期时间等)。 |
15
+ | dataChoiceBusinessType | `String`/`Number` | 业务数据选择类型(如 110:物理仓, 120:逻辑仓, 250:客户 等),用于决定渲染哪种业务选择器。 |
16
+ | dataInputBusinessType | `Number` | 输入交互类型(11:单选, 12:多选)。 |
17
+ | values | `Array` | 当前输入的值数组。 |
18
+ | valueNames | `Array` | 当前输入值的名称数组(用于回显)。 |
19
+ | callback | `Function` | 值发生变化时的回调,签名:`(newValues, newValueNames) => void`。 |
20
+ | disabled | `Boolean` | 是否禁用。 |
21
+ | customerWidth | `String` | 自定义控件宽度。 |
22
+ | queryIdentify | `String` | 字典或枚举的标识符,用于获取下拉选项数据。 |
23
+ | queryIdentifyType | `String` | 标识符类型(`dictCodeIdentify`, `dynamicDictCodeIdentify` 等)。 |
24
+ | initialThresholdQuery | `Object` | 初始查询参数。 |
25
+ | propertyCode | `String` | 属性编码。 |
26
+ | others | `Object` | 其他扩展配置,如 `customSelectorConfig`。 |
27
+
28
+ ## 支持的控件类型
29
+
30
+ 组件根据 `dataTypeCode` 和 `dataChoiceBusinessType` 自动匹配以下控件:
31
+
32
+ 1. **基础控件**:
33
+ * Input (文本/数值)
34
+ * DatePicker / RangePicker (日期/时间)
35
+ * Select (枚举/字典下拉)
36
+
37
+ 2. **区间控件**:
38
+ * 当操作符为区间类型(如 `be`, `bed`)时,自动渲染两个输入控件及中间的 `~` 符号。
39
+
40
+ 3. **业务选择器**:
41
+ * 物理仓 (`physicalWarehouse`)
42
+ * 逻辑仓 (`realWarehouse`)
43
+ * 虚拟仓 (`virtualWarehouse`)
44
+ * 渠道仓 (`channelWarehouse`)
45
+ * 商品SPU/SKU
46
+ * 省市区级联 (`BsCascader`)
47
+ * 行政/采购/销售/库存/结算组织 (`BusinessTreeSearchSelect`)
48
+ * 供应商/客户/店铺/员工 (`BusinessSearchSelect`)
49
+ * 品牌/类目
50
+ * 自定义选择器 (`CustomSelector`)
51
+
52
+ ## 使用示例
53
+
54
+ ```javascript
55
+ <RuleField
56
+ selectOperation="eq"
57
+ dataTypeCode="21"
58
+ values={['some value']}
59
+ valueNames={['some value']}
60
+ callback={(vals, names) => console.log(vals, names)}
61
+ disabled={false}
62
+ />
63
+ ```