Commit 8245f8a369447fdcaa70de78916f2839cc466fec
1 parent
1c1894af
将业务表单做为动态组件,直接显示到审批页面,不再需要点击查看
Showing
2 changed files
with
19 additions
and
9 deletions
yudao-ui-admin/src/views/bpm/oa/leave/detail.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | <!-- 对话框(添加 / 修改) --> | 3 | <!-- 对话框(添加 / 修改) --> |
| 4 | - <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | 4 | + <el-form ref="form" :model="form" label-width="100px"> |
| 5 | <el-form-item label="开始时间:" prop="startTime"> {{parseTime(form.startTime, '{y}-{m}-{d}')}} </el-form-item> | 5 | <el-form-item label="开始时间:" prop="startTime"> {{parseTime(form.startTime, '{y}-{m}-{d}')}} </el-form-item> |
| 6 | <el-form-item label="结束时间:" prop="endTime"> {{parseTime(form.endTime, '{y}-{m}-{d}')}} </el-form-item> | 6 | <el-form-item label="结束时间:" prop="endTime"> {{parseTime(form.endTime, '{y}-{m}-{d}')}} </el-form-item> |
| 7 | <el-form-item label="请假类型:" prop="type"> | 7 | <el-form-item label="请假类型:" prop="type"> |
| @@ -19,9 +19,15 @@ export default { | @@ -19,9 +19,15 @@ export default { | ||
| 19 | name: "LeaveDetail", | 19 | name: "LeaveDetail", |
| 20 | components: { | 20 | components: { |
| 21 | }, | 21 | }, |
| 22 | + props: { | ||
| 23 | + id: { | ||
| 24 | + type: [String, Number], | ||
| 25 | + default: undefined | ||
| 26 | + }, | ||
| 27 | + }, | ||
| 22 | data() { | 28 | data() { |
| 23 | return { | 29 | return { |
| 24 | - id: undefined, // 请假编号 | 30 | + leaveId: undefined, // 请假编号 |
| 25 | // 表单参数 | 31 | // 表单参数 |
| 26 | form: { | 32 | form: { |
| 27 | startTime: undefined, | 33 | startTime: undefined, |
| @@ -34,8 +40,8 @@ export default { | @@ -34,8 +40,8 @@ export default { | ||
| 34 | }; | 40 | }; |
| 35 | }, | 41 | }, |
| 36 | created() { | 42 | created() { |
| 37 | - this.id = this.$route.query.id; | ||
| 38 | - if (!this.id) { | 43 | + this.leaveId = this.id || this.$route.query.id; |
| 44 | + if (!this.leaveId) { | ||
| 39 | this.$message.error('未传递 id 参数,无法查看 OA 请假信息'); | 45 | this.$message.error('未传递 id 参数,无法查看 OA 请假信息'); |
| 40 | return; | 46 | return; |
| 41 | } | 47 | } |
| @@ -44,7 +50,7 @@ export default { | @@ -44,7 +50,7 @@ export default { | ||
| 44 | methods: { | 50 | methods: { |
| 45 | /** 获得请假信息 */ | 51 | /** 获得请假信息 */ |
| 46 | getDetail() { | 52 | getDetail() { |
| 47 | - getLeave(this.id).then(response => { | 53 | + getLeave(this.leaveId).then(response => { |
| 48 | this.form = response.data; | 54 | this.form = response.data; |
| 49 | }); | 55 | }); |
| 50 | }, | 56 | }, |
yudao-ui-admin/src/views/bpm/processInstance/detail.vue
| @@ -39,10 +39,7 @@ | @@ -39,10 +39,7 @@ | ||
| 39 | </div> | 39 | </div> |
| 40 | </el-col> | 40 | </el-col> |
| 41 | <div v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 20"> | 41 | <div v-if="this.processInstance.processDefinition && this.processInstance.processDefinition.formType === 20"> |
| 42 | - <router-link :to="this.processInstance.processDefinition.formCustomViewPath + '?id=' | ||
| 43 | - + this.processInstance.businessKey"> | ||
| 44 | - <el-button type="primary">点击查看</el-button> | ||
| 45 | - </router-link> | 42 | + <async-biz-form-component :id="this.processInstance.businessKey"></async-biz-form-component> |
| 46 | </div> | 43 | </div> |
| 47 | </el-card> | 44 | </el-card> |
| 48 | 45 | ||
| @@ -115,6 +112,7 @@ import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssig | @@ -115,6 +112,7 @@ import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssig | ||
| 115 | import {getDate} from "@/utils/dateUtils"; | 112 | import {getDate} from "@/utils/dateUtils"; |
| 116 | import {listSimpleUsers} from "@/api/system/user"; | 113 | import {listSimpleUsers} from "@/api/system/user"; |
| 117 | import {getActivityList} from "@/api/bpm/activity"; | 114 | import {getActivityList} from "@/api/bpm/activity"; |
| 115 | +import Vue from "vue"; | ||
| 118 | 116 | ||
| 119 | // 流程实例的详情页,可用于审批 | 117 | // 流程实例的详情页,可用于审批 |
| 120 | export default { | 118 | export default { |
| @@ -193,6 +191,12 @@ export default { | @@ -193,6 +191,12 @@ export default { | ||
| 193 | // 设置流程信息 | 191 | // 设置流程信息 |
| 194 | this.processInstance = response.data; | 192 | this.processInstance = response.data; |
| 195 | 193 | ||
| 194 | + //将业务表单,注册为动态组件 | ||
| 195 | + const path = this.processInstance.processDefinition.formCustomViewPath; | ||
| 196 | + Vue.component("async-biz-form-component", function(resolve) { | ||
| 197 | + require([`@/views${path}`], resolve); | ||
| 198 | + }); | ||
| 199 | + | ||
| 196 | // 设置表单信息 | 200 | // 设置表单信息 |
| 197 | if (this.processInstance.processDefinition.formType === 10) { | 201 | if (this.processInstance.processDefinition.formType === 10) { |
| 198 | this.detailForm = { | 202 | this.detailForm = { |