@coding-flow/flow-mobile-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 +67 -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 +62 -0
- package/dist/components/flow-approval/components/action/custom.d.ts +8 -0
- package/dist/components/flow-approval/components/action/custom.js +17 -0
- package/dist/components/flow-approval/components/action/delegate.d.ts +8 -0
- package/dist/components/flow-approval/components/action/delegate.js +62 -0
- package/dist/components/flow-approval/components/action/factory.d.ts +9 -0
- package/dist/components/flow-approval/components/action/factory.js +38 -0
- package/dist/components/flow-approval/components/action/pass.d.ts +8 -0
- package/dist/components/flow-approval/components/action/pass.js +87 -0
- package/dist/components/flow-approval/components/action/reject.d.ts +8 -0
- package/dist/components/flow-approval/components/action/reject.js +64 -0
- package/dist/components/flow-approval/components/action/return.d.ts +8 -0
- package/dist/components/flow-approval/components/action/return.js +62 -0
- package/dist/components/flow-approval/components/action/revoke.d.ts +1 -0
- package/dist/components/flow-approval/components/action/revoke.js +32 -0
- package/dist/components/flow-approval/components/action/save.d.ts +8 -0
- package/dist/components/flow-approval/components/action/save.js +22 -0
- package/dist/components/flow-approval/components/action/transfer.d.ts +8 -0
- package/dist/components/flow-approval/components/action/transfer.js +62 -0
- package/dist/components/flow-approval/components/action/type.d.ts +4 -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 +29 -0
- package/dist/components/flow-approval/components/custom-style-button.d.ts +9 -0
- package/dist/components/flow-approval/components/custom-style-button.js +52 -0
- package/dist/components/flow-approval/components/flow-node-history.d.ts +9 -0
- package/dist/components/flow-approval/components/flow-node-history.js +46 -0
- package/dist/components/flow-approval/components/flow-time-node.d.ts +9 -0
- package/dist/components/flow-approval/components/flow-time-node.js +59 -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.css +5 -0
- package/dist/components/flow-approval/index.d.ts +10 -0
- package/dist/components/flow-approval/index.js +24 -0
- package/dist/components/flow-approval/layout/body.d.ts +6 -0
- package/dist/components/flow-approval/layout/body.js +35 -0
- package/dist/components/flow-approval/layout/footer.d.ts +1 -0
- package/dist/components/flow-approval/layout/footer.js +84 -0
- package/dist/components/flow-approval/layout/header.d.ts +1 -0
- package/dist/components/flow-approval/layout/header.js +20 -0
- package/dist/components/flow-approval/layout/hooks/use-layout-presenter.d.ts +2 -0
- package/dist/components/flow-approval/layout/hooks/use-layout-presenter.js +7 -0
- package/dist/components/flow-approval/layout/index.d.ts +3 -0
- package/dist/components/flow-approval/layout/index.js +44 -0
- package/dist/components/flow-approval/layout/presenter.d.ts +15 -0
- package/dist/components/flow-approval/layout/presenter.js +40 -0
- package/dist/components/flow-approval/typings/index.d.ts +4 -0
- package/dist/components/flow-approval/typings/index.js +5 -0
- package/dist/favicon.png +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugins/view/add-audit-view.d.ts +3 -0
- package/dist/plugins/view/add-audit-view.js +39 -0
- package/dist/plugins/view/delegate-view.d.ts +3 -0
- package/dist/plugins/view/delegate-view.js +39 -0
- package/dist/plugins/view/return-view.d.ts +3 -0
- package/dist/plugins/view/return-view.js +47 -0
- package/dist/plugins/view/sign-key-view.d.ts +3 -0
- package/dist/plugins/view/sign-key-view.js +19 -0
- package/dist/plugins/view/transfer-view.d.ts +3 -0
- package/dist/plugins/view/transfer-view.js +39 -0
- package/package.json +57 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, TextArea, Toast } from "antd-mobile";
|
|
4
|
+
import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
5
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
6
|
+
import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
|
|
7
|
+
import { EventBus } from "@coding-flow/flow-core";
|
|
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
|
+
react.useEffect(()=>{
|
|
17
|
+
EventBus.getInstance().on(action.id, ()=>{
|
|
18
|
+
if (isStartNode) handleSubmit();
|
|
19
|
+
else {
|
|
20
|
+
form.resetFields();
|
|
21
|
+
setModalVisible(true);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return ()=>{
|
|
25
|
+
EventBus.getInstance().off(action.id);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
const handleSubmit = (params)=>{
|
|
29
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
30
|
+
if (res.success) {
|
|
31
|
+
Toast.show("操作成功");
|
|
32
|
+
setModalVisible(false);
|
|
33
|
+
context.close();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const adviceRules = state.flow?.adviceRequired ? [
|
|
38
|
+
{
|
|
39
|
+
required: state.flow?.adviceRequired || false,
|
|
40
|
+
message: '请输入审批意见'
|
|
41
|
+
}
|
|
42
|
+
] : [];
|
|
43
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
44
|
+
children: /*#__PURE__*/ jsx(PopupModal, {
|
|
45
|
+
open: modalVisible,
|
|
46
|
+
onClose: ()=>{
|
|
47
|
+
setModalVisible(false);
|
|
48
|
+
},
|
|
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
|
+
export { PassAction };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, TextArea, Toast } from "antd-mobile";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
6
|
+
import { EventBus } from "@coding-flow/flow-core";
|
|
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
|
+
react.useEffect(()=>{
|
|
14
|
+
EventBus.getInstance().on(action.id, ()=>{
|
|
15
|
+
form.resetFields();
|
|
16
|
+
setModalVisible(true);
|
|
17
|
+
});
|
|
18
|
+
return ()=>{
|
|
19
|
+
EventBus.getInstance().off(action.id);
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
const handleSubmit = (params)=>{
|
|
23
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
24
|
+
if (res.success) {
|
|
25
|
+
Toast.show("操作成功");
|
|
26
|
+
setModalVisible(false);
|
|
27
|
+
context.close();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const adviceRules = state.flow?.adviceRequired ? [
|
|
32
|
+
{
|
|
33
|
+
required: state.flow?.adviceRequired || false,
|
|
34
|
+
message: '请输入审批意见'
|
|
35
|
+
}
|
|
36
|
+
] : [];
|
|
37
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
38
|
+
children: /*#__PURE__*/ jsx(PopupModal, {
|
|
39
|
+
title: "审批拒绝",
|
|
40
|
+
open: modalVisible,
|
|
41
|
+
onClose: ()=>setModalVisible(false),
|
|
42
|
+
onOk: ()=>{
|
|
43
|
+
form.submit();
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
46
|
+
form: form,
|
|
47
|
+
layout: "vertical",
|
|
48
|
+
onFinish: (values)=>{
|
|
49
|
+
handleSubmit(values);
|
|
50
|
+
},
|
|
51
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
52
|
+
name: "advice",
|
|
53
|
+
label: "拒绝意见",
|
|
54
|
+
required: state.flow?.adviceRequired,
|
|
55
|
+
rules: adviceRules,
|
|
56
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
57
|
+
placeholder: "请输入拒绝意见"
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { RejectAction };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Toast } from "antd-mobile";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { ReturnView } from "../../../../plugins/view/return-view.js";
|
|
6
|
+
import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
7
|
+
import { EventBus } from "@coding-flow/flow-core";
|
|
8
|
+
const ReturnAction = (props)=>{
|
|
9
|
+
const action = props.action;
|
|
10
|
+
const { context } = useApprovalContext();
|
|
11
|
+
const [form] = Form.useForm();
|
|
12
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
13
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
14
|
+
const handleSubmit = (params)=>{
|
|
15
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
16
|
+
if (res.success) {
|
|
17
|
+
Toast.show("操作成功");
|
|
18
|
+
setModalVisible(false);
|
|
19
|
+
context.close();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
react.useEffect(()=>{
|
|
24
|
+
EventBus.getInstance().on(action.id, ()=>{
|
|
25
|
+
form.resetFields();
|
|
26
|
+
setModalVisible(true);
|
|
27
|
+
});
|
|
28
|
+
return ()=>{
|
|
29
|
+
EventBus.getInstance().off(action.id);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
33
|
+
children: /*#__PURE__*/ jsx(PopupModal, {
|
|
34
|
+
title: "退回审批",
|
|
35
|
+
open: modalVisible,
|
|
36
|
+
onClose: ()=>setModalVisible(false),
|
|
37
|
+
onOk: ()=>{
|
|
38
|
+
form.submit();
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
41
|
+
form: form,
|
|
42
|
+
layout: "vertical",
|
|
43
|
+
onFinish: (values)=>{
|
|
44
|
+
handleSubmit(values);
|
|
45
|
+
},
|
|
46
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
47
|
+
name: "backNodeId",
|
|
48
|
+
label: "退回节点",
|
|
49
|
+
required: true,
|
|
50
|
+
rules: [
|
|
51
|
+
{
|
|
52
|
+
required: true,
|
|
53
|
+
message: '退回节点不能为空'
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
children: /*#__PURE__*/ jsx(ReturnView, {})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export { ReturnAction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RevokeAction: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Button, Toast } from "antd-mobile";
|
|
4
|
+
import { Popconfirm } from "@coding-flow/flow-mobile-ui";
|
|
5
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
6
|
+
const RevokeAction = ()=>{
|
|
7
|
+
const { state, context } = useApprovalContext();
|
|
8
|
+
const presenter = context.getPresenter().getFlowActionPresenter();
|
|
9
|
+
const revoke = state.flow?.revoke || false;
|
|
10
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
11
|
+
children: revoke && /*#__PURE__*/ jsx(Popconfirm, {
|
|
12
|
+
title: "确认要撤销审批吗?",
|
|
13
|
+
onConfirm: ()=>{
|
|
14
|
+
presenter.revoke().then((res)=>{
|
|
15
|
+
if (res.success) {
|
|
16
|
+
Toast.show("流程已撤回");
|
|
17
|
+
context.close();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
22
|
+
style: {
|
|
23
|
+
width: '100%',
|
|
24
|
+
padding: '10px',
|
|
25
|
+
margin: '5px'
|
|
26
|
+
},
|
|
27
|
+
children: "撤回"
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { RevokeAction };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Toast } from "antd-mobile";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { EventBus } from "@coding-flow/flow-core";
|
|
6
|
+
const SaveAction = (props)=>{
|
|
7
|
+
const action = props.action;
|
|
8
|
+
const { context } = useApprovalContext();
|
|
9
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
10
|
+
react.useEffect(()=>{
|
|
11
|
+
EventBus.getInstance().on(action.id, ()=>{
|
|
12
|
+
actionPresenter.action(action.id).then((res)=>{
|
|
13
|
+
if (res.success) Toast.show("流程数据已保存");
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
return ()=>{
|
|
17
|
+
EventBus.getInstance().off(action.id);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return /*#__PURE__*/ jsx(Fragment, {});
|
|
21
|
+
};
|
|
22
|
+
export { SaveAction };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Form, Toast } from "antd-mobile";
|
|
4
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { TransferView } from "../../../../plugins/view/transfer-view.js";
|
|
6
|
+
import { EventBus } from "@coding-flow/flow-core";
|
|
7
|
+
import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
8
|
+
const TransferAction = (props)=>{
|
|
9
|
+
const action = props.action;
|
|
10
|
+
const { context } = useApprovalContext();
|
|
11
|
+
const [form] = Form.useForm();
|
|
12
|
+
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
13
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
14
|
+
react.useEffect(()=>{
|
|
15
|
+
EventBus.getInstance().on(action.id, ()=>{
|
|
16
|
+
form.resetFields();
|
|
17
|
+
setModalVisible(true);
|
|
18
|
+
});
|
|
19
|
+
return ()=>{
|
|
20
|
+
EventBus.getInstance().off(action.id);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
const handleSubmit = (params)=>{
|
|
24
|
+
actionPresenter.action(action.id, params).then((res)=>{
|
|
25
|
+
if (res.success) {
|
|
26
|
+
Toast.show("操作成功");
|
|
27
|
+
setModalVisible(false);
|
|
28
|
+
context.close();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
33
|
+
children: /*#__PURE__*/ jsx(PopupModal, {
|
|
34
|
+
title: "转办审批",
|
|
35
|
+
open: modalVisible,
|
|
36
|
+
onClose: ()=>setModalVisible(false),
|
|
37
|
+
onOk: ()=>{
|
|
38
|
+
form.submit();
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
41
|
+
form: form,
|
|
42
|
+
layout: "vertical",
|
|
43
|
+
onFinish: (values)=>{
|
|
44
|
+
handleSubmit(values);
|
|
45
|
+
},
|
|
46
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
47
|
+
name: "forwardOperatorIds",
|
|
48
|
+
label: "转办人员",
|
|
49
|
+
required: true,
|
|
50
|
+
rules: [
|
|
51
|
+
{
|
|
52
|
+
required: true,
|
|
53
|
+
message: '转办人员不能为空'
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
children: /*#__PURE__*/ jsx(TransferView, {})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export { TransferAction };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UrgeAction: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Button, Toast } from "antd-mobile";
|
|
4
|
+
import { Popconfirm } from "@coding-flow/flow-mobile-ui";
|
|
5
|
+
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
6
|
+
const UrgeAction = ()=>{
|
|
7
|
+
const { state, context } = useApprovalContext();
|
|
8
|
+
const presenter = context.getPresenter().getFlowActionPresenter();
|
|
9
|
+
const urge = state.flow?.urge || false;
|
|
10
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
11
|
+
children: urge && /*#__PURE__*/ jsx(Popconfirm, {
|
|
12
|
+
title: "确认要催办审批用户吗?",
|
|
13
|
+
onConfirm: ()=>{
|
|
14
|
+
presenter.urge().then((res)=>{
|
|
15
|
+
if (res.success) Toast.show("已发送催办提醒.");
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
19
|
+
style: {
|
|
20
|
+
width: '100%',
|
|
21
|
+
padding: '10px',
|
|
22
|
+
margin: '5px'
|
|
23
|
+
},
|
|
24
|
+
children: "催办"
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
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,52 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { Button, Space } from "antd-mobile";
|
|
4
|
+
import { Icon } from "@coding-flow/flow-icons";
|
|
5
|
+
const CustomStyleButton = (props)=>{
|
|
6
|
+
const display = props.display;
|
|
7
|
+
const title = display?.title || props.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: {
|
|
35
|
+
...style,
|
|
36
|
+
width: '100%',
|
|
37
|
+
padding: '10px',
|
|
38
|
+
margin: '5px'
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ jsxs(Space, {
|
|
41
|
+
children: [
|
|
42
|
+
props.display?.icon && /*#__PURE__*/ jsx(Icon, {
|
|
43
|
+
type: props.display.icon
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ jsx("span", {
|
|
46
|
+
children: title
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
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,46 @@
|
|
|
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, Steps } from "antd-mobile";
|
|
5
|
+
import { FlowOperatorItem, getNodeStatus } from "./flow-time-node.js";
|
|
6
|
+
const { Step } = Steps;
|
|
7
|
+
const FlowNodeHistory = (props)=>{
|
|
8
|
+
const { context } = useApprovalContext();
|
|
9
|
+
const [processNodes, setProcessNodes] = react.useState([]);
|
|
10
|
+
const triggerProcessNodes = ()=>{
|
|
11
|
+
context.getPresenter().processNodes().then((nodes)=>{
|
|
12
|
+
setProcessNodes(nodes);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
react.useEffect(()=>{
|
|
16
|
+
setTimeout(()=>{
|
|
17
|
+
triggerProcessNodes();
|
|
18
|
+
}, 100);
|
|
19
|
+
}, []);
|
|
20
|
+
react.useImperativeHandle(props.actionRef, ()=>({
|
|
21
|
+
refresh: ()=>{
|
|
22
|
+
triggerProcessNodes();
|
|
23
|
+
}
|
|
24
|
+
}), []);
|
|
25
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
26
|
+
children: processNodes.length > 0 ? /*#__PURE__*/ jsx(Steps, {
|
|
27
|
+
direction: "vertical",
|
|
28
|
+
children: processNodes.map((node)=>{
|
|
29
|
+
const operators = node.operators;
|
|
30
|
+
return /*#__PURE__*/ jsx(Step, {
|
|
31
|
+
title: node.nodeName,
|
|
32
|
+
description: /*#__PURE__*/ jsx(Fragment, {
|
|
33
|
+
children: operators.map((operator)=>/*#__PURE__*/ jsx(FlowOperatorItem, {
|
|
34
|
+
operator: operator,
|
|
35
|
+
state: node.state
|
|
36
|
+
}))
|
|
37
|
+
}),
|
|
38
|
+
status: getNodeStatus(node)
|
|
39
|
+
});
|
|
40
|
+
})
|
|
41
|
+
}) : /*#__PURE__*/ jsx(Empty, {
|
|
42
|
+
description: "暂无审批流程记录"
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export { FlowNodeHistory };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlowApprovalOperator, ProcessNode } from "@coding-flow/flow-types";
|
|
3
|
+
export declare const getNodeStatus: (node: ProcessNode) => "finish" | "process" | "wait";
|
|
4
|
+
interface FlowOperatorItemProps {
|
|
5
|
+
operator: FlowApprovalOperator;
|
|
6
|
+
state: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const FlowOperatorItem: React.FC<FlowOperatorItemProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
const getNodeStatus = (node)=>{
|
|
5
|
+
if (-1 === node.state) return 'finish';
|
|
6
|
+
if (0 === node.state) return 'process';
|
|
7
|
+
return 'wait';
|
|
8
|
+
};
|
|
9
|
+
const FlowOperatorItem = (props)=>{
|
|
10
|
+
const operator = props.operator;
|
|
11
|
+
const state = props.state;
|
|
12
|
+
if (-1 === state) return /*#__PURE__*/ jsxs(Fragment, {
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15
|
+
style: {
|
|
16
|
+
fontSize: 12
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
"审批人: ",
|
|
20
|
+
operator.flowOperator.name
|
|
21
|
+
]
|
|
22
|
+
}),
|
|
23
|
+
operator.approveTime > 0 && /*#__PURE__*/ jsxs("div", {
|
|
24
|
+
style: {
|
|
25
|
+
fontSize: 12
|
|
26
|
+
},
|
|
27
|
+
children: [
|
|
28
|
+
dayjs(operator.approveTime).format('YYYY-MM-DD HH:mm:ss'),
|
|
29
|
+
" ",
|
|
30
|
+
operator.actionName
|
|
31
|
+
]
|
|
32
|
+
}),
|
|
33
|
+
operator.advice && /*#__PURE__*/ jsx("div", {
|
|
34
|
+
style: {
|
|
35
|
+
padding: 8,
|
|
36
|
+
backgroundColor: '#fafafa',
|
|
37
|
+
borderRadius: 4,
|
|
38
|
+
marginTop: 4
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
41
|
+
style: {
|
|
42
|
+
fontSize: 12
|
|
43
|
+
},
|
|
44
|
+
children: operator.advice
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
50
|
+
style: {
|
|
51
|
+
fontSize: 12
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
"待审批人: ",
|
|
55
|
+
operator.flowOperator.name
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export { FlowOperatorItem, getNodeStatus };
|