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 | 1 | <template> |
| 2 | 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 | 5 | <el-form-item label="开始时间:" prop="startTime"> {{parseTime(form.startTime, '{y}-{m}-{d}')}} </el-form-item> |
| 6 | 6 | <el-form-item label="结束时间:" prop="endTime"> {{parseTime(form.endTime, '{y}-{m}-{d}')}} </el-form-item> |
| 7 | 7 | <el-form-item label="请假类型:" prop="type"> |
| ... | ... | @@ -19,9 +19,15 @@ export default { |
| 19 | 19 | name: "LeaveDetail", |
| 20 | 20 | components: { |
| 21 | 21 | }, |
| 22 | + props: { | |
| 23 | + id: { | |
| 24 | + type: [String, Number], | |
| 25 | + default: undefined | |
| 26 | + }, | |
| 27 | + }, | |
| 22 | 28 | data() { |
| 23 | 29 | return { |
| 24 | - id: undefined, // 请假编号 | |
| 30 | + leaveId: undefined, // 请假编号 | |
| 25 | 31 | // 表单参数 |
| 26 | 32 | form: { |
| 27 | 33 | startTime: undefined, |
| ... | ... | @@ -34,8 +40,8 @@ export default { |
| 34 | 40 | }; |
| 35 | 41 | }, |
| 36 | 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 | 45 | this.$message.error('未传递 id 参数,无法查看 OA 请假信息'); |
| 40 | 46 | return; |
| 41 | 47 | } |
| ... | ... | @@ -44,7 +50,7 @@ export default { |
| 44 | 50 | methods: { |
| 45 | 51 | /** 获得请假信息 */ |
| 46 | 52 | getDetail() { |
| 47 | - getLeave(this.id).then(response => { | |
| 53 | + getLeave(this.leaveId).then(response => { | |
| 48 | 54 | this.form = response.data; |
| 49 | 55 | }); |
| 50 | 56 | }, | ... | ... |
yudao-ui-admin/src/views/bpm/processInstance/detail.vue
| ... | ... | @@ -39,10 +39,7 @@ |
| 39 | 39 | </div> |
| 40 | 40 | </el-col> |
| 41 | 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 | 43 | </div> |
| 47 | 44 | </el-card> |
| 48 | 45 | |
| ... | ... | @@ -115,6 +112,7 @@ import {approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssig |
| 115 | 112 | import {getDate} from "@/utils/dateUtils"; |
| 116 | 113 | import {listSimpleUsers} from "@/api/system/user"; |
| 117 | 114 | import {getActivityList} from "@/api/bpm/activity"; |
| 115 | +import Vue from "vue"; | |
| 118 | 116 | |
| 119 | 117 | // 流程实例的详情页,可用于审批 |
| 120 | 118 | export default { |
| ... | ... | @@ -193,6 +191,12 @@ export default { |
| 193 | 191 | // 设置流程信息 |
| 194 | 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 | 201 | if (this.processInstance.processDefinition.formType === 10) { |
| 198 | 202 | this.detailForm = { | ... | ... |