Skip to content

Commit ed1dece

Browse files
committed
新功能支持:2024-11-27
1. 支持审批意见数据的表单返回 【已完成】 2. 选人组件的支持 3. 历史记录数据的展示 【已完成】 4. 流程图的展示 【已完成】
1 parent 253e294 commit ed1dece

File tree

7 files changed

+101
-91
lines changed

7 files changed

+101
-91
lines changed

admin-ui/src/components/Flow/flow/FlowDetail.tsx

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
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";
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";
66

77
interface FlowDetailProps {
88
view: React.ComponentType<FlowFormViewProps> | FlowFormView;
@@ -20,46 +20,50 @@ const FlowDetail: React.FC<FlowDetailProps> = (props) => {
2020

2121
return (
2222
<>
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-
)}
23+
<div className="flowApprovalViewBox">
24+
{FlowFormView && (
25+
<div className="flowViewDetail" style={{ height: !FlowFormView || flowData.isStartFlow() ? '85vh' : '68vh' }}>
26+
<FlowFormView
27+
data={flowData.getFlowData()}
28+
form={props.form}
29+
visible={props.visible}
30+
editable={flowData.getFlowNodeEditable()}
31+
compare={!flowData.isStartFlow()}
32+
/>
33+
</div>
34+
)}
3235

33-
{!FlowFormView && (
34-
<Result
35-
status="404"
36-
title="未设置流程视图"
37-
subTitle="抱歉,该流程未设置流程视图,无法正常展示"
38-
/>
39-
)}
36+
{!FlowFormView && (
37+
<Result
38+
status="404"
39+
title="未设置流程视图"
40+
subTitle="抱歉,该流程未设置流程视图,无法正常展示"
41+
/>
42+
)}
4043

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>
44+
{/*仅当非发起流程时再展示审批意见框*/}
45+
{FlowFormView && !flowData.isStartFlow() && (
46+
<div className="opinionForm">
47+
<div>
48+
<Divider>
49+
审批意见
50+
</Divider>
51+
<ProForm
52+
form={props.adviceForm}
53+
submitter={false}
54+
autoFocusFirstInput={false}
55+
>
56+
<ProFormTextArea
57+
disabled={props.review}
58+
label={""}
59+
placeholder={'请输入审批意见'}
60+
name={"advice"}
61+
/>
62+
</ProForm>
63+
</div>
6064
</div>
61-
</div>
62-
)}
65+
)}
66+
</div>
6367
</>
6468
)
6569
}

admin-ui/src/components/Flow/flow/index.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.ant-modal-root .ant-modal-wrap {
32
overflow: hidden !important;
43
}
@@ -80,7 +79,7 @@
8079
.flowViewDetail {
8180
margin-bottom: 100px;
8281
width: 100%;
83-
height: 68vh;
82+
// height: 68vh;
8483
overflow-y: auto;
8584
position: relative;
8685
.hr-form {

admin-ui/src/components/Flow/flow/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface FlowViewProps {
3636
workCode?: string;
3737
// 是否显示
3838
visible: boolean;
39+
// 设置显示
3940
setVisible: (visible: boolean) => void;
4041

4142
// 预览模式

admin-ui/src/components/Flow/flow/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import {FormInstance} from "antd/es/form/hooks/useForm";
2+
import { FormInstance } from "antd/es/form/hooks/useForm";
33

44
// 表单视图属性
55
export interface FlowFormViewProps {

admin-ui/src/components/Flow/panel/ScriptModal.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ code {
2323
margin-top: 10px;
2424
display: block;
2525
}
26+
27+
.ScriptModal {
28+
height: 69vh;
29+
overflow: auto;
30+
}

admin-ui/src/components/Flow/panel/ScriptModal.tsx

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
2-
import {ModalForm, ProFormText} from "@ant-design/pro-components";
2+
import { ModalForm, ProFormText } from "@ant-design/pro-components";
33
import ProFormCode from "@/components/Form/ProFormCode";
4-
import {EyeOutlined} from "@ant-design/icons";
4+
import { EyeOutlined } from "@ant-design/icons";
55
import "./ScriptModal.scss";
66

77
interface ScriptModalProps {
@@ -11,12 +11,13 @@ interface ScriptModalProps {
1111
onFinish: (values: any) => void;
1212
}
1313

14-
const ScriptModal:React.FC<ScriptModalProps> = (props)=>{
14+
const ScriptModal: React.FC<ScriptModalProps> = (props) => {
1515

1616
const [show, setShow] = React.useState(false);
1717

1818
return (
1919
<ModalForm
20+
className={"ScriptModal"}
2021
form={props.form}
2122
title={"脚本预览"}
2223
width={"80%"}
@@ -42,61 +43,61 @@ const ScriptModal:React.FC<ScriptModalProps> = (props)=>{
4243

4344
<a onClick={() => {
4445
setShow(!show);
45-
}}><EyeOutlined/> 查看帮助</a>
46+
}}><EyeOutlined /> 查看帮助</a>
4647

4748
{show && (
4849
<div>
49-
<pre>
50-
脚本说明:
51-
函数的定义必须为
52-
<code>
53-
{
54-
`
50+
<pre>
51+
脚本说明:
52+
函数的定义必须为
53+
<code>
54+
{
55+
`
5556
def run(content){
5657
// 你的代码
5758
return true;
5859
}
5960
`
60-
}
61-
</code>
62-
在设置操作人是函数返回的人员的id数组:
63-
<code>
64-
{
65-
`
61+
}
62+
</code>
63+
在设置操作人是函数返回的人员的id数组:
64+
<code>
65+
{
66+
`
6667
def run(content){
6768
// 你的代码
6869
return [1,2,3];
6970
}
7071
`
71-
}
72-
</code>
73-
在设置异常配置是函数返回的是人员或节点:
74-
<code>
75-
{
76-
`
72+
}
73+
</code>
74+
在设置异常配置是函数返回的是人员或节点:
75+
<code>
76+
{
77+
`
7778
def run(content){
7879
// 你的代码
7980
// return content.createNodeErrTrigger("code");
8081
// return content.createOperatorErrTrigger(1,2,3);
8182
}
8283
`
83-
}
84-
</code>
85-
在自定义标题时,返回的字符串:
86-
<code>
87-
{
88-
`
84+
}
85+
</code>
86+
在自定义标题时,返回的字符串:
87+
<code>
88+
{
89+
`
8990
def run(content){
9091
// 你的代码
9192
return content.getCreateOperator().getName() + '-' + content.getFlowWork().getTitle() + '-' + content.getFlowNode().getName();
9293
}
9394
`
94-
}
95-
</code>
96-
在自定义按钮事件时,返回createMessageResult函数:
97-
<code>
98-
{
99-
`
95+
}
96+
</code>
97+
在自定义按钮事件时,返回createMessageResult函数:
98+
<code>
99+
{
100+
`
100101
def run(content){
101102
// 你的代码
102103
// 自定义返回标题
@@ -107,12 +108,12 @@ def run(content){
107108
return content.createMessageResult('我是自定义标题', true).addItem('我是标题1','我是内容2').addItem('我是标题2','我是内容2');
108109
}
109110
`
110-
}
111-
</code>
112-
在自定义按钮事件时,操作流程:
113-
<code>
114-
{
115-
`
111+
}
112+
</code>
113+
在自定义按钮事件时,操作流程:
114+
<code>
115+
{
116+
`
116117
def run(content){
117118
// 你的代码
118119
// 自定义返回标题
@@ -135,11 +136,11 @@ def run(content){
135136
return content.createMessageResult('我是自定义标题', true).addMessage('我是标题1','我是内容2').addMessage('我是标题2','我是内容2').closeable(false);
136137
}
137138
`
138-
}
139-
</code>
140-
content对象能力,content对象下存在了flowWork 流程设计对象访问方式为content.getFlowWork(),flowNode 流程节点对象访问方式为content.getFlowNode(),createOperator 创建人对象访问方式为content.getCreateOperator(),currentOperator 当前操作人对象访问方式为content.getCurrentOperator()
141-
获取当前表单数据对象 content.getBindData(),获取当前审批意见对象 content.getOpinion(),获取当前节点的审批历史记录数据 content.getHistoryRecords(),获取spring的bean对象 content.getBean("beanName")
142-
</pre>
139+
}
140+
</code>
141+
content对象能力,content对象下存在了flowWork 流程设计对象访问方式为content.getFlowWork(),flowNode 流程节点对象访问方式为content.getFlowNode(),createOperator 创建人对象访问方式为content.getCreateOperator(),currentOperator 当前操作人对象访问方式为content.getCurrentOperator()
142+
获取当前表单数据对象 content.getBindData(),获取当前审批意见对象 content.getOpinion(),获取当前节点的审批历史记录数据 content.getHistoryRecords(),获取spring的bean对象 content.getBean("beanName")
143+
</pre>
143144
</div>
144145
)}
145146

admin-ui/src/components/Flow/register/flow.register.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import PostponedFormView from "@/components/Flow/components/PostponedFormView";
33
import ResultFormView from "@/components/Flow/components/ResultFormView";
44
import {PostponedFormViewKey, ResultFormViewKey} from "@/components/Flow/flow/types";
55

6-
registerComponent(PostponedFormViewKey,PostponedFormView);
7-
registerComponent(ResultFormViewKey,ResultFormView);
6+
registerComponent(PostponedFormViewKey, PostponedFormView);
7+
registerComponent(ResultFormViewKey, ResultFormView);

0 commit comments

Comments
 (0)