81
81
</el-card >
82
82
83
83
<!-- 审批记录 -->
84
- <el-card class =" box-card" v-loading =" tasksLoad" >
85
- <template #header >
86
- <span class =" el-icon-picture-outline" >审批记录</span >
87
- </template >
88
- <el-col :span =" 16" :offset =" 4" >
89
- <div class =" block" >
90
- <el-timeline >
91
- <el-timeline-item
92
- v-for =" (item, index) in tasks"
93
- :key =" index"
94
- :icon =" getTimelineItemIcon(item)"
95
- :type =" getTimelineItemType(item)"
96
- >
97
- <p style =" font-weight : 700 " >任务:{{ item.name }}</p >
98
- <el-card :body-style =" { padding: '10px' }" >
99
- <label v-if =" item.assigneeUser" style =" font-weight : normal ; margin-right : 30px " >
100
- 审批人:{{ item.assigneeUser.nickname }}
101
- <el-tag type =" info" size =" small" >{{ item.assigneeUser.deptName }}</el-tag >
102
- </label >
103
- <label style =" font-weight : normal " v-if =" item.createTime" >创建时间:</label >
104
- <label style =" color : #8a909c ; font-weight : normal " >
105
- {{ parseTime(item?.createTime) }}
106
- </label >
107
- <label v-if =" item.endTime" style =" margin-left : 30px ; font-weight : normal " >
108
- 审批时间:
109
- </label >
110
- <label v-if =" item.endTime" style =" color : #8a909c ; font-weight : normal " >
111
- {{ parseTime(item?.endTime) }}
112
- </label >
113
- <label v-if =" item.durationInMillis" style =" margin-left : 30px ; font-weight : normal " >
114
- 耗时:
115
- </label >
116
- <label v-if =" item.durationInMillis" style =" color : #8a909c ; font-weight : normal " >
117
- {{ formatPast2(item?.durationInMillis) }}
118
- </label >
119
- <p v-if =" item.reason" >
120
- <el-tag :type =" getTimelineItemType(item)" >{{ item.reason }}</el-tag >
121
- </p >
122
- </el-card >
123
- </el-timeline-item >
124
- </el-timeline >
125
- </div >
126
- </el-col >
127
- </el-card >
84
+ <ProcessInstanceTaskList :loading =" tasksLoad" :tasks =" tasks" />
128
85
129
86
<!-- 高亮流程图 -->
130
87
<ProcessInstanceBpmnViewer
140
97
</ContentWrap >
141
98
</template >
142
99
<script setup lang="ts">
143
- import { parseTime } from ' @/utils/formatTime'
144
- import * as ProcessInstanceApi from ' @/api/bpm/processInstance'
145
- import * as TaskApi from ' @/api/bpm/task'
146
- import { formatPast2 } from ' @/utils/formatTime'
147
100
import { setConfAndFields2 } from ' @/utils/formCreate'
148
101
import type { ApiAttrs } from ' @form-create/element-ui/types/config'
149
102
import { useUserStore } from ' @/store/modules/user'
103
+ import * as DefinitionApi from ' @/api/bpm/definition'
104
+ import * as ProcessInstanceApi from ' @/api/bpm/processInstance'
105
+ import * as TaskApi from ' @/api/bpm/task'
150
106
import TaskUpdateAssigneeForm from ' ./TaskUpdateAssigneeForm.vue'
151
107
import ProcessInstanceBpmnViewer from ' ./ProcessInstanceBpmnViewer.vue'
152
- import * as DefinitionApi from ' @/api/bpm/definition'
153
-
108
+ import ProcessInstanceTaskList from ' ./ProcessInstanceTaskList.vue'
154
109
const { query } = useRoute () // 查询参数
155
110
const message = useMessage () // 消息弹窗
156
111
const { proxy } = getCurrentInstance () as any
157
112
158
- // ========== 审批信息 ==========
159
- const id = query .id as unknown as number
113
+ const userId = useUserStore (). getUser . id // 当前登录的编号
114
+ const id = query .id as unknown as number // 流程实例的编号
160
115
const processInstanceLoading = ref (false ) // 流程实例的加载中
161
116
const processInstance = ref <any >({}) // 流程实例
117
+ const bpmnXML = ref (' ' ) // BPMN XML
118
+ const tasksLoad = ref (true ) // 任务的加载中
119
+ const tasks = ref <any []>([]) // 任务列表
120
+ // ========== 审批信息 ==========
162
121
const runningTasks = ref <any []>([]) // 运行中的任务
163
122
const auditForms = ref <any []>([]) // 审批任务的表单
164
123
const auditRule = reactive ({
165
124
reason: [{ required: true , message: ' 审批建议不能为空' , trigger: ' blur' }]
166
125
})
126
+ // ========== 申请信息 ==========
127
+ const fApi = ref <ApiAttrs >() //
128
+ const detailForm = ref ({
129
+ // 流程表单详情
130
+ rule: [],
131
+ option: {},
132
+ value: {}
133
+ })
167
134
168
- // 处理审批通过和不通过的操作
135
+ /** 处理审批通过和不通过的操作 */
169
136
const handleAudit = async (task , pass ) => {
170
137
// 1.1 获得对应表单
171
138
const index = runningTasks .value .indexOf (task )
172
139
const auditFormRef = proxy .$refs [' form' + index ][0 ]
173
- // alert(auditFormRef)
174
-
175
140
// 1.2 校验表单
176
141
const elForm = unref (auditFormRef )
177
142
if (! elForm ) return
@@ -194,54 +159,6 @@ const handleAudit = async (task, pass) => {
194
159
getDetail ()
195
160
}
196
161
197
- // ========== 申请信息 ==========
198
- const fApi = ref <ApiAttrs >()
199
- const userId = useUserStore ().getUser .id // 当前登录的编号
200
- // 流程表单详情
201
- const detailForm = ref ({
202
- rule: [],
203
- option: {},
204
- value: {}
205
- })
206
-
207
- // ========== 审批记录 ==========
208
- const tasksLoad = ref (true )
209
- const tasks = ref <any []>([])
210
-
211
- const getTimelineItemIcon = (item ) => {
212
- if (item .result === 1 ) {
213
- return ' el-icon-time'
214
- }
215
- if (item .result === 2 ) {
216
- return ' el-icon-check'
217
- }
218
- if (item .result === 3 ) {
219
- return ' el-icon-close'
220
- }
221
- if (item .result === 4 ) {
222
- return ' el-icon-remove-outline'
223
- }
224
- return ' '
225
- }
226
- const getTimelineItemType = (item ) => {
227
- if (item .result === 1 ) {
228
- return ' primary'
229
- }
230
- if (item .result === 2 ) {
231
- return ' success'
232
- }
233
- if (item .result === 3 ) {
234
- return ' danger'
235
- }
236
- if (item .result === 4 ) {
237
- return ' info'
238
- }
239
- return ' '
240
- }
241
-
242
- // ========== 审批记录 ==========
243
- const bpmnXML = ref (' ' )
244
-
245
162
/** 转派审批人 */
246
163
const taskUpdateAssigneeFormRef = ref ()
247
164
const openTaskUpdateAssigneeForm = (id : string ) => {
@@ -352,9 +269,3 @@ const getDetail = () => {
352
269
})
353
270
}
354
271
</script >
355
- <style lang="scss">
356
- .box-card {
357
- width : 100% ;
358
- margin-bottom : 20px ;
359
- }
360
- </style >
0 commit comments