bpm:流程详情的审批表单

pull/2/head
YunaiV 2023-01-24 10:15:26 +08:00
parent 0aa72b3200
commit 3702fb0c16
2 changed files with 90 additions and 93 deletions

View File

@ -1,6 +1,47 @@
<template>
<ContentWrap>
<!-- TODO 审批信息 -->
<!-- 审批信息 -->
<el-card
class="box-card"
v-loading="processInstanceLoading"
v-for="(item, index) in runningTasks"
:key="index"
>
<template #header>
<span class="el-icon-picture-outline">审批任务{{ item.name }}</span>
</template>
<el-col :span="16" :offset="6">
<el-form
:ref="'form' + index"
:model="auditForms[index]"
:rules="auditRule"
label-width="100px"
>
<el-form-item label="流程名" v-if="processInstance && processInstance.name">
{{ processInstance.name }}
</el-form-item>
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser">
{{ processInstance.startUser.nickname }}
<el-tag type="info" size="mini">{{ processInstance.startUser.deptName }}</el-tag>
</el-form-item>
<el-form-item label="审批建议" prop="reason">
<el-input
type="textarea"
v-model="auditForms[index].reason"
placeholder="请输入审批建议"
/>
</el-form-item>
</el-form>
<div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
<XButton
pre-icon="ep:select"
type="success"
title="通过"
@click="handleAudit(item, true)"
/>
</div>
</el-col>
</el-card>
<!-- 申请信息 -->
<el-card class="box-card" v-loading="processInstanceLoading">
@ -92,14 +133,16 @@ const processInstanceLoading = ref(false) // 流程实例的加载中
const processInstance = ref({}) //
const runningTasks = ref([]) //
const auditForms = ref([]) //
// const auditRule = reactive({
// reason: [{ required: true, message: '', trigger: 'blur' }]
// })
const auditRule = reactive({
reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }]
})
// ========== ==========
import { setConfAndFields2 } from '@/utils/formCreate'
import { ApiAttrs } from '@form-create/element-ui/types/config'
import { useUserStore } from '@/store/modules/user'
const fApi = ref<ApiAttrs>()
const userId = useUserStore().getUser.id //
//
const detailForm = ref({
rule: [],
@ -207,19 +250,21 @@ onMounted(() => {
})
//
// const userId = store.getters.userId
// this.tasks.forEach(task => {
// if (task.result !== 1) { //
// return
// }
// if (!task.assigneeUser || task.assigneeUser.id !== userId) { //
// return
// }
// this.runningTasks.push({ ...task })
// this.auditForms.push({
// reason: ''
// })
// })
tasks.value.forEach((task) => {
// 1.1
if (task.result !== 1) {
return
}
// 1.2
if (!task.assigneeUser || task.assigneeUser.id !== userId) {
return
}
// 2.
runningTasks.value.push({ ...task })
auditForms.value.push({
reason: ''
})
})
})
.finally(() => {
tasksLoad.value = false

View File

@ -1,45 +1,6 @@
<template>
<div class="app-container">
<!-- 审批信息 -->
<el-card
class="box-card"
v-loading="processInstanceLoading"
v-for="(item, index) in runningTasks"
:key="index"
>
<div slot="header" class="clearfix">
<span class="el-icon-picture-outline">审批任务{{ item.name }}</span>
</div>
<el-col :span="16" :offset="6">
<el-form
:ref="'form' + index"
:model="auditForms[index]"
:rules="auditRule"
label-width="100px"
>
<el-form-item label="流程名" v-if="processInstance && processInstance.name">
{{ processInstance.name }}
</el-form-item>
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser">
{{ processInstance.startUser.nickname }}
<el-tag type="info" size="mini">{{ processInstance.startUser.deptName }}</el-tag>
</el-form-item>
<el-form-item label="审批建议" prop="reason">
<el-input
type="textarea"
v-model="auditForms[index].reason"
placeholder="请输入审批建议"
/>
</el-form-item>
</el-form>
<div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
<el-button
icon="el-icon-edit-outline"
type="success"
size="mini"
@click="handleAudit(item, true)"
>通过</el-button
>
<el-button
icon="el-icon-circle-close"
type="danger"
@ -68,11 +29,6 @@
@click="handleBack(item)"
>退回</el-button
>
</div>
</el-col>
</el-card>
<!-- 高亮流程图 -->
<el-card class="box-card" v-loading="processInstanceLoading">
@ -124,7 +80,6 @@ import { decodeFields } from "@/utils/formGenerator"
import Parser from '@/components/parser/Parser'
import { getProcessInstanceApi } from "@/api/bpm/processInstance"
import { approveTask, getTaskListByProcessInstanceId, rejectTask, updateTaskAssignee } from "@/api/bpm/task"
import { getDate } from "@/utils/dateUtils"
import { getListSimpleUsersApi } from "@/api/system/user"
import { getActivityList } from "@/api/bpm/activity"
@ -190,9 +145,6 @@ export default {
})
})
},
getDateStar (ms) {
return getDate(ms)
},
/** 处理审批通过和不通过的操作 */
handleAudit (task, pass) {