code review:修复工作流的审批界面报错问题

This commit is contained in:
YunaiV 2023-10-17 19:50:09 +08:00
parent 0242c84196
commit c27685285a
2 changed files with 29 additions and 32 deletions

View File

@ -1,13 +1,20 @@
<template>
<el-drawer v-model="drawerVisible" title="子任务" size="70%">
<!-- 当前任务 -->
<template #header>
<h4>{{ baseTask.name }} 审批人{{ baseTask.assigneeUser?.nickname }}</h4>
<el-button style="margin-left: 5px" v-if="showSubSignButton(baseTask)" type="danger" plain @click="handleSubSign(baseTask)">
<Icon icon="ep:remove" />
减签
<el-button
style="margin-left: 5px"
v-if="isSubSignButtonVisible(baseTask)"
type="danger"
plain
@click="handleSubSign(baseTask)"
>
<Icon icon="ep:remove" /> 减签
</el-button>
</template>
<el-table :data="tableData" style="width: 100%" row-key="id" border>
<!-- 子任务列表 -->
<el-table :data="baseTask.children" style="width: 100%" row-key="id" border>
<el-table-column prop="assigneeUser.nickname" label="审批人" />
<el-table-column prop="assigneeUser.deptName" label="所在部门" />
<el-table-column label="审批状态" prop="result">
@ -32,13 +39,12 @@
<el-table-column label="操作" prop="operation">
<template #default="scope">
<el-button
v-if="showSubSignButton(scope.row)"
v-if="isSubSignButtonVisible(scope.row)"
type="danger"
plain
@click="handleSubSign(scope.row)"
>
<Icon icon="ep:remove" />
减签
<Icon icon="ep:remove" /> 减签
</el-button>
</template>
</el-table-column>
@ -53,12 +59,11 @@ import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import TaskSubSignDialogForm from './TaskSubSignDialogForm.vue'
const message = useMessage() //
defineOptions({ name: 'ProcessInstancechildrenList' })
defineOptions({ name: 'ProcessInstanceChildrenTaskList' })
const message = useMessage() //
const drawerVisible = ref(false) //
const tableData = ref<any[]>([]) //
const baseTask = ref<object>({})
/** 打开弹窗 */
const open = async (task: any) => {
@ -67,29 +72,21 @@ const open = async (task: any) => {
return
}
baseTask.value = task
//
tableData.value = task.children
//
drawerVisible.value = true
}
defineExpose({ open }) // openModal
const emit = defineEmits(['success']) // success
/**
* 减签
*/
/** 发起减签 */
const taskSubSignDialogForm = ref()
const handleSubSign = (item) => {
taskSubSignDialogForm.value.open(item.id)
// TODO @
}
/**
* 显示减签按钮
* @param task
*/
const showSubSignButton = (task:any) => {
if(!isEmpty(task.children)){
/** 是否显示减签按钮 */
const isSubSignButtonVisible = (task: any) => {
if (task && task.children && !isEmpty(task.children)) {
//
const subTask = task.children.find((item) => item.result === 1 || item.result === 9)
return !isEmpty(subTask)

View File

@ -22,12 +22,12 @@
</el-form-item>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm('before')"
>向前加签</el-button
>
<el-button :disabled="formLoading" type="primary" @click="submitForm('after')"
>向后加签</el-button
>
<el-button :disabled="formLoading" type="primary" @click="submitForm('before')">
向前加签
</el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm('after')">
向后加签
</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>