index.vue
3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
<div class="main">
<div
class="flowContent"
>
<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,getProcessOutline } from "@api/user";
import flowNode from "./flownode"
export default {
name: "",
components: {flowNode},
props: {},
data() {
return {
flowData:{},
flowShow:false,
flowState:[]
}
},
created() {},
mounted() {
this.getTemplate();
},
methods: {
getTemplate(){
let params = {
"params": {},
"workflowPeriod": "current",
"workitemInstanceId": this.$route.query.workitemInstanceId
}
getActivityDetail(params).then((res) => {
console.log(res.processInstance.templetId);
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) => {});
})
.catch((error) => {});
},
},
computed: {},
watch: {},
};
</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>