22 <ContentWrap >
33 <!-- 审批信息 -->
44 <el-card
5- class =" box-card"
6- v-loading =" processInstanceLoading"
75 v-for =" (item, index) in runningTasks"
86 :key =" index"
7+ v-loading =" processInstanceLoading"
8+ class =" box-card"
99 >
1010 <template #header >
1111 <span class =" el-icon-picture-outline" >审批任务【{{ item.name }}】</span >
1212 </template >
13- <el-col :span = " 16 " :offset = " 6 " >
13+ <el-col :offset = " 6 " :span = " 16 " >
1414 <el-form
1515 :ref =" 'form' + index"
1616 :model =" auditForms[index]"
1717 :rules =" auditRule"
1818 label-width =" 100px"
1919 >
20- <el-form-item label = " 流程名 " v-if =" processInstance && processInstance.name" >
20+ <el-form-item v-if =" processInstance && processInstance.name" label = " 流程名 " >
2121 {{ processInstance.name }}
2222 </el-form-item >
23- <el-form-item label = " 流程发起人 " v-if =" processInstance && processInstance.startUser" >
23+ <el-form-item v-if =" processInstance && processInstance.startUser" label = " 流程发起人 " >
2424 {{ processInstance.startUser.nickname }}
25- <el-tag type = " info " size = " small " >{{ processInstance.startUser.deptName }}</el-tag >
25+ <el-tag size = " small " type = " info " >{{ processInstance.startUser.deptName }}</el-tag >
2626 </el-form-item >
2727 <el-form-item label =" 审批建议" prop =" reason" >
2828 <el-input
29- type =" textarea"
3029 v-model =" auditForms[index].reason"
3130 placeholder =" 请输入审批建议"
31+ type =" textarea"
3232 />
3333 </el-form-item >
3434 </el-form >
3535 <div style =" margin-left : 10% ; margin-bottom : 20px ; font-size : 14px " >
3636 <el-button type =" success" @click =" handleAudit(item, true)" >
37- <Icon icon =" ep:select" /> 通过
37+ <Icon icon =" ep:select" />
38+ 通过
3839 </el-button >
3940 <el-button type =" danger" @click =" handleAudit(item, false)" >
40- <Icon icon =" ep:close" /> 不通过
41+ <Icon icon =" ep:close" />
42+ 不通过
4143 </el-button >
4244 <el-button type =" primary" @click =" openTaskUpdateAssigneeForm(item.id)" >
43- <Icon icon =" ep:edit" /> 转办
45+ <Icon icon =" ep:edit" />
46+ 转办
4447 </el-button >
4548 <el-button type =" primary" @click =" handleDelegate(item)" >
46- <Icon icon =" ep:position" /> 委派
49+ <Icon icon =" ep:position" />
50+ 委派
4751 </el-button >
4852 <el-button type =" warning" @click =" handleBack(item)" >
49- <Icon icon =" ep:back" /> 回退
53+ <Icon icon =" ep:back" />
54+ 回退
5055 </el-button >
5156 </div >
5257 </el-col >
5358 </el-card >
5459
5560 <!-- 申请信息 -->
56- <el-card class = " box-card " v-loading =" processInstanceLoading" >
61+ <el-card v-loading =" processInstanceLoading" class = " box-card " >
5762 <template #header >
5863 <span class =" el-icon-document" >申请信息【{{ processInstance.name }}】</span >
5964 </template >
6065 <!-- 情况一:流程表单 -->
61- <el-col v-if =" processInstance?.processDefinition?.formType === 10" :span = " 16 " :offset = " 6 " >
66+ <el-col v-if =" processInstance?.processDefinition?.formType === 10" :offset = " 6 " :span = " 16 " >
6267 <form-create
6368 ref =" fApi"
64- :rule =" detailForm.rule"
65- :option =" detailForm.option"
6669 v-model =" detailForm.value"
70+ :option =" detailForm.option"
71+ :rule =" detailForm.rule"
6772 />
6873 </el-col >
69- <!-- 情况二:流程表单 -->
74+ <!-- 情况二:业务表单 -->
7075 <div v-if =" processInstance?.processDefinition?.formType === 20" >
71- <router-link
72- :to ="
73- processInstance.processDefinition.formCustomViewPath +
74- '?id=' +
75- processInstance.businessKey
76- "
77- >
78- <el-button type =" primary" ><Icon icon =" ep:view" /> 点击查看</el-button >
79- </router-link >
76+ <autoComponent :id =" processInstance.businessKey" />
8077 </div >
8178 </el-card >
8279
8582
8683 <!-- 高亮流程图 -->
8784 <ProcessInstanceBpmnViewer
88- :id =" id "
89- :process-instance = " processInstance "
85+ :id =" `${id}` "
86+ :bpmn-xml = " bpmnXML "
9087 :loading =" processInstanceLoading"
88+ :process-instance =" processInstance"
9189 :tasks =" tasks"
92- :bpmn-xml =" bpmnXML"
9390 />
9491
9592 <!-- 弹窗:转派审批人 -->
9693 <TaskUpdateAssigneeForm ref =" taskUpdateAssigneeFormRef" @success =" getDetail" />
9794 </ContentWrap >
9895</template >
99- <script setup lang="ts" name="BpmProcessInstanceDetail">
96+ <script lang="ts" name="BpmProcessInstanceDetail" setup >
10097import { useUserStore } from ' @/store/modules/user'
10198import { setConfAndFields2 } from ' @/utils/formCreate'
10299import type { ApiAttrs } from ' @form-create/element-ui/types/config'
@@ -106,6 +103,8 @@ import * as TaskApi from '@/api/bpm/task'
106103import TaskUpdateAssigneeForm from ' ./TaskUpdateAssigneeForm.vue'
107104import ProcessInstanceBpmnViewer from ' ./ProcessInstanceBpmnViewer.vue'
108105import ProcessInstanceTaskList from ' ./ProcessInstanceTaskList.vue'
106+ import { registerComponent } from ' @/utils/routerHelper'
107+
109108const { query } = useRoute () // 查询参数
110109const message = useMessage () // 消息弹窗
111110const { proxy } = getCurrentInstance () as any
@@ -184,7 +183,7 @@ const getDetail = () => {
184183 // 2. 获得流程任务列表(审批记录)
185184 getTaskList ()
186185}
187-
186+ const autoComponent = ref ( null ) // 异步组件
188187/** 加载流程实例 */
189188const getProcessInstance = async () => {
190189 try {
@@ -195,7 +194,7 @@ const getProcessInstance = async () => {
195194 return
196195 }
197196 processInstance .value = data
198-
197+ autoComponent . value = registerComponent ( data . processDefinition . formCustomViewPath )
199198 // 设置表单信息
200199 const processDefinition = data .processDefinition
201200 if (processDefinition .formType === 10 ) {
@@ -213,7 +212,7 @@ const getProcessInstance = async () => {
213212 }
214213
215214 // 加载流程图
216- bpmnXML .value = await DefinitionApi .getProcessDefinitionBpmnXML (processDefinition .id )
215+ bpmnXML .value = await DefinitionApi .getProcessDefinitionBpmnXML (processDefinition .id as number )
217216 } finally {
218217 processInstanceLoading .value = false
219218 }
0 commit comments