mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
bpm:流程详情的审批表单
This commit is contained in:
parent
3702fb0c16
commit
bd6a1dcc64
@ -12,7 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-col :span="16" :offset="6">
|
<el-col :span="16" :offset="6">
|
||||||
<el-form
|
<el-form
|
||||||
:ref="'form' + index"
|
:ref="auditFormRefs"
|
||||||
:model="auditForms[index]"
|
:model="auditForms[index]"
|
||||||
:rules="auditRule"
|
:rules="auditRule"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser">
|
<el-form-item label="流程发起人" v-if="processInstance && processInstance.startUser">
|
||||||
{{ processInstance.startUser.nickname }}
|
{{ 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>
|
||||||
<el-form-item label="审批建议" prop="reason">
|
<el-form-item label="审批建议" prop="reason">
|
||||||
<el-input
|
<el-input
|
||||||
@ -137,6 +137,33 @@ const auditRule = reactive({
|
|||||||
reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }]
|
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 { setConfAndFields2 } from '@/utils/formCreate'
|
||||||
import { ApiAttrs } from '@form-create/element-ui/types/config'
|
import { ApiAttrs } from '@form-create/element-ui/types/config'
|
||||||
@ -187,6 +214,10 @@ const getTimelineItemType = (item) => {
|
|||||||
|
|
||||||
// ========== 初始化 ==========
|
// ========== 初始化 ==========
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getDetail()
|
||||||
|
})
|
||||||
|
|
||||||
|
const getDetail = () => {
|
||||||
// 1. 获得流程实例相关
|
// 1. 获得流程实例相关
|
||||||
processInstanceLoading.value = true
|
processInstanceLoading.value = true
|
||||||
ProcessInstanceApi.getProcessInstanceApi(id)
|
ProcessInstanceApi.getProcessInstanceApi(id)
|
||||||
@ -269,7 +300,7 @@ onMounted(() => {
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
tasksLoad.value = false
|
tasksLoad.value = false
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -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) {
|
handleUpdateAssignee (task) {
|
||||||
// 设置表单
|
// 设置表单
|
||||||
|
Loading…
Reference in New Issue
Block a user