@coding-flow/flow-pc-approval 0.0.5 → 0.0.7
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.
|
@@ -4,21 +4,30 @@ import { Form, Input, Modal, message } from "antd";
|
|
|
4
4
|
import { useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
5
5
|
import { SignKeyView } from "../../../../plugins/view/sign-key-view.js";
|
|
6
6
|
import { CustomStyleButton } from "../custom-style-button.js";
|
|
7
|
+
import { ManualView } from "../../../../plugins/view/manual-view.js";
|
|
7
8
|
const { TextArea } = Input;
|
|
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();
|
|
16
19
|
const handleSubmit = (params)=>{
|
|
17
20
|
actionPresenter.action(action.id, params).then((res)=>{
|
|
18
21
|
if (res.success) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const options = res.data?.options || [];
|
|
23
|
+
if (options.length > 0) {
|
|
24
|
+
setRequest(params);
|
|
25
|
+
setOptions(options);
|
|
26
|
+
} else {
|
|
27
|
+
message.success("操作成功");
|
|
28
|
+
setModalVisible(false);
|
|
29
|
+
context.close();
|
|
30
|
+
}
|
|
22
31
|
}
|
|
23
32
|
});
|
|
24
33
|
};
|
|
@@ -81,6 +90,16 @@ const PassAction = (props)=>{
|
|
|
81
90
|
})
|
|
82
91
|
]
|
|
83
92
|
})
|
|
93
|
+
}),
|
|
94
|
+
options && options.length > 0 && /*#__PURE__*/ jsx(ManualView, {
|
|
95
|
+
options: options,
|
|
96
|
+
onChange: (value)=>{
|
|
97
|
+
setOptions([]);
|
|
98
|
+
if (value) handleSubmit({
|
|
99
|
+
...request,
|
|
100
|
+
manualNodeId: value
|
|
101
|
+
});
|
|
102
|
+
}
|
|
84
103
|
})
|
|
85
104
|
]
|
|
86
105
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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, Modal, Select } from "antd";
|
|
6
|
+
const ManualView = (props)=>{
|
|
7
|
+
const [visible, setVisible] = react.useState(true);
|
|
8
|
+
const ManualViewComponent = ViewBindPlugin.getInstance().get(ManualViewPluginKey);
|
|
9
|
+
const [form] = Form.useForm();
|
|
10
|
+
const handleOk = (value)=>{
|
|
11
|
+
props.onChange(value?.manualNodeId || '');
|
|
12
|
+
setVisible(false);
|
|
13
|
+
};
|
|
14
|
+
if (ManualViewComponent) return /*#__PURE__*/ jsx(ManualViewComponent, {
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/ jsx(Modal, {
|
|
18
|
+
title: "请选择下级节点",
|
|
19
|
+
width: "40%",
|
|
20
|
+
open: visible,
|
|
21
|
+
destroyOnHidden: true,
|
|
22
|
+
onCancel: ()=>setVisible(false),
|
|
23
|
+
onOk: ()=>{
|
|
24
|
+
form.submit();
|
|
25
|
+
},
|
|
26
|
+
children: /*#__PURE__*/ jsx(Form, {
|
|
27
|
+
form: form,
|
|
28
|
+
onFinish: handleOk,
|
|
29
|
+
layout: "vertical",
|
|
30
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
31
|
+
name: "manualNodeId",
|
|
32
|
+
label: "下级节点",
|
|
33
|
+
children: /*#__PURE__*/ jsx(Select, {
|
|
34
|
+
placeholder: "请选择下级节点走向",
|
|
35
|
+
options: props.options.map((item)=>({
|
|
36
|
+
value: item.id,
|
|
37
|
+
label: item.name
|
|
38
|
+
}))
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export { ManualView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-pc-approval",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "flow-engine pc form approval components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ant-design/icons": "~6.1.0",
|
|
36
|
-
"@coding-form/form-engine": "^0.0.
|
|
36
|
+
"@coding-form/form-engine": "^0.0.14",
|
|
37
37
|
"@reduxjs/toolkit": "^2.11.2",
|
|
38
38
|
"antd": "^6.2.1",
|
|
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-types": "0.0.
|
|
44
|
-
"@coding-flow/flow-icons": "0.0.
|
|
45
|
-
"@coding-flow/flow-approval-presenter": "0.0.
|
|
46
|
-
"@coding-flow/flow-pc-ui": "0.0.
|
|
47
|
-
"@coding-flow/flow-pc-form": "0.0.
|
|
42
|
+
"@coding-flow/flow-core": "0.0.7",
|
|
43
|
+
"@coding-flow/flow-types": "0.0.7",
|
|
44
|
+
"@coding-flow/flow-icons": "0.0.7",
|
|
45
|
+
"@coding-flow/flow-approval-presenter": "0.0.7",
|
|
46
|
+
"@coding-flow/flow-pc-ui": "0.0.7",
|
|
47
|
+
"@coding-flow/flow-pc-form": "0.0.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@coding-flow/flow-types": "0.0.
|
|
50
|
+
"@coding-flow/flow-types": "0.0.7"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rslib build",
|