@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
|
@@ -8,11 +8,9 @@ import { handleError } from '../../../utils/requestUtils';
|
|
|
8
8
|
import { queryIdentityInfo, findChangedThresholdQuery, setParams, dateFormat, fullDateFormat } from './util';
|
|
9
9
|
import { request as SulaRequest } from 'bssula';
|
|
10
10
|
import { stringify } from 'querystring';
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BsCascader
|
|
15
|
-
} from '../../../index';
|
|
11
|
+
import BusinessSearchSelect from '../../Business/SearchSelect';
|
|
12
|
+
import BusinessTreeSearchSelect from '../../Business/TreeSearchSelect';
|
|
13
|
+
import { BsCascader } from '../../Functional/BsAntdSula/index';
|
|
16
14
|
import CustomSelector from './CustomPlugin/CustomSelector';
|
|
17
15
|
const { RangePicker } = DatePicker;
|
|
18
16
|
|
|
@@ -29,6 +27,7 @@ export default class RuleField extends Component {
|
|
|
29
27
|
thresholdQuery: {},
|
|
30
28
|
thresholdList: [],
|
|
31
29
|
options: [],
|
|
30
|
+
isQueryParams: false
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -45,6 +44,7 @@ export default class RuleField extends Component {
|
|
|
45
44
|
queryIdentify,
|
|
46
45
|
propertyCode,
|
|
47
46
|
queryIdentifyType,
|
|
47
|
+
isQueryParams
|
|
48
48
|
} = this.props;
|
|
49
49
|
this.setState(
|
|
50
50
|
{
|
|
@@ -57,6 +57,7 @@ export default class RuleField extends Component {
|
|
|
57
57
|
dataTypeCode,
|
|
58
58
|
dataChoiceBusinessType,
|
|
59
59
|
dataInputBusinessType,
|
|
60
|
+
isQueryParams,
|
|
60
61
|
others,
|
|
61
62
|
fieldValues: [...values],
|
|
62
63
|
options,
|
|
@@ -283,11 +284,26 @@ export default class RuleField extends Component {
|
|
|
283
284
|
itemDetail={},
|
|
284
285
|
others={},
|
|
285
286
|
propertyCode,
|
|
287
|
+
isQueryParams
|
|
286
288
|
} = this.props;
|
|
287
289
|
const { thresholdList } = this.state;
|
|
288
290
|
const styleCommon = {
|
|
289
291
|
width: customerWidth || '180px',
|
|
290
292
|
};
|
|
293
|
+
|
|
294
|
+
if(isQueryParams) {
|
|
295
|
+
return <Input
|
|
296
|
+
defaultValue={values.join(',')}
|
|
297
|
+
disabled={disabled}
|
|
298
|
+
style={styleCommon}
|
|
299
|
+
onBlur={(e) => {
|
|
300
|
+
values = e.target.value.split(',');
|
|
301
|
+
valueNames = e.target.value.split(',');
|
|
302
|
+
callback(values, valueNames);
|
|
303
|
+
}}
|
|
304
|
+
/>
|
|
305
|
+
}
|
|
306
|
+
|
|
291
307
|
if (!selectOperation) return <Input disabled style={styleCommon}></Input>;
|
|
292
308
|
const SET_TYPE = ['in', 'nin', 'cn', 'ncn','5']; //集合类型 (数字为 兼容用户管理子应用使用规则组件)
|
|
293
309
|
const INTERVAL_TYPE = ['be', 'bed', 'nbe', 'nbed', 'ber', 'bel']; //区间类型
|
|
@@ -1932,7 +1948,7 @@ export default class RuleField extends Component {
|
|
|
1932
1948
|
}
|
|
1933
1949
|
}
|
|
1934
1950
|
// 配送方式选择器
|
|
1935
|
-
if (dataChoiceBusinessType == 310) {
|
|
1951
|
+
if (dataChoiceBusinessType == 310 || dataChoiceBusinessType == 311) {
|
|
1936
1952
|
if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
|
|
1937
1953
|
return (
|
|
1938
1954
|
<>
|
|
@@ -1952,6 +1968,14 @@ export default class RuleField extends Component {
|
|
|
1952
1968
|
labelInValue={true}
|
|
1953
1969
|
value={values[0]}
|
|
1954
1970
|
requestConfig={{
|
|
1971
|
+
...(dataChoiceBusinessType === 311
|
|
1972
|
+
? {
|
|
1973
|
+
otherParams: {
|
|
1974
|
+
// 配送方式只选择标准配送方式
|
|
1975
|
+
'qp-recordChannnelCode-eq': 80,
|
|
1976
|
+
},
|
|
1977
|
+
}
|
|
1978
|
+
: {}),
|
|
1955
1979
|
filterInit: 'qp-code-in',
|
|
1956
1980
|
}}
|
|
1957
1981
|
onChange={(value) => {
|
|
@@ -1983,6 +2007,14 @@ export default class RuleField extends Component {
|
|
|
1983
2007
|
labelInValue={true}
|
|
1984
2008
|
value={values[1]}
|
|
1985
2009
|
requestConfig={{
|
|
2010
|
+
...(dataChoiceBusinessType === 311
|
|
2011
|
+
? {
|
|
2012
|
+
otherParams: {
|
|
2013
|
+
// 配送方式只选择标准配送方式
|
|
2014
|
+
'qp-recordChannnelCode-eq': 80,
|
|
2015
|
+
},
|
|
2016
|
+
}
|
|
2017
|
+
: {}),
|
|
1986
2018
|
filterInit: 'qp-code-in',
|
|
1987
2019
|
}}
|
|
1988
2020
|
onChange={(value) => {
|
|
@@ -2020,6 +2052,14 @@ export default class RuleField extends Component {
|
|
|
2020
2052
|
labelInValue={true}
|
|
2021
2053
|
value={currentValue}
|
|
2022
2054
|
requestConfig={{
|
|
2055
|
+
...(dataChoiceBusinessType === 311
|
|
2056
|
+
? {
|
|
2057
|
+
otherParams: {
|
|
2058
|
+
// 配送方式只选择标准配送方式
|
|
2059
|
+
'qp-recordChannnelCode-eq': 80,
|
|
2060
|
+
},
|
|
2061
|
+
}
|
|
2062
|
+
: {}),
|
|
2023
2063
|
filterInit: 'qp-code-in',
|
|
2024
2064
|
}}
|
|
2025
2065
|
onChange={(value) => {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# RuleSetter 规则设置器组件
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
`RuleSetter` 是一个封装了完整规则编辑逻辑的高级业务组件。它内部集成了 `RuleObjectComponent`,并内置了规则模板详情查询、规则对象树加载、操作符获取、规则实例数据回显以及规则保存等全套数据交互逻辑。
|
|
5
|
+
|
|
6
|
+
开发者只需提供规则模板 ID (`id`) 和业务标识 (`extStrField01`),即可快速在页面中引入一个功能完备的规则编辑器。
|
|
7
|
+
|
|
8
|
+
## 组件路径
|
|
9
|
+
`src/components/Solution/RuleSetter/index.tsx`
|
|
10
|
+
|
|
11
|
+
## Props 属性说明
|
|
12
|
+
|
|
13
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
14
|
+
|Ref | --- | --- | --- |
|
|
15
|
+
| id / sceneId | `String` | 是 | 规则模板 ID,用于加载规则元数据(对象树、操作符等)。 |
|
|
16
|
+
| extStrField01 | `String` | 否 | 业务关键字段(如业务单据ID、租户ID等),用于区分同一模板下的不同业务实例。 |
|
|
17
|
+
| name | `String` | 否 | 规则实例名称。 |
|
|
18
|
+
| type | `String` | 否 | 组件模式。`instance` 表示规则实例模式(加载并保存具体的业务规则);为空则通常用于模板设计模式。 |
|
|
19
|
+
| saveUrl | `String` | 否 | 自定义保存接口地址。默认为 `/basic/ruleDetail/addAndUpdate`。 |
|
|
20
|
+
| customerValidator | `Function` | 否 | 自定义校验函数。`(ruleResultList, ruleTypeData) => boolean`。 |
|
|
21
|
+
| parseCustomParams | `Function` | 否 | 自定义保存参数处理函数。`(params) => newParams`。 |
|
|
22
|
+
| RuleObjectComponentProps | `Object` | 否 | 透传给底层 `RuleObjectComponent` 的属性对象。可用于开启特定功能(如插入SQL)。 |
|
|
23
|
+
|
|
24
|
+
## 开启“插入 SQL”功能
|
|
25
|
+
|
|
26
|
+
通过 `RuleObjectComponentProps` 属性,可以将 `needShowInsertSQL` 参数传递给底层的规则组件,从而开启“插入 SQL”功能。
|
|
27
|
+
|
|
28
|
+
开启后,在每条规则条件的右侧会新增一个“插入 SQL”按钮,允许用户直接输入 SQL 片段作为条件值。
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
<RuleSetter
|
|
32
|
+
id="template_123"
|
|
33
|
+
type="instance"
|
|
34
|
+
RuleObjectComponentProps={{
|
|
35
|
+
needShowInsertSQL: true
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 代码演示
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import React, { useRef } from 'react';
|
|
44
|
+
import { Button, message } from 'antd';
|
|
45
|
+
import { RuleSetter } from '../../../index';
|
|
46
|
+
|
|
47
|
+
export default () => {
|
|
48
|
+
const ruleSetterRef = useRef();
|
|
49
|
+
|
|
50
|
+
const handleSave = () => {
|
|
51
|
+
if (ruleSetterRef.current) {
|
|
52
|
+
// 调用组件内部的保存方法
|
|
53
|
+
ruleSetterRef.current.handleSave()
|
|
54
|
+
.then(() => {
|
|
55
|
+
message.success('规则保存成功');
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
console.error('保存失败', err);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div style={{ background: '#f5f5f5', padding: 20 }}>
|
|
65
|
+
<div style={{ marginBottom: 16, textAlign: 'right' }}>
|
|
66
|
+
<Button type="primary" onClick={handleSave}>
|
|
67
|
+
保存规则
|
|
68
|
+
</Button>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<RuleSetter
|
|
72
|
+
ref={ruleSetterRef}
|
|
73
|
+
id="100000132" // 示例模板ID,请替换为实际存在的ID
|
|
74
|
+
type="instance"
|
|
75
|
+
extStrField01="business_order_001" // 示例业务ID
|
|
76
|
+
name="订单审核规则"
|
|
77
|
+
// 开启插入SQL功能
|
|
78
|
+
RuleObjectComponentProps={{
|
|
79
|
+
needShowInsertSQL: true,
|
|
80
|
+
needShowReqCondition: true,
|
|
81
|
+
// 也可以传递其他 RuleObjectComponent 支持的属性
|
|
82
|
+
onlyCondition: false
|
|
83
|
+
}}
|
|
84
|
+
saveUrl="/api/custom/save/rule" // 可选:自定义保存接口
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 注意事项
|
|
92
|
+
|
|
93
|
+
1. **数据依赖**:该组件强依赖后端接口(如 `/basic/ruleTemplate/`等),请确保后端服务正常且接口地址匹配。
|
|
94
|
+
2. **Ref 引用**:组件暴露了 `handleSave` 方法,父组件需要通过 `ref` 来触发保存操作。
|
|
95
|
+
3. **模式区别**:
|
|
96
|
+
* `type="instance"`:会根据 `id` 和 `extStrField01` 加载已保存的规则实例数据。
|
|
97
|
+
* `type` 为空:主要用于设计规则模板本身,加载的是模板定义数据。
|
package/src/index.ts
CHANGED
|
@@ -43,8 +43,17 @@ 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';
|
|
47
|
+
export { default as TrialCalculation} from './components/Business/TrialCalculation';
|
|
48
|
+
|
|
49
|
+
export { processDetailButtonsVisible as processDetailButtonsVisible } from './components/Business/DetailPageWrapper';
|
|
50
|
+
|
|
51
|
+
|
|
46
52
|
|
|
47
53
|
// 通用组件
|
|
48
54
|
export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
|
|
49
55
|
export { default as Section } from './components/Common/Section';
|
|
50
56
|
export { default as ParagraphCopier } from './components/Common/ParagraphCopier';
|
|
57
|
+
|
|
58
|
+
export { default as SystemLog } from './components/Business/SystemLog';
|
|
59
|
+
export * from './components/Business/ImportExport';
|
package/src/utils/auth.ts
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import { getMenuAuthDataKey } from '
|
|
1
|
+
import { getLimitMenuDataKey, getMenuAuthDataKey } from './LocalstorageUtils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 根据上游权限编码获取关联的导入导出业务功能编码。
|
|
5
|
+
*/
|
|
6
|
+
export const getRelationTemplateCode = (authCode: string): string => {
|
|
7
|
+
if (!authCode) return '';
|
|
8
|
+
|
|
9
|
+
let menuData: any[] = [];
|
|
10
|
+
try {
|
|
11
|
+
const storedMenuData = JSON.parse(
|
|
12
|
+
localStorage.getItem(getLimitMenuDataKey()) || '[]',
|
|
13
|
+
);
|
|
14
|
+
menuData = Array.isArray(storedMenuData) ? storedMenuData : [];
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let buttonDataList: any[] = [];
|
|
20
|
+
/**
|
|
21
|
+
* 递归收集叶子菜单下的按钮配置。
|
|
22
|
+
*/
|
|
23
|
+
const collectButtons = (items: any[]) => {
|
|
24
|
+
items.forEach((item: any) => {
|
|
25
|
+
if (item?.children?.length) {
|
|
26
|
+
collectButtons(item.children);
|
|
27
|
+
} else {
|
|
28
|
+
buttonDataList = [...buttonDataList, ...(item?.buttons || [])];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
collectButtons(menuData);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
buttonDataList.find((item) => item.bizCode === authCode)
|
|
36
|
+
?.relationExcelTemplateCode || ''
|
|
37
|
+
);
|
|
38
|
+
};
|
|
2
39
|
|
|
3
40
|
// 判断某个按钮/菜单 是否有权限,返回布尔值
|
|
4
41
|
export const authFunc = (code: string) => {
|
|
@@ -36,4 +73,4 @@ export const handleJudgeAuthButtons = (buttonCodeArray: any[]) => {
|
|
|
36
73
|
export const shouldUseAuth = () => {
|
|
37
74
|
// @ts-ignore
|
|
38
75
|
return window.__POWERED_BY_WUJIE__ ? true : false;
|
|
39
|
-
};
|
|
76
|
+
};
|
package/src/utils/utils.ts
CHANGED
|
@@ -267,4 +267,44 @@ export const handleConvertResponse = (items: any, total: number): object => {
|
|
|
267
267
|
|
|
268
268
|
export const noEmptyArray = (targetObj: any) => {
|
|
269
269
|
return Array.isArray(targetObj) && targetObj.length !== 0;
|
|
270
|
-
};
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const formContainerAndItemLayout = (type: string, title: any, name: string) => {
|
|
273
|
+
return type === 'form' ? {
|
|
274
|
+
container: {
|
|
275
|
+
type: 'card',
|
|
276
|
+
props: {
|
|
277
|
+
title,
|
|
278
|
+
id: Math.random(),
|
|
279
|
+
level: 1,
|
|
280
|
+
name
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
itemLayout: {
|
|
284
|
+
span: 8, // span表示每项所占的栅格数
|
|
285
|
+
labelCol: {
|
|
286
|
+
span: 8,
|
|
287
|
+
},
|
|
288
|
+
wrapperCol: {
|
|
289
|
+
span: 18,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
} : {
|
|
293
|
+
container: {
|
|
294
|
+
type: 'card',
|
|
295
|
+
props: {
|
|
296
|
+
title,
|
|
297
|
+
id: Math.random(),
|
|
298
|
+
level: 1,
|
|
299
|
+
bordered: null,
|
|
300
|
+
isWhiteCard: true,
|
|
301
|
+
name
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
itemLayout: {
|
|
305
|
+
wrapperCol: {
|
|
306
|
+
span: 0,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
}
|
|
310
|
+
}
|