Skip to content

Commit a43f4eb

Browse files
committed
fix 3.3.24
1 parent f5edc8f commit a43f4eb

File tree

21 files changed

+135
-86
lines changed

21 files changed

+135
-86
lines changed

admin-ui/src/components/Flow/components/ResultFormView.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,49 @@ const ResultFormView: React.FC<ResultFormProps> = (props) => {
1010
if (!result) {
1111
return null;
1212
}
13+
14+
const resultStateTag = ()=>{
15+
const resultState = result.resultState;
16+
if(resultState === "SUCCESS") {
17+
return "success"
18+
}
19+
if(resultState === "WARNING") {
20+
return "warning"
21+
}
22+
return "info";
23+
};
24+
25+
1326
return (
1427
<Modal
1528
width={"40%"}
1629
height={"60%"}
1730
open={props.visible}
1831
onCancel={() => {
1932
props.setVisible(false);
20-
if(props.flowCloseable){
33+
if (props.flowCloseable) {
2134
props.closeFlow();
2235
}
2336
}}
2437
onClose={() => {
2538
props.setVisible(false);
26-
if(props.flowCloseable){
39+
if (props.flowCloseable) {
2740
props.closeFlow();
2841
}
2942
}}
3043
onOk={() => {
3144
props.setVisible(false);
32-
if(props.flowCloseable){
45+
if (props.flowCloseable) {
3346
props.closeFlow();
3447
}
3548
}}
3649
destroyOnClose={true}
3750
>
3851

3952
<Result
40-
status="success"
53+
status={resultStateTag()}
4154
title={result.title}
4255
>
43-
4456
{result.items && result.items.map((item: FlowResultItem, index: number) => {
4557
return (
4658
<ProDescriptions

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const ResultFormViewKey = 'ResultFormView';
4444

4545
export interface FlowResultMessage {
4646
title: string,
47+
resultState:string,
4748
items: FlowResultItem[]
4849
}
4950

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def run(content){
118118
// 你的代码
119119
// 自定义返回标题
120120
// return content.createMessageResult('我是自定义标题');
121+
// 自定义返回标题,并且设置返回状态 SUCCESS、INFO、WARNING 三种状态
122+
// return content.createMessageResult('我是自定义标题').resultState('SUCCESS');
121123
// 自定义返回标题并且关闭流程
122124
// return content.createMessageResult('我是自定义标题', true);
123125
// 提交流程

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
2121
hidden={true}
2222
/>
2323

24+
<ProFormText
25+
name={"username"}
26+
hidden={true}
27+
/>
28+
2429
<ProFormDigit
2530
name={"days"}
2631
label={"请假天数"}

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

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
import React from "react";
22
import Page from "@/components/Layout/Page";
3-
import {
4-
ActionType,
5-
ModalForm,
6-
PageContainer,
7-
ProForm,
8-
ProFormDigit,
9-
ProFormText,
10-
ProFormTextArea,
11-
ProTable
12-
} from "@ant-design/pro-components";
13-
import {list, startLeave} from "@/api/leave";
14-
import {Button, message} from "antd";
15-
import FlowSelect from "@/pages/flow/work/select";
3+
import {ActionType, PageContainer, ProTable} from "@ant-design/pro-components";
4+
import {list} from "@/api/leave";
5+
import {Button} from "antd";
166
import FlowView from "@/components/Flow/flow";
177
import LeaveForm from "@/pages/flow/leave/LeaveForm";
188

@@ -21,8 +11,7 @@ const LeavePage = () => {
2111

2212
const [visible, setVisible] = React.useState(false);
2313

24-
const [flowSelectVisible, setFlowSelectVisible] = React.useState(false);
25-
const [form] = ProForm.useForm();
14+
const username = localStorage.getItem('username');
2615

2716
const actionRef = React.useRef<ActionType>();
2817
const columns = [
@@ -41,20 +30,11 @@ const LeavePage = () => {
4130
},
4231
{
4332
title: '请假人',
44-
dataIndex: 'userName',
33+
dataIndex: 'username',
4534
}
4635
] as any[];
4736

4837

49-
const handleStartFlow = async (values: any) => {
50-
const res = await startLeave(values);
51-
if (res.success) {
52-
message.success("发起成功,请到待办中心");
53-
setVisible(false);
54-
actionRef.current?.reload();
55-
}
56-
}
57-
5838
return (
5939
<PageContainer>
6040
<Page>
@@ -83,6 +63,7 @@ const LeavePage = () => {
8363
workCode={"leave"}
8464
formParams={{
8565
clazzName: 'com.codingapi.example.domain.Leave',
66+
username: username
8667
}}
8768
/>
8869

example/example-application/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.23</version>
8+
<version>3.3.24</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-application/src/main/java/com/codingapi/example/command/LeaveCmdController.java

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.codingapi.example.handler;
2+
3+
import com.codingapi.example.domain.Leave;
4+
import com.codingapi.example.repository.LeaveRepository;
5+
import com.codingapi.springboot.flow.event.FlowApprovalEvent;
6+
import com.codingapi.springboot.framework.event.IHandler;
7+
import lombok.AllArgsConstructor;
8+
import org.springframework.stereotype.Service;
9+
10+
@Service
11+
@AllArgsConstructor
12+
public class LeaveHandler implements IHandler<FlowApprovalEvent> {
13+
14+
private final LeaveRepository leaveRepository;
15+
16+
@Override
17+
public void handler(FlowApprovalEvent event) {
18+
if(event.isFinish() && event.match(Leave.class)){
19+
Leave leave = (Leave)event.getBindData();
20+
leaveRepository.save(leave);
21+
}
22+
}
23+
}

example/example-domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.23</version>
8+
<version>3.3.24</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.23</version>
8+
<version>3.3.24</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

0 commit comments

Comments
 (0)