From ea7c19b7bfd7a5260fa321579e6941f28ef2eb46 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 27 八月 2026 11:36:30 +0800
Subject: [PATCH] fix(order): 解决实验室字段必填验证和数据源问题

---
 src/views/business/productOrder/index.vue |  179 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 111 insertions(+), 68 deletions(-)

diff --git a/src/views/business/productOrder/index.vue b/src/views/business/productOrder/index.vue
index d8371fb..1f24b24 100644
--- a/src/views/business/productOrder/index.vue
+++ b/src/views/business/productOrder/index.vue
@@ -39,30 +39,32 @@
         </el-form-item>
       </el-form>
     </div>
-    <div class="table-tab">
-      <div>
-        <ul class="tab">
-          <li :class="{ active: tabIndex === 0 }" v-if="checkPermi(['get:insOrder:reviewed'])" @click="handleTab(0)">寰呭鏍�</li>
-          <li :class="{ active: tabIndex === 1 }" v-if="checkPermi(['get:insOrder:checkout'])" @click="handleTab(1)">妫�楠屼腑</li>
-          <li :class="{ active: tabIndex === 2 }" v-if="checkPermi(['get:insOrder:customerOrdered'])" @click="handleTab(2)">濮旀墭宸叉</li>
-          <li :class="{ active: tabIndex === 3 }" v-if="checkPermi(['get:insOrder:spotCheck'])" @click="handleTab(3)">鎶芥牱宸叉</li>
-          <li :class="{ active: tabIndex === 4 }" v-if="checkPermi(['get:insOrder:sendBack'])" @click="handleTab(4)">閫�鍥�</li>
-          <li :class="{ active: tabIndex === 5 }" v-if="checkPermi(['get:insOrder:revocation'])" @click="handleTab(5)">鎾ら攢</li>
-          <li :class="{ active: tabIndex === 6 }" v-if="checkPermi(['get:insOrder:all'])" @click="handleTab(6)">鍏ㄩ儴</li>
-        </ul>
+    <div class="container" v-loading="isLoading">
+      <div class="table-tab">
+        <div>
+          <ul class="tab">
+            <li :class="{ active: tabIndex === 0 }" v-if="checkPermi(['get:insOrder:reviewed'])" @click="handleTab(0)">寰呭鏍�</li>
+            <li :class="{ active: tabIndex === 1 }" v-if="checkPermi(['get:insOrder:checkout'])" @click="handleTab(1)">妫�楠屼腑</li>
+            <li :class="{ active: tabIndex === 2 }" v-if="checkPermi(['get:insOrder:customerOrdered'])" @click="handleTab(2)">濮旀墭宸叉</li>
+            <li :class="{ active: tabIndex === 3 }" v-if="checkPermi(['get:insOrder:spotCheck'])" @click="handleTab(3)">鎶芥牱宸叉</li>
+            <li :class="{ active: tabIndex === 4 }" v-if="checkPermi(['get:insOrder:sendBack'])" @click="handleTab(4)">閫�鍥�</li>
+            <li :class="{ active: tabIndex === 5 }" v-if="checkPermi(['get:insOrder:revocation'])" @click="handleTab(5)">鎾ら攢</li>
+            <li :class="{ active: tabIndex === 6 }" v-if="checkPermi(['get:insOrder:all'])" @click="handleTab(6)">鍏ㄩ儴</li>
+          </ul>
+        </div>
+        <div>
+          <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 6" size="small"
+                     @click="downLoad">瀵煎嚭</el-button>
+          <el-button v-if="tabIndex === 1" size="small" type="primary" @click="openAddIns">娣诲姞妫�楠岄」</el-button>
+          <el-button size="small" type="primary" @click="openPrint">鏍囩鎵撳嵃</el-button>
+          <el-button v-if="checkPermi(['add:insOrder'])" size="small" type="primary" @click="playOrder(1)">涓嬪崟</el-button>
+        </div>
       </div>
-      <div>
-        <el-button v-if="tabIndex === 2 || tabIndex === 3 || tabIndex === 6" size="small"
-          @click="downLoad">瀵煎嚭</el-button>
-        <el-button v-if="tabIndex === 1" size="small" type="primary" @click="openAddIns">娣诲姞妫�楠岄」</el-button>
-        <el-button size="small" type="primary" @click="openPrint">鏍囩鎵撳嵃</el-button>
-        <el-button v-if="checkPermi(['add:insOrder'])" size="small" type="primary" @click="playOrder(1)">涓嬪崟</el-button>
+      <div class="table">
+        <lims-table :tableData="tableData" :column="column" :isSelection="true" :handleSelectionChange="selectMethod"
+                    @pagination="pagination" :height="'calc(100vh - 280px)'" :key="upIndex" :page="page"
+                    :tableLoading="tableLoading"></lims-table>
       </div>
-    </div>
-    <div class="table">
-      <lims-table :tableData="tableData" :column="column" :isSelection="true" :handleSelectionChange="selectMethod"
-        @pagination="pagination" :height="'calc(100vh - 280px)'" :key="upIndex" :page="page"
-        :tableLoading="tableLoading"></lims-table>
     </div>
     <div>
       <!-- 瀹℃牳 -->
@@ -128,11 +130,11 @@
               </div>
             </el-col>
             <el-col class="search_thing" style="width: 95%;">
-              <div class="search_label"><span class="required-span">* </span>璇曢獙瀹わ細</div>
+              <div class="search_label">璇曢獙瀹わ細</div>
               <div class="search_input">
                 <el-select v-model="distributeData.sonLaboratory" clearable filterable placeholder="璇烽�夋嫨" size="small"
                   style="width: 100%;">
-                  <el-option v-for="(item, i) in sonLaboratoryList" :key="i + 'oooo'" :label="item.label"
+                  <el-option v-for="(item, i) in newJuLaboratoryList" :key="i + 'oooo'" :label="item.label"
                     :value="item.value">
                   </el-option>
                 </el-select>
@@ -164,7 +166,7 @@
         <div v-if="deleteDialogVisible" style="height: 70vh;overflow-y: auto;">
           <lims-table :tableData="componentDataDelete" :column="columnDelete" :isSelection="true"
             :handleSelectionChange="selectDelete" @pagination="paginationDelete" height="500px"
-            key="componentDataDelete" :page="pageDelete" :tableLoading="tableLoadingDelete"></lims-table>
+            :key="orderId" :page="pageDelete" :tableLoading="tableLoadingDelete"></lims-table>
         </div>
         <span slot="footer" class="dialog-footer">
           <el-row>
@@ -328,9 +330,12 @@
 import {
   checkUpdate, delInsOrder, getSampleByOrderId,
   rawAllInsOrderExport,
-  selectInsOrderParameter, selectNoProducts, selectOrderManDay,
+  selectInsOrderParameter,
+  selectNoProducts,
+  getRevocationInsProductList,
+  selectOrderManDay,
   updateInspected,
-  updateOrderEntrustCode, updateSampleModel, updateStatus, upInsOrder, upPlanUser2
+  updateOrderEntrustCode, updateSampleModel, updateStatus, upInsOrder
 } from "@/api/business/productOrder";
 import { selectUserCondition } from "@/api/performance/class";
 import { downFile, getFileList, selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
@@ -345,6 +350,7 @@
   },
   data() {
     return {
+      isLoading: false, // 鎺у埗鍔犺浇鐘舵��
       entity: {
         orderType: '',
         state: '',
@@ -759,7 +765,6 @@
       ],
       qrData: [],
       multipleSelection: [],
-      sonLaboratoryList: [],
       printDialog: false,
       addInspectionDia: false,
       dialogVisible: false,
@@ -777,10 +782,19 @@
       }
     }
   },
+  dicts: ['sys_sub_lab'],
   computed: {
     ...mapGetters(["nickName"]),
+    newJuLaboratoryList() {
+      return (this.dict.type.sys_sub_lab || []).filter(item => item.label === '鏂拌仛')
+    },
   },
   mounted() {
+    if (this.checkPermi(['get:raw:await'])) {
+      this.tabIndex = 0
+    } else {
+      this.tabIndex = 2
+    }
     this.refreshTable()
     this.getAuthorizedPerson()
   },
@@ -800,8 +814,9 @@
         }
       }
       const params = { ...this.entity, state: this.tabList[this.tabIndex].value }
-      this.tableLoading = true
+      this.isLoading = true; // 寮�濮嬪姞杞�
       selectInsOrderParameter({...this.page,...params}).then(res => {
+        this.isLoading = false; // 缁撴潫鍔犺浇
         this.upIndex++
         this.tableLoading = false
         if (res.code === 200) {
@@ -809,7 +824,7 @@
           this.page.total = res.data.total
         }
       }).catch(err => {
-        this.tableLoading = false
+        this.isLoading = false; // 缁撴潫鍔犺浇
       })
     },
     refresh() {
@@ -918,7 +933,12 @@
     },
     // 瀵煎嚭璁板綍
     downLoad() {
-      const params = { ...this.entity, state: this.tabList[this.tabIndex].value }
+      let params = {}
+      if (this.multipleSelection.length > 0) {
+        params.ids = this.multipleSelection.map(item => item.id).join(',');
+      } else {
+        params = { ...this.entity, state: this.tabList[this.tabIndex].value }
+      }
       rawAllInsOrderExport({ ...params }).then(res => {
         const blob = new Blob([res], { type: 'application/octet-stream' });
         this.$download.saveAs(blob, '濮旀墭妫�娴嬩俊鎭鍑�.xlsx');
@@ -971,14 +991,26 @@
     },
     // 鐐瑰嚮鏍峰搧鍚嶇О
     selectAllByOne(row) {
-      this.$router.push({
-        path: "/productOrder/addView", query: {
-          examine: 1,
-          active: 2,
-          currentId: row.id,
-          tabIndex: this.tabIndex,
-        }
-      });
+      if (this.tabIndex === 4) {
+        this.$router.push({
+          path: "/productOrder/addOrder", query: {
+            examine: 1,
+            active: 2,
+            currentId: row.id,
+            tabIndex: this.tabIndex,
+          }
+        });
+      } else {
+        this.$router.push({
+          path: "/productOrder/addView", query: {
+            examine: 1,
+            active: 2,
+            currentId: row.id,
+            tabIndex: this.tabIndex,
+          }
+        });
+      }
+
     },
     // 淇敼鏍峰搧鍨嬪彿
     editSampleModel (row) {
@@ -1141,7 +1173,20 @@
       this.orderId = row.id
       this.revocationInsProductIds = row.revocationInsProductIds
       this.deleteTilte = '鎾ら攢瀹℃牳'
+      // this.getRevocationInsProductList()
       this.deleteDialogVisible = true;
+    },
+    getRevocationInsProductList(){
+      this.tableLoadingDelete = true
+      getRevocationInsProductList({orderId:this.orderId}).then(res=>{
+        if(res.code===200){
+          this.componentDataDelete = res.data
+        }
+        this.tableLoadingDelete = false
+      }).catch(error=>{
+        console.error(error)
+        this.tableLoadingDelete = false
+      })
     },
     handleNo() {
       if (this.deleteTilte == '鎾ら攢') {
@@ -1160,6 +1205,7 @@
     // 涓嬪彂
     handleIssued(row) {
       this.issuedDialogVisible = true;
+      this.distributeData.sonLaboratory = this.newJuLaboratoryList.length > 0 ? this.newJuLaboratoryList[0].value : ''
       selectOrderManDay({
         id: row.id
       }).then(res => {
@@ -1167,19 +1213,6 @@
         this.distributeData.sampleId = row.sampleId
         this.distributeData.appointed = res.data
         this.distributeData.type = row.type
-      })
-      upPlanUser2({
-        orderId: row.id,
-      }).then(res => {
-        if (res.code === 200 && res.data.length > 0) {
-          this.sonLaboratoryList = [];
-          res.data.forEach(m => {
-            this.sonLaboratoryList.push({
-              value: m,
-              label: m
-            })
-          })
-        }
       })
     },
     submitForm2() {
@@ -1190,10 +1223,6 @@
       //
       if (this.distributeData.userId == null || this.distributeData.userId == '') {
         this.$message.error('鎸囨淳浜哄憳鏈~鍐�')
-        return
-      }
-      if (this.distributeData.userId && (this.distributeData.sonLaboratory == null || this.distributeData.sonLaboratory == '')) {
-        this.$message.error('璇曢獙瀹ゆ湭濉啓')
         return
       }
       this.upLoad = true;
@@ -1251,6 +1280,7 @@
     },
     handleTab(i) {
       this.tabIndex = i;
+      this.multipleSelection = []
       this.refreshTable()
     },
     // 鏌ョ湅妫�楠屾暟鎹�
@@ -1261,16 +1291,29 @@
         inspectorList = row.userName.split(',')
       }
       inspectorList.push(this.nickName)
-      this.$router.push({
-        path: "/inspectionTask/inspection",
-        query: {
-          sonLaboratory: row.sonLaboratory,
-          state: 3,
-          typeSource: row.typeSource,
-          orderId: row.id,
-          inspectorList: inspectorList,
-        },
-      })
+      if (this.checkPermi(['business:inspectionView'])) {
+        this.$router.push({
+          name: "InspectionView",
+          query: {
+            sonLaboratory: row.sonLaboratory,
+            state: 3,
+            typeSource: row.typeSource,
+            orderId: row.id,
+            inspectorList: inspectorList,
+          },
+        })
+      } else {
+        this.$router.push({
+          path: "/inspectionTask/inspection",
+          query: {
+            sonLaboratory: row.sonLaboratory,
+            state: 3,
+            typeSource: row.typeSource,
+            orderId: row.id,
+            inspectorList: inspectorList,
+          },
+        })
+      }
     },
     goback() {
       this.state = 0
@@ -1281,8 +1324,8 @@
       this.InspectionKey++
     },
     changeUser() {
-      if (this.sonLaboratoryList.length > 0) {
-        this.distributeData.sonLaboratory = this.sonLaboratoryList[0].value
+      if (this.newJuLaboratoryList.length > 0) {
+        this.distributeData.sonLaboratory = this.newJuLaboratoryList[0].value
       }
     },
     handleDelete(row) {

--
Gitblit v1.9.3