From c922ea3b9c5eefd2e3cd6bfcf0ed1c4d2f608c3f Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: 星期三, 03 四月 2024 20:42:05 +0800
Subject: [PATCH] add 添加委托

---
 src/components/Process/submitVerify.vue |   43 +++++++++++++++++----
 src/api/workflow/task/types.ts          |   18 ++++----
 src/api/workflow/task/index.ts          |   12 ++++++
 3 files changed, 56 insertions(+), 17 deletions(-)

diff --git a/src/api/workflow/task/index.ts b/src/api/workflow/task/index.ts
index 07b183d..8260e69 100644
--- a/src/api/workflow/task/index.ts
+++ b/src/api/workflow/task/index.ts
@@ -226,3 +226,15 @@
     method: 'get'
   });
 };
+
+/**
+ * 濮旀墭浠诲姟
+ * @returns
+ */
+export const delegateTask = (data: any) => {
+  return request({
+    url: `/workflow/task/delegateTask`,
+    method: 'post',
+    data: data
+  });
+};
diff --git a/src/api/workflow/task/types.ts b/src/api/workflow/task/types.ts
index 2e39d06..0425a1a 100644
--- a/src/api/workflow/task/types.ts
+++ b/src/api/workflow/task/types.ts
@@ -32,15 +32,15 @@
   parentTaskId?: any;
   tenantId: string;
   claimTime?: string;
-  businessStatus: string;
-  businessStatusName: string;
-  processDefinitionName: string;
-  processDefinitionKey: string;
-  participantVo: ParticipantVo;
-  multiInstance: boolean;
-  businessKey: string;
-  wfNodeConfigVo: NodeConfigVO;
-  wfDefinitionConfigVo: DefinitionConfigVO;
+  businessStatus?: string;
+  businessStatusName?: string;
+  processDefinitionName?: string;
+  processDefinitionKey?: string;
+  participantVo?: ParticipantVo;
+  multiInstance?: boolean;
+  businessKey?: string;
+  wfNodeConfigVo?: NodeConfigVO;
+  wfDefinitionConfigVo?: DefinitionConfigVO;
 }
 
 export interface VariableVo {
diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue
index 0d7e413..b0e4c11 100644
--- a/src/components/Process/submitVerify.vue
+++ b/src/components/Process/submitVerify.vue
@@ -24,6 +24,7 @@
     <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>
@@ -33,9 +34,11 @@
       </span>
     </template>
     <!-- 鎶勯�� -->
-    <UserSelect ref="userSelectCopyRef" :multiple="userMultiple" :data="selectCopyUserIds" @confirm-call-back="userSelectCopyCallBack"></UserSelect>
+    <UserSelect ref="userSelectCopyRef" :multiple="true" :data="selectCopyUserIds" @confirm-call-back="userSelectCopyCallBack"></UserSelect>
     <!-- 杞姙 -->
-    <UserSelect ref="transferTaskRef" :multiple="userMultiple" @confirm-call-back="handleTransferTask"></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='closeDialog' />
 
@@ -78,7 +81,7 @@
 import { ref } from 'vue';
 import { ComponentInternalInstance } from 'vue';
 import { ElForm } from 'element-plus';
-import { completeTask, backProcess, getTaskById,transferTask,terminationTask,getTaskNodeList } 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;
@@ -86,6 +89,8 @@
 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>>();
 
@@ -105,8 +110,6 @@
 const selectCopyUserList = ref<UserVO[]>([]);
 //鎶勯�佷汉id
 const selectCopyUserIds = ref<string>(undefined);
-//鏄惁澶氶�変汉鍛�
-const userMultiple = ref(false);
 // 椹冲洖鏄惁鏄剧ず
 const backVisible = ref(false);
 const backLoading = ref(true);
@@ -137,7 +140,10 @@
   processDefinitionName: undefined,
   processDefinitionKey: undefined,
   participantVo: undefined,
-  multiInstance: undefined
+  multiInstance: undefined,
+  businessKey: undefined,
+  wfNodeConfigVo: undefined,
+  wfDefinitionConfigVo: undefined
 });
 //鍔犵 鍑忕鏍囬
 const title = ref('');
@@ -240,7 +246,6 @@
 };
 //鎵撳紑鎶勯�佷汉鍛�
 const openUserSelectCopy = () => {
-  userMultiple.value = true
   userSelectCopyRef.value.open();
 };
 //纭鎶勯�佷汉鍛�
@@ -274,7 +279,6 @@
 };
 //鎵撳紑杞姙
 const openTransferTask = () => {
-  userMultiple.value = false
   transferTaskRef.value.open();
 };
 //杞姙
@@ -297,6 +301,29 @@
   }
 }
 
+//鎵撳紑濮旀墭
+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 = {

--
Gitblit v1.9.3