From 9de3f25f6a714175ffed224f3f5c7e9b70735ba0 Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: 星期六, 01 六月 2024 22:05:45 +0800
Subject: [PATCH] update 调整审批按钮加载

---
 src/components/Process/submitVerify.vue |  180 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 94 insertions(+), 86 deletions(-)

diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue
index d71b855..b253276 100644
--- a/src/components/Process/submitVerify.vue
+++ b/src/components/Process/submitVerify.vue
@@ -8,29 +8,43 @@
           <el-checkbox label="3" name="type">鐭俊</el-checkbox>
         </el-checkbox-group>
       </el-form-item>
-      <el-form-item label="闄勪欢" v-if="task.businessStatus === 'waiting'">
-        <fileUpload v-model="form.fileId" :fileType="['doc', 'xls', 'ppt', 'txt', 'pdf', 'xlsx', 'docx', 'zip']" :fileSize="'20'"/>
+      <el-form-item v-if="task.businessStatus === 'waiting'" label="闄勪欢">
+        <fileUpload v-model="form.fileId" :file-type="['doc', 'xls', 'ppt', 'txt', 'pdf', 'xlsx', 'docx', 'zip']" :file-size="'20'" />
       </el-form-item>
       <el-form-item label="鎶勯��">
-        <el-button type="primary" @click="openUserSelectCopy" icon="Plus" circle />
-          <el-tag v-for="user in selectCopyUserList" :key="user.userId" closable style="margin: 2px" @close="handleCopyCloseTag(user)">
-            {{ user.userName }}
-          </el-tag>
+        <el-button type="primary" icon="Plus" circle @click="openUserSelectCopy" />
+        <el-tag v-for="user in selectCopyUserList" :key="user.userId" closable style="margin: 2px" @close="handleCopyCloseTag(user)">
+          {{ user.userName }}
+        </el-tag>
       </el-form-item>
-      <el-form-item label="瀹℃壒鎰忚" v-if="task.businessStatus === 'waiting'">
+      <el-form-item v-if="task.businessStatus === 'waiting'" label="瀹℃壒鎰忚">
         <el-input v-model="form.message" type="textarea" resize="none" />
       </el-form-item>
     </el-form>
     <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="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>
+        <el-button :disabled="buttonDisabled" type="primary" @click="handleCompleteTask"> 鎻愪氦 </el-button>
+        <el-button v-if="task.businessStatus === 'waiting'" :disabled="buttonDisabled" type="primary" @click="openDelegateTask"> 濮旀墭 </el-button>
+        <el-button v-if="task.businessStatus === 'waiting'" :disabled="buttonDisabled" type="primary" @click="openTransferTask"> 杞姙 </el-button>
+        <el-button
+          v-if="task.businessStatus === 'waiting' && task.multiInstance"
+          :disabled="buttonDisabled"
+          type="primary"
+          @click="addMultiInstanceUser"
+        >
+          鍔犵
+        </el-button>
+        <el-button
+          v-if="task.businessStatus === 'waiting' && task.multiInstance"
+          :disabled="buttonDisabled"
+          type="primary"
+          @click="deleteMultiInstanceUser"
+        >
+          鍑忕
+        </el-button>
+        <el-button v-if="task.businessStatus === 'waiting'" :disabled="buttonDisabled" type="danger" @click="handleTerminationTask"> 缁堟 </el-button>
+        <el-button v-if="task.businessStatus === 'waiting'" :disabled="buttonDisabled" type="danger" @click="handleBackProcessOpen"> 閫�鍥� </el-button>
+        <el-button :disabled="buttonDisabled" @click="cancel">鍙栨秷</el-button>
       </span>
     </template>
     <!-- 鎶勯�� -->
@@ -40,19 +54,14 @@
     <!-- 濮旀墭 -->
     <UserSelect ref="delegateTaskRef" :multiple="false" @confirm-call-back="handleDelegateTask"></UserSelect>
     <!-- 鍔犵缁勪欢 -->
-    <multiInstanceUser ref="multiInstanceUserRef" :title="title" @submit-callback='closeDialog' />
+    <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 v-if="task.businessStatus === 'waiting'" v-loading="backLoading" :model="backForm" label-width="120px">
         <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 v-model="backForm.targetActivityId" clearable placeholder="璇烽�夋嫨" 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="娑堟伅鎻愰啋">
@@ -67,8 +76,8 @@
         </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>
+        <div class="dialog-footer" style="float: right; padding-bottom: 20px">
+          <el-button v-loading="backLoading" type="primary" @click="handleBackProcess">纭</el-button>
           <el-button v-loading="backLoading" @click="backVisible = false">鍙栨秷</el-button>
         </div>
       </template>
@@ -81,7 +90,7 @@
 import { ref } from 'vue';
 import { ComponentInternalInstance } from 'vue';
 import { ElForm } from 'element-plus';
-import { completeTask, backProcess, getTaskById,transferTask,terminationTask,getTaskNodeList,delegateTask } 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;
@@ -91,7 +100,7 @@
 const transferTaskRef = ref<InstanceType<typeof UserSelect>>();
 const delegateTaskRef = ref<InstanceType<typeof UserSelect>>();
 
-  //鍔犵缁勪欢
+//鍔犵缁勪欢
 const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>();
 
 const props = defineProps({
@@ -103,7 +112,7 @@
 //閬僵灞�
 const loading = ref(true);
 //鎸夐挳
-const buttonLoading = ref(true);
+const buttonDisabled = ref(true);
 //浠诲姟id
 const taskId = ref<string>('');
 //鎶勯�佷汉
@@ -166,23 +175,23 @@
   messageType: ['1']
 });
 const closeDialog = () => {
-  dialog.visible = false
-}
+  dialog.visible = false;
+};
 //鎵撳紑寮圭獥
 const openDialog = (id?: string) => {
-  selectCopyUserIds.value = undefined
-  selectCopyUserList.value = []
-  form.value.fileId = undefined
+  selectCopyUserIds.value = undefined;
+  selectCopyUserList.value = [];
+  form.value.fileId = undefined;
   taskId.value = id;
   form.value.message = undefined;
   dialog.visible = true;
   loading.value = true;
-  buttonLoading.value = true;
+  buttonDisabled.value = true;
   nextTick(() => {
     getTaskById(taskId.value).then((response) => {
       task.value = response.data;
       loading.value = false;
-      buttonLoading.value = false;
+      buttonDisabled.value = false;
     });
   });
 };
@@ -194,42 +203,42 @@
 const handleCompleteTask = async () => {
   form.value.taskId = taskId.value;
   form.value.taskVariables = props.taskVariables;
-  if(selectCopyUserList && selectCopyUserList.value.length > 0){
-    let wfCopyList = []
-    selectCopyUserList.value.forEach( e=> {
+  if (selectCopyUserList.value && selectCopyUserList.value.length > 0) {
+    let wfCopyList = [];
+    selectCopyUserList.value.forEach((e) => {
       let copyUser = {
         userId: e.userId,
         userName: e.nickName
-      }
-      wfCopyList.push(copyUser)
-    })
-    form.value.wfCopyList = wfCopyList
+      };
+      wfCopyList.push(copyUser);
+    });
+    form.value.wfCopyList = wfCopyList;
   }
   await proxy?.$modal.confirm('鏄惁纭鎻愪氦锛�');
   loading.value = true;
-  buttonLoading.value = true;
+  buttonDisabled.value = true;
   try {
     await completeTask(form.value);
     dialog.visible = false;
     emits('submitCallback');
     proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
   } finally {
-    loading.value = false
-    buttonLoading.value = false
+    loading.value = false;
+    buttonDisabled.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
-}
+  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 () => {
   backForm.value.taskId = taskId.value;
@@ -238,14 +247,14 @@
   backLoading.value = true;
   await backProcess(backForm.value).finally(() => (loading.value = false));
   dialog.visible = false;
-  backLoading.value = false
+  backLoading.value = false;
   emits('submitCallback');
   proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
 };
 //鍙栨秷
 const cancel = async () => {
   dialog.visible = false;
-  buttonLoading.value = false;
+  buttonDisabled.value = false;
   emits('cancelCallback');
 };
 //鎵撳紑鎶勯�佷汉鍛�
@@ -254,11 +263,11 @@
 };
 //纭鎶勯�佷汉鍛�
 const userSelectCopyCallBack = (data: UserVO[]) => {
-  if(data && data.length > 0){
-    selectCopyUserList.value = data
+  if (data && data.length > 0) {
+    selectCopyUserList.value = data;
     selectCopyUserIds.value = selectCopyUserList.value.map((item) => item.userId).join(',');
   }
-}
+};
 //鍒犻櫎鎶勯�佷汉鍛�
 const handleCopyCloseTag = (user: UserVO) => {
   const userId = user.userId;
@@ -286,63 +295,62 @@
   transferTaskRef.value.open();
 };
 //杞姙
-const handleTransferTask  = async (data) => {
-  if(data && data.length > 0){
+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;
+    buttonDisabled.value = true;
     await transferTask(params).finally(() => (loading.value = false));
     dialog.visible = false;
     emits('submitCallback');
     proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
-  }else{
+  } else {
     proxy?.$modal.msgWarning('璇烽�夋嫨鐢ㄦ埛锛�');
   }
-}
+};
 
 //鎵撳紑濮旀墭
 const openDelegateTask = () => {
   delegateTaskRef.value.open();
 };
 //濮旀墭
-const handleDelegateTask  = async (data) => {
-  if(data && data.length > 0){
+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;
+    buttonDisabled.value = true;
     await delegateTask(params).finally(() => (loading.value = false));
     dialog.visible = false;
     emits('submitCallback');
     proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
-  }else{
+  } 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('鎿嶄綔鎴愬姛');
-  
-}
+const handleTerminationTask = async (data) => {
+  let params = {
+    taskId: taskId.value,
+    comment: form.value.message
+  };
+  await proxy?.$modal.confirm('鏄惁纭缁堟锛�');
+  loading.value = true;
+  buttonDisabled.value = true;
+  await terminationTask(params).finally(() => (loading.value = false));
+  dialog.visible = false;
+  emits('submitCallback');
+  proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
+};
 
 /**
  * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉�

--
Gitblit v1.9.3