From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期二, 29 四月 2025 13:25:29 +0800
Subject: [PATCH] Merge branch 'dev' into dev_tides

---
 src/views/business/productOrder/index.vue |  280 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 193 insertions(+), 87 deletions(-)

diff --git a/src/views/business/productOrder/index.vue b/src/views/business/productOrder/index.vue
index 5ecdc8b..b602274 100644
--- a/src/views/business/productOrder/index.vue
+++ b/src/views/business/productOrder/index.vue
@@ -8,26 +8,16 @@
           </el-input>
         </el-form-item>
         <el-form-item label="鏍峰搧鍚嶇О" prop="sampleName">
-          <el-input v-model="entity.partNo" clearable placeholder="璇疯緭鍏�" size="small"
+          <el-input v-model="entity.sampleName" clearable placeholder="璇疯緭鍏�" size="small"
             @keyup.enter.native="refreshTable"></el-input>
         </el-form-item>
         <el-form-item label="鏍峰搧鍨嬪彿" prop="sampleModel">
           <el-input v-model="entity.sampleModel" clearable placeholder="璇疯緭鍏�" size="small"
             @keyup.enter.native="refreshTable()"></el-input>
         </el-form-item>
-        <el-form-item>
-          <el-button :icon="!more ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" style="color: #3A7BFA;" type="text"
-            @click="more = !more">{{ !more ? '鏇村' : '鏀惰捣' }}</el-button>
-          <el-button size="small" @click="refresh()">閲� 缃�</el-button>
-          <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
-        </el-form-item>
-        <el-form-item label="鏍峰搧缂栧彿" prop="sampleCode" v-if="more">
-          <el-input v-model="entity.sampleCode" clearable placeholder="璇疯緭鍏�" size="small"
-            @keyup.enter.native="refreshTable">
-          </el-input>
-        </el-form-item>
         <el-form-item label="涓嬪崟鏃堕棿" prop="createTime" v-if="more">
           <el-date-picker v-model="entity.createTime" clearable format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small"
+                          @change="refreshTable"
             style="width:100%" type="date" value-format="yyyy-MM-dd HH:mm:ss">
           </el-date-picker>
         </el-form-item>
@@ -41,32 +31,40 @@
             @keyup.enter.native="refreshTable">
           </el-input>
         </el-form-item>
+        <el-form-item>
+          <el-button :icon="!more ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" style="color: #3A7BFA;" type="text"
+                     @click="more = !more">{{ !more ? '鏇村' : '鏀惰捣' }}</el-button>
+          <el-button size="mini" type="primary" @click="refreshTable()">鏌ヨ</el-button>
+          <el-button size="mini" @click="refresh()">閲嶇疆</el-button>
+        </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>
       <!-- 瀹℃牳 -->
@@ -151,7 +149,7 @@
           </el-row>
         </span>
       </el-dialog>
-      <el-dialog :visible.sync="dataDialogVisible" title="鏁版嵁鏌ョ湅" width="80%">
+      <el-dialog :visible.sync="dataDialogVisible" title="鏁版嵁鏌ョ湅" width="80%" @close="closeDia">
         <div v-if="dataDialogVisible">
           <lims-table :tableData="tableDataLook" :column="tableDataLookColumn" @pagination="tableDataLookPagination"
             height="500px" key="tableDataLook" :page="tableDataLookPage"
@@ -298,31 +296,49 @@
       @closePrintDialog="closePrintDialog"></print-dialog>
     <!--娣诲姞閬楁紡妫�楠岄」寮规-->
     <add-inspection-dia v-if="addInspectionDia" ref="addInspectionDia"></add-inspection-dia>
-    <!--    <Inspection v-if="state>0" :key="InspectionKey" :inspectorList="inspectorList" :orderId="orderId"-->
-    <!--                :sonLaboratory="sonLaboratory" :state="state"-->
-    <!--                :typeSource="typeSource" @goback="goback" @refreshView="refreshView"/>-->
+    <!--淇敼鏍峰搧鍨嬪彿寮规-->
+    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
+               :visible.sync="dialogVisible" title="淇敼鏍峰搧鍨嬪彿" width="80%">
+      <el-table ref="sampleTable" :data="sampleList" border highlight-current-row
+                :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"
+                max-height="400px" tooltip-effect="dark">
+        <el-table-column align="center" label="搴忓彿" type="index" width="65"></el-table-column>
+        <el-table-column align="center" label="鏍峰搧鍚嶇О" min-width="100" prop="sample"> </el-table-column>
+        <el-table-column align="center" label="鏍峰搧缂栧彿" min-width="100" prop="sampleCode"></el-table-column>
+        <el-table-column align="center" label="鏍峰搧鍨嬪彿" min-width="60" prop="model">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.model" clearable placeholder="涓嶅~鍐欏垯绯荤粺鑷姩鐢熸垚"
+                      size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="妫�楠屾爣鍑�" min-width="100" prop="standardMethodName"></el-table-column>
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+				<el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+        <el-button :loading="submitListLoad" type="primary" @click="submitList">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import vueQr from 'vue-qr'
 import PrintJS from 'print-js'
-import file from "@/utils/file";
 import PrintDialog from "@/views/business/productOrder/components/printDialog.vue";
 import AddInspectionDia from "@/views/business/productOrder/components/addInspectionDia.vue";
 import limsTable from "@/components/Table/lims-table.vue";
 import {
-  checkUpdate, delInsOrder,
+  checkUpdate, delInsOrder, getSampleByOrderId,
   rawAllInsOrderExport,
   selectInsOrderParameter, selectNoProducts, selectOrderManDay,
   updateInspected,
-  updateOrderEntrustCode, updateStatus, upInsOrder, upPlanUser2
+  updateOrderEntrustCode, updateSampleModel, updateStatus, upInsOrder, upPlanUser2
 } from "@/api/business/productOrder";
 import { selectUserCondition } from "@/api/performance/class";
 import { downFile, getFileList, selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
 import {mapGetters} from "vuex";
-// import Inspection from "../do/b1-inspect-order-plan/Inspection.vue";
 export default {
+  name: 'ProductOrder',
   components: {
     limsTable,
     AddInspectionDia,
@@ -331,6 +347,7 @@
   },
   data() {
     return {
+      isLoading: false, // 鎺у埗鍔犺浇鐘舵��
       entity: {
         orderType: '',
         state: '',
@@ -339,10 +356,28 @@
       tableData: [],
       tableLoading: false,
       column: [
-        { label: '濮旀墭缂栧彿', prop: 'entrustCode', width: '160px' },
+        {
+          label: "濮旀墭缂栧彿",
+          prop: "entrustCode",
+          width: "160px",
+          dataType: "link",
+          linkMethod: "changeEntrustCode",
+        },
         { label: '濮旀墭鍗曚綅', prop: 'company' },
-        { label: '鏍峰搧鍚嶇О', prop: 'sampleName' },
-        { label: '鏍峰搧鍨嬪彿', prop: 'sampleModel' },
+        {
+          label: "鏍峰搧鍚嶇О",
+          prop: "sampleName",
+          width: "160px",
+          dataType: "link",
+          linkMethod: "selectAllByOne",
+        },
+        {
+          label: "鏍峰搧鍨嬪彿",
+          prop: "sampleModel",
+          width: "160px",
+          dataType: "link",
+          linkMethod: "editSampleModel",
+        },
         { label: '鏍峰搧鏁伴噺', prop: 'sampleNum' },
         { label: '妫�楠屼汉', prop: 'testingName' },
         {
@@ -523,7 +558,7 @@
       ],
       page: {
         total: 0,
-        size: 10,
+        size: 20,
         current: 1
       },
       state: 0,// 0:鍙拌处椤碉紝1锛氭楠岄〉闈�,2妫�楠岄〉闈�(澶嶆牳)锛岄粯璁や负0,3鏁版嵁鏌ョ湅
@@ -547,11 +582,12 @@
       quashDialogVisible: false,
       issuedDialogVisible: false,
       dataDialogVisible: false, // 鏁版嵁鏌ョ湅寮规
+      currentRow: {}, // 鏁版嵁鏌ョ湅寮规
       tableDataLookTableLoading: false, // 鏁版嵁鏌ョ湅寮规
       tableDataLook: [],
       tableDataLookPage: {
         total: 0,
-        size: 10,
+        size: 20,
         current: 1
       },
       tableDataLookColumn: [
@@ -642,7 +678,7 @@
       ],
       pageFile: {
         total: 0,
-        size: 10,
+        size: 20,
         current: 1
       },
       formData: {},
@@ -679,7 +715,7 @@
       ],
       pageDelete: {
         total: 0,
-        size: 10,
+        size: 20,
         current: 1
       },
       deleteDialogVisible: false,
@@ -728,7 +764,10 @@
       multipleSelection: [],
       sonLaboratoryList: [],
       printDialog: false,
-      addInspectionDia: false
+      addInspectionDia: false,
+      dialogVisible: false,
+      submitListLoad: false,
+      sampleList: []
     }
   },
   watch: {
@@ -745,8 +784,16 @@
     ...mapGetters(["nickName"]),
   },
   mounted() {
+    if (this.checkPermi(['get:raw:await'])) {
+      this.tabIndex = 0
+    } else {
+      this.tabIndex = 2
+    }
     this.refreshTable()
     this.getAuthorizedPerson()
+  },
+  activated() {
+    this.refreshTable()
   },
   methods: {
     // 鏌ヨ鍒楄〃鏁版嵁
@@ -761,8 +808,9 @@
         }
       }
       const params = { ...this.entity, state: this.tabList[this.tabIndex].value }
-      this.tableLoading = true
-      selectInsOrderParameter(params).then(res => {
+      this.isLoading = true; // 寮�濮嬪姞杞�
+      selectInsOrderParameter({...this.page,...params}).then(res => {
+        this.isLoading = false; // 缁撴潫鍔犺浇
         this.upIndex++
         this.tableLoading = false
         if (res.code === 200) {
@@ -770,7 +818,7 @@
           this.page.total = res.data.total
         }
       }).catch(err => {
-        this.tableLoading = false
+        this.isLoading = false; // 缁撴潫鍔犺浇
       })
     },
     refresh() {
@@ -783,6 +831,9 @@
     },
     // 鎵撳紑淇敼濮旀墭缂栧彿寮规
     changeEntrustCode(row) {
+      if (this.tabIndex !== 1) {
+        return
+      }
       this.entrustCodeVisible = true
       this.entrustCodeInfo = { ...row }
     },
@@ -876,7 +927,13 @@
     },
     // 瀵煎嚭璁板綍
     downLoad() {
-      rawAllInsOrderExport({ ...this.entity }).then(res => {
+      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');
       }).catch(err => {
@@ -926,27 +983,53 @@
       this.dataDialogVisible = false;
       this.upLoad = false;
     },
-    // 璇︽儏
+    // 鐐瑰嚮鏍峰搧鍚嶇О
     selectAllByOne(row) {
-      this.active = 2;
-      // console.log(row);
-      // //鎵撳紑寮规
-      // this.dialogVisible = true;
-      // //row = 鐐瑰嚮瀵瑰簲琛屽��
-      // //澶嶅埗缁檉ormData
-      // this.formData = this.HaveJson(row);
-      this.currentId = row.id
-      this.examine = 1
+      this.$router.push({
+        path: "/productOrder/addView", query: {
+          examine: 1,
+          active: 2,
+          currentId: row.id,
+          tabIndex: this.tabIndex,
+        }
+      });
+    },
+    // 淇敼鏍峰搧鍨嬪彿
+    editSampleModel (row) {
+      if (this.tabIndex !== 1) {
+        return
+      }
+      this.dialogVisible = true
+      this.getDataList(row)
+    },
+    getDataList(row) {
+      this.dialogVisible = true
+      getSampleByOrderId({insOrderId: row.id}).then(res => {
+        this.sampleList = res.data
+      })
+    },
+    // 鎻愪氦鏍峰搧鍨嬪彿淇敼
+    submitList () {
+      this.submitListLoad = true
+      updateSampleModel(this.sampleList).then(res => {
+        this.submitListLoad = false
+        this.dialogVisible = false
+        this.$message.success('淇敼鎴愬姛')
+        this.refreshTable()
+      }).catch(err => {
+        this.submitListLoad = false
+      })
     },
     // 鏁版嵁鏌ョ湅
     handleDataLook(row) {
       this.dataDialogVisible = true;
-      this.getDataTableList(row)
+      this.currentRow = row;
+      this.getDataTableList(this.currentRow)
     },
     // 鏌ヨ鏁版嵁鏌ョ湅鍒楄〃鏁版嵁
     getDataTableList(row) {
       this.tableDataLookTableLoading = true
-      selectSampleAndProductByOrderId({ id: row.id }).then(res => {
+      selectSampleAndProductByOrderId({ id: row.id, ...this.tableDataLookPage }).then(res => {
         this.tableDataLookTableLoading = false
         if (res.code === 200) {
           this.tableDataLook = res.data.records
@@ -958,7 +1041,15 @@
     },
     tableDataLookPagination(page) {
       this.tableDataLookPage.size = page.limit
-      this.getDataTableList()
+      this.getDataTableList(this.currentRow)
+    },
+    closeDia () {
+      this.tableDataLookPage = {
+        total: 0,
+        size: 20,
+        current: 1
+      }
+      this.dataDialogVisible = false
     },
     // 闄勪欢鏌ョ湅
     handleFileLook(row) {
@@ -986,7 +1077,7 @@
       downFile({
         id: row.id,
       }).then(res => {
-        this.$download.downloadFileFromUrl(res.data.fileUrl, row.fileName);
+        this.$download.saveAs(res.data.fileUrl, row.fileName);
       }).catch(error => {
 
       })
@@ -994,8 +1085,13 @@
     // 涓嬭浇鎶ュ憡
     download(row) {
       let url = row.urlS ? row.urlS : row.url;
-      if (url) {
-        this.$download.downloadFileFromUrl(url, this.downLoadInfo.fileName);
+      if(url){
+        url = url.split('.')[0]+'.pdf'
+        const link = document.createElement('a');
+        link.href = this.javaApi + url;
+        link.target = '_blank';
+        document.body.appendChild(link);
+        link.click();
       }
     },
     // 鎾ら攢
@@ -1013,7 +1109,7 @@
     },
     getDeleteList() {
       this.tableLoadingDelete = true
-      selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds }).then(res => {
+      selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds, ...this.pageDelete }).then(res => {
         this.tableLoadingDelete = false
         this.componentDataDelete = res.data.records
         this.pageDelete.total = res.data.total
@@ -1122,10 +1218,6 @@
         userId: this.distributeData.userId,
         sonLaboratory: this.distributeData.sonLaboratory,
       }).then(res => {
-        if (res.code === 201) {
-          this.upLoad = false
-          return
-        }
         this.$message.success('淇敼鎴愬姛')
         this.upLoad = false
         this.issuedDialogVisible = false
@@ -1165,14 +1257,15 @@
     },
     // 涓嬪崟
     playOrder(num) {
-      this.$router.push({ path: "/productOrder/add", query: { examine: 0, active: num, tabIndex: this.tabIndex } });
+      this.$router.push({ path: "/productOrder/addOrder", query: { examine: 0, active: num, tabIndex: this.tabIndex } });
     },
     // 瀹℃牳
     handleVerify(row) {
-      this.$router.push({ path: "/productOrder/add", query: { examine: 1, active: 3, currentId: row.id } });
+      this.$router.push({ path: "/productOrder/addView", query: { examine: 1, active: 3, currentId: row.id } });
     },
     handleTab(i) {
       this.tabIndex = i;
+      this.multipleSelection = []
       this.refreshTable()
     },
     // 鏌ョ湅妫�楠屾暟鎹�
@@ -1183,16 +1276,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

--
Gitblit v1.9.3