From 40a75dae3182cb55b30a2e8093c5eed82465f59c Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期一, 15 四月 2024 10:40:33 +0800
Subject: [PATCH] fix 修复代码缩进.

---
 src/components/Process/submitVerify.vue |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 153 insertions(+), 12 deletions(-)

diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue
index 9e2a7be..d71b855 100644
--- a/src/components/Process/submitVerify.vue
+++ b/src/components/Process/submitVerify.vue
@@ -24,15 +24,56 @@
     <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="openDelegateTask"> 濮旀墭 </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="true" :data="selectCopyUserIds" @confirm-call-back="userSelectCopyCallBack"></UserSelect>
+    <!-- 杞姙 -->
+    <UserSelect ref="transferTaskRef" :multiple="false" @confirm-call-back="handleTransferTask"></UserSelect>
+    <!-- 濮旀墭 -->
+    <UserSelect ref="delegateTaskRef" :multiple="false" @confirm-call-back="handleDelegateTask"></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 +81,16 @@
 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,delegateTask } 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 delegateTaskRef = ref<InstanceType<typeof UserSelect>>();
+
   //鍔犵缁勪欢
 const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>();
 
@@ -66,6 +110,11 @@
 const selectCopyUserList = ref<UserVO[]>([]);
 //鎶勯�佷汉id
 const selectCopyUserIds = ref<string>(undefined);
+// 椹冲洖鏄惁鏄剧ず
+const backVisible = ref(false);
+const backLoading = ref(true);
+// 鍙┏鍥炲緱浠诲姟鑺傜偣
+const taskNodeList = ref([]);
 //浠诲姟
 const task = ref<TaskVO>({
   id: undefined,
@@ -91,7 +140,9 @@
   processDefinitionName: undefined,
   processDefinitionKey: undefined,
   participantVo: undefined,
-  multiInstance: undefined
+  multiInstance: undefined,
+  businessKey: undefined,
+  wfNodeConfigVo: undefined
 });
 //鍔犵 鍑忕鏍囬
 const title = ref('');
@@ -107,6 +158,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
@@ -147,20 +208,37 @@
   await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�');
   loading.value = true;
   buttonLoading.value = true;
-  await completeTask(form.value).finally(() => (loading.value = false));
-  dialog.visible = false;
-  emits('submitCallback');
-  proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
+  try {
+    await completeTask(form.value);
+    dialog.visible = false;
+    emits('submitCallback');
+    proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
+  } finally {
+    loading.value = false
+    buttonLoading.value = false
+  }
 };
 
+/** 椹冲洖寮圭獥鎵撳紑 */
+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('鎿嶄綔鎴愬姛');
 };
@@ -203,6 +281,69 @@
     multiInstanceUserRef.value.getDeleteMultiInstanceList(taskId.value);
   }
 };
+//鎵撳紑杞姙
+const openTransferTask = () => {
+  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 openDelegateTask = () => {
+  delegateTaskRef.value.open();
+};
+//濮旀墭
+const handleDelegateTask  = async (data) => {
+  if(data && data.length > 0){
+    let params = {
+      taskId: taskId.value,
+      userId: data[0].userId,
+      nickName: data[0].nickName
+    }
+    await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�');
+    loading.value = true;
+    buttonLoading.value = true;
+    await delegateTask(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