Skip to content

Commit eebafb6

Browse files
committed
fix chart show
1 parent ed1dece commit eebafb6

File tree

21 files changed

+110
-44
lines changed

21 files changed

+110
-44
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ interface FlowButtonsProps {
1313
const FlowButtons: React.FC<FlowButtonsProps> = (props) => {
1414
const flowData = props.flowData;
1515

16-
if (!flowData) {
16+
if (!flowData ) {
17+
return null;
18+
}
19+
20+
if(flowData.hasData() && flowData.isDone()){
1721
return null;
1822
}
1923

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const FlowChart: React.FC<FlowChartProps> = (props) => {
2121
const container = useRef<HTMLDivElement>(null);
2222
const lfRef = useRef<LogicFlow>(null);
2323

24-
console.log(flowData.getFlowSchema());
25-
2624
useEffect(() => {
2725
const SilentConfig = {
2826
isSilentMode: true,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const FlowDetail: React.FC<FlowDetailProps> = (props) => {
2727
data={flowData.getFlowData()}
2828
form={props.form}
2929
visible={props.visible}
30-
editable={flowData.getFlowNodeEditable()}
30+
editable={!flowData.isDone() && flowData.getFlowNodeEditable()}
3131
compare={!flowData.isStartFlow()}
3232
/>
3333
</div>
@@ -42,7 +42,7 @@ const FlowDetail: React.FC<FlowDetailProps> = (props) => {
4242
)}
4343

4444
{/*仅当非发起流程时再展示审批意见框*/}
45-
{FlowFormView && !flowData.isStartFlow() && (
45+
{FlowFormView && !flowData.isDone() && !flowData.isStartFlow() && (
4646
<div className="opinionForm">
4747
<div>
4848
<Divider>

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

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export class FlowData extends FlowWorkData {
9797
this.formParams = formParams;
9898
}
9999

100+
canHandle = () => {
101+
return this.data.canHandle;
102+
}
103+
100104
isStartFlow = () => {
101105
if (this.data) {
102106
return this.data.flowNode.startNode;
@@ -148,19 +152,26 @@ export class FlowData extends FlowWorkData {
148152
}
149153

150154

151-
getNodeState = (code:string)=>{
155+
getNodeState = (code: string) => {
152156
const historyRecords = this.data.historyRecords || [];
153157

154158
const historyNodeCodes = historyRecords.map((record: any) => {
155159
return record.nodeCode;
156160
});
157161

158162
const currentNodeCode = this.data.flowNode.code;
159-
if(currentNodeCode === code) {
163+
if (currentNodeCode === code) {
164+
if (this.isFinished()) {
165+
return "done";
166+
}
160167
return "current";
161168
}
162169

163-
if(historyNodeCodes.indexOf(code) !== -1) {
170+
if (historyNodeCodes.indexOf(code) !== -1) {
171+
return "done";
172+
}
173+
174+
if (this.isFinished()) {
164175
return "done";
165176
}
166177

@@ -169,10 +180,10 @@ export class FlowData extends FlowWorkData {
169180

170181
getFlowSchema = () => {
171182

172-
if(this.data.flowWork.schema) {
173-
const schema = JSON.parse(this.data.flowWork.schema);
183+
if (this.data.flowWork.schema) {
184+
const schema = JSON.parse(this.data.flowWork.schema);
174185

175-
for(const node of schema.nodes) {
186+
for (const node of schema.nodes) {
176187
node.properties.settingVisible = false;
177188
node.properties.state = this.getNodeState(node.properties.code);
178189
}
@@ -193,5 +204,18 @@ export class FlowData extends FlowWorkData {
193204
return this.data.historyRecords;
194205
}
195206

207+
isDone() {
208+
if (this.data.flowRecord) {
209+
return this.data.flowRecord.flowStatus === 'FINISH' || this.data.flowRecord.flowType === 'DONE';
210+
}
211+
return false;
212+
}
213+
214+
private isFinished() {
215+
if (this.data.flowRecord) {
216+
return this.data.flowRecord.flowStatus === 'FINISH';
217+
}
218+
return false;
219+
}
196220
}
197221

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

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {custom, postponed, recall, saveFlow, startFlow, submitFlow, transfer, tr
55
import {message} from "antd";
66
import {useDispatch, useSelector} from "react-redux";
77
import {
8-
clearUserSelect,
8+
clearUserSelect, closeUserSelect,
99
FlowReduxState,
1010
setUserSelectModal,
1111
showPostponed,
@@ -126,7 +126,7 @@ export const registerEvents = (id: string,
126126
}
127127

128128
// 提交流程
129-
const handleSubmitFlow = (flowState: boolean, callback: (res: any) => void) => {
129+
const handleSubmitFlow = (flowState: boolean, callback: (res: any) => void,operatorIds?:any[]) => {
130130
const advice = adviceForm.getFieldValue('advice');
131131
setRequestLoading(true);
132132

@@ -135,6 +135,7 @@ export const registerEvents = (id: string,
135135
const body = {
136136
recordId,
137137
advice: advice,
138+
operatorIds:operatorIds,
138139
success: flowState,
139140
formData: {
140141
...flowData,
@@ -290,6 +291,19 @@ export const registerEvents = (id: string,
290291
const currentUser = selectUsers[0];
291292
handlerTransferFlow(currentUser);
292293
}
294+
295+
if(selectUserType === 'flow' && selectUsers && selectUsers.length > 0){
296+
handleSubmitFlow(true,(res)=>{
297+
const flowSubmitResultBuilder = new FlowSubmitResultBuilder(res.data);
298+
dispatch(closeUserSelect());
299+
dispatch(showResult({
300+
closeFlow: true,
301+
result: flowSubmitResultBuilder.builder()
302+
}));
303+
},selectUsers.map((item:FlowUser)=> {
304+
return item.id;
305+
}));
306+
}
293307
}, [selectUsers]);
294308

295309

@@ -301,7 +315,7 @@ export const registerEvents = (id: string,
301315
handlerSaveFlow();
302316
} else {
303317
handlerStartFlow(() => {
304-
message.success('流程已保存至个人待办').then();
318+
message.success('流程已保存').then();
305319
});
306320
}
307321
break;
@@ -314,18 +328,29 @@ export const registerEvents = (id: string,
314328
break;
315329
}
316330
case 'SPECIFY_SUBMIT': {
317-
handleTrySubmitFlow((res) => {
318-
const operators = res.data.operators;
319-
const userIds = operators.map((item: any) => {
320-
return item.userId;
331+
const _trySubmitFlow = () => {
332+
handleTrySubmitFlow((res) => {
333+
const operators = res.data.operators;
334+
const userIds = operators.map((item: any) => {
335+
return item.userId;
336+
});
337+
const approvalType = res.data.flowNode.approvalType;
338+
dispatch(setUserSelectModal({
339+
mode: approvalType==='SIGN'?'single':'multiple',
340+
type: 'flow',
341+
visible: true,
342+
specifyUserIds: userIds
343+
}));
321344
});
322-
dispatch(setUserSelectModal({
323-
mode: 'single',
324-
type: 'flow',
325-
visible: true,
326-
specifyUserIds: userIds
327-
}));
328-
});
345+
}
346+
if(recordId){
347+
_trySubmitFlow();
348+
}else{
349+
handlerStartFlow((id) => {
350+
recordId = id;
351+
_trySubmitFlow();
352+
});
353+
}
329354
break;
330355
}
331356
case 'SUBMIT': {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {Provider, useDispatch, useSelector} from "react-redux";
2121
import {
2222
clearPostponed,
2323
clearResult,
24-
clearUserSelect,
24+
clearUserSelect, closeUserSelect,
2525
FlowReduxState,
2626
flowStore,
2727
setSelectUsers,
@@ -208,7 +208,7 @@ const $FlowView: React.FC<FlowViewProps> = (props) => {
208208
<UserSelectView
209209
visible={userSelectVisible}
210210
setVisible={() => {
211-
dispatch(clearUserSelect());
211+
dispatch(closeUserSelect());
212212
}}
213213
onFinish={(values) => {
214214
dispatch(setSelectUsers(values));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface FlowUser {
7575
}
7676

7777
// 选人表单 【拓展视图】
78+
7879
export interface UserSelectProps {
7980
visible: boolean;
8081
setVisible: (visible: boolean) => void;

admin-ui/src/components/Flow/store/FlowSlice.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export type FlowStoreAction = {
4343
type: string,
4444
specifyUserIds: number[]
4545
}>) => void;
46-
setSelectUsers: (state: FlowStore, action: PayloadAction<any[]>) => void;
46+
setSelectUsers: (state: FlowStore, action: PayloadAction<FlowUser[]>) => void;
47+
closeUserSelect: (state: FlowStore) => void;
4748
clearUserSelect: (state: FlowStore) => void;
4849
}
4950

@@ -94,10 +95,13 @@ export const flowSlice = createSlice<FlowStore, FlowStoreAction, "flow", {}>({
9495

9596
setSelectUsers: (state, action) => {
9697
state.userSelectVisible = false;
97-
state.userSelectMode = 'single';
9898
state.currentUsers = action.payload;
9999
},
100100

101+
closeUserSelect: (state) => {
102+
state.userSelectVisible = false;
103+
},
104+
101105
clearUserSelect: (state) => {
102106
state.userSelectVisible = false;
103107
state.userSelectMode = 'single';
@@ -117,6 +121,7 @@ export const {
117121
clearResult,
118122
clearUserSelect,
119123
setUserSelectModal,
124+
closeUserSelect,
120125
setSelectUsers
121126
} = flowSlice.actions;
122127
export const flowStore = configureStore({

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.22</version>
8+
<version>3.3.23</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

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.22</version>
8+
<version>3.3.23</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

0 commit comments

Comments
 (0)