@bit-sun/business-component 4.2.0-alpha.1 → 4.2.0-alpha.10
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/.umirc.ts +9 -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/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/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/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 +3 -0
- package/dist/index.esm.js +1909 -1186
- package/dist/index.js +1908 -1181
- package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
- package/dist/utils/TableUtils.d.ts +18 -19
- package/dist/utils/utils.d.ts +41 -0
- package/docs/flow-control-readme.md +283 -0
- package/package.json +1 -1
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +0 -1
- package/src/components/Business/BsSulaQueryTable/index.md +57 -4
- package/src/components/Business/BsSulaQueryTable/index.tsx +164 -7
- 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/SearchSelect/BusinessUtils.tsx +363 -41
- package/src/components/Business/SystemLog/index.md +37 -0
- package/src/components/Business/SystemLog/index.tsx +87 -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 +92 -0
- package/src/components/Functional/DataValidation/index.tsx +22 -3
- package/src/components/Functional/QueryMutipleInput/index.tsx +1 -1
- package/src/components/Functional/SearchSelect/index.tsx +68 -10
- package/src/components/Functional/SearchSelect/utils.tsx +4 -1
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +9 -1
- package/src/components/Solution/RuleComponent/RenderCompItem_README.md +189 -0
- package/src/components/Solution/RuleComponent/index.js +1 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +25 -1
- package/src/index.ts +7 -0
- package/src/utils/utils.ts +41 -1
|
@@ -38,14 +38,14 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
|
|
|
38
38
|
} | {
|
|
39
39
|
title: string;
|
|
40
40
|
dataIndex: string;
|
|
41
|
-
render: (text: any, record: any) =>
|
|
41
|
+
render: (text: any, record: any) => JSX.Element;
|
|
42
42
|
className?: undefined;
|
|
43
43
|
width?: undefined;
|
|
44
44
|
} | {
|
|
45
45
|
title: string;
|
|
46
46
|
dataIndex: string;
|
|
47
47
|
className: string;
|
|
48
|
-
render: () =>
|
|
48
|
+
render: () => JSX.Element;
|
|
49
49
|
width?: undefined;
|
|
50
50
|
})[];
|
|
51
51
|
showModal: () => void;
|
|
@@ -53,13 +53,13 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
|
|
|
53
53
|
handleCancel: (e: React.MouseEvent<HTMLElement>) => void;
|
|
54
54
|
handleTableHeadHidden: (title: string) => void;
|
|
55
55
|
onSortEnd: ({ oldIndex, newIndex }: any) => void;
|
|
56
|
-
DraggableContainer: (props: any) =>
|
|
57
|
-
DraggableBodyRow: ({ className, style, ...restProps }: any) =>
|
|
56
|
+
DraggableContainer: (props: any) => JSX.Element;
|
|
57
|
+
DraggableBodyRow: ({ className, style, ...restProps }: any) => JSX.Element;
|
|
58
58
|
onChange: (e: any, title: any) => void;
|
|
59
59
|
handleReset: () => void;
|
|
60
60
|
handleResetSetting: () => Promise<unknown>;
|
|
61
61
|
onSearch: (e: any) => void;
|
|
62
62
|
onSearchSort: (e: any) => void;
|
|
63
|
-
render():
|
|
63
|
+
render(): JSX.Element;
|
|
64
64
|
}
|
|
65
65
|
export default TableColumnSetting;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import moment from 'moment';
|
|
3
2
|
type mediaListType = {
|
|
4
3
|
type: number;
|
|
@@ -49,24 +48,24 @@ declare const updateGuanDate: (requestParams: any, dateKeyParams?: any) => {
|
|
|
49
48
|
};
|
|
50
49
|
submit: any;
|
|
51
50
|
};
|
|
52
|
-
declare const textIcon: (type: string | number, text?: string) =>
|
|
53
|
-
declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) =>
|
|
54
|
-
declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) =>
|
|
55
|
-
declare const handleTextOverflow: (text: string | undefined, width?: number) =>
|
|
56
|
-
declare const handleTextLineFeed: (text: string | undefined, width?: number) =>
|
|
57
|
-
declare const handleTextTooltip: (text: any) =>
|
|
58
|
-
declare const handleTextBreakSpaces: (text: any) =>
|
|
59
|
-
declare const handleStatusBadge: (text: any, color: any) =>
|
|
60
|
-
declare const HandleTotalCount: (totalParams: any) =>
|
|
51
|
+
declare const textIcon: (type: string | number, text?: string) => JSX.Element | undefined;
|
|
52
|
+
declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
|
|
53
|
+
declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
|
|
54
|
+
declare const handleTextOverflow: (text: string | undefined, width?: number) => JSX.Element;
|
|
55
|
+
declare const handleTextLineFeed: (text: string | undefined, width?: number) => JSX.Element;
|
|
56
|
+
declare const handleTextTooltip: (text: any) => JSX.Element;
|
|
57
|
+
declare const handleTextBreakSpaces: (text: any) => JSX.Element;
|
|
58
|
+
declare const handleStatusBadge: (text: any, color: any) => JSX.Element;
|
|
59
|
+
declare const HandleTotalCount: (totalParams: any) => JSX.Element;
|
|
61
60
|
declare const handleCommonTimeRender: (text: any, format?: any) => any;
|
|
62
|
-
declare const handleTooltip: (text: any, timeTrue?: boolean) =>
|
|
63
|
-
declare const handleTooltipHours: (text: any, timeTrue?: boolean) =>
|
|
61
|
+
declare const handleTooltip: (text: any, timeTrue?: boolean) => JSX.Element;
|
|
62
|
+
declare const handleTooltipHours: (text: any, timeTrue?: boolean) => JSX.Element;
|
|
64
63
|
type tableColumnsImageType = {
|
|
65
64
|
width?: number | string;
|
|
66
65
|
height?: number | string;
|
|
67
66
|
[key: string]: any;
|
|
68
67
|
};
|
|
69
|
-
declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) =>
|
|
68
|
+
declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) => JSX.Element;
|
|
70
69
|
interface ColumnsEditInterfave {
|
|
71
70
|
text?: string;
|
|
72
71
|
record?: any;
|
|
@@ -82,7 +81,7 @@ interface ColumnsEditInterfave {
|
|
|
82
81
|
};
|
|
83
82
|
[key: string]: any;
|
|
84
83
|
}
|
|
85
|
-
declare const ColumnsEdit: (props: ColumnsEditInterfave) =>
|
|
84
|
+
declare const ColumnsEdit: (props: ColumnsEditInterfave) => JSX.Element;
|
|
86
85
|
type UserColumnsType = {
|
|
87
86
|
name: string;
|
|
88
87
|
department?: string;
|
|
@@ -90,13 +89,13 @@ type UserColumnsType = {
|
|
|
90
89
|
company?: string;
|
|
91
90
|
avatar?: string;
|
|
92
91
|
};
|
|
93
|
-
declare const userColumns: (props: UserColumnsType) =>
|
|
94
|
-
declare const userInfoCard: (props: any) =>
|
|
92
|
+
declare const userColumns: (props: UserColumnsType) => JSX.Element;
|
|
93
|
+
declare const userInfoCard: (props: any) => JSX.Element;
|
|
95
94
|
declare const getItemDefaultWidth: (item: any) => number;
|
|
96
|
-
declare const sulaTableRenderTooltip: ({ text }: any) =>
|
|
95
|
+
declare const sulaTableRenderTooltip: ({ text }: any) => JSX.Element;
|
|
97
96
|
declare const renderNumberText: ({ text }: any) => any;
|
|
98
97
|
declare const renderFixed2: (text: any) => any;
|
|
99
|
-
declare const handleTextWarpCustom: (text: any, style?: {}) =>
|
|
98
|
+
declare const handleTextWarpCustom: (text: any, style?: {}) => JSX.Element;
|
|
100
99
|
declare const calculateValidPeriod: (start: any, end: any) => string;
|
|
101
|
-
declare const handleTextWarp: (text: any) =>
|
|
100
|
+
declare const handleTextWarp: (text: any) => JSX.Element;
|
|
102
101
|
export { getSkuImg, updateGuanDate, textIcon, handleTextDoubleOrId, handleTextDouble, handleTextOverflow, handleTextLineFeed, handleTextTooltip, handleTextBreakSpaces, handleStatusBadge, HandleTotalCount, handleTooltip, handleCommonTimeRender, handleTooltipHours, tableColumnsImage, ColumnsEdit, userColumns, userInfoCard, getItemDefaultWidth, renderNumberText, sulaTableRenderTooltip, renderFixed2, handleTextWarpCustom, handleTextWarp, calculateValidPeriod };
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -31,3 +31,44 @@ export declare const randomString: (len?: any) => string;
|
|
|
31
31
|
export declare const createUniqID: (length: any) => string;
|
|
32
32
|
export declare const handleConvertResponse: (items: any, total: number) => object;
|
|
33
33
|
export declare const noEmptyArray: (targetObj: any) => boolean;
|
|
34
|
+
export declare const formContainerAndItemLayout: (type: string, title: any, name: string) => {
|
|
35
|
+
container: {
|
|
36
|
+
type: string;
|
|
37
|
+
props: {
|
|
38
|
+
title: any;
|
|
39
|
+
id: number;
|
|
40
|
+
level: number;
|
|
41
|
+
name: string;
|
|
42
|
+
bordered?: undefined;
|
|
43
|
+
isWhiteCard?: undefined;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
itemLayout: {
|
|
47
|
+
span: number;
|
|
48
|
+
labelCol: {
|
|
49
|
+
span: number;
|
|
50
|
+
};
|
|
51
|
+
wrapperCol: {
|
|
52
|
+
span: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
container: {
|
|
57
|
+
type: string;
|
|
58
|
+
props: {
|
|
59
|
+
title: any;
|
|
60
|
+
id: number;
|
|
61
|
+
level: number;
|
|
62
|
+
bordered: null;
|
|
63
|
+
isWhiteCard: boolean;
|
|
64
|
+
name: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
itemLayout: {
|
|
68
|
+
wrapperCol: {
|
|
69
|
+
span: number;
|
|
70
|
+
};
|
|
71
|
+
span?: undefined;
|
|
72
|
+
labelCol?: undefined;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,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
|
@@ -20,7 +20,6 @@ import { arrayMoveImmutable } from 'array-move';
|
|
|
20
20
|
import close from '../../../assets/close.svg';
|
|
21
21
|
import drag from '../../../assets/drag.svg';
|
|
22
22
|
import shezhi from '../../../assets/icon-shezhi.svg';
|
|
23
|
-
import shezhi from '../../../assets/icon-shezhi.svg';
|
|
24
23
|
import './index.less';
|
|
25
24
|
import ENUM from '@/utils/enumConfig';
|
|
26
25
|
import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
|
|
@@ -16,11 +16,32 @@ order: 1
|
|
|
16
16
|
### BsSulaQueryTable
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
19
|
-
import React, { useState } from 'react';
|
|
20
|
-
import { Tabs } from 'antd';
|
|
19
|
+
import React, { useState, useEffect } from 'react';
|
|
20
|
+
import { Tabs, Button } from 'antd';
|
|
21
21
|
import { BsSulaQueryTable } from '../../../index.ts';
|
|
22
22
|
|
|
23
23
|
export default () => {
|
|
24
|
+
const [rows, setRows] = useState([]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
window.__POWERED_BY_WUJIE__ = true;
|
|
28
|
+
const flowConfig = [
|
|
29
|
+
{
|
|
30
|
+
tradeType: 180,
|
|
31
|
+
controlButtons: ['DRP_Sale_Order_edit'],
|
|
32
|
+
config: [
|
|
33
|
+
{ fromStatus: 1, buttons: ['DRP_Sale_Order_edit'] },
|
|
34
|
+
{ fromStatus: 25, buttons: [] },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
localStorage.setItem('BUSINESS_FLOW_BUTTONS', JSON.stringify(flowConfig));
|
|
39
|
+
const authCodes = [
|
|
40
|
+
'User_ApplicationList_add',
|
|
41
|
+
'DRP_Sale_Order_edit',
|
|
42
|
+
];
|
|
43
|
+
localStorage.setItem('menuAuth_mainProject', JSON.stringify(authCodes));
|
|
44
|
+
}, []);
|
|
24
45
|
const config = {
|
|
25
46
|
needPageHeader: false,
|
|
26
47
|
remoteDataSource: {
|
|
@@ -38,7 +59,8 @@ export default () => {
|
|
|
38
59
|
return {
|
|
39
60
|
...item,
|
|
40
61
|
id: `${index}`,
|
|
41
|
-
orderStatus: index ===
|
|
62
|
+
orderStatus: index % 2 === 0 ? 1 : 25,
|
|
63
|
+
saleInfo: { tradeStatus: index % 2 === 0 ? 1 : 25 },
|
|
42
64
|
name: `${item.name.first} ${item.name.last}`,
|
|
43
65
|
};
|
|
44
66
|
}),
|
|
@@ -73,6 +95,14 @@ export default () => {
|
|
|
73
95
|
},
|
|
74
96
|
action: ['refreshTable'],
|
|
75
97
|
},
|
|
98
|
+
{
|
|
99
|
+
type: 'button',
|
|
100
|
+
code: 'User_ApplicationList_delete',
|
|
101
|
+
props: {
|
|
102
|
+
children: '删除',
|
|
103
|
+
},
|
|
104
|
+
action: ['refreshTable'],
|
|
105
|
+
},
|
|
76
106
|
],
|
|
77
107
|
fields: [
|
|
78
108
|
{
|
|
@@ -191,6 +221,28 @@ export default () => {
|
|
|
191
221
|
key: 'email3',
|
|
192
222
|
title: '邮箱3',
|
|
193
223
|
},
|
|
224
|
+
{
|
|
225
|
+
key: 'operate',
|
|
226
|
+
title: '操作',
|
|
227
|
+
isPermissionColumn: true,
|
|
228
|
+
fixed: 'right',
|
|
229
|
+
render: [
|
|
230
|
+
{
|
|
231
|
+
type: 'link',
|
|
232
|
+
props: {
|
|
233
|
+
children: '编辑',
|
|
234
|
+
type: 'primary',
|
|
235
|
+
},
|
|
236
|
+
visible: '#{record.saleInfo.tradeStatus == 1}',
|
|
237
|
+
code: 'DRP_Sale_Order_edit',
|
|
238
|
+
action: {
|
|
239
|
+
type: 'route',
|
|
240
|
+
path: '/sales-management/sales-order/edit/#{record.id}',
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
],
|
|
245
|
+
},
|
|
194
246
|
],
|
|
195
247
|
rowSelection: {
|
|
196
248
|
onChange: (rowKey: any, rows: any) => {
|
|
@@ -199,6 +251,8 @@ export default () => {
|
|
|
199
251
|
},
|
|
200
252
|
},
|
|
201
253
|
rowKey: 'id',
|
|
254
|
+
tradeType: 180,
|
|
255
|
+
statusFieldPath: 'saleInfo.tradeStatus',
|
|
202
256
|
tableProps: {
|
|
203
257
|
initialPaging: {
|
|
204
258
|
pagination: {
|
|
@@ -216,4 +270,3 @@ export default () => {
|
|
|
216
270
|
);
|
|
217
271
|
};
|
|
218
272
|
```
|
|
219
|
-
|