Skip to content

Commit f6e8254

Browse files
committed
add start node try submit
1 parent 0645a4d commit f6e8254

File tree

33 files changed

+1595
-626
lines changed

33 files changed

+1595
-626
lines changed

admin-ui/src/api/flow.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ export async function schema(body: any) {
3838

3939
// 流程控制
4040

41-
export async function detail(id:any) {
42-
return get('/api/query/flowRecord/detail', {id});
41+
export async function startFlow(body:any) {
42+
return post('/api/cmd/flowRecord/startFlow', body);
43+
}
44+
45+
export async function detail(id?:any,workCode?:any) {
46+
return get('/api/query/flowRecord/detail', {id,workCode});
4347
}
4448

4549
export async function saveFlow(body:any) {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react";
2+
import {ModalForm, ProFormDigit} from "@ant-design/pro-components";
3+
import {PostponedFormProps} from "@/components/Flow/flow/types";
4+
5+
6+
const PostponedFormView:React.FC<PostponedFormProps> = (props)=>{
7+
8+
return (
9+
<ModalForm
10+
title={"延期调整"}
11+
open={props.visible}
12+
modalProps={{
13+
onCancel: () => {
14+
props.setVisible(false);
15+
},
16+
onClose: () => {
17+
props.setVisible(false);
18+
},
19+
destroyOnClose:true,
20+
}}
21+
onFinish={async (values) => {
22+
props.onFinish(values);
23+
}}
24+
>
25+
<ProFormDigit
26+
name={"hours"}
27+
label={"延期时间"}
28+
tooltip={"以当前时间开始延期,延期单位为小时"}
29+
addonAfter={"小时"}
30+
rules={[
31+
{
32+
required: true,
33+
message: "请输入延期时间"
34+
}
35+
]}
36+
/>
37+
</ModalForm>
38+
)
39+
}
40+
41+
export default PostponedFormView;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React from 'react';
2+
import {Modal, Result} from "antd";
3+
import {ProDescriptions} from "@ant-design/pro-components";
4+
import {FlowResultItem, ResultFormProps} from "@/components/Flow/flow/types";
5+
6+
7+
const ResultFormView: React.FC<ResultFormProps> = (props) => {
8+
const {result} = props;
9+
10+
if (!result) {
11+
return null;
12+
}
13+
return (
14+
<Modal
15+
width={"40%"}
16+
height={"60%"}
17+
open={props.visible}
18+
onCancel={() => {
19+
props.setVisible(false);
20+
if(props.flowCloseable){
21+
props.closeFlow();
22+
}
23+
}}
24+
onClose={() => {
25+
props.setVisible(false);
26+
if(props.flowCloseable){
27+
props.closeFlow();
28+
}
29+
}}
30+
onOk={() => {
31+
props.setVisible(false);
32+
if(props.flowCloseable){
33+
props.closeFlow();
34+
}
35+
}}
36+
destroyOnClose={true}
37+
>
38+
39+
<Result
40+
status="success"
41+
title={result.title}
42+
>
43+
44+
{result.items && result.items.map((item: FlowResultItem, index: number) => {
45+
return (
46+
<ProDescriptions
47+
column={2}
48+
>
49+
<ProDescriptions.Item
50+
span={2}
51+
label={item.title.label}
52+
valueType="text"
53+
>
54+
{item.title.value}
55+
</ProDescriptions.Item>
56+
57+
<ProDescriptions.Item
58+
span={1}
59+
label={item.message.label}
60+
valueType="text"
61+
>
62+
{item.message.value}
63+
</ProDescriptions.Item>
64+
</ProDescriptions>
65+
)
66+
})}
67+
</Result>
68+
</Modal>
69+
)
70+
}
71+
72+
export default ResultFormView;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from "react";
2+
import {FlowData} from "@/components/Flow/flow/data";
3+
import {Button, Space} from "antd";
4+
5+
6+
interface FlowButtonsProps {
7+
flowData: FlowData;
8+
requestLoading: boolean;
9+
setRequestLoading: (loading: boolean) => void;
10+
handlerClick: (item: any) => void;
11+
}
12+
13+
const FlowButtons: React.FC<FlowButtonsProps> = (props) => {
14+
const flowData = props.flowData;
15+
16+
if (!flowData) {
17+
return null;
18+
}
19+
20+
const buttons = flowData.getNodeButtons();
21+
22+
return (
23+
<Space>
24+
{buttons && buttons.map((item: any) => {
25+
const style = item.style && {
26+
...JSON.parse(item.style),
27+
color: "white",
28+
} || {};
29+
return (
30+
<Button
31+
key={item.id}
32+
onClick={() => {
33+
props.handlerClick(item);
34+
}}
35+
loading={props.requestLoading}
36+
style={{
37+
...style
38+
}}
39+
>
40+
{item.name}
41+
</Button>
42+
)
43+
})}
44+
</Space>
45+
)
46+
}
47+
48+
export default FlowButtons;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
import {FlowData} from "@/components/Flow/flow/data";
3+
4+
interface FlowChartProps {
5+
flowData:FlowData
6+
}
7+
8+
const FlowChart:React.FC<FlowChartProps> = (props)=>{
9+
10+
return (
11+
<>
12+
Flow Chart
13+
</>
14+
)
15+
}
16+
17+
export default FlowChart;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import React from "react";
2+
import {Divider, Result} from "antd";
3+
import {ProForm, ProFormTextArea} from "@ant-design/pro-components";
4+
import {FlowFormView, FlowFormViewProps} from "@/components/Flow/flow/types";
5+
import {FlowData} from "@/components/Flow/flow/data";
6+
7+
interface FlowDetailProps {
8+
view: React.ComponentType<FlowFormViewProps> | FlowFormView;
9+
visible: boolean;
10+
form: any;
11+
adviceForm: any;
12+
review?: boolean;
13+
flowData: FlowData;
14+
}
15+
16+
const FlowDetail: React.FC<FlowDetailProps> = (props) => {
17+
const flowData = props.flowData;
18+
19+
const FlowFormView = flowData.getFlowFormView(props.view) as React.ComponentType<FlowFormViewProps>;
20+
21+
return (
22+
<>
23+
{FlowFormView && (
24+
<FlowFormView
25+
data={flowData.getFlowData()}
26+
form={props.form}
27+
visible={props.visible}
28+
editable={flowData.getFlowNodeEditable()}
29+
compare={!flowData.isStartFlow()}
30+
/>
31+
)}
32+
33+
{!FlowFormView && (
34+
<Result
35+
status="404"
36+
title="未设置流程视图"
37+
subTitle="抱歉,该流程未设置流程视图,无法正常展示"
38+
/>
39+
)}
40+
41+
{/*仅当非发起流程时再展示审批意见框*/}
42+
{FlowFormView && !flowData.isStartFlow() && (
43+
<div className="opinionForm">
44+
<div>
45+
<Divider>
46+
审批意见
47+
</Divider>
48+
<ProForm
49+
form={props.adviceForm}
50+
submitter={false}
51+
autoFocusFirstInput={false}
52+
>
53+
<ProFormTextArea
54+
disabled={props.review}
55+
label={""}
56+
placeholder={'请输入审批意见'}
57+
name={"advice"}
58+
/>
59+
</ProForm>
60+
</div>
61+
</div>
62+
)}
63+
</>
64+
)
65+
}
66+
67+
export default FlowDetail;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import {FlowData} from "@/components/Flow/flow/data";
3+
4+
5+
interface FlowHistoryProps {
6+
flowData:FlowData
7+
}
8+
9+
const FlowHistory:React.FC<FlowHistoryProps> = (props)=>{
10+
11+
return (
12+
<>
13+
Flow History
14+
</>
15+
)
16+
}
17+
18+
export default FlowHistory;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import React from "react";
2+
import {FlowData} from "@/components/Flow/flow/data";
3+
import {Skeleton, Tabs} from "antd";
4+
import {FlowFormView, FlowFormViewProps} from "@/components/Flow/flow/types";
5+
import {FormInstance} from "antd/es/form/hooks/useForm";
6+
import FlowHistory from "@/components/Flow/flow/FlowHistory";
7+
import FlowChart from "@/components/Flow/flow/FlowChart";
8+
import FlowDetail from "@/components/Flow/flow/FlowDetail";
9+
10+
11+
interface FlowTabsProps {
12+
flowData: FlowData;
13+
view: React.ComponentType<FlowFormViewProps> | FlowFormView;
14+
visible: boolean;
15+
form: FormInstance<any>;
16+
adviceForm: FormInstance<any>;
17+
// 预览模式
18+
review?: boolean;
19+
}
20+
21+
const FlowTabs: React.FC<FlowTabsProps> = (props) => {
22+
23+
const flowData = props.flowData;
24+
25+
if (!flowData.hasData()) {
26+
return (
27+
<Tabs
28+
className="view-flow-tabs"
29+
items={[
30+
{
31+
key: 'flow',
32+
label: '流程详情',
33+
children: (
34+
<Skeleton loading={true}>
35+
<></>
36+
</Skeleton>
37+
),
38+
},
39+
{
40+
key: 'history',
41+
label: '流程历史',
42+
children: (
43+
<Skeleton loading={true}>
44+
<></>
45+
</Skeleton>
46+
),
47+
},
48+
{
49+
key: 'chart',
50+
label: '流程图',
51+
children: (
52+
<Skeleton loading={true}>
53+
<></>
54+
</Skeleton>
55+
),
56+
}
57+
]}
58+
/>
59+
);
60+
}
61+
62+
63+
const items = [
64+
{
65+
key: 'flow',
66+
label: '流程详情',
67+
children: (
68+
<FlowDetail
69+
flowData={flowData}
70+
adviceForm={props.adviceForm}
71+
form={props.form}
72+
visible={props.visible}
73+
view={props.view}/>
74+
),
75+
},
76+
!flowData.isStartFlow() && {
77+
key: 'history',
78+
label: '流程历史',
79+
children: <FlowHistory flowData={flowData}/>,
80+
},
81+
{
82+
key: 'chart',
83+
label: '流程图',
84+
children: <FlowChart flowData={flowData}/>,
85+
}
86+
] as any[];
87+
88+
return (
89+
<Tabs
90+
className="view-flow-tabs"
91+
items={items}
92+
/>
93+
)
94+
}
95+
96+
export default FlowTabs;

0 commit comments

Comments
 (0)