4a719e5f by 杨威

流程跟踪模块开发

1 parent 16496a0d
......@@ -37,6 +37,7 @@
"vue-router": "^3.4.9",
"vuex": "^3.6.0",
"webpack-theme-color-replacer": "^1.3.14",
"x2js": "^3.4.0",
"xlsx": "^0.16.9"
},
"devDependencies": {
......
......@@ -78,4 +78,17 @@ export function templateLoad(data) {
method: 'get',
})
}
/**
* 获取工作流大纲
*/
export function getProcessOutline(data) {
return request({
url: '/workflow/getProcessOutline',
method: 'get',
params: {
processInstanceId:data,
isCurrent:true
}
})
}
......
<template>
<div class="flowBox">
<div class="node" v-for="node in flowData.Process.Nodes.ManualNode" :key="node.id">{{node.name}}</div>
<div class="node-wrap">
<div class="node"
v-for="node in flowData.Nodes.ManualNode"
:key="node.id"
:class="[
{'wjh' : node.activityState == 1},
{'jh' : node.activityState == 2 },
{'gq' : node.activityState == 3 },
{'wc' : node.activityState == 4 },
{'zz' : node.activityState == 5 }
]"
>
{{node.name}}
</div>
</div>
</div>
</template>
......@@ -12,7 +26,13 @@ export default {
flowData:{
type:Object,
default:null
}
},
flowState:{
type:Array,
default: () => {
return [];
},
},
},
data(){
return {
......@@ -22,8 +42,8 @@ export default {
mounted(){
this.$nextTick(()=>{
console.log(this.flowData,'flowData.Nodes');
console.log(this.flowState,'flowState');
})
},
methods:{},
computed: {},
......@@ -34,6 +54,7 @@ export default {
.flowBox{
width: 150%;
height: 100%;
position: relative;
// 网格背景
background-image: -webkit-gradient(
linear,
......@@ -50,5 +71,48 @@ export default {
),
linear-gradient(rgba(0, 0, 0, 0.15) 10%, rgba(0, 0, 0, 0) 10%);
background-size: 10px 10px;
.node-wrap{
position: absolute;
top: 50%;
left: 20px;
.node{
display: inline-block;
min-width: 80px;
line-height: 30px;
background-color: #A9A9A9;
text-align: center;
border-radius: 6px;
margin-right: 50px;
position: relative;
color: #ffffff;
}
.node::after{
content: "";
position: absolute;
width: 50px;
height: 30px;
left: 100%;
background-image: url("../../../assets/images/arrow.jpg");
background-size: 50px 30px;
}
.node:last-child:after{
display: none;
}
.wjh{
background-color: #A9A9A9;
}
.jh{
background-color: #449D44;
}
.gq{
background-color: #F0AD4E;
}
.wc{
background-color: #5BC0DE;
}
.zz{
background-color: #F13F2F;
}
}
}
</style>
\ No newline at end of file
......
......@@ -3,13 +3,20 @@
<div
class="flowContent"
>
<flowNode :flowData="flowData"></flowNode>
<flowNode :flowData="flowData" :flowState="flowState" v-if="flowShow"></flowNode>
<ul class="legend">
<li><span class="circle wjh"></span><span class="name">未激活</span></li>
<li><span class="circle jh"></span><span class="name">激活</span></li>
<li><span class="circle gq"></span><span class="name">挂起</span></li>
<li><span class="circle wc"></span><span class="name">完成</span></li>
<li><span class="circle zz"></span><span class="name">终止</span></li>
</ul>
</div>
</div>
</template>
<script>
import { getActivityDetail,templateLoad } from "@api/user";
import { getActivityDetail,templateLoad,getProcessOutline } from "@api/user";
import flowNode from "./flownode"
export default {
name: "",
......@@ -19,6 +26,7 @@ export default {
return {
flowData:{},
flowShow:false,
flowState:[]
}
},
created() {},
......@@ -34,9 +42,24 @@ export default {
}
getActivityDetail(params).then((res) => {
console.log(res.processInstance.templetId);
templateLoad(res.processInstance.templetId).then((res) => {
console.log(this.$x2js.xml2js(res));
this.flowData = this.$x2js.xml2js(res);
templateLoad(res.processInstance.templetId).then((res1) => {
console.log(this.$x2js.xml2js(res1).Process,'Process');
getProcessOutline(res.processInstance.id).then((res2) => {
this.flowData = this.$x2js.xml2js(res1).Process;
console.log(res2.activityOutlines,'res.activityOutlines');
this.flowState = res2.activityOutlines;
this.$nextTick(()=>{
this.flowData.Nodes.ManualNode.push(this.flowData.Nodes.EndNode);
this.flowData.Nodes.ManualNode.unshift(this.flowData.Nodes.StartNode);
// this.flowData.Nodes.StartNode.activityType = this.flowState.filter( i => i.activityTemplateId == this.flowData.Nodes.StartNode.id)[0].activityType;
// this.flowData.Nodes.EndNode.activityType = this.flowState.filter( i => i.activityTemplateId == this.flowData.Nodes.EndNode.id)[0].activityType;
this.flowData.Nodes.ManualNode.forEach(item => {
item.activityState = this.flowState.filter( i => i.activityTemplateId == item.id)[0].activityState;
});
this.flowShow = true;
})
})
.catch((error) => {});
})
.catch((error) => {});
})
......@@ -49,11 +72,45 @@ export default {
</script>
<style scoped lang="less">
.main {
position: relative;
.flowContent {
width: calc(100% + 6px);
height: 100%;
position: relative;
overflow-x: scroll;
}
.legend{
position: absolute;
top: 20px;
right: 20px;
li{
margin-bottom: 10px;
.circle{
display: inline-block;
width: 12px;
height: 12px;
border-radius: 6px;
}
.name{
margin-left: 10px;
font-weight: bold;
}
.wjh{
background-color: #A9A9A9;
}
.jh{
background-color: #449D44;
}
.gq{
background-color: #F0AD4E;
}
.wc{
background-color: #5BC0DE;
}
.zz{
background-color: #F13F2F;
}
}
}
}
</style>
......