Commit 06d8ceb11c48dc432d069427e4c9987809080a40
1 parent
bd6a1dcc
bpm:流程详情的审批表单
Showing
2 changed files
with
12 additions
and
6 deletions
yudao-ui-admin-vue3/src/types/auto-components.d.ts
| ... | ... | @@ -61,6 +61,8 @@ declare module '@vue/runtime-core' { |
| 61 | 61 | ElTabPane: typeof import('element-plus/es')['ElTabPane'] |
| 62 | 62 | ElTabs: typeof import('element-plus/es')['ElTabs'] |
| 63 | 63 | ElTag: typeof import('element-plus/es')['ElTag'] |
| 64 | + ElTimeline: typeof import('element-plus/es')['ElTimeline'] | |
| 65 | + ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] | |
| 64 | 66 | ElTooltip: typeof import('element-plus/es')['ElTooltip'] |
| 65 | 67 | ElTransfer: typeof import('element-plus/es')['ElTransfer'] |
| 66 | 68 | ElTree: typeof import('element-plus/es')['ElTree'] | ... | ... |
yudao-ui-admin-vue3/src/views/bpm/processInstance/detail.vue
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | </template> |
| 13 | 13 | <el-col :span="16" :offset="6"> |
| 14 | 14 | <el-form |
| 15 | - :ref="auditFormRefs" | |
| 15 | + :ref="'form' + index" | |
| 16 | 16 | :model="auditForms[index]" |
| 17 | 17 | :rules="auditRule" |
| 18 | 18 | label-width="100px" |
| ... | ... | @@ -119,6 +119,7 @@ |
| 119 | 119 | </ContentWrap> |
| 120 | 120 | </template> |
| 121 | 121 | <script setup lang="ts"> |
| 122 | +import { getCurrentInstance } from 'vue' | |
| 122 | 123 | import dayjs from 'dayjs' |
| 123 | 124 | import * as ProcessInstanceApi from '@/api/bpm/processInstance' |
| 124 | 125 | import * as TaskApi from '@/api/bpm/task' |
| ... | ... | @@ -126,6 +127,7 @@ import { formatPast2 } from '@/utils/formatTime' |
| 126 | 127 | |
| 127 | 128 | const { query } = useRoute() // 查询参数 |
| 128 | 129 | const message = useMessage() // 消息弹窗 |
| 130 | +const { proxy } = getCurrentInstance() | |
| 129 | 131 | |
| 130 | 132 | // ========== 审批信息 ========== |
| 131 | 133 | const id = query.id as unknown as number |
| ... | ... | @@ -141,12 +143,14 @@ const auditRule = reactive({ |
| 141 | 143 | const handleAudit = async (task, pass) => { |
| 142 | 144 | // 1.1 获得对应表单 |
| 143 | 145 | const index = runningTasks.value.indexOf(task) |
| 144 | - // const auditFormRef = ref<any>([]).value.get(index) | |
| 146 | + const auditFormRef = proxy.$refs['form' + index][0] | |
| 147 | + // alert(auditFormRef) | |
| 148 | + | |
| 145 | 149 | // 1.2 校验表单 |
| 146 | - // const elForm = unref(auditFormRef) | |
| 147 | - // if (!elForm) return | |
| 148 | - // const valid = await auditFormRef.validate() | |
| 149 | - // if (!valid) return | |
| 150 | + const elForm = unref(auditFormRef) | |
| 151 | + if (!elForm) return | |
| 152 | + const valid = await elForm.validate() | |
| 153 | + if (!valid) return | |
| 150 | 154 | |
| 151 | 155 | // 2.1 提交审批 |
| 152 | 156 | const data = { | ... | ... |