@coding-flow/flow-pc-approval 0.0.1
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/LICENSE +201 -0
- package/README.md +261 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +12 -0
- package/dist/api/record.d.ts +10 -0
- package/dist/api/record.js +48 -0
- package/dist/api/workflow.d.ts +3 -0
- package/dist/api/workflow.js +7 -0
- package/dist/components/flow-approval/components/action/add-audit.d.ts +8 -0
- package/dist/components/flow-approval/components/action/add-audit.js +64 -0
- package/dist/components/flow-approval/components/action/custom.d.ts +8 -0
- package/dist/components/flow-approval/components/action/custom.js +39 -0
- package/dist/components/flow-approval/components/action/delegate.d.ts +8 -0
- package/dist/components/flow-approval/components/action/delegate.js +64 -0
- package/dist/components/flow-approval/components/action/factory.d.ts +11 -0
- package/dist/components/flow-approval/components/action/factory.js +34 -0
- package/dist/components/flow-approval/components/action/pass.d.ts +8 -0
- package/dist/components/flow-approval/components/action/pass.js +88 -0
- package/dist/components/flow-approval/components/action/reject.d.ts +8 -0
- package/dist/components/flow-approval/components/action/reject.js +67 -0
- package/dist/components/flow-approval/components/action/return.d.ts +8 -0
- package/dist/components/flow-approval/components/action/return.js +64 -0
- package/dist/components/flow-approval/components/action/revoke.d.ts +1 -0
- package/dist/components/flow-approval/components/action/revoke.js +26 -0
- package/dist/components/flow-approval/components/action/save.d.ts +8 -0
- package/dist/components/flow-approval/components/action/save.js +20 -0
- package/dist/components/flow-approval/components/action/transfer.d.ts +8 -0
- package/dist/components/flow-approval/components/action/transfer.js +64 -0
- package/dist/components/flow-approval/components/action/type.d.ts +5 -0
- package/dist/components/flow-approval/components/action/type.js +0 -0
- package/dist/components/flow-approval/components/action/urge.d.ts +1 -0
- package/dist/components/flow-approval/components/action/urge.js +23 -0
- package/dist/components/flow-approval/components/custom-style-button.d.ts +9 -0
- package/dist/components/flow-approval/components/custom-style-button.js +41 -0
- package/dist/components/flow-approval/components/flow-node-history.d.ts +9 -0
- package/dist/components/flow-approval/components/flow-node-history.js +37 -0
- package/dist/components/flow-approval/components/flow-time-node.d.ts +13 -0
- package/dist/components/flow-approval/components/flow-time-node.js +145 -0
- package/dist/components/flow-approval/components/form-view-component.d.ts +6 -0
- package/dist/components/flow-approval/components/form-view-component.js +68 -0
- package/dist/components/flow-approval/index.d.ts +14 -0
- package/dist/components/flow-approval/index.js +37 -0
- package/dist/components/flow-approval/layout/body.d.ts +1 -0
- package/dist/components/flow-approval/layout/body.js +150 -0
- package/dist/components/flow-approval/layout/header.d.ts +1 -0
- package/dist/components/flow-approval/layout/header.js +74 -0
- package/dist/components/flow-approval/layout/index.d.ts +3 -0
- package/dist/components/flow-approval/layout/index.js +32 -0
- package/dist/components/flow-approval/typings/index.d.ts +5 -0
- package/dist/components/flow-approval/typings/index.js +6 -0
- package/dist/components/flow-mock/components/todo.d.ts +6 -0
- package/dist/components/flow-mock/components/todo.js +205 -0
- package/dist/components/flow-mock/hooks/use-mock-presenter.d.ts +5 -0
- package/dist/components/flow-mock/hooks/use-mock-presenter.js +24 -0
- package/dist/components/flow-mock/index.d.ts +1 -0
- package/dist/components/flow-mock/index.js +18 -0
- package/dist/components/flow-mock/model.d.ts +5 -0
- package/dist/components/flow-mock/model.js +11 -0
- package/dist/components/flow-mock/presenter.d.ts +11 -0
- package/dist/components/flow-mock/presenter.js +28 -0
- package/dist/components/flow-mock/types.d.ts +4 -0
- package/dist/components/flow-mock/types.js +0 -0
- package/dist/components/flow-title/index.d.ts +6 -0
- package/dist/components/flow-title/index.js +8 -0
- package/dist/components/workflow-select-modal/index.d.ts +8 -0
- package/dist/components/workflow-select-modal/index.js +32 -0
- package/dist/favicon.png +0 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/plugins/view/add-audit-view.d.ts +3 -0
- package/dist/plugins/view/add-audit-view.js +32 -0
- package/dist/plugins/view/delegate-view.d.ts +3 -0
- package/dist/plugins/view/delegate-view.js +32 -0
- package/dist/plugins/view/return-view.d.ts +3 -0
- package/dist/plugins/view/return-view.js +39 -0
- package/dist/plugins/view/sign-key-view.d.ts +3 -0
- package/dist/plugins/view/sign-key-view.js +21 -0
- package/dist/plugins/view/transfer-view.d.ts +3 -0
- package/dist/plugins/view/transfer-view.js +32 -0
- package/package.json +57 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CheckCircleFilled, ClockCircleOutlined, SyncOutlined } from "@ant-design/icons";
|
|
3
|
+
import { Tag, Typography } from "antd";
|
|
4
|
+
import "react";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
const { Text } = Typography;
|
|
7
|
+
const getStatusConfig = (status)=>{
|
|
8
|
+
switch(status){
|
|
9
|
+
case 'completed':
|
|
10
|
+
return {
|
|
11
|
+
color: 'success',
|
|
12
|
+
label: '已审批',
|
|
13
|
+
icon: /*#__PURE__*/ jsx(CheckCircleFilled, {
|
|
14
|
+
style: {
|
|
15
|
+
color: '#52c41a',
|
|
16
|
+
fontSize: 16
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
case 'current':
|
|
21
|
+
return {
|
|
22
|
+
color: 'processing',
|
|
23
|
+
label: '待审批',
|
|
24
|
+
icon: /*#__PURE__*/ jsx(SyncOutlined, {
|
|
25
|
+
spin: true,
|
|
26
|
+
style: {
|
|
27
|
+
color: '#1890ff',
|
|
28
|
+
fontSize: 16
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
case 'pending':
|
|
33
|
+
return {
|
|
34
|
+
color: 'default',
|
|
35
|
+
label: '未执行',
|
|
36
|
+
icon: /*#__PURE__*/ jsx(ClockCircleOutlined, {
|
|
37
|
+
style: {
|
|
38
|
+
color: '#d9d9d9',
|
|
39
|
+
fontSize: 16
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const getNodeStatus = (node)=>{
|
|
46
|
+
if (-1 === node.state) return 'completed';
|
|
47
|
+
if (0 === node.state) return 'current';
|
|
48
|
+
return 'pending';
|
|
49
|
+
};
|
|
50
|
+
const FlowOperatorItem = (props)=>{
|
|
51
|
+
const operator = props.operator;
|
|
52
|
+
const state = props.state;
|
|
53
|
+
if (-1 === state) return /*#__PURE__*/ jsxs(Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ jsxs(Text, {
|
|
56
|
+
type: "secondary",
|
|
57
|
+
style: {
|
|
58
|
+
fontSize: 12
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
"审批人: ",
|
|
62
|
+
operator.flowOperator.name
|
|
63
|
+
]
|
|
64
|
+
}),
|
|
65
|
+
operator.approveTime > 0 && /*#__PURE__*/ jsxs(Text, {
|
|
66
|
+
type: "secondary",
|
|
67
|
+
style: {
|
|
68
|
+
fontSize: 12
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
dayjs(operator.approveTime).format('YYYY-MM-DD HH:mm:ss'),
|
|
72
|
+
" ",
|
|
73
|
+
operator.actionName
|
|
74
|
+
]
|
|
75
|
+
}),
|
|
76
|
+
operator.advice && /*#__PURE__*/ jsx("div", {
|
|
77
|
+
style: {
|
|
78
|
+
padding: 8,
|
|
79
|
+
backgroundColor: '#fafafa',
|
|
80
|
+
borderRadius: 4,
|
|
81
|
+
marginTop: 4
|
|
82
|
+
},
|
|
83
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
84
|
+
type: "secondary",
|
|
85
|
+
style: {
|
|
86
|
+
fontSize: 12
|
|
87
|
+
},
|
|
88
|
+
children: operator.advice
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/ jsxs(Text, {
|
|
94
|
+
type: "secondary",
|
|
95
|
+
style: {
|
|
96
|
+
fontSize: 12
|
|
97
|
+
},
|
|
98
|
+
children: [
|
|
99
|
+
"待审批人: ",
|
|
100
|
+
operator.flowOperator.name
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const FlowTimeNode = (props)=>{
|
|
105
|
+
const node = props.node;
|
|
106
|
+
const operators = node.operators || [];
|
|
107
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
108
|
+
style: {
|
|
109
|
+
display: 'flex',
|
|
110
|
+
flexDirection: 'column',
|
|
111
|
+
gap: 4,
|
|
112
|
+
width: '100%'
|
|
113
|
+
},
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ jsxs("div", {
|
|
116
|
+
style: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
gap: 8
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
/*#__PURE__*/ jsx(Text, {
|
|
123
|
+
strong: true,
|
|
124
|
+
style: {
|
|
125
|
+
fontSize: 14
|
|
126
|
+
},
|
|
127
|
+
children: node.nodeName
|
|
128
|
+
}),
|
|
129
|
+
/*#__PURE__*/ jsx(Tag, {
|
|
130
|
+
color: getStatusConfig(getNodeStatus(node)).color,
|
|
131
|
+
style: {
|
|
132
|
+
margin: 0
|
|
133
|
+
},
|
|
134
|
+
children: getStatusConfig(getNodeStatus(node)).label
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
operators.map((operator)=>/*#__PURE__*/ jsx(FlowOperatorItem, {
|
|
139
|
+
operator: operator,
|
|
140
|
+
state: node.state
|
|
141
|
+
}))
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
export { FlowTimeNode, getNodeStatus, getStatusConfig };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Form } from "antd";
|
|
6
|
+
import { FlowFormView } from "@coding-flow/flow-pc-form";
|
|
7
|
+
const FormViewComponent = (props)=>{
|
|
8
|
+
const { state, context } = useApprovalContext();
|
|
9
|
+
const review = state.review || false;
|
|
10
|
+
const ViewComponent = ViewBindPlugin.getInstance().get(state.flow?.view || 'default') || FlowFormView;
|
|
11
|
+
const flowForm = state.flow?.form;
|
|
12
|
+
const fieldPermissions = state.flow?.fieldPermissions || [];
|
|
13
|
+
const mergeable = state.flow?.mergeable || false;
|
|
14
|
+
const todos = state.flow?.todos || [];
|
|
15
|
+
const formList = todos.length > 0 ? todos.map((item)=>({
|
|
16
|
+
form: Form.useForm()[0],
|
|
17
|
+
data: item
|
|
18
|
+
})) : [
|
|
19
|
+
{
|
|
20
|
+
form: Form.useForm()[0],
|
|
21
|
+
data: void 0
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
react.useEffect(()=>{
|
|
25
|
+
formList.forEach((item)=>{
|
|
26
|
+
const formInstance = item.form;
|
|
27
|
+
const formRecord = item.data?.data;
|
|
28
|
+
context.getPresenter().getFormActionContext().addAction({
|
|
29
|
+
save: ()=>formInstance.getFieldsValue(),
|
|
30
|
+
key: ()=>'view-form',
|
|
31
|
+
validate: ()=>new Promise((resolve, reject)=>{
|
|
32
|
+
formInstance.validateFields().then(resolve).catch(reject);
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
formInstance.resetFields();
|
|
36
|
+
formInstance.setFieldsValue({
|
|
37
|
+
...formRecord,
|
|
38
|
+
recordId: item.data?.recordId
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
42
|
+
const handleMergeRecordIdsSelected = (recordIds)=>{
|
|
43
|
+
context.getPresenter().getFlowActionPresenter().setSubmitRecordIds(recordIds);
|
|
44
|
+
};
|
|
45
|
+
if (ViewComponent && flowForm) {
|
|
46
|
+
if (mergeable) return /*#__PURE__*/ jsx(ViewComponent, {
|
|
47
|
+
mergeable: mergeable,
|
|
48
|
+
fieldPermissions: fieldPermissions,
|
|
49
|
+
review: review,
|
|
50
|
+
meta: flowForm,
|
|
51
|
+
formList: formList,
|
|
52
|
+
onValuesChange: props.onValuesChange,
|
|
53
|
+
onMergeRecordIdsSelected: handleMergeRecordIdsSelected
|
|
54
|
+
});
|
|
55
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
56
|
+
children: formList.map((item, index)=>/*#__PURE__*/ jsx(ViewComponent, {
|
|
57
|
+
data: item.data,
|
|
58
|
+
mergeable: mergeable,
|
|
59
|
+
fieldPermissions: fieldPermissions,
|
|
60
|
+
review: review,
|
|
61
|
+
meta: flowForm,
|
|
62
|
+
form: item.form,
|
|
63
|
+
onValuesChange: props.onValuesChange
|
|
64
|
+
}, index))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export { FormViewComponent };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ApprovalPanelProps {
|
|
3
|
+
workflowCode?: string;
|
|
4
|
+
recordId?: string;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
review?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ApprovalPanel: React.FC<ApprovalPanelProps>;
|
|
9
|
+
interface ApprovalPanelDrawerProps extends ApprovalPanelProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ApprovalPanelDrawer: React.FC<ApprovalPanelDrawerProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Drawer } from "@coding-flow/flow-pc-ui";
|
|
4
|
+
import { detail } from "../../api/record.js";
|
|
5
|
+
import { ApprovalLayout } from "./layout/index.js";
|
|
6
|
+
import { useMockContext } from "@coding-flow/flow-approval-presenter";
|
|
7
|
+
const ApprovalPanel = (props)=>{
|
|
8
|
+
const [content, dispatch] = react.useState(void 0);
|
|
9
|
+
const mockKey = useMockContext();
|
|
10
|
+
react.useEffect(()=>{
|
|
11
|
+
const id = props.recordId || props.workflowCode || '';
|
|
12
|
+
detail(id, mockKey).then((res)=>{
|
|
13
|
+
if (res.success) dispatch(res.data);
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
return /*#__PURE__*/ jsx("div", {
|
|
17
|
+
children: content && /*#__PURE__*/ jsx(ApprovalLayout, {
|
|
18
|
+
content: content,
|
|
19
|
+
onClose: props.onClose,
|
|
20
|
+
review: props.review
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const ApprovalPanelDrawer = (props)=>/*#__PURE__*/ jsx(Drawer, {
|
|
25
|
+
open: props.open,
|
|
26
|
+
onClose: props.onClose,
|
|
27
|
+
styles: {
|
|
28
|
+
body: {
|
|
29
|
+
padding: 0,
|
|
30
|
+
margin: 0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
children: /*#__PURE__*/ jsx(ApprovalPanel, {
|
|
34
|
+
...props
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
export { ApprovalPanel, ApprovalPanelDrawer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Body: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react, { useState } from "react";
|
|
3
|
+
import { FormViewComponent } from "../components/form-view-component.js";
|
|
4
|
+
import { FlowNodeHistory } from "../components/flow-node-history.js";
|
|
5
|
+
import { ApprovalContentPaddingH, ApprovalContentPaddingV, ApprovalLayoutHeight, ApprovalSidebarCollapsedWidth, ApprovalSidebarWidth } from "../typings/index.js";
|
|
6
|
+
import { Button, Card, Flex, Layout, Typography } from "antd";
|
|
7
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
8
|
+
const { Sider, Content } = Layout;
|
|
9
|
+
const { Title } = Typography;
|
|
10
|
+
const Body = ()=>{
|
|
11
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
12
|
+
const flowNodeHistoryAction = react.useRef(null);
|
|
13
|
+
const handleValuesChange = (values)=>{
|
|
14
|
+
flowNodeHistoryAction.current?.refresh();
|
|
15
|
+
};
|
|
16
|
+
return /*#__PURE__*/ jsxs(Layout, {
|
|
17
|
+
style: {
|
|
18
|
+
padding: `${ApprovalContentPaddingV}px ${ApprovalContentPaddingH}px`,
|
|
19
|
+
backgroundColor: '#f5f5f5',
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: `calc(100vh - ${ApprovalLayoutHeight}px)`
|
|
22
|
+
},
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(Content, {
|
|
25
|
+
style: {
|
|
26
|
+
overflow: 'auto',
|
|
27
|
+
width: '100%'
|
|
28
|
+
},
|
|
29
|
+
children: /*#__PURE__*/ jsx(Card, {
|
|
30
|
+
style: {
|
|
31
|
+
height: '100%',
|
|
32
|
+
borderRadius: 8
|
|
33
|
+
},
|
|
34
|
+
styles: {
|
|
35
|
+
body: {
|
|
36
|
+
padding: 24
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
children: /*#__PURE__*/ jsx(FormViewComponent, {
|
|
40
|
+
onValuesChange: handleValuesChange
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsxs(Sider, {
|
|
45
|
+
width: ApprovalSidebarWidth,
|
|
46
|
+
collapsedWidth: ApprovalSidebarCollapsedWidth,
|
|
47
|
+
collapsible: true,
|
|
48
|
+
collapsed: collapsed,
|
|
49
|
+
onCollapse: setCollapsed,
|
|
50
|
+
trigger: null,
|
|
51
|
+
style: {
|
|
52
|
+
marginLeft: "8px",
|
|
53
|
+
backgroundColor: '#fff',
|
|
54
|
+
borderRadius: 8,
|
|
55
|
+
overflow: 'hidden'
|
|
56
|
+
},
|
|
57
|
+
children: [
|
|
58
|
+
!collapsed && /*#__PURE__*/ jsxs(Flex, {
|
|
59
|
+
vertical: true,
|
|
60
|
+
style: {
|
|
61
|
+
height: '100%'
|
|
62
|
+
},
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ jsxs(Flex, {
|
|
65
|
+
justify: "space-between",
|
|
66
|
+
align: "center",
|
|
67
|
+
style: {
|
|
68
|
+
padding: '16px 24px',
|
|
69
|
+
borderBottom: '1px solid #f0f0f0',
|
|
70
|
+
backgroundColor: '#fafafa'
|
|
71
|
+
},
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ jsx(Title, {
|
|
74
|
+
level: 5,
|
|
75
|
+
style: {
|
|
76
|
+
margin: 0,
|
|
77
|
+
fontSize: 15
|
|
78
|
+
},
|
|
79
|
+
children: "流程记录"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsx(Button, {
|
|
82
|
+
type: "text",
|
|
83
|
+
size: "small",
|
|
84
|
+
icon: /*#__PURE__*/ jsx(LeftOutlined, {
|
|
85
|
+
style: {
|
|
86
|
+
fontSize: 12
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
onClick: ()=>setCollapsed(true),
|
|
90
|
+
style: {
|
|
91
|
+
color: '#8c8c8c'
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx("div", {
|
|
97
|
+
style: {
|
|
98
|
+
padding: 16,
|
|
99
|
+
flex: 1,
|
|
100
|
+
overflow: 'auto'
|
|
101
|
+
},
|
|
102
|
+
children: /*#__PURE__*/ jsx(FlowNodeHistory, {
|
|
103
|
+
actionRef: flowNodeHistoryAction
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
collapsed && /*#__PURE__*/ jsxs(Flex, {
|
|
109
|
+
vertical: true,
|
|
110
|
+
align: "center",
|
|
111
|
+
justify: "center",
|
|
112
|
+
gap: 16,
|
|
113
|
+
style: {
|
|
114
|
+
height: '100%',
|
|
115
|
+
padding: '12px 8px',
|
|
116
|
+
backgroundColor: '#fafafa'
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ jsx(Button, {
|
|
120
|
+
type: "text",
|
|
121
|
+
size: "small",
|
|
122
|
+
icon: /*#__PURE__*/ jsx(RightOutlined, {
|
|
123
|
+
style: {
|
|
124
|
+
fontSize: 12
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
onClick: ()=>setCollapsed(false),
|
|
128
|
+
style: {
|
|
129
|
+
color: '#8c8c8c'
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ jsx("div", {
|
|
133
|
+
style: {
|
|
134
|
+
writingMode: 'vertical-rl',
|
|
135
|
+
textOrientation: 'mixed',
|
|
136
|
+
letterSpacing: 4,
|
|
137
|
+
fontSize: 14,
|
|
138
|
+
fontWeight: 500,
|
|
139
|
+
color: '#595959'
|
|
140
|
+
},
|
|
141
|
+
children: "流程记录"
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
export { Body };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Header: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { Button, Flex, Space, Typography, message } from "antd";
|
|
5
|
+
import { ApprovalLayoutHeight } from "../typings/index.js";
|
|
6
|
+
import { ActionFactory } from "../components/action/factory.js";
|
|
7
|
+
import { UrgeAction } from "../components/action/urge.js";
|
|
8
|
+
import { RevokeAction } from "../components/action/revoke.js";
|
|
9
|
+
import { ObjectUtils } from "@coding-flow/flow-core";
|
|
10
|
+
const { Title } = Typography;
|
|
11
|
+
const Header = ()=>{
|
|
12
|
+
const { state, context } = useApprovalContext();
|
|
13
|
+
const actions = state.flow?.actions || [];
|
|
14
|
+
const review = state?.review || false;
|
|
15
|
+
const handlerClickCheck = (id)=>{
|
|
16
|
+
if (state.flow?.mergeable) {
|
|
17
|
+
const presenter = context.getPresenter().getFlowActionPresenter();
|
|
18
|
+
const selectRecordIds = presenter.getSubmitRecordIds();
|
|
19
|
+
const currentFormData = presenter.getCurrentFormData();
|
|
20
|
+
if (ObjectUtils.isEmptyObject(currentFormData) && 0 == selectRecordIds.length) {
|
|
21
|
+
message.error('请先选择审批流程.');
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/ jsx("div", {
|
|
28
|
+
style: {
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: ApprovalLayoutHeight,
|
|
31
|
+
borderBottom: '1px solid #f0f0f0',
|
|
32
|
+
backgroundColor: '#fff'
|
|
33
|
+
},
|
|
34
|
+
children: /*#__PURE__*/ jsxs(Flex, {
|
|
35
|
+
align: "center",
|
|
36
|
+
justify: "space-between",
|
|
37
|
+
style: {
|
|
38
|
+
margin: '0 24px',
|
|
39
|
+
height: '100%'
|
|
40
|
+
},
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsx(Title, {
|
|
43
|
+
level: 4,
|
|
44
|
+
style: {
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
fontWeight: 500
|
|
47
|
+
},
|
|
48
|
+
children: state.flow?.title || '审批详情'
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ jsxs(Space, {
|
|
51
|
+
size: 8,
|
|
52
|
+
children: [
|
|
53
|
+
!review && actions.map((action)=>{
|
|
54
|
+
const FlowActionComponent = ActionFactory.getInstance().getFlowActionComponent(action);
|
|
55
|
+
if (FlowActionComponent) return /*#__PURE__*/ jsx(FlowActionComponent, {
|
|
56
|
+
action: action,
|
|
57
|
+
onClickCheck: (actionId)=>handlerClickCheck(actionId)
|
|
58
|
+
});
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ jsx(UrgeAction, {}),
|
|
61
|
+
/*#__PURE__*/ jsx(RevokeAction, {}),
|
|
62
|
+
/*#__PURE__*/ jsx(Button, {
|
|
63
|
+
onClick: ()=>{
|
|
64
|
+
context.close();
|
|
65
|
+
},
|
|
66
|
+
children: "关闭"
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export { Header };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Provider } from "react-redux";
|
|
4
|
+
import { ApprovalContext, approvalStore, createApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { Header } from "./header.js";
|
|
6
|
+
import { Body } from "./body.js";
|
|
7
|
+
const ApprovalLayoutScope = (props)=>{
|
|
8
|
+
const { context } = createApprovalContext(props);
|
|
9
|
+
return /*#__PURE__*/ jsx(ApprovalContext.Provider, {
|
|
10
|
+
value: context,
|
|
11
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
12
|
+
style: {
|
|
13
|
+
width: '100%',
|
|
14
|
+
height: '100vh',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
overflow: 'hidden'
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(Header, {}),
|
|
21
|
+
/*#__PURE__*/ jsx(Body, {})
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const ApprovalLayout = (props)=>/*#__PURE__*/ jsx(Provider, {
|
|
27
|
+
store: approvalStore,
|
|
28
|
+
children: /*#__PURE__*/ jsx(ApprovalLayoutScope, {
|
|
29
|
+
...props
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
export { ApprovalLayout };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const ApprovalLayoutHeight = 64;
|
|
2
|
+
const ApprovalContentPaddingV = 24;
|
|
3
|
+
const ApprovalContentPaddingH = 24;
|
|
4
|
+
const ApprovalSidebarWidth = 250;
|
|
5
|
+
const ApprovalSidebarCollapsedWidth = 48;
|
|
6
|
+
export { ApprovalContentPaddingH, ApprovalContentPaddingV, ApprovalLayoutHeight, ApprovalSidebarCollapsedWidth, ApprovalSidebarWidth };
|