批量审批
This commit is contained in:
1 parent
32d60d2f62
commit
70847847d5
3 files changed
+88
-12
No files matched your search
@@ -107,6 +107,15 @@ export function completeTask(param: Object) {
|
||||
})
|
||||
}
|
||||
|
||||
// 批量完成任务
|
||||
export function batchCompleteTask(param: Object) {
|
||||
return request({
|
||||
url: "/task/task/batchCompleteTask",
|
||||
method: "post",
|
||||
data: param,
|
||||
})
|
||||
}
|
||||
|
||||
// 完成任务
|
||||
export function transferTask(param: Object) {
|
||||
return request({
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="批量审批" :width="400">
|
||||
<el-input v-model="submitDesc" type="textarea" maxlength="100" :rows="5" placeholder="请输入审核意见..." show-word-limit />
|
||||
<template #footer>
|
||||
<el-button size="large" type="danger" icon="Close" @click="submit(0)">拒绝</el-button>
|
||||
<el-button size="large" type="primary" icon="Check" @click="submit(1)">提交</el-button>
|
||||
<el-button size="large" @click="visible = false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue"
|
||||
import { ElLoading } from "element-plus"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { batchCompleteTask } from "/@/api/flow/task"
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "taskSubmitEvent"): void
|
||||
}>()
|
||||
|
||||
const visible = ref(false)
|
||||
const submitDesc = ref("")
|
||||
const processIds = ref<string[]>([])
|
||||
const loading = ref<any>()
|
||||
|
||||
const openDialog = (ids: string[]) => {
|
||||
submitDesc.value = ""
|
||||
visible.value = true
|
||||
processIds.value = ids
|
||||
}
|
||||
|
||||
// 全屏loading
|
||||
const loadingStart = () => {
|
||||
loading.value = ElLoading.service({
|
||||
lock: true,
|
||||
text: "提交中...",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
})
|
||||
}
|
||||
|
||||
const submit = async (isSuccess: number) => {
|
||||
const param = {
|
||||
isSuccess,
|
||||
processInstances: processIds.value,
|
||||
taskLocalParamMap: {
|
||||
approveDesc: submitDesc.value,
|
||||
},
|
||||
}
|
||||
console.log(param)
|
||||
|
||||
try {
|
||||
loadingStart()
|
||||
const res = await batchCompleteTask(param).finally(() => loading.value.close())
|
||||
if (res.code == 0) {
|
||||
visible.value = false
|
||||
emit("taskSubmitEvent")
|
||||
useMessage().success("通过成功")
|
||||
return
|
||||
}
|
||||
useMessage().error("通过失败")
|
||||
} catch (error) {
|
||||
useMessage().error("错误")
|
||||
} finally {
|
||||
loading.value.close()
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
@@ -198,6 +198,9 @@
|
||||
|
||||
<!-- 审批抽屉 -->
|
||||
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />
|
||||
|
||||
<!-- 批量审批对话框 -->
|
||||
<batch-deal ref="batchDealRef" @task-submit-event="taskSubmitEvent" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -214,6 +217,7 @@ import ProcessDrawer from "/@/components/processDrawer/index.vue"
|
||||
const UserForm = defineAsyncComponent(() => import("./form.vue"))
|
||||
const FaceManage = defineAsyncComponent(() => import("./face-manage.vue"))
|
||||
const PopoverInput = defineAsyncComponent(() => import("/@/components/PopoverInput/index.vue"))
|
||||
const BatchDeal = defineAsyncComponent(() => import("./batchDeal.vue"))
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -227,6 +231,7 @@ const draggableDepTreeRef = ref() // 树组件ref引用
|
||||
const activeName = ref("2")
|
||||
const tabItems = ref<any>([{}])
|
||||
const processDrawerRef = ref()
|
||||
const batchDealRef = ref()
|
||||
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any
|
||||
@@ -284,16 +289,8 @@ const deal = (row: any) => {
|
||||
// 批量开始处理
|
||||
const doBatchDeal = () => {
|
||||
if (!selectObjs.value.length) return useMessage().warning("流程id不存在")
|
||||
const processIds = []
|
||||
for (const i of selectObjs.value) {
|
||||
for (const j of state.dataList!) {
|
||||
if (i == j.id) {
|
||||
processIds.push(j.processId)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!processIds.length) return useMessage().warning("流程id不存在")
|
||||
const processIds = selectObjs.value.filter((item: any) => item.processId).map((item: any) => item.processId)
|
||||
batchDealRef.value.openDialog(processIds)
|
||||
}
|
||||
|
||||
// 审批提交事件
|
||||
@@ -312,8 +309,8 @@ const handleSelectable = (row: any) => {
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: { userId: string }[]) => {
|
||||
selectObjs.value = objs.map(({ userId }) => userId)
|
||||
const handleSelectionChange = (objs: { userId: string; processId: string | null }[]) => {
|
||||
selectObjs.value = objs.map(({ userId, processId }) => ({ userId, processId }))
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user