93 lines
2.2 KiB
Vue
93 lines
2.2 KiB
Vue
<template>
|
|
<el-dialog v-model="dialogVisible" title="拒绝审核" width="400px">
|
|
<el-input v-loading="loading" v-model="submitDesc" type="textarea" maxlength="100" :rows="5" placeholder="审核意见" show-word-limit />
|
|
<template #footer>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="submit">确定</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { defineExpose } from "vue"
|
|
import { completeTask } from "/@/api/flow/task"
|
|
import { useMessage } from "/@/hooks/message"
|
|
import type { FlowFormItem, TaskData, TaskSubmitParam } from "./types"
|
|
import { ElLoading } from "element-plus"
|
|
|
|
const emit = defineEmits(["taskSubmitEvent"])
|
|
|
|
const dialogVisible = ref(false)
|
|
const submitDesc = ref("")
|
|
const currentData = ref()
|
|
const currentOpenFlowForm = ref()
|
|
const loading = ref()
|
|
|
|
const handle = (row: TaskData, formData: FlowFormItem[]) => {
|
|
submitDesc.value = ""
|
|
currentData.value = row
|
|
currentOpenFlowForm.value = formData
|
|
dialogVisible.value = true
|
|
}
|
|
|
|
// 全屏loading
|
|
const loadingStart = () => {
|
|
loading.value = ElLoading.service({
|
|
lock: true,
|
|
text: "提交中...",
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
})
|
|
}
|
|
|
|
defineExpose({ handle })
|
|
|
|
const submit = async () => {
|
|
let value = currentOpenFlowForm.value
|
|
|
|
let formData: any = {}
|
|
for (var item of value) {
|
|
formData[item.id] = item.props.value
|
|
|
|
if (item.type === "Layout") {
|
|
let subList = item.props.value
|
|
|
|
var d = []
|
|
for (var array of subList) {
|
|
var v = {}
|
|
|
|
for (var subItem of array) {
|
|
v[subItem.id] = subItem.props.value
|
|
}
|
|
d.push(v)
|
|
}
|
|
formData[item.id] = d
|
|
}
|
|
}
|
|
|
|
formData[currentData.value.nodeId + "_approve_condition"] = false
|
|
|
|
const param = {
|
|
paramMap: formData,
|
|
taskId: currentData.value.taskId,
|
|
taskLocalParamMap: {
|
|
approveDesc: "拒绝原因:" + submitDesc.value,
|
|
},
|
|
}
|
|
try {
|
|
loadingStart()
|
|
const res = await completeTask(param).finally(() => loading.value.close())
|
|
if (res.code === 0) {
|
|
useMessage().success("拒绝成功")
|
|
dialogVisible.value = false
|
|
emit("taskSubmitEvent")
|
|
return
|
|
}
|
|
useMessage().error("拒绝失败")
|
|
} catch (error) {
|
|
useMessage().error("错误")
|
|
} finally {
|
|
loading.value.close()
|
|
}
|
|
}
|
|
</script>
|