From d186c800f041e1f9c7e9ca8356544ce41f9673e2 Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: 星期五, 22 三月 2024 23:42:30 +0800
Subject: [PATCH] add 添加流程实例,全部待办表单查看

---
 src/views/workflow/processInstance/index.vue |   70 ++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/src/views/workflow/processInstance/index.vue b/src/views/workflow/processInstance/index.vue
index 19e57f7..8a4ba4a 100644
--- a/src/views/workflow/processInstance/index.vue
+++ b/src/views/workflow/processInstance/index.vue
@@ -77,27 +77,9 @@
             </el-table-column>
             <el-table-column align="center" prop="startTime" label="鍚姩鏃堕棿" width="160"></el-table-column>
             <el-table-column v-if="tab === 'finish'" align="center" prop="endTime" label="缁撴潫鏃堕棿" width="160"></el-table-column>
-            <el-table-column label="鎿嶄綔" align="center" width="160" class-name="small-padding fixed-width">
+            <el-table-column label="鎿嶄綔" align="center" :width="tab === 'finish' ? '130' : '160'">
               <template #default="scope">
-                <el-row :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button link type="primary" size="small" icon="Document" @click="handleApprovalRecord(scope.row)">瀹℃壒璁板綍</el-button>
-                  </el-col>
-                  <el-col :span="1.5">
-                    <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
-                  </el-col>
-                </el-row>
                 <el-row v-if="tab === 'running'" :gutter="10" class="mb8">
-                  <el-col :span="1.5">
-                    <el-button
-                      link
-                      type="primary"
-                      size="small"
-                      icon="Sort"
-                      @click="getProcessDefinitionHitoryList(scope.row.processDefinitionId, scope.row.processDefinitionKey)"
-                      >鍒囨崲鐗堟湰</el-button
-                    >
-                  </el-col>
                   <el-col :span="1.5">
                     <el-popover :ref="`popoverRef${scope.$index}`" trigger="click" placement="left" :width="300">
                       <el-input v-model="deleteReason" resize="none" :rows="3" type="textarea" placeholder="璇疯緭鍏ヤ綔搴熷師鍥�" />
@@ -109,6 +91,24 @@
                         <el-button link type="primary" size="small" icon="CircleClose">浣滃簾</el-button>
                       </template>
                     </el-popover>
+                  </el-col>
+                  <el-col :span="1.5">
+                    <el-button
+                      link
+                      type="primary"
+                      size="small"
+                      icon="Sort"
+                      @click="getProcessDefinitionHitoryList(scope.row.processDefinitionId, scope.row.processDefinitionKey)"
+                      >鍒囨崲鐗堟湰</el-button
+                    >
+                  </el-col>
+                </el-row>
+                <el-row :gutter="10" class="mb8">
+                  <el-col :span="1.5">
+                    <el-button link type="primary" size="small" icon="View" @click="handleView(scope.row)">鏌ョ湅</el-button>
+                  </el-col>
+                  <el-col :span="1.5">
+                    <el-button link type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
                   </el-col>
                 </el-row>
               </template>
@@ -146,8 +146,6 @@
         </el-table-column>
       </el-table>
     </el-dialog>
-    <!-- 瀹℃壒璁板綍 -->
-    <approvalRecord ref="approvalRecordRef" />
   </div>
 </template>
 
@@ -160,12 +158,10 @@
   deleteRunInstance
 } from '@/api/workflow/processInstance';
 import { getListByKey, migrationDefinition } from '@/api/workflow/processDefinition';
-import ApprovalRecord from '@/components/Process/approvalRecord.vue';
 import { listCategory } from '@/api/workflow/category';
 import { CategoryVO } from '@/api/workflow/category/types';
 import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
 //瀹℃壒璁板綍缁勪欢
-const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const queryFormRef = ref<ElFormInstance>();
 const categoryTreeRef = ref<ElTreeInstance>();
@@ -213,11 +209,6 @@
   categoryCode: undefined
 });
 
-onMounted(() => {
-  getProcessInstanceRunningList();
-  getTreeselect();
-});
-
 /** 鑺傜偣鍗曞嚮浜嬩欢 */
 const handleNodeClick = (data: CategoryVO) => {
   queryParams.value.categoryCode = data.categoryCode;
@@ -250,12 +241,6 @@
   categoryOptions.value.push(data);
 };
 
-//瀹℃壒璁板綍
-const handleApprovalRecord = (row: any) => {
-  if (approvalRecordRef.value) {
-    approvalRecordRef.value.init(row.id);
-  }
-};
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
   if ('running' === tab.value) {
@@ -312,6 +297,7 @@
   proxy?.$modal.msgSuccess('鍒犻櫎鎴愬姛');
 };
 const changeTab = async (data: string) => {
+  processInstanceList.value = []
   queryParams.value.pageNum = 1;
   if ('running' === data) {
     getProcessInstanceRunningList();
@@ -359,4 +345,20 @@
     loading.value = false;
   });
 };
+/** 鏌ョ湅鎸夐挳鎿嶄綔 */
+const handleView = (row) => {
+  if(row.wfFormDefinitionVo){
+    proxy.$tab.closePage(proxy.$route);
+    proxy.$router.push({
+      path: `${row.wfFormDefinitionVo.path}/${row.businessKey}/view`
+    })
+  }else{
+    proxy?.$modal.msgError('璇峰埌娴佺▼瀹氫箟鑿滃崟閰嶇疆璺敱锛�');
+  }
+};
+
+onMounted(() => {
+  getProcessInstanceRunningList();
+  getTreeselect();
+});
 </script>

--
Gitblit v1.9.3