bpm:流程详情的审批表单

This commit is contained in:
YunaiV 2023-01-24 11:34:31 +08:00
parent 3702fb0c16
commit bd6a1dcc64
2 changed files with 35 additions and 27 deletions

View File

@ -12,7 +12,7 @@
</template>
<el-col :span="16" :offset="6">
<el-form
:ref="'form' + index"
:ref="auditFormRefs"
:model="auditForms[index]"
:rules="auditRule"
label-width="100px"
@ -22,7 +22,7 @@
</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-tag type="info" size="small">{{ processInstance.startUser.deptName }}</el-tag>
</el-form-item>
<el-form-item label="审批建议" prop="reason">
<el-input
@ -137,6 +137,33 @@ const auditRule = reactive({
reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }]
})
//
const handleAudit = async (task, pass) => {
// 1.1
const index = runningTasks.value.indexOf(task)
// const auditFormRef = ref<any>([]).value.get(index)
// 1.2
// const elForm = unref(auditFormRef)
// if (!elForm) return
// const valid = await auditFormRef.validate()
// if (!valid) return
// 2.1
const data = {
id: task.id,
reason: auditForms.value[index].reason
}
if (pass) {
await TaskApi.approveTask(data)
message.success('审批通过成功')
} else {
await TaskApi.rejectTask(data)
message.success('审批不通过成功')
}
// 2.2
getDetail()
}
// ========== ==========
import { setConfAndFields2 } from '@/utils/formCreate'
import { ApiAttrs } from '@form-create/element-ui/types/config'
@ -187,6 +214,10 @@ const getTimelineItemType = (item) => {
// ========== ==========
onMounted(() => {
getDetail()
})
const getDetail = () => {
// 1.
processInstanceLoading.value = true
ProcessInstanceApi.getProcessInstanceApi(id)
@ -269,7 +300,7 @@ onMounted(() => {
.finally(() => {
tasksLoad.value = false
})
})
}
</script>
<style lang="scss">

View File

@ -146,30 +146,7 @@ export default {
})
},
/** 处理审批通过和不通过的操作 */
handleAudit (task, pass) {
const index = this.runningTasks.indexOf(task)
this.$refs['form' + index][0].validate(valid => {
if (!valid) {
return
}
const data = {
id: task.id,
reason: this.auditForms[index].reason
}
if (pass) {
approveTask(data).then(response => {
this.$modal.msgSuccess("审批通过成功!")
this.getDetail() //
})
} else {
rejectTask(data).then(response => {
this.$modal.msgSuccess("审批不通过成功!")
this.getDetail() //
})
}
})
},
/** 处理转派审批人 */
handleUpdateAssignee (task) {
//