audit_detail.vue
2.58 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
117
118
119
<template>
<view class="page">
<view class="fixed">
<view class="tabs" :class="[`${tab === 'base' ? 'bg1' : 'bg2'}`]">
<view :class="['tab', { active: tab === 'base' }]" @click="tab = 'base'">基础信息</view>
<view :class="['tab', { active: tab === 'flow' }]" @click="tab = 'flow'">流程</view>
</view>
</view>
<view class="body">
<view v-if="tab === 'base'">
<component :is="componentName" :id="auditCtx.businessId" ref="basicRef" />
</view>
<view v-else>
<FlowTimeline :nodeList="nodeList" :isEnd="isEnd" />
</view>
</view>
</view>
</template>
<script>
import FlowTimeline from '@/components/flow-timeline/index.vue'
import { getSysFlowComponentPath } from '@/utils/flow-components.js'
import { getFlowLinkByInstanceIdApi } from '@/api/flow.js'
export default {
components: {
FlowTimeline
},
data() {
return {
tab: 'base',
auditCtx: {
taskId: '',
instanceId: '',
businessId: '',
bizFlag: ''
},
isEnd: false, // 流程是否结束
nodeList: []
}
},
computed: {
componentName() {
const name = getSysFlowComponentPath(this.auditCtx.bizFlag || '')
return name || ''
}
},
onLoad() {
const CACHE_KEY = 'FLOW_AUDIT_CACHE'
const cache = uni.getStorageSync(CACHE_KEY) || {};
console.log('审核详情__cache', cache)
this.auditCtx = cache;
if (this.auditCtx && this.auditCtx.instanceId) {
this.loadFlowLinkByInstanceId(this.auditCtx.instanceId)
}
},
methods: {
loadFlowLinkByInstanceId(instanceId) {
getFlowLinkByInstanceIdApi({ instanceId }).then(res => {
console.log('审核__loadFlowLinkByInstanceId', res)
const _data = res && res.data ? res.data : {};
this.nodeList = _data.nodeList || [];
this.isEnd = _data.end || false;
}).catch(() => { })
},
}
}
</script>
<style lang="scss" scoped>
.page {
display: flex;
flex-direction: column;
height: 100vh
}
.fixed {
position: fixed;
top: 96rpx;
left: 0;
right: 0;
z-index: 2;
.tabs {
display: flex;
align-items: center;
height: 96rpx;
&.bg1 {
background-image: url('/static/images/flow/tab_1_icon.png');
background-repeat: no-repeat;
background-position: right center;
background-size: cover;
}
&.bg2 {
background-image: url('/static/images/flow/tab_2_icon.png');
background-repeat: no-repeat;
background-position: right center;
background-size: cover;
}
.tab {
width: 50%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
font-weight: 600;
color: rgba(0, 0, 0, 0.9);
&.active {
color: $theme-primary;
}
}
}
}
.body {
flex: 1;
padding-top: 104rpx;
}
</style>