@coding-flow/flow-mobile-approval 0.0.6 → 0.0.8
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.
|
@@ -5,11 +5,14 @@ import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
|
5
5
|
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
6
6
|
import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
|
|
7
7
|
import { EventBus } from "@coding-flow/flow-core";
|
|
8
|
+
import { ManualView } from "../../../../plugins/view/manual-view.js";
|
|
8
9
|
const PassAction = (props)=>{
|
|
9
10
|
const action = props.action;
|
|
10
11
|
const { state, context } = useApprovalContext();
|
|
11
12
|
const actionPresenter = context.getPresenter().getFlowActionPresenter();
|
|
12
13
|
const [modalVisible, setModalVisible] = react.useState(false);
|
|
14
|
+
const [options, setOptions] = react.useState([]);
|
|
15
|
+
const [request, setRequest] = react.useState({});
|
|
13
16
|
const isStartNode = state.flow?.nodeType === 'START';
|
|
14
17
|
const currentOperator = state.flow?.currentOperator;
|
|
15
18
|
const [form] = Form.useForm();
|
|
@@ -28,9 +31,15 @@ const PassAction = (props)=>{
|
|
|
28
31
|
const handleSubmit = (params)=>{
|
|
29
32
|
actionPresenter.action(action.id, params).then((res)=>{
|
|
30
33
|
if (res.success) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const options = res.data?.options || [];
|
|
35
|
+
if (options.length > 0) {
|
|
36
|
+
setRequest(params);
|
|
37
|
+
setOptions(options);
|
|
38
|
+
} else {
|
|
39
|
+
Toast.show("操作成功");
|
|
40
|
+
setModalVisible(false);
|
|
41
|
+
context.close();
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
});
|
|
36
45
|
};
|
|
@@ -40,48 +49,60 @@ const PassAction = (props)=>{
|
|
|
40
49
|
message: '请输入审批意见'
|
|
41
50
|
}
|
|
42
51
|
] : [];
|
|
43
|
-
return /*#__PURE__*/
|
|
44
|
-
children:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
onOk: ()=>{
|
|
50
|
-
form.submit();
|
|
51
|
-
},
|
|
52
|
-
children: /*#__PURE__*/ jsxs(Form, {
|
|
53
|
-
form: form,
|
|
54
|
-
layout: "vertical",
|
|
55
|
-
onFinish: (values)=>{
|
|
56
|
-
handleSubmit(values);
|
|
52
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ jsx(PopupModal, {
|
|
55
|
+
open: modalVisible,
|
|
56
|
+
onClose: ()=>{
|
|
57
|
+
setModalVisible(false);
|
|
57
58
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
onOk: ()=>{
|
|
60
|
+
form.submit();
|
|
61
|
+
},
|
|
62
|
+
children: /*#__PURE__*/ jsxs(Form, {
|
|
63
|
+
form: form,
|
|
64
|
+
layout: "vertical",
|
|
65
|
+
onFinish: (values)=>{
|
|
66
|
+
handleSubmit(values);
|
|
67
|
+
},
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ jsx(Form.Item, {
|
|
70
|
+
name: "advice",
|
|
71
|
+
label: "审批意见",
|
|
72
|
+
required: state.flow?.adviceRequired,
|
|
73
|
+
rules: adviceRules,
|
|
74
|
+
children: /*#__PURE__*/ jsx(TextArea, {
|
|
75
|
+
placeholder: "请输入审批意见"
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
state.flow?.signRequired && currentOperator && /*#__PURE__*/ jsx(Form.Item, {
|
|
79
|
+
name: "signKey",
|
|
80
|
+
label: "审批签名",
|
|
81
|
+
required: state.flow?.signRequired,
|
|
82
|
+
rules: [
|
|
83
|
+
{
|
|
84
|
+
required: true,
|
|
85
|
+
message: '请设置审批签名'
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
children: /*#__PURE__*/ jsx(SignKeyView, {
|
|
89
|
+
current: currentOperator
|
|
90
|
+
})
|
|
80
91
|
})
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
options && options.length > 0 && /*#__PURE__*/ jsx(ManualView, {
|
|
96
|
+
options: options,
|
|
97
|
+
onChange: (value)=>{
|
|
98
|
+
setOptions([]);
|
|
99
|
+
if (value) handleSubmit({
|
|
100
|
+
...request,
|
|
101
|
+
manualNodeId: value
|
|
102
|
+
});
|
|
103
|
+
}
|
|
83
104
|
})
|
|
84
|
-
|
|
105
|
+
]
|
|
85
106
|
});
|
|
86
107
|
};
|
|
87
108
|
export { PassAction };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { ManualViewPluginKey } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Form, Selector } from "antd-mobile";
|
|
6
|
+
import { PopupModal } from "@coding-flow/flow-mobile-ui";
|
|
7
|
+
const ManualView = (props)=>{
|
|
8
|
+
const ManualViewComponent = ViewBindPlugin.getInstance().get(ManualViewPluginKey);
|
|
9
|
+
const [visible, setVisible] = react.useState(true);
|
|
10
|
+
const [form] = Form.useForm();
|
|
11
|
+
if (ManualViewComponent) return /*#__PURE__*/ jsx(ManualViewComponent, {
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
const handleOk = (value)=>{
|
|
15
|
+
const manualNodeId = value?.manualNodeId;
|
|
16
|
+
props.onChange(manualNodeId ? manualNodeId[0] : '');
|
|
17
|
+
setVisible(false);
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/ jsx(PopupModal, {
|
|
20
|
+
title: "请选择下一节点",
|
|
21
|
+
open: visible,
|
|
22
|
+
onClose: ()=>{
|
|
23
|
+
setVisible(false);
|
|
24
|
+
},
|
|
25
|
+
onOk: ()=>{
|
|
26
|
+
form.submit();
|
|
27
|
+
},
|
|
28
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
29
|
+
form: form,
|
|
30
|
+
onFinish: handleOk,
|
|
31
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
32
|
+
name: "manualNodeId",
|
|
33
|
+
label: "下级节点",
|
|
34
|
+
children: /*#__PURE__*/ jsx(Selector, {
|
|
35
|
+
multiple: false,
|
|
36
|
+
options: props.options.map((option)=>({
|
|
37
|
+
label: option.name,
|
|
38
|
+
value: option.id
|
|
39
|
+
}))
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export { ManualView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-mobile-approval",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "flow-engine pc mobile approval components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"dayjs": "^1.11.19",
|
|
40
40
|
"immer": "^11.1.3",
|
|
41
41
|
"react-redux": "^9.2.0",
|
|
42
|
-
"@coding-flow/flow-core": "0.0.
|
|
43
|
-
"@coding-flow/flow-
|
|
44
|
-
"@coding-flow/flow-
|
|
45
|
-
"@coding-flow/flow-mobile-ui": "0.0.
|
|
46
|
-
"@coding-flow/flow-
|
|
47
|
-
"@coding-flow/flow-
|
|
42
|
+
"@coding-flow/flow-core": "0.0.8",
|
|
43
|
+
"@coding-flow/flow-approval-presenter": "0.0.8",
|
|
44
|
+
"@coding-flow/flow-icons": "0.0.8",
|
|
45
|
+
"@coding-flow/flow-mobile-ui": "0.0.8",
|
|
46
|
+
"@coding-flow/flow-mobile-form": "0.0.8",
|
|
47
|
+
"@coding-flow/flow-types": "0.0.8"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@coding-flow/flow-types": "0.0.
|
|
50
|
+
"@coding-flow/flow-types": "0.0.8"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rslib build",
|