@bit-sun/business-component 4.2.0-alpha.3 → 4.2.0-alpha.31
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/.fatherrc.ts +1 -1
- package/.umirc.ts +13 -9
- package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
- package/dist/components/Business/BsLayouts/index.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +6 -6
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
- package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
- package/dist/components/Business/CommonAlert/index.d.ts +1 -2
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
- package/dist/components/Business/DetailPageWrapper/index.d.ts +12 -12
- package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
- package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
- package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
- package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
- package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
- package/dist/components/Business/ImportExport/index.d.ts +14 -0
- package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
- package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
- package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
- package/dist/components/Business/ImportExport/types.d.ts +134 -0
- package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/StateFlow/index.d.ts +1 -2
- package/dist/components/Business/SystemLog/index.d.ts +78 -0
- package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
- package/dist/components/Business/TrialCalculation/index.d.ts +15 -0
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +6 -6
- package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
- package/dist/components/Business/columnSettingTable/index.d.ts +3 -3
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +3 -3
- package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
- package/dist/components/Common/Section/index.d.ts +1 -1
- package/dist/components/Functional/AddSelect/index.d.ts +1 -2
- package/dist/components/Functional/AuthButton/index.d.ts +1 -2
- package/dist/components/Functional/DataImport/index.d.ts +3 -3
- package/dist/components/Functional/DataValidation/index.d.ts +5 -5
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/pagination.d.ts +22 -0
- package/dist/components/Functional/SearchSelect/utils.d.ts +2 -3
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
- package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +5397 -1220
- package/dist/index.js +5417 -1213
- package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
- package/dist/utils/TableUtils.d.ts +18 -19
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/utils.d.ts +41 -0
- package/docs/error-record.md +52 -0
- package/docs/flow-control-readme.md +283 -0
- package/docs/task-records/2026-07-31-import-export-extraction.md +81 -0
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
- package/src/components/Business/BsSulaQueryTable/index.md +57 -4
- package/src/components/Business/BsSulaQueryTable/index.tsx +174 -10
- package/src/components/Business/BsSulaQueryTable/setting.tsx +6 -0
- package/src/components/Business/DetailPageWrapper/index.tsx +81 -1
- package/src/components/Business/DetailPageWrapper/readme.md +89 -0
- package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
- package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
- package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
- package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
- package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
- package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
- package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
- package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
- package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
- package/src/components/Business/ImportExport/businessFunction.ts +29 -0
- package/src/components/Business/ImportExport/index.md +104 -0
- package/src/components/Business/ImportExport/index.tsx +208 -0
- package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
- package/src/components/Business/ImportExport/services/importExport.ts +208 -0
- package/src/components/Business/ImportExport/services/routing.ts +21 -0
- package/src/components/Business/ImportExport/types.ts +180 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +704 -48
- package/src/components/Business/SearchSelect/index.md +2 -2
- package/src/components/Business/SystemLog/index.md +37 -0
- package/src/components/Business/SystemLog/index.tsx +87 -0
- package/src/components/Business/TrialCalculation/PathDisplay.less +93 -0
- package/src/components/Business/TrialCalculation/PathDisplay_README.md +77 -0
- package/src/components/Business/TrialCalculation/index.tsx +322 -0
- package/src/components/Business/columnSettingTable/index.tsx +7 -6
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +23 -22
- package/src/components/Functional/AddSelect/index.tsx +95 -1
- package/src/components/Functional/DataValidation/index.tsx +31 -9
- package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -2
- package/src/components/Functional/SearchSelect/index.md +109 -0
- package/src/components/Functional/SearchSelect/index.tsx +99 -17
- package/src/components/Functional/SearchSelect/pagination.ts +57 -0
- package/src/components/Functional/SearchSelect/utils.tsx +28 -18
- package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
- package/src/components/Solution/RuleComponent/README.md +187 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +9 -1
- package/src/components/Solution/RuleComponent/RenderCompItem_README.md +189 -0
- package/src/components/Solution/RuleComponent/RuleField.md +63 -0
- package/src/components/Solution/RuleComponent/index.js +237 -8
- package/src/components/Solution/RuleComponent/ruleFiled.js +46 -6
- package/src/components/Solution/RuleSetter/README.md +97 -0
- package/src/index.ts +9 -0
- package/src/typings/umi.d.ts +9 -0
- package/src/utils/LocalstorageUtils.ts +1 -1
- package/src/utils/auth.ts +39 -2
- package/src/utils/utils.ts +41 -1
|
@@ -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
|
+
```
|
|
@@ -35,12 +35,10 @@ import {
|
|
|
35
35
|
} from './util';
|
|
36
36
|
import { getDictionarySource, judgeIsEmpty, uuid } from '../../../utils/utils';
|
|
37
37
|
import { coverToParallel } from '../../../utils/TreeUtils';
|
|
38
|
-
import
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
BsCascader,
|
|
43
|
-
} from '../../../index';
|
|
38
|
+
import BusinessSearchSelect from '../../Business/SearchSelect';
|
|
39
|
+
import BusinessTreeSearchSelect from '../../Business/TreeSearchSelect';
|
|
40
|
+
import EllipsisTooltip from '../../Functional/EllipsisTooltip';
|
|
41
|
+
import { BsCascader } from '../../Functional/BsAntdSula/index';
|
|
44
42
|
import { request } from 'bssula';
|
|
45
43
|
import Formula from './Formula';
|
|
46
44
|
import RenderSpecificAction from './renderSpecificAction';
|
|
@@ -48,6 +46,19 @@ import RenderCompItem from './RenderCompItem';
|
|
|
48
46
|
|
|
49
47
|
const { RangePicker } = DatePicker;
|
|
50
48
|
|
|
49
|
+
const FIXED_DATA_TYPES = {
|
|
50
|
+
10: '字符串',
|
|
51
|
+
20: '短整数',
|
|
52
|
+
21: '长整数',
|
|
53
|
+
22: '小数',
|
|
54
|
+
40: '数组',
|
|
55
|
+
41: '布尔值',
|
|
56
|
+
12: '富文本',
|
|
57
|
+
30: '日期',
|
|
58
|
+
31: '时间',
|
|
59
|
+
32: '日期时间',
|
|
60
|
+
};
|
|
61
|
+
|
|
51
62
|
class RuleObjectComponent extends Component {
|
|
52
63
|
constructor(props) {
|
|
53
64
|
super(props);
|
|
@@ -151,6 +162,8 @@ class RuleObjectComponent extends Component {
|
|
|
151
162
|
value: element.id,
|
|
152
163
|
id: element.id,
|
|
153
164
|
dataTypeCode: element.valueType,
|
|
165
|
+
entityValueType: element.entityValueType,
|
|
166
|
+
entityInputType: element.entityInputType,
|
|
154
167
|
dataChoiceBusinessType: element.choiceType,
|
|
155
168
|
dataInputBusinessType: element.inputType,
|
|
156
169
|
info: element.info,
|
|
@@ -178,6 +191,8 @@ class RuleObjectComponent extends Component {
|
|
|
178
191
|
metaObjectCode: this.props.metaObjectCode || item.code,
|
|
179
192
|
...item,
|
|
180
193
|
dataTypeCode: item.valueType,
|
|
194
|
+
entityValueType: item.entityValueType,
|
|
195
|
+
entityInputType: item.entityInputType,
|
|
181
196
|
dataChoiceBusinessType: item.choiceType,
|
|
182
197
|
dataInputBusinessType: item.inputType,
|
|
183
198
|
}),
|
|
@@ -225,6 +240,8 @@ class RuleObjectComponent extends Component {
|
|
|
225
240
|
value: element.id,
|
|
226
241
|
id: element.id,
|
|
227
242
|
dataTypeCode: element.valueType,
|
|
243
|
+
entityValueType: element.entityValueType,
|
|
244
|
+
entityInputType: element.entityInputType,
|
|
228
245
|
dataChoiceBusinessType: element.choiceType,
|
|
229
246
|
dataInputBusinessType: element.inputType,
|
|
230
247
|
info: element.info,
|
|
@@ -689,6 +706,7 @@ class RuleObjectComponent extends Component {
|
|
|
689
706
|
disabled,
|
|
690
707
|
systemVariableList,
|
|
691
708
|
needShowInsertSQL,
|
|
709
|
+
needShowReqCondition,
|
|
692
710
|
} = this.props;
|
|
693
711
|
let thresholdQuery = {
|
|
694
712
|
...initialThresholdQuery,
|
|
@@ -748,6 +766,7 @@ class RuleObjectComponent extends Component {
|
|
|
748
766
|
<div
|
|
749
767
|
className={'rule_line_content'}
|
|
750
768
|
style={{ display: 'flex', marginBottom: '0px', padding: '10px 0px' }}
|
|
769
|
+
key={itemDetail.elementId}
|
|
751
770
|
>
|
|
752
771
|
<div
|
|
753
772
|
className={'logical_operate_content'}
|
|
@@ -823,6 +842,8 @@ class RuleObjectComponent extends Component {
|
|
|
823
842
|
itemDetail.elementName = nodeInfo.triggerNode.props.title;
|
|
824
843
|
itemDetail.dataTypeCode =
|
|
825
844
|
nodeInfo.triggerNode.props.dataTypeCode;
|
|
845
|
+
itemDetail.entityValueType = nodeInfo.triggerNode.props.entityValueType;
|
|
846
|
+
itemDetail.entityInputType = nodeInfo.triggerNode.props.entityInputType;
|
|
826
847
|
itemDetail.metaObjectCode =
|
|
827
848
|
nodeInfo.triggerNode.props.metaObjectCode;
|
|
828
849
|
itemDetail.isInsertParam = false;
|
|
@@ -996,6 +1017,7 @@ class RuleObjectComponent extends Component {
|
|
|
996
1017
|
itemDetail.params = [];
|
|
997
1018
|
} else {
|
|
998
1019
|
itemDetail.systemCode = null;
|
|
1020
|
+
delete itemDetail.type;
|
|
999
1021
|
}
|
|
1000
1022
|
|
|
1001
1023
|
this.setState(
|
|
@@ -1029,6 +1051,8 @@ class RuleObjectComponent extends Component {
|
|
|
1029
1051
|
itemDetail.type = 30;
|
|
1030
1052
|
itemDetail.paramNames = [];
|
|
1031
1053
|
itemDetail.params = [];
|
|
1054
|
+
} else {
|
|
1055
|
+
delete itemDetail.type;
|
|
1032
1056
|
}
|
|
1033
1057
|
|
|
1034
1058
|
this.setState(
|
|
@@ -1048,13 +1072,21 @@ class RuleObjectComponent extends Component {
|
|
|
1048
1072
|
<div
|
|
1049
1073
|
style={{
|
|
1050
1074
|
display:
|
|
1051
|
-
itemDetail.operationType == 'logic' &&
|
|
1075
|
+
itemDetail.operationType == 'logic' &&
|
|
1076
|
+
(!disabled ||
|
|
1077
|
+
(itemDetail.reqConditionData &&
|
|
1078
|
+
itemDetail.reqConditionData.reqParamName &&
|
|
1079
|
+
itemDetail.reqConditionData.params?.length))
|
|
1052
1080
|
? 'block'
|
|
1053
1081
|
: 'none',
|
|
1054
1082
|
}}
|
|
1055
1083
|
>
|
|
1056
1084
|
<span
|
|
1057
|
-
style={{
|
|
1085
|
+
style={{
|
|
1086
|
+
color: '#008fe0',
|
|
1087
|
+
cursor: 'pointer',
|
|
1088
|
+
display: disabled ? 'none' : 'inline',
|
|
1089
|
+
}}
|
|
1058
1090
|
type="link"
|
|
1059
1091
|
onClick={() => {
|
|
1060
1092
|
this.addPeerRule(itemDetail);
|
|
@@ -1069,6 +1101,138 @@ class RuleObjectComponent extends Component {
|
|
|
1069
1101
|
/>
|
|
1070
1102
|
添加条件
|
|
1071
1103
|
</span>
|
|
1104
|
+
{needShowReqCondition && (
|
|
1105
|
+
<span
|
|
1106
|
+
style={{
|
|
1107
|
+
marginLeft: 10,
|
|
1108
|
+
display: disabled ? 'none' : 'inline',
|
|
1109
|
+
}}
|
|
1110
|
+
>
|
|
1111
|
+
<Button
|
|
1112
|
+
type="link"
|
|
1113
|
+
disabled={
|
|
1114
|
+
disabled &&
|
|
1115
|
+
(!itemDetail.reqConditionData ||
|
|
1116
|
+
!itemDetail.reqConditionData.reqParamName ||
|
|
1117
|
+
!itemDetail.reqConditionData.params?.length)
|
|
1118
|
+
}
|
|
1119
|
+
style={{ padding: 0, height: 'auto' }}
|
|
1120
|
+
onClick={() => this.handleReqConditionToggle(itemDetail)}
|
|
1121
|
+
>
|
|
1122
|
+
{itemDetail.isReqCondition
|
|
1123
|
+
? '取消参数条件控制'
|
|
1124
|
+
: '参数条件控制'}
|
|
1125
|
+
</Button>
|
|
1126
|
+
</span>
|
|
1127
|
+
)}
|
|
1128
|
+
{(itemDetail.isReqCondition ||
|
|
1129
|
+
(disabled &&
|
|
1130
|
+
itemDetail.reqConditionData &&
|
|
1131
|
+
itemDetail.reqConditionData.reqParamName &&
|
|
1132
|
+
itemDetail.reqConditionData.params?.length)) &&
|
|
1133
|
+
itemDetail.reqConditionData && (
|
|
1134
|
+
<div
|
|
1135
|
+
style={{
|
|
1136
|
+
marginTop: 10,
|
|
1137
|
+
display:
|
|
1138
|
+
disabled &&
|
|
1139
|
+
(!itemDetail.reqConditionData.reqParamName ||
|
|
1140
|
+
!itemDetail.reqConditionData.params?.length)
|
|
1141
|
+
? 'none'
|
|
1142
|
+
: 'flex',
|
|
1143
|
+
alignItems: 'center',
|
|
1144
|
+
background: '#f5f5f5',
|
|
1145
|
+
padding: '10px',
|
|
1146
|
+
borderRadius: '4px',
|
|
1147
|
+
}}
|
|
1148
|
+
>
|
|
1149
|
+
<Select
|
|
1150
|
+
disabled={disabled}
|
|
1151
|
+
style={{ width: 150, marginRight: 10 }}
|
|
1152
|
+
placeholder="请选择"
|
|
1153
|
+
value={String(
|
|
1154
|
+
itemDetail.reqConditionData.reqParamType || '10',
|
|
1155
|
+
)}
|
|
1156
|
+
onChange={(val) =>
|
|
1157
|
+
this.handleReqDataChange(itemDetail, 'reqParamType', val)
|
|
1158
|
+
}
|
|
1159
|
+
>
|
|
1160
|
+
<Select.Option value="10">请求参数名称</Select.Option>
|
|
1161
|
+
<Select.Option value="20">请求头参数名称</Select.Option>
|
|
1162
|
+
<Select.Option value="40">源请求地址</Select.Option>
|
|
1163
|
+
</Select>
|
|
1164
|
+
{String(itemDetail.reqConditionData.reqParamType || '10') !==
|
|
1165
|
+
'40' && (
|
|
1166
|
+
<Input
|
|
1167
|
+
disabled={disabled}
|
|
1168
|
+
style={{ width: 150, marginRight: 10 }}
|
|
1169
|
+
value={itemDetail.reqConditionData.reqParamName}
|
|
1170
|
+
onChange={(e) =>
|
|
1171
|
+
this.handleReqDataChange(
|
|
1172
|
+
itemDetail,
|
|
1173
|
+
'reqParamName',
|
|
1174
|
+
e.target.value,
|
|
1175
|
+
)
|
|
1176
|
+
}
|
|
1177
|
+
/>
|
|
1178
|
+
)}
|
|
1179
|
+
|
|
1180
|
+
<span style={{ marginRight: 8, flexShrink: 0 }}>类型:</span>
|
|
1181
|
+
<Select
|
|
1182
|
+
disabled={disabled}
|
|
1183
|
+
style={{ width: 120, marginRight: 10 }}
|
|
1184
|
+
value={itemDetail.reqConditionData.dataTypeCode}
|
|
1185
|
+
onChange={(val) =>
|
|
1186
|
+
this.handleReqDataChange(itemDetail, 'dataTypeCode', val)
|
|
1187
|
+
}
|
|
1188
|
+
>
|
|
1189
|
+
{Object.keys(FIXED_DATA_TYPES).map((code) => (
|
|
1190
|
+
<Select.Option key={code} value={code}>
|
|
1191
|
+
{FIXED_DATA_TYPES[code]}
|
|
1192
|
+
</Select.Option>
|
|
1193
|
+
))}
|
|
1194
|
+
</Select>
|
|
1195
|
+
|
|
1196
|
+
<Select
|
|
1197
|
+
disabled={disabled}
|
|
1198
|
+
style={{ width: 120, marginRight: 10 }}
|
|
1199
|
+
value={itemDetail.reqConditionData.operationCode}
|
|
1200
|
+
onChange={(val) =>
|
|
1201
|
+
this.handleReqDataChange(itemDetail, 'operationCode', val)
|
|
1202
|
+
}
|
|
1203
|
+
>
|
|
1204
|
+
{[
|
|
1205
|
+
{ 'code': '1', 'name': '在集合' },
|
|
1206
|
+
{ 'code': '2', 'name': '不等于' },
|
|
1207
|
+
{ code: '3', name: '小于' },
|
|
1208
|
+
{ code: '4', name: '大于' },
|
|
1209
|
+
{ code: '5', name: '等于' },
|
|
1210
|
+
].map((op) => (
|
|
1211
|
+
<Select.Option key={op.code} value={op.code}>
|
|
1212
|
+
{op.name}
|
|
1213
|
+
</Select.Option>
|
|
1214
|
+
))}
|
|
1215
|
+
</Select>
|
|
1216
|
+
|
|
1217
|
+
<RuleField
|
|
1218
|
+
customerWidth={'180px'}
|
|
1219
|
+
isQueryParams={true}
|
|
1220
|
+
selectOperation={itemDetail.reqConditionData.operationCode}
|
|
1221
|
+
dataTypeCode={itemDetail.reqConditionData.dataTypeCode}
|
|
1222
|
+
values={itemDetail.reqConditionData.params || []}
|
|
1223
|
+
valueNames={itemDetail.reqConditionData.paramNames || []}
|
|
1224
|
+
callback={(newValues, newValueNames) =>
|
|
1225
|
+
this.handleReqDataChange(
|
|
1226
|
+
itemDetail,
|
|
1227
|
+
'params',
|
|
1228
|
+
newValues,
|
|
1229
|
+
newValueNames,
|
|
1230
|
+
)
|
|
1231
|
+
}
|
|
1232
|
+
disabled={disabled}
|
|
1233
|
+
/>
|
|
1234
|
+
</div>
|
|
1235
|
+
)}
|
|
1072
1236
|
</div>
|
|
1073
1237
|
</div>
|
|
1074
1238
|
</div>
|
|
@@ -1496,6 +1660,8 @@ class RuleObjectComponent extends Component {
|
|
|
1496
1660
|
delete itemDetail.params;
|
|
1497
1661
|
delete itemDetail.paramNames;
|
|
1498
1662
|
delete itemDetail.dataTypeCode;
|
|
1663
|
+
delete itemDetail.entityValueType;
|
|
1664
|
+
delete itemDetail.entityInputType;
|
|
1499
1665
|
delete itemDetail.elementId;
|
|
1500
1666
|
delete itemDetail.elementName;
|
|
1501
1667
|
delete itemDetail.metaObjectCode;
|
|
@@ -1561,6 +1727,8 @@ class RuleObjectComponent extends Component {
|
|
|
1561
1727
|
parentDetail.elementName = parentDetail.subExpression[0].elementName;
|
|
1562
1728
|
parentDetail.dataTypeCode =
|
|
1563
1729
|
parentDetail.subExpression[0].dataTypeCode;
|
|
1730
|
+
parentDetail.entityValueType = parentDetail.subExpression[0].entityValueType;
|
|
1731
|
+
parentDetail.entityInputType = parentDetail.subExpression[0].entityInputType;
|
|
1564
1732
|
delete parentDetail.subExpression;
|
|
1565
1733
|
}
|
|
1566
1734
|
}
|
|
@@ -1646,6 +1814,67 @@ class RuleObjectComponent extends Component {
|
|
|
1646
1814
|
);
|
|
1647
1815
|
};
|
|
1648
1816
|
|
|
1817
|
+
handleReqConditionToggle = (itemDetail) => {
|
|
1818
|
+
const { ruleClassData } = this.state;
|
|
1819
|
+
const { callBack } = this.props;
|
|
1820
|
+
itemDetail.isReqCondition = !itemDetail.isReqCondition;
|
|
1821
|
+
if (itemDetail.isReqCondition && !itemDetail.reqConditionData) {
|
|
1822
|
+
itemDetail.reqConditionData = {
|
|
1823
|
+
operationType: 'relation',
|
|
1824
|
+
dataTypeCode: '10',
|
|
1825
|
+
entityInputType: '10',
|
|
1826
|
+
entityValueType: '10',
|
|
1827
|
+
operationCode: '',
|
|
1828
|
+
reqParamName: '',
|
|
1829
|
+
params: [],
|
|
1830
|
+
paramNames: [],
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
this.setState(
|
|
1834
|
+
{
|
|
1835
|
+
ruleClassData,
|
|
1836
|
+
},
|
|
1837
|
+
() => {
|
|
1838
|
+
callBack(ruleClassData);
|
|
1839
|
+
},
|
|
1840
|
+
);
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
handleReqDataChange = (itemDetail, field, value, valueNames) => {
|
|
1844
|
+
const { ruleClassData } = this.state;
|
|
1845
|
+
const { callBack } = this.props;
|
|
1846
|
+
if (!itemDetail.reqConditionData) return;
|
|
1847
|
+
|
|
1848
|
+
if (field === 'dataTypeCode') {
|
|
1849
|
+
itemDetail.reqConditionData.dataTypeCode = value;
|
|
1850
|
+
itemDetail.reqConditionData.entityInputType = value;
|
|
1851
|
+
itemDetail.reqConditionData.entityValueType = value;
|
|
1852
|
+
itemDetail.reqConditionData.operationCode = '';
|
|
1853
|
+
itemDetail.reqConditionData.params = [];
|
|
1854
|
+
itemDetail.reqConditionData.paramNames = [];
|
|
1855
|
+
} else if (field === 'operationCode') {
|
|
1856
|
+
itemDetail.reqConditionData.operationCode = value;
|
|
1857
|
+
} else if (field === 'reqParamName') {
|
|
1858
|
+
itemDetail.reqConditionData.reqParamName = value;
|
|
1859
|
+
} else if (field === 'params') {
|
|
1860
|
+
itemDetail.reqConditionData.params = value;
|
|
1861
|
+
if (valueNames) {
|
|
1862
|
+
itemDetail.reqConditionData.paramNames = valueNames;
|
|
1863
|
+
}
|
|
1864
|
+
} else if (field === 'reqParamType') {
|
|
1865
|
+
itemDetail.reqConditionData.reqParamType = value;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
this.setState(
|
|
1869
|
+
{
|
|
1870
|
+
ruleClassData,
|
|
1871
|
+
},
|
|
1872
|
+
() => {
|
|
1873
|
+
callBack(ruleClassData);
|
|
1874
|
+
},
|
|
1875
|
+
);
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1649
1878
|
render() {
|
|
1650
1879
|
const { onlyOneRule, callBack, disabled, headerButtonComponentFun } = this.props;
|
|
1651
1880
|
const { ruleClassData, modalParams } = this.state;
|