@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,64 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Modal, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { DelegateView } from "../../../../plugins/view/delegate-view.js";
|
|
6
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
7
|
+
const DelegateAction = (props)=>{
|
|
8
|
+
const action = props.action;
|
|
9
|
+
const { context } = useApprovalContext();
|
|
10
|
+
const [form] = Form.useForm();
|
|
11
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const handleSubmit = (params)=>{
|
|
14
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
15
|
+
if (res.success) {
|
|
16
|
+
message.success("操作成功");
|
|
17
|
+
setModalVisible(false);
|
|
18
|
+
context.close();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(CustomStyleButton, {
|
|
25
|
+
display: props.action.display,
|
|
26
|
+
onClick: ()=>{
|
|
27
|
+
if (props.onClickCheck?.(action.id)) {
|
|
28
|
+
form.resetFields();
|
|
29
|
+
setModalVisible(true);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
title: action.title
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
35
|
+
title: "委派审批",
|
|
36
|
+
open: modalVisible,
|
|
37
|
+
onCancel: ()=>setModalVisible(false),
|
|
38
|
+
onOk: ()=>{
|
|
39
|
+
form.submit();
|
|
40
|
+
},
|
|
41
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
42
|
+
form: form,
|
|
43
|
+
layout: "vertical",
|
|
44
|
+
onFinish: (values)=>{
|
|
45
|
+
handleSubmit(values);
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
48
|
+
name: "forwardOperatorIds",
|
|
49
|
+
label: "委派人员",
|
|
50
|
+
required: true,
|
|
51
|
+
rules: [
|
|
52
|
+
{
|
|
53
|
+
required: true,
|
|
54
|
+
message: '委派人员不能为空'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
children: /*#__PURE__*/ jsx(DelegateView, {})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { DelegateAction };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlowActionProps } from "./type";
|
|
3
|
+
import { FlowAction } from "@coding-flow/flow-types";
|
|
4
|
+
export declare class ActionFactory {
|
|
5
|
+
private readonly cache;
|
|
6
|
+
private constructor();
|
|
7
|
+
private static readonly instance;
|
|
8
|
+
static getInstance(): ActionFactory;
|
|
9
|
+
private initActions;
|
|
10
|
+
getFlowActionComponent(action: FlowAction): React.ComponentType<FlowActionProps> | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { PassAction } from "./pass.js";
|
|
3
|
+
import { AddAuditAction } from "./add-audit.js";
|
|
4
|
+
import { CustomAction } from "./custom.js";
|
|
5
|
+
import { DelegateAction } from "./delegate.js";
|
|
6
|
+
import { RejectAction } from "./reject.js";
|
|
7
|
+
import { ReturnAction } from "./return.js";
|
|
8
|
+
import { SaveAction } from "./save.js";
|
|
9
|
+
import { TransferAction } from "./transfer.js";
|
|
10
|
+
class ActionFactory {
|
|
11
|
+
cache;
|
|
12
|
+
constructor(){
|
|
13
|
+
this.cache = new Map();
|
|
14
|
+
this.initActions();
|
|
15
|
+
}
|
|
16
|
+
static instance = new ActionFactory();
|
|
17
|
+
static getInstance() {
|
|
18
|
+
return ActionFactory.instance;
|
|
19
|
+
}
|
|
20
|
+
initActions() {
|
|
21
|
+
this.cache.set("ADD_AUDIT", AddAuditAction);
|
|
22
|
+
this.cache.set("CUSTOM", CustomAction);
|
|
23
|
+
this.cache.set("DELEGATE", DelegateAction);
|
|
24
|
+
this.cache.set("PASS", PassAction);
|
|
25
|
+
this.cache.set("REJECT", RejectAction);
|
|
26
|
+
this.cache.set("RETURN", ReturnAction);
|
|
27
|
+
this.cache.set("SAVE", SaveAction);
|
|
28
|
+
this.cache.set("TRANSFER", TransferAction);
|
|
29
|
+
}
|
|
30
|
+
getFlowActionComponent(action) {
|
|
31
|
+
return this.cache.get(action.type);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export { ActionFactory };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Input, Modal, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
|
|
6
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
7
|
+
const { TextArea } = Input;
|
|
8
|
+
const PassAction = (props)=>{
|
|
9
|
+
const action = props.action;
|
|
10
|
+
const { state, context } = useApprovalContext();
|
|
11
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const isStartNode = state.flow?.nodeType === 'START';
|
|
14
|
+
const currentOperator = state.flow?.currentOperator;
|
|
15
|
+
const [form] = Form.useForm();
|
|
16
|
+
const handleSubmit = (params)=>{
|
|
17
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
18
|
+
if (res.success) {
|
|
19
|
+
message.success("操作成功");
|
|
20
|
+
setModalVisible(false);
|
|
21
|
+
context.close();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const adviceRules = state.flow?.adviceRequired ? [
|
|
26
|
+
{
|
|
27
|
+
required: state.flow?.adviceRequired || false,
|
|
28
|
+
message: '请输入审批意见'
|
|
29
|
+
}
|
|
30
|
+
] : [];
|
|
31
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsx(CustomStyleButton, {
|
|
34
|
+
display: props.action.display,
|
|
35
|
+
onClick: ()=>{
|
|
36
|
+
if (props.onClickCheck?.(action.id)) if (isStartNode) handleSubmit();
|
|
37
|
+
else {
|
|
38
|
+
form.resetFields();
|
|
39
|
+
setModalVisible(true);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
title: action.title
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
45
|
+
title: "审批通过",
|
|
46
|
+
open: modalVisible,
|
|
47
|
+
destroyOnHidden: true,
|
|
48
|
+
onCancel: ()=>setModalVisible(false),
|
|
49
|
+
onOk: ()=>{
|
|
50
|
+
form.submit();
|
|
51
|
+
},
|
|
52
|
+
children: /*#__PURE__*/ jsxs(Form, {
|
|
53
|
+
form: form,
|
|
54
|
+
layout: "vertical",
|
|
55
|
+
onFinish: (values)=>{
|
|
56
|
+
handleSubmit(values);
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ jsx(Form.Item, {
|
|
60
|
+
name: "advice",
|
|
61
|
+
label: "审批意见",
|
|
62
|
+
required: state.flow?.adviceRequired,
|
|
63
|
+
rules: adviceRules,
|
|
64
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
65
|
+
placeholder: "请输入审批意见"
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
state.flow?.signRequired && currentOperator && /*#__PURE__*/ jsx(Form.Item, {
|
|
69
|
+
name: "signKey",
|
|
70
|
+
label: "审批签名",
|
|
71
|
+
required: state.flow?.signRequired,
|
|
72
|
+
rules: [
|
|
73
|
+
{
|
|
74
|
+
required: true,
|
|
75
|
+
message: '请设置审批签名'
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
children: /*#__PURE__*/ jsx(SignKeyView, {
|
|
79
|
+
current: currentOperator
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
export { PassAction };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Input, Modal, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
6
|
+
const { TextArea } = Input;
|
|
7
|
+
const RejectAction = (props)=>{
|
|
8
|
+
const action = props.action;
|
|
9
|
+
const { state, context } = useApprovalContext();
|
|
10
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
11
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
12
|
+
const [form] = Form.useForm();
|
|
13
|
+
const handleSubmit = (params)=>{
|
|
14
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
15
|
+
if (res.success) {
|
|
16
|
+
message.success("操作成功");
|
|
17
|
+
setModalVisible(false);
|
|
18
|
+
context.close();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const adviceRules = state.flow?.adviceRequired ? [
|
|
23
|
+
{
|
|
24
|
+
required: state.flow?.adviceRequired || false,
|
|
25
|
+
message: '请输入审批意见'
|
|
26
|
+
}
|
|
27
|
+
] : [];
|
|
28
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
29
|
+
children: [
|
|
30
|
+
/*#__PURE__*/ jsx(CustomStyleButton, {
|
|
31
|
+
display: props.action.display,
|
|
32
|
+
onClick: ()=>{
|
|
33
|
+
if (props.onClickCheck?.(action.id)) {
|
|
34
|
+
form.resetFields();
|
|
35
|
+
setModalVisible(true);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
title: action.title
|
|
39
|
+
}),
|
|
40
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
41
|
+
title: "审批拒绝",
|
|
42
|
+
open: modalVisible,
|
|
43
|
+
onCancel: ()=>setModalVisible(false),
|
|
44
|
+
onOk: ()=>{
|
|
45
|
+
form.submit();
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
48
|
+
form: form,
|
|
49
|
+
layout: "vertical",
|
|
50
|
+
onFinish: (values)=>{
|
|
51
|
+
handleSubmit(values);
|
|
52
|
+
},
|
|
53
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
54
|
+
name: "advice",
|
|
55
|
+
label: "拒绝意见",
|
|
56
|
+
required: state.flow?.adviceRequired,
|
|
57
|
+
rules: adviceRules,
|
|
58
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
59
|
+
placeholder: "请输入拒绝意见"
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
export { RejectAction };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Modal, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { ReturnView } from "../../../../plugins/view/return-view.js";
|
|
6
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
7
|
+
const ReturnAction = (props)=>{
|
|
8
|
+
const action = props.action;
|
|
9
|
+
const { context } = useApprovalContext();
|
|
10
|
+
const [form] = Form.useForm();
|
|
11
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const handleSubmit = (params)=>{
|
|
14
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
15
|
+
if (res.success) {
|
|
16
|
+
message.success("操作成功");
|
|
17
|
+
setModalVisible(false);
|
|
18
|
+
context.close();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(CustomStyleButton, {
|
|
25
|
+
display: props.action.display,
|
|
26
|
+
onClick: ()=>{
|
|
27
|
+
if (props.onClickCheck?.(action.id)) {
|
|
28
|
+
form.resetFields();
|
|
29
|
+
setModalVisible(true);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
title: action.title
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
35
|
+
title: "退回审批",
|
|
36
|
+
open: modalVisible,
|
|
37
|
+
onCancel: ()=>setModalVisible(false),
|
|
38
|
+
onOk: ()=>{
|
|
39
|
+
form.submit();
|
|
40
|
+
},
|
|
41
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
42
|
+
form: form,
|
|
43
|
+
layout: "vertical",
|
|
44
|
+
onFinish: (values)=>{
|
|
45
|
+
handleSubmit(values);
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
48
|
+
name: "backNodeId",
|
|
49
|
+
label: "退回节点",
|
|
50
|
+
required: true,
|
|
51
|
+
rules: [
|
|
52
|
+
{
|
|
53
|
+
required: true,
|
|
54
|
+
message: '退回节点不能为空'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
children: /*#__PURE__*/ jsx(ReturnView, {})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { ReturnAction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RevokeAction: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Button, Popconfirm, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
const RevokeAction = ()=>{
|
|
6
|
+
const { state, context } = useApprovalContext();
|
|
7
|
+
const presenter = context.getPresenter().getFlowActionPresenter();
|
|
8
|
+
const revoke = state.flow?.revoke || false;
|
|
9
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
10
|
+
children: revoke && /*#__PURE__*/ jsx(Popconfirm, {
|
|
11
|
+
title: "确认要撤销审批吗?",
|
|
12
|
+
onConfirm: ()=>{
|
|
13
|
+
presenter.revoke().then((res)=>{
|
|
14
|
+
if (res.success) {
|
|
15
|
+
message.success("流程已撤回");
|
|
16
|
+
context.close();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
21
|
+
children: "撤回"
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export { RevokeAction };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
6
|
+
const SaveAction = (props)=>{
|
|
7
|
+
const action = props.action;
|
|
8
|
+
const { context } = useApprovalContext();
|
|
9
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
10
|
+
return /*#__PURE__*/ jsx(CustomStyleButton, {
|
|
11
|
+
display: props.action.display,
|
|
12
|
+
onClick: ()=>{
|
|
13
|
+
if (props.onClickCheck?.(action.id)) actionPresenter.action(action.id).then((res)=>{
|
|
14
|
+
if (res.success) message.success("流程数据已保存");
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
title: action.title
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export { SaveAction };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Modal, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { TransferView } from "../../../../plugins/view/transfer-view.js";
|
|
6
|
+
import { CustomStyleButton } from "../custom-style-button.js";
|
|
7
|
+
const TransferAction = (props)=>{
|
|
8
|
+
const action = props.action;
|
|
9
|
+
const { context } = useApprovalContext();
|
|
10
|
+
const [form] = Form.useForm();
|
|
11
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const handleSubmit = (params)=>{
|
|
14
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
15
|
+
if (res.success) {
|
|
16
|
+
message.success("操作成功");
|
|
17
|
+
setModalVisible(false);
|
|
18
|
+
context.close();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(CustomStyleButton, {
|
|
25
|
+
display: props.action.display,
|
|
26
|
+
onClick: ()=>{
|
|
27
|
+
if (props.onClickCheck?.(action.id)) {
|
|
28
|
+
form.resetFields();
|
|
29
|
+
setModalVisible(true);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
title: action.title
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
35
|
+
title: "转办审批",
|
|
36
|
+
open: modalVisible,
|
|
37
|
+
onCancel: ()=>setModalVisible(false),
|
|
38
|
+
onOk: ()=>{
|
|
39
|
+
form.submit();
|
|
40
|
+
},
|
|
41
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
42
|
+
form: form,
|
|
43
|
+
layout: "vertical",
|
|
44
|
+
onFinish: (values)=>{
|
|
45
|
+
handleSubmit(values);
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
48
|
+
name: "forwardOperatorIds",
|
|
49
|
+
label: "转办人员",
|
|
50
|
+
required: true,
|
|
51
|
+
rules: [
|
|
52
|
+
{
|
|
53
|
+
required: true,
|
|
54
|
+
message: '转办人员不能为空'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
children: /*#__PURE__*/ jsx(TransferView, {})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { TransferAction };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UrgeAction: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Button, Popconfirm, message } from "antd";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
const UrgeAction = ()=>{
|
|
6
|
+
const { state, context } = useApprovalContext();
|
|
7
|
+
const presenter = context.getPresenter().getFlowActionPresenter();
|
|
8
|
+
const urge = state.flow?.urge || false;
|
|
9
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
10
|
+
children: urge && /*#__PURE__*/ jsx(Popconfirm, {
|
|
11
|
+
title: "确认要催办审批用户吗?",
|
|
12
|
+
onConfirm: ()=>{
|
|
13
|
+
presenter.urge().then((res)=>{
|
|
14
|
+
if (res.success) message.success("已发送催办提醒.");
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
18
|
+
children: "催办"
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export { UrgeAction };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlowActionDisplay } from "@coding-flow/flow-types";
|
|
3
|
+
interface CustomStyleButtonProps {
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
title: string;
|
|
6
|
+
display: FlowActionDisplay;
|
|
7
|
+
}
|
|
8
|
+
export declare const CustomStyleButton: React.FC<CustomStyleButtonProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "antd";
|
|
3
|
+
import react from "react";
|
|
4
|
+
import { Icon } from "@coding-flow/flow-icons";
|
|
5
|
+
const CustomStyleButton = (props)=>{
|
|
6
|
+
const display = props.display;
|
|
7
|
+
const title = props.title || display.title;
|
|
8
|
+
const style = react.useMemo(()=>{
|
|
9
|
+
if (display) {
|
|
10
|
+
const data = JSON.parse(display.style);
|
|
11
|
+
if (data) {
|
|
12
|
+
let style = {};
|
|
13
|
+
if (data.backgroundColor) style = Object.assign(data, {
|
|
14
|
+
backgroundColor: `#${data.backgroundColor}`
|
|
15
|
+
});
|
|
16
|
+
if (data.borderColor) style = Object.assign(data, {
|
|
17
|
+
borderColor: `#${data.borderColor}`
|
|
18
|
+
});
|
|
19
|
+
if (data.borderRadius) style = Object.assign(data, {
|
|
20
|
+
borderRadius: Number.parseInt(data.borderRadius)
|
|
21
|
+
});
|
|
22
|
+
if (data.borderSize) style = Object.assign(data, {
|
|
23
|
+
borderWidth: Number.parseInt(data.borderSize)
|
|
24
|
+
});
|
|
25
|
+
return style;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {};
|
|
29
|
+
}, [
|
|
30
|
+
display
|
|
31
|
+
]);
|
|
32
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
33
|
+
onClick: props.onClick,
|
|
34
|
+
style: style,
|
|
35
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
36
|
+
type: display.icon
|
|
37
|
+
}),
|
|
38
|
+
children: title
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export { CustomStyleButton };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface FlowNodeHistoryAction {
|
|
3
|
+
refresh: () => void;
|
|
4
|
+
}
|
|
5
|
+
interface FlowNodeHistoryProps {
|
|
6
|
+
actionRef?: React.Ref<FlowNodeHistoryAction>;
|
|
7
|
+
}
|
|
8
|
+
export declare const FlowNodeHistory: React.FC<FlowNodeHistoryProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { Empty, Timeline } from "antd";
|
|
5
|
+
import { FlowTimeNode, getNodeStatus, getStatusConfig } from "./flow-time-node.js";
|
|
6
|
+
const FlowNodeHistory = (props)=>{
|
|
7
|
+
const { context } = useApprovalContext();
|
|
8
|
+
const [processNodes, setProcessNodes] = react.useState([]);
|
|
9
|
+
const triggerProcessNodes = ()=>{
|
|
10
|
+
context.getPresenter().processNodes().then((nodes)=>{
|
|
11
|
+
setProcessNodes(nodes);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
react.useEffect(()=>{
|
|
15
|
+
setTimeout(()=>{
|
|
16
|
+
triggerProcessNodes();
|
|
17
|
+
}, 100);
|
|
18
|
+
}, []);
|
|
19
|
+
react.useImperativeHandle(props.actionRef, ()=>({
|
|
20
|
+
refresh: ()=>{
|
|
21
|
+
triggerProcessNodes();
|
|
22
|
+
}
|
|
23
|
+
}), []);
|
|
24
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
25
|
+
children: processNodes.length > 0 ? /*#__PURE__*/ jsx(Timeline, {
|
|
26
|
+
items: processNodes.map((node)=>({
|
|
27
|
+
icon: getStatusConfig(getNodeStatus(node)).icon,
|
|
28
|
+
content: /*#__PURE__*/ jsx(FlowTimeNode, {
|
|
29
|
+
node: node
|
|
30
|
+
})
|
|
31
|
+
}))
|
|
32
|
+
}) : /*#__PURE__*/ jsx(Empty, {
|
|
33
|
+
description: "暂无审批流程记录"
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export { FlowNodeHistory };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ProcessNode } from "@coding-flow/flow-types";
|
|
3
|
+
export declare const getStatusConfig: (status: "completed" | "current" | "pending") => {
|
|
4
|
+
color: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export declare const getNodeStatus: (node: ProcessNode) => "completed" | "current" | "pending";
|
|
9
|
+
interface FlowTimeNodeProps {
|
|
10
|
+
node: ProcessNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const FlowTimeNode: React.FC<FlowTimeNodeProps>;
|
|
13
|
+
export {};
|