Skip to content

Commit 80a32e0

Browse files
committed
update 3.3.39
1 parent 1c90c48 commit 80a32e0

File tree

4 files changed

+86
-14
lines changed

4 files changed

+86
-14
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const registerEvents = (id: string,
2323
form: FormInstance<any>,
2424
adviceForm: FormInstance<any>,
2525
setRequestLoading: (loading: boolean) => void,
26+
reload: () => void,
2627
closeFlow: () => void) => {
2728

2829
const timeOut = useSelector((state: FlowReduxState) => state.flow.timeOut);
@@ -315,6 +316,11 @@ export const registerEvents = (id: string,
315316
id?: string
316317
}) => {
317318
switch (button.type) {
319+
case 'RELOAD': {
320+
reload();
321+
break;
322+
}
323+
318324
case 'SAVE': {
319325
// 保存流程,如果没有创建流程先创建,若已经创建则保存
320326
if (recordId) {
@@ -439,9 +445,9 @@ export const registerEvents = (id: string,
439445
const buttonId = button.id;
440446
const customButton = data.getNodeButton(buttonId);
441447
dispatch(triggerEventClick(customButton.eventKey));
442-
setTimeout(()=>{
448+
setTimeout(() => {
443449
dispatch(clearTriggerEventClick());
444-
},300);
450+
}, 300);
445451
}
446452
break;
447453
}

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

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import FlowTitle from "@/components/Flow/flow/FlowTitle";
55
import {FlowData} from "@/components/Flow/flow/data";
66
import FlowTabs from "@/components/Flow/flow/FlowTabs";
77
import {
8+
EVENT_CLOSE_RESULT_VIEW, EVENT_RELOAD_DARA,
89
FlowFormParams,
910
FlowFormView,
1011
FlowFormViewProps,
@@ -21,11 +22,15 @@ import {Provider, useDispatch, useSelector} from "react-redux";
2122
import {
2223
clearPostponed,
2324
clearResult,
25+
clearTriggerEventClick,
2426
closeUserSelect,
2527
FlowReduxState,
26-
flowStore, hideFlowView,
28+
flowStore,
29+
hideFlowView,
2730
setSelectUsers,
28-
setTimeOut, showFlowView
31+
setTimeOut,
32+
showFlowView,
33+
triggerEventClick
2934
} from "@/components/Flow/store/FlowSlice";
3035
import "./index.scss";
3136

@@ -106,22 +111,48 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
106111
}
107112
}
108113

114+
// 重新加载数据
115+
const reload = () => {
116+
detail(recordId, null).then(res => {
117+
if (res.success) {
118+
setData(res.data);
119+
setTimeout(() => {
120+
dispatch(triggerEventClick(EVENT_RELOAD_DARA));
121+
setTimeout(() => {
122+
dispatch(clearTriggerEventClick());
123+
}, 300);
124+
}, 300);
125+
}
126+
});
127+
}
128+
109129
// 注册事件
110130
useEffect(() => {
111131
setData(null);
112132
setRecordId(props.id);
113133
if (props.visible) {
114134
dispatch(showFlowView());
115135
loadFlowDetail();
116-
}else{
136+
} else {
117137
dispatch(hideFlowView());
118138
}
119139
}, [props.visible]);
120140

121141

142+
// 关闭结果视图时的事件回掉
143+
useEffect(() => {
144+
if (!resultVisible) {
145+
dispatch(triggerEventClick(EVENT_CLOSE_RESULT_VIEW));
146+
setTimeout(() => {
147+
dispatch(clearTriggerEventClick());
148+
}, 300);
149+
}
150+
}, [resultVisible]);
151+
152+
122153
// 关闭视图时回掉父级关闭对象
123154
useEffect(() => {
124-
if(!flowViewVisible){
155+
if (!flowViewVisible) {
125156
props.setVisible(false);
126157
}
127158
}, [flowViewVisible]);
@@ -135,6 +166,7 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
135166
viewForm,
136167
adviceForm,
137168
setRequestLoading,
169+
reload,
138170
() => {
139171
props.setVisible(false)
140172
}
@@ -153,6 +185,9 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
153185
// 用户选人视图
154186
const UserSelectView = getComponent(UserSelectViewKey) as React.ComponentType<UserSelectProps>;
155187

188+
// 流程数据
189+
const flowData = new FlowData(data, props.formParams);
190+
156191
return (
157192
<Modal
158193
className="flow-Modal"
@@ -172,7 +207,7 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
172207
closable={false}
173208
title={
174209
<FlowTitle
175-
flowData={new FlowData(data, props.formParams)}
210+
flowData={flowData}
176211
requestLoading={requestLoading}
177212
setRequestLoading={setRequestLoading}
178213
handlerClick={(item: any) => {
@@ -183,7 +218,7 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
183218
>
184219
<FlowTabs
185220
handlerClick={handlerClicks}
186-
flowData={new FlowData(data, props.formParams)}
221+
flowData={flowData}
187222
view={props.view}
188223
requestLoading={requestLoading}
189224
setRequestLoading={setRequestLoading}
@@ -219,7 +254,7 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
219254
/>
220255
)}
221256

222-
{UserSelectView && userSelectType && (
257+
{UserSelectView && userSelectType && (
223258
<UserSelectView
224259
visible={userSelectVisible}
225260
setVisible={() => {

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@ import {FormInstance} from "antd/es/form/hooks/useForm";
33
import {FlowData} from "@/components/Flow/flow/data";
44

55
// 自定义按钮类型
6-
export type CustomButtonType = 'SAVE' | 'START' | 'SUBMIT' | 'TRY_SUBMIT' | 'SPECIFY_SUBMIT' | 'REJECT' | 'TRANSFER' | 'RECALL' | 'POSTPONED' | 'URGE' | 'CUSTOM' | 'VIEW';
6+
export type CustomButtonType =
7+
'RELOAD'
8+
| 'SAVE'
9+
| 'START'
10+
| 'SUBMIT'
11+
| 'TRY_SUBMIT'
12+
| 'SPECIFY_SUBMIT'
13+
| 'REJECT'
14+
| 'TRANSFER'
15+
| 'RECALL'
16+
| 'POSTPONED'
17+
| 'URGE'
18+
| 'CUSTOM'
19+
| 'VIEW';
720

821
// 流程图中线的类型
922
export type EdgeType = 'line' | 'polyline' | 'bezier';
@@ -54,6 +67,11 @@ export interface FlowFormParams {
5467
[key: string]: any;
5568
}
5669

70+
// 关闭结果视图事件
71+
export const EVENT_CLOSE_RESULT_VIEW = 'EVENT_CLOSE_RESULT_VIEW';
72+
// 重新加载数据事件
73+
export const EVENT_RELOAD_DARA = 'EVENT_RELOAD_DARA';
74+
5775
export const PostponedFormViewKey = 'PostponedFormView';
5876

5977
// 延期表单 【拓展视图】
@@ -93,7 +111,7 @@ export const UserSelectViewKey = 'UserSelectView';
93111
export type UserSelectMode = 'single' | 'multiple';
94112

95113
export type UserSelectType =
96-
// 选择下级流程节点的人员,约定人员id范围
114+
// 选择下级流程节点的人员,约定人员id范围
97115
'nextNodeUser'
98116
// 选择转办人员,约定本单位下的人员
99117
| 'transfer'

admin-ui/src/pages/flow/leave/LeaveForm.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {useEffect} from "react";
22
import {ProForm, ProFormDigit, ProFormText, ProFormTextArea} from "@ant-design/pro-components";
3-
import {FlowFormViewProps} from "@/components/Flow/flow/types";
3+
import {EVENT_CLOSE_RESULT_VIEW, EVENT_RELOAD_DARA, FlowFormViewProps} from "@/components/Flow/flow/types";
44
import {Button} from "antd";
55
import {useSelector} from "react-redux";
66
import {FlowReduxState} from "@/components/Flow/store/FlowSlice";
@@ -12,7 +12,7 @@ const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
1212
const opinionEditorVisible = useSelector((state: FlowReduxState) => state.flow.opinionEditorVisible);
1313

1414
useEffect(() => {
15-
if(props.visible) {
15+
if (props.visible) {
1616
console.log('init props.visible ');
1717
props.form.resetFields();
1818
props.form.setFieldsValue(props.data);
@@ -31,12 +31,25 @@ const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
3131
const [visible, setVisible] = React.useState(false);
3232

3333
useEffect(() => {
34-
if (eventKey) {
34+
if (eventKey ==='test') {
3535
console.log("点击了自定义事件", eventKey);
3636
setVisible(true);
3737
}
38+
39+
// 当流程审批反馈结果关闭时,重新加载数据
40+
if (eventKey==EVENT_CLOSE_RESULT_VIEW && props.flowData?.getNodeCode() ==='start') {
41+
// 重新加载数据
42+
console.log("重新加载数据");
43+
props.handlerClick && props.handlerClick({type: "RELOAD"});
44+
}
45+
46+
if (eventKey==EVENT_RELOAD_DARA) {
47+
props.form.resetFields();
48+
props.form.setFieldsValue(props.data);
49+
}
3850
}, [eventKey]);
3951

52+
4053
return (
4154
<ProForm
4255
form={props.form}

0 commit comments

Comments
 (0)