From 00a7a8ce23c041e08b60a0ea7f81a951122326c4 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: 星期日, 17 三月 2024 18:26:22 +0800 Subject: [PATCH] add 添加流程自由驳回节点 --- src/components/Process/submitVerify.vue | 124 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 117 insertions(+), 7 deletions(-) diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index 9e2a7be..0d7e413 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -24,15 +24,53 @@ <template #footer> <span class="dialog-footer"> <el-button v-loading="buttonLoading" type="primary" @click="handleCompleteTask"> 鎻愪氦 </el-button> + <el-button v-if="task.businessStatus === 'waiting'" v-loading="buttonLoading" type="primary" @click="openTransferTask"> 杞姙 </el-button> <el-button v-if="task.businessStatus === 'waiting' && task.multiInstance" v-loading="buttonLoading" type="primary" @click="addMultiInstanceUser"> 鍔犵 </el-button> <el-button v-if="task.businessStatus === 'waiting' && task.multiInstance" v-loading="buttonLoading" type="primary" @click="deleteMultiInstanceUser"> 鍑忕 </el-button> - <el-button v-if="task.businessStatus === 'waiting'" v-loading="buttonLoading" type="danger" @click="handleBackProcess"> 閫�鍥� </el-button> + <el-button v-if="task.businessStatus === 'waiting'" v-loading="buttonLoading" type="danger" @click="handleTerminationTask"> 缁堟 </el-button> + <el-button v-if="task.businessStatus === 'waiting'" v-loading="buttonLoading" type="danger" @click="handleBackProcessOpen"> 閫�鍥� </el-button> <el-button v-loading="buttonLoading" @click="cancel">鍙栨秷</el-button> </span> </template> - <UserSelect ref="userSelectCopyRef" :data="selectCopyUserIds" @confirm-call-back="userSelectCopyCallBack"></UserSelect> + <!-- 鎶勯�� --> + <UserSelect ref="userSelectCopyRef" :multiple="userMultiple" :data="selectCopyUserIds" @confirm-call-back="userSelectCopyCallBack"></UserSelect> + <!-- 杞姙 --> + <UserSelect ref="transferTaskRef" :multiple="userMultiple" @confirm-call-back="handleTransferTask"></UserSelect> <!-- 鍔犵缁勪欢 --> - <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback="handleQuery" /> + <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback='closeDialog' /> + + <!-- 椹冲洖寮�濮� --> + <el-dialog v-model="backVisible" draggable title="椹冲洖" width="40%" :close-on-click-modal="false"> + <el-form v-loading="backLoading" :model="backForm" label-width="120px" v-if="task.businessStatus === 'waiting'"> + <el-form-item label="椹冲洖鑺傜偣"> + <el-select clearable placeholder="璇烽�夋嫨" v-model="backForm.targetActivityId" style="width: 300px"> + <el-option + v-for="item in taskNodeList" + :key="item.nodeId" + :label="item.nodeName" + :value="item.nodeId" + /> + </el-select> + </el-form-item> + <el-form-item label="娑堟伅鎻愰啋"> + <el-checkbox-group v-model="backForm.messageType"> + <el-checkbox label="1" name="type" disabled>绔欏唴淇�</el-checkbox> + <el-checkbox label="2" name="type">閭欢</el-checkbox> + <el-checkbox label="3" name="type">鐭俊</el-checkbox> + </el-checkbox-group> + </el-form-item> + <el-form-item label="瀹℃壒鎰忚"> + <el-input v-model="backForm.message" type="textarea" resize="none" /> + </el-form-item> + </el-form> + <template #footer> + <div class="dialog-footer" style="float: right;padding-bottom: 20px;"> + <el-button type="primary" v-loading="backLoading" @click="handleBackProcess">纭</el-button> + <el-button v-loading="backLoading" @click="backVisible = false">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + <!-- 椹冲洖缁撴潫 --> </el-dialog> </template> @@ -40,13 +78,14 @@ import { ref } from 'vue'; import { ComponentInternalInstance } from 'vue'; import { ElForm } from 'element-plus'; -import { completeTask, backProcess, getTaskById } from '@/api/workflow/task'; +import { completeTask, backProcess, getTaskById,transferTask,terminationTask,getTaskNodeList } from '@/api/workflow/task'; import UserSelect from '@/components/UserSelect'; import MultiInstanceUser from '@/components/Process/multiInstanceUser.vue'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; import { UserVO } from '@/api/system/user/types'; import { TaskVO } from '@/api/workflow/task/types'; const userSelectCopyRef = ref<InstanceType<typeof UserSelect>>(); +const transferTaskRef = ref<InstanceType<typeof UserSelect>>(); //鍔犵缁勪欢 const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>(); @@ -66,6 +105,13 @@ const selectCopyUserList = ref<UserVO[]>([]); //鎶勯�佷汉id const selectCopyUserIds = ref<string>(undefined); +//鏄惁澶氶�変汉鍛� +const userMultiple = ref(false); +// 椹冲洖鏄惁鏄剧ず +const backVisible = ref(false); +const backLoading = ref(true); +// 鍙┏鍥炲緱浠诲姟鑺傜偣 +const taskNodeList = ref([]); //浠诲姟 const task = ref<TaskVO>({ id: undefined, @@ -107,6 +153,16 @@ messageType: ['1'], wfCopyList: [] }); +const backForm = ref<Record<string, any>>({ + taskId: undefined, + targetActivityId: undefined, + message: undefined, + variables: {}, + messageType: ['1'] +}); +const closeDialog = () => { + dialog.visible = false +} //鎵撳紑寮圭獥 const openDialog = (id?: string) => { selectCopyUserIds.value = undefined @@ -153,14 +209,26 @@ proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); }; +/** 椹冲洖寮圭獥鎵撳紑 */ +const handleBackProcessOpen = async () => { + backForm.value = {} + backForm.value.messageType = ['1'] + backVisible.value = true + backLoading.value = true + let data = await getTaskNodeList(task.value.processInstanceId) + taskNodeList.value = data.data + backLoading.value = false + backForm.value.targetActivityId = taskNodeList.value[0].nodeId +} /** 椹冲洖娴佺▼ */ const handleBackProcess = async () => { - form.value.taskId = taskId.value; + backForm.value.taskId = taskId.value; await proxy?.$modal.confirm('鏄惁纭椹冲洖鍒扮敵璇蜂汉锛�'); loading.value = true; - buttonLoading.value = true; - await backProcess(form.value).finally(() => (loading.value = false)); + backLoading.value = true; + await backProcess(backForm.value).finally(() => (loading.value = false)); dialog.visible = false; + backLoading.value = false emits('submitCallback'); proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); }; @@ -172,6 +240,7 @@ }; //鎵撳紑鎶勯�佷汉鍛� const openUserSelectCopy = () => { + userMultiple.value = true userSelectCopyRef.value.open(); }; //纭鎶勯�佷汉鍛� @@ -203,6 +272,47 @@ multiInstanceUserRef.value.getDeleteMultiInstanceList(taskId.value); } }; +//鎵撳紑杞姙 +const openTransferTask = () => { + userMultiple.value = false + transferTaskRef.value.open(); +}; +//杞姙 +const handleTransferTask = async (data) => { + if(data && data.length > 0){ + let params = { + taskId: taskId.value, + userId: data[0].userId, + comment: form.value.message + } + await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�'); + loading.value = true; + buttonLoading.value = true; + await transferTask(params).finally(() => (loading.value = false)); + dialog.visible = false; + emits('submitCallback'); + proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); + }else{ + proxy?.$modal.msgWarning('璇烽�夋嫨鐢ㄦ埛锛�'); + } +} + +//缁堟浠诲姟 +const handleTerminationTask = async (data) => { + let params = { + taskId: taskId.value, + comment: form.value.message + } + await proxy?.$modal.confirm('鏄惁纭缁堟锛�'); + loading.value = true; + buttonLoading.value = true; + await terminationTask(params).finally(() => (loading.value = false)); + dialog.visible = false; + emits('submitCallback'); + proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛'); + +} + /** * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉� */ -- Gitblit v1.9.3