<template>
|
<div class="process-view">
|
<div class="process-view__tabs" v-loading="loading">
|
<process-diagram-viewer />
|
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import {getFlowDetail, getWorkSetpsByBusinessId} from "@/api/design";
|
import ProcessDiagramViewer from "@/views/admin/layout/ProcessDiagramViewer";
|
|
export default {
|
components: { ProcessDiagramViewer },
|
data() {
|
return {
|
loading: false,
|
processInstanceId: "",
|
formData: {},
|
currentNode: {},
|
processInfo: "",
|
};
|
},
|
methods: {
|
|
getProcessInfo() {
|
this.loading = true;
|
let param = {"id": this.processInstanceId}
|
getWorkSetpsByBusinessId(param).then(rsp => {
|
let workSetps=rsp.data.data
|
if(workSetps.length>0){
|
let index=-1;
|
let resultProcess;
|
let noApprovalArr=workSetps.filter(item=>item.end_time===null);
|
////如果所有节点都没审批 那么就取index_no=1的id为当前运行的节点
|
if(noApprovalArr.length===workSetps.length){
|
resultProcess=workSetps.find(item=>item.index_no===1)
|
}else{
|
//否则就取遍历查询 审批节点不为空 index_no最大的
|
workSetps.forEach(item => {
|
if (item.index_no > index && item.end_time!==null) {
|
index = item.index_no;
|
resultProcess = item;
|
}
|
})
|
}
|
this.$store.state.runningList .push(resultProcess.approve_step_id)
|
param.id=resultProcess.approve_id
|
this.getFlowDetail(param)
|
}else{
|
this.$message.error("未查询到审批流数据!")
|
}
|
}).catch(err => {
|
this.$message.error(err)
|
})
|
|
|
},
|
getFlowDetail(param){
|
getFlowDetail(param).then(rsp => {
|
let form = rsp.data.data;
|
form.process =this.$Utils.convertToTreeData(form.steps, {
|
"id": form.id, "parentId": null,
|
"type": "ROOT",
|
"name": "发起人",
|
"desc": "任何人", "props": {
|
"assignedUser": [],
|
"formPerms": []
|
},
|
},1,form.id)
|
|
form.name=this.$Utils.decode(form.name);
|
form.templateName = form.name
|
this.$store.state.design = form;
|
this.$store.commit('loadForm', form)
|
}).catch(err => {
|
this.$message.error(err)
|
}) .finally(() => {
|
this.loading = false;
|
});
|
}
|
},
|
beforeMount() {
|
this.processInstanceId = this.$route.query.processInstanceId;
|
},
|
mounted() {
|
this.getProcessInfo();
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.process-view {
|
padding: 20px;
|
height: 100%;
|
//display: flex;
|
//flex-direction: column;
|
box-sizing: border-box;
|
|
&__header {
|
margin-bottom: 10px;
|
}
|
|
&__tabs {
|
flex: 1;
|
/deep/ .el-tabs__content {
|
height: calc(100vh - 150px);
|
overflow-y: auto;
|
}
|
}
|
}
|
</style>
|