From b0d4df5f39525ae7fe252e8ee65d85fd71dca721 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 07 五月 2026 14:53:32 +0800
Subject: [PATCH] 手动下单:检验中订单撤销报错问题修复

---
 src/views/business/unpass/index-manage.vue |  478 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 424 insertions(+), 54 deletions(-)

diff --git a/src/views/business/unpass/index-manage.vue b/src/views/business/unpass/index-manage.vue
index fc5ac30..1ed6b55 100644
--- a/src/views/business/unpass/index-manage.vue
+++ b/src/views/business/unpass/index-manage.vue
@@ -3,6 +3,12 @@
     <div class="search">
       <div>
         <el-form :model="entity" ref="entity" size="small" :inline="true">
+          <el-form-item label="IFS鍩�" prop="contract">
+            <el-select @keyup.enter.native="refreshTable" v-model="entity.contract" clearable placeholder="璇烽�夋嫨" size="small">
+              <el-option label="ZTNS" value="ZTNS"/>
+              <el-option label="KJNS" value="KJNS"/>
+            </el-select>
+          </el-form-item>
           <el-form-item label="鎵瑰彿" prop="updateBatchNo">
             <el-input v-model="entity.updateBatchNo" clearable placeholder="璇疯緭鍏�" size="small"
                       @keyup.enter.native="refreshTable()">
@@ -12,24 +18,56 @@
             <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.no"
                       @keyup.enter.native="refreshTable()"></el-input>
           </el-form-item>
-          <el-form-item label="瑙勬牸鍨嬪彿" prop="model">
-            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.model"
+          <el-form-item label="瑙勬牸鍨嬪彿" prop="specsModels">
+            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.specsModels"
                       @keyup.enter.native="refreshTable()"></el-input>
           </el-form-item>
           <el-form-item label="鏍峰搧鍚嶇О" prop="sample">
             <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.sample"
                       @keyup.enter.native="refreshTable()"></el-input>
           </el-form-item>
+          <el-form-item label="鐗╂枡灞炴��" prop="materialProp">
+            <el-select clearable size="small" v-model="entity.materialProp" style="width: 100%" @change="refreshTable()">
+              <el-option v-for="dict in dict.type.material_prop_type" :key="dict.value" :label="dict.label"
+                         :value="dict.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="OA瀹℃牳鐘舵��" prop="operation">
+            <el-select clearable size="small" v-model="entity.operation" style="width: 100%" @change="refreshTable()">
+              <el-option v-for="dict in dict.type.oa_workflow_state" :key="dict.value" :label="dict.label"
+                         :value="dict.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="鍙嶉鏃ユ湡" prop="feedbackDateTime">
+            <el-date-picker
+              type="daterange"
+              size="small"
+              start-placeholder="寮�濮嬫棩鏈�"
+              end-placeholder="缁撴潫鏃ユ湡"
+              clearable
+              value-format="yyyy-MM-dd"
+              v-model="entity.feedbackDateTime"
+              @keyup.enter.native="refreshTable()">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="渚涘簲鍟嗗悕绉�" prop="supplierName">
+            <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.supplierName"
+                      @keyup.enter.native="refreshTable()"></el-input>
+          </el-form-item>
           <el-form-item>
             <el-button type="primary" size="mini" @click="refreshTable">鏌ヨ</el-button>
             <el-button size="mini" @click="refresh">閲嶇疆</el-button>
+            <el-button :loading="exportLoading" type="success" size="mini" @click="exportUnqualifiedHandler">瀵煎嚭</el-button>
+            <el-button type="primary" size="mini" @click="openInsOrderDialog">鏂板涓嶅悎鏍煎鐞�</el-button>
           </el-form-item>
         </el-form>
       </div>
     </div>
     <div>
       <lims-table :tableData="tableData" :column="column"
-                  :height="'calc(100vh - 250px)'" @pagination="pagination"
+                  :more="true" @pagination="pagination"
                   :page="page" :tableLoading="tableLoading"></lims-table>
     </div>
     <el-dialog
@@ -58,6 +96,38 @@
         <el-button type="primary" @click="cancelOA" :loading="cancelOALoading">纭� 瀹�</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="閫夋嫨涓嶅悎鏍艰鍗�"
+      :show-close="false"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+      :visible.sync="insOrderVisible"
+      width="50%">
+      <el-row :gutter="20" style="margin-bottom:10px">
+        <el-col :span="12">
+          <el-input clearable size="small" v-model="lotBatchNo" placeholder="璇疯緭鍏ユ壒娆″彿"></el-input>
+        </el-col>
+        <el-col :span="12">
+          <el-button size="small" type="primary" @click="searchInsOrderList">鎼滅储</el-button>
+        </el-col>
+      </el-row>
+      <lims-table ref="insOrderTable"
+                  :tableData="insOrderDataList"
+                  :column="insOrderTableDataColumn"
+                  :isSelection="true"
+                  :selectionSelectable="insOrderSelectable"
+                  :handleSelectionChange="selectMethod"
+                  :rowClassName="insOrderRowClassName"
+                  @pagination="insOrderPageination"
+                  :height="500"
+                  :page="insOrderPage"
+                  :tableLoading="insOrderTableLoading">
+      </lims-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="resetInsOrderForm">鍙� 娑�</el-button>
+        <el-button type="primary" @click="openAddUnqualifiedHandlerView">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
     <UnPassDialog ref="unPassDialog" v-if="unPassDialog"
                   :orderId="orderId"
                   @resetForm="resetForm1"
@@ -70,56 +140,211 @@
 </template>
 
 <script>
+import {getIfsByAll} from "@/api/business/rawMaterialOrder";
 import UnPassDialog from "./components/unPassDialog.vue";
 import OAProcess from "./components/OAProcess.vue";
 import limsTable from "@/components/Table/lims-table.vue";
-import {deleteUnqualifiedHandler, page, pushOA} from "@/api/business/unqualifiedHandler";
-
+import {deleteUnqualifiedHandler, page, pushOA,exportUnqualifiedHandler} from "@/api/business/unqualifiedHandler";
+import {transformExcel} from '@/utils/file'
 export default {
   components: {
     limsTable,
     OAProcess,
     UnPassDialog,
   },
+  dicts: ['material_prop_type','oa_workflow_state'],
   data() {
     return {
+      lotBatchNo:null,
+      insOrderVisible:false,
+      insOrderTableLoading:false,
+      insOrderDataList:[],
+      insOrderTableDataColumn:[
+        {
+          label: 'IFS鍩�',
+          prop: 'contract',
+          width: '120px',
+          dataType: 'tag',
+          formatData: (params) => {
+            return params
+          },
+          formatType: (params) => {
+            if (params === 'ZTNS') {
+              return ''
+            } else if (params === 'KJNS') {
+              return 'success'
+            }else {
+              return null
+            }
+          }
+
+        },
+        { label: '濮旀墭缂栧彿', prop: 'entrustCode', width: "160px", },
+        {
+          dataType: 'tag',
+          label: '妫�楠岀姸鎬�',
+          prop: 'inspectStatus',
+          formatData: (params) => {
+            if (params == 0) {
+              return '妫�楠屼腑'
+            } else if (params == 1) {
+              return '鍚堟牸'
+            } else if (params == 2) {
+              return '涓嶅悎鏍�'
+            } else if (params == 3) {
+              return '鏈笅鍗�'
+            } else if (params == 4) {
+              return '璁╂鏀捐'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 0) {
+              return 'warning'
+            } else if (params == 1) {
+              return 'success'
+            } else if (params == 2) {
+              return 'danger'
+            } else if (params == 3) {
+              return 'info'
+            } else if (params == 4) {
+              return ''
+            } else {
+              return null
+            }
+          }
+        },
+        { label: '璁㈠崟鍙�', prop: 'orderNo' },
+        { label: '鎶佃揪鐨勯噰璐暟閲�', prop: 'purQtyInStore' ,width:'160' },
+        { label: '涓嬪彂鏃堕棿', prop: 'sendTime',width:'160' },
+        { label: '鎵瑰彿', prop: 'updateBatchNo',width:'160' },
+        { label: '闆朵欢鍙�', prop: 'partNo',width:'140' },
+        { label: '闆朵欢鎻忚堪', prop: 'partDesc' },
+        { label: '渚涘簲鍟嗗悕绉�', prop: 'supplierName' },
+        { label: '涓嶅悎鏍兼弿杩�', prop: 'unqualifiedDesc',width:'160' },
+        {
+          dataType: 'tag',
+          label: '鍏嶆',
+          prop: 'isExemption',
+          formatData: (params) => {
+            if (params == 1) {
+              return '鍏嶆'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 1) {
+              return 'success'
+            } else {
+              return null
+            }
+          }
+        },
+        {
+          label: '鏍峰搧鍚嶇О',
+          prop: 'sampleName',
+          width: "160px"
+        },
+        { label: '鏍峰搧鍨嬪彿', prop: 'sampleModel' },
+        { label: '妫�楠屼汉', prop: 'userName' },
+        {
+          label: '鐗╂枡灞炴��',
+          prop: 'materialProp',
+          formatData: (params) => {
+            if (!params) return null
+
+            for (let i = 0; i < this.dict.type.material_prop_type.length; i++) {
+              const item = this.dict.type.material_prop_type[i]
+              if (item.value == params) {
+                return item.label
+              }
+            }
+            return null
+          }
+        },
+        {
+          dataType: 'tag',
+          label: '鐗╂枡绫诲瀷',
+          prop: 'isExpire',
+          formatData: (params) => {
+            if (params == 1) {
+              return '杩囨湡鐗╂枡'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 1) {
+              return 'info'
+            } else {
+              return null
+            }
+          }
+        },
+        { label: '鍗曚綅', prop: 'buyUnitMeas' },
+        { label: '鎺ユ敹鏃堕棿', prop: 'receiverDate',width:'160' },
+        { label: '鎶ユ鏃堕棿', prop: 'declareDate',width:'160' },
+      ],
+      insOrderPage:{
+        total: 0,
+        size: 20,
+        current: 1
+      },
       handlerId: null,
+      contract:null,
       entity: {
+        contract: null,
         sample: null,
-        model: null,
+        specsModels: null,
+        supplierName: null,
+        feedbackDateTime:[],
+        materialProp: null,
+        operation:null
       },
       tableData: [],
       tableLoading: false,
       column: [
+        {
+          label: 'IFS鍩�',
+          prop: 'contract',
+          width: '80px',
+          dataType: 'tag',
+          formatData: (params) => {
+            return params
+          },
+          formatType: (params) => {
+            if (params === 'ZTNS') {
+              return ''
+            } else if (params === 'KJNS') {
+              return 'success'
+            }else {
+              return null
+            }
+          }
+
+        },
         { label: '缂栧彿', prop: 'no', width: "160px", },
-        // {
-        //   label: "OA瀹℃牳鐘舵��",
-        //   prop: "oaState",
-        //   width: "100px",
-        //   dataType: "tag",
-        //   formatData: (params) => {
-        //     if (params == 1) {
-        //       return "寰呭鏍�";
-        //     } else if(params == 2) {
-        //       return "瀹℃牳涓�";
-        //     }  else if(params == 3) {
-        //       return "閫氳繃";
-        //     } else {
-        //       return "椹冲洖";
-        //     }
-        //   },
-        //   formatType: (params) => {
-        //     if (params == 1) {
-        //       return "warning";
-        //     } else if(params == 2) {
-        //       return "info";
-        //     }  else if(params == 3) {
-        //       return "success";
-        //     } else {
-        //       return "danger";
-        //     }
-        //   },
-        // },
+        {
+          label: "OA瀹℃牳鐘舵��",
+          prop: "operation",
+          width: "100px",
+          dataType: "tag",
+          formatData: (params) => {
+            return params
+          },
+          formatType: (params) => {
+            if(params){
+              this.dict.type.oa_workflow_state.forEach(item => {
+                if(item.value === params){
+                  params = item.raw.listClass
+                }
+              });
+            }
+            return params
+          },
+        },
         { label: '璁㈠崟鍙�', prop: 'orderNo' },
         {
           label: "闆朵欢鍙�",
@@ -128,16 +353,31 @@
           dataType: "link",
           linkMethod: "openUnPassDialog",
         },
-        { label: '闆朵欢鎻忚堪', prop: 'partDesc' },
-        { label: '鐗╂枡鍚嶇О', prop: 'materialName' },
-        { label: '鐢熶骇鎵规', prop: 'productionBatch' },
+        { label: '闆朵欢鎻忚堪', prop: 'partDesc',width: "160px" },
+        {
+          label: '鐗╂枡灞炴��',
+          prop: 'materialProp',
+          formatData: (params) => {
+            if (!params) return null
+
+            for (let i = 0; i < this.dict.type.material_prop_type.length; i++) {
+              const item = this.dict.type.material_prop_type[i]
+              if (item.value == params) {
+                return item.label
+              }
+            }
+            return null
+          }
+        },
+        { label: '鐗╂枡鍚嶇О', prop: 'materialName',width: "160px" },
+        { label: '鐢熶骇鎵规', prop: 'productionBatch',width: "160px" },
         { label: '鍒拌揣鏁伴噺', prop: 'cargoQuantity' },
         { label: '瑙勬牸鍨嬪彿', prop: 'specsModels' },
         { label: '鎶ユ鏃ユ湡', prop: 'inspectTime' },
         { label: '鐘舵��', prop: 'statusDB' },
         { label: '鍙嶉浜�', prop: 'feedbackUser' },
-        { label: '瑕佹楠岀殑閲囪喘鏁伴噺', prop: 'qtyToInspect' },
-        { label: '鍙嶉鏃ユ湡', prop: 'feedbackTime' },
+        { label: '瑕佹楠岀殑閲囪喘鏁伴噺', prop: 'qtyToInspect',width: "140px" },
+        { label: '鍙嶉鏃ユ湡', prop: 'feedbackTime',width: "100px" },
         {
           label: "鍒嗙被",
           prop: "classification",
@@ -166,42 +406,44 @@
         {
           label: "涓嶅悎鏍煎綊灞�",
           prop: "offGradeAscription",
-          width: "100px",
+          width: "120px",
           dataType: "tag",
           formatData: (params) => {
             if (params == 0) {
-              return "鐢熶骇鍙嶉涓嶅悎鏍�";
-            } else if(params == 1) {
               return "妫�娴嬩笉鍚堟牸";
+            } else if(params == 1) {
+              return "鐢熶骇鍙嶉涓嶅悎鏍�";
             } else {
               return null
             }
           },
           formatType: (params) => {
             if (params == 0) {
-              return "warning";
+              return "danger";
             } else if(params == 1) {
-              return "info";
+              return "warning";
             } else {
               return "null";
             }
           },
         },
-        { label: '涓嶅悎鏍兼弿杩�', prop: 'unqualifiedDesc' },
+        { label: '涓嶅悎鏍兼弿杩�', prop: 'unqualifiedDesc',width: "160px" },
         {
           dataType: 'action',
           fixed: 'right',
           label: '鎿嶄綔',
-          width: '180px',
+          width: '220px',
           operation: [
             {
-              name: '鎻愪氦OA',
+              name: (row)=>{
+                return row.requestId !== null && row.operation==='閫�鍥�' ? '閲嶆柊鎻愪氦' : '鎻愪氦OA'
+              },
               type: 'text',
               clickFun: (row) => {
                 this.openOA(row);
               },
               disabled: (row, index) => {
-                return row.requestId !== null  // 鏈塺equestId璇存槑宸茬粡鎻愪氦杩嘜A锛屼笉鍙啀娆℃彁浜�
+                return row.requestId !== null && row.operation!=='閫�鍥�'  // 鏈塺equestId璇存槑宸茬粡鎻愪氦杩嘜A锛屼笉鍙啀娆℃彁浜�
               }
             },
             {
@@ -218,7 +460,7 @@
                 this.deleteOA(row);
               },
               disabled: (row, index) => {
-                return row.requestId !== null  // 鏈塺equestId璇存槑宸茬粡鎻愪氦杩嘜A锛屼笉鍙啀娆℃彁浜�
+                return row.requestId !== null && row.operation!=='閫�鍥�'  // 鏈塺equestId璇存槑宸茬粡鎻愪氦杩嘜A锛屼笉鍙啀娆℃彁浜�
               }
             },
           ]
@@ -226,7 +468,7 @@
       ],
       page: {
         total: 0,
-        size: 10,
+        size: 20,
         current: 1
       },
       statusList: [],
@@ -237,15 +479,124 @@
       submitOALoading: false, // OA娴佺▼寮规鎻愪氦鎸夐挳loading
       deleteVisible: false, // OA娴佺▼鍒犻櫎寮规
       cancelOALoading: false, // OA娴佺▼鍒犻櫎寮规鎻愪氦鎸夐挳loading
+      exportLoading:false
     };
   },
   mounted() {
     this.refreshTable()
   },
   methods: {
+    getInsOrderRowId(row) {
+      if (!row) {
+        return ''
+      }
+      const currentId = row.enterOrderId || row.insOrderId || row.orderId || row.id
+      return currentId ? String(currentId) : ''
+    },
+    getExistingInsOrderIds() {
+      const ids = new Set()
+      this.tableData.forEach(row => {
+        ['insOrderId'].forEach(key => {
+          if (row[key] !== undefined && row[key] !== null && row[key] !== '') {
+            ids.add(String(row[key]))
+          }
+        })
+      })
+      return ids
+    },
+    isDisabledInsOrderRow(row) {
+      const currentId = this.getInsOrderRowId(row)
+      if (!currentId) {
+        return false
+      }
+      return this.getExistingInsOrderIds().has(currentId)
+    },
+    insOrderSelectable(row) {
+      return !this.isDisabledInsOrderRow(row)
+    },
+    insOrderRowClassName({ row }) {
+      return this.isDisabledInsOrderRow(row) ? 'disabled-selection-row' : ''
+    },
+    resetInsOrderForm(){
+      this.insOrderDataList = []
+      this.lotBatchNo = null
+      this.orderId = ''
+      this.$nextTick(()=>{
+        this.insOrderVisible = false
+      })
+    },
+    openInsOrderDialog(){
+      this.insOrderVisible = true
+    },
+    searchInsOrderList(){
+      this.insOrderTableLoading = true
+      const params = {
+        updateBatchNo: this.lotBatchNo,
+        isInspect: 1,
+        ...this.insOrderPage
+      }
+      getIfsByAll(params).then(res => {
+        this.insOrderTableLoading = false
+        if (res.code === 200) {
+          this.insOrderDataList = res.data.records
+          this.insOrderPage.total = res.data.total
+        }
+      }).catch(err => {
+        this.insOrderTableLoading = false
+      })
+    },
+    insOrderPageination(page){
+      this.insOrderPage.size = page.limit
+      this.searchInsOrderList()
+    },
+    selectMethod(val){
+      if (!val || val.length === 0) {
+        this.orderId = ''
+        return
+      }
+
+      const currentRow = val[val.length - 1]
+      this.orderId = this.getInsOrderRowId(currentRow)
+
+      if (val.length > 1 && this.$refs.insOrderTable && this.$refs.insOrderTable.$refs.multipleTable) {
+        this.$refs.insOrderTable.$refs.multipleTable.clearSelection()
+        this.$refs.insOrderTable.$refs.multipleTable.toggleRowSelection(currentRow, true)
+      }
+    },
+    //鎵撳紑鏂板涓嶅悎鏍煎鐞嗗脊妗�
+    openAddUnqualifiedHandlerView(){
+      if(!this.orderId){
+        this.$message.warning("璇烽�夋嫨涓�鏉¤鍗曡褰�")
+        return;
+      }
+      this.insOrderVisible = false
+      this.unPassDialog = true;
+      this.$nextTick(() => {
+        this.$refs.unPassDialog.getInsOrder('add');
+      });
+    },
+    exportUnqualifiedHandler(){
+      this.exportLoading = true
+      const newEntity = { ...this.entity }
+      if (newEntity.feedbackDateTime && newEntity.feedbackDateTime.length > 0) {
+        newEntity.feedbackStartTime = newEntity.feedbackDateTime[0]
+        newEntity.feedbackEndTime = newEntity.feedbackDateTime[1]
+      }
+      exportUnqualifiedHandler({...newEntity}).then(res=>{
+        transformExcel(res,'涓嶅悎鏍煎鐞嗚褰�.xlsx')
+        this.exportLoading = false
+      }).catch(error=>{
+        console.error(error)
+      })
+    },
     refreshTable() {
       this.tableLoading = true
-      page({ ...this.page, ...this.entity }).then(res => {
+      const newEntity = { ...this.entity }
+      if (newEntity.feedbackDateTime && newEntity.feedbackDateTime.length > 0) {
+        newEntity.feedbackStartTime = newEntity.feedbackDateTime[0]
+        newEntity.feedbackEndTime = newEntity.feedbackDateTime[1]
+      }
+      page({ ...this.page, ...newEntity }).then(res => {
         this.tableLoading = false
         this.tableData = res.data.records
         this.page.total = res.data.total
@@ -274,6 +625,9 @@
     resetForm1 () {
       this.$refs.unPassDialog.$refs['unPassForm'].resetFields();
       this.unPassDialog = false
+      this.$nextTick(()=>{
+        this.refreshTable('page')
+      })
     },
     // 鎵撳紑鍒犻櫎OA纭寮规
     deleteOA (row) {
@@ -298,13 +652,22 @@
     // 鏌ョ湅鎻愪氦OA鐨勬暟鎹�
     openOA (row) {
       this.handlerId = row.handlerId
-      this.dialogVisible = true
+      this.contract = row.contract
+      if(row && row.requestId !== null  ){
+        // 閲嶆柊鎻愪氦OA,鎵撳紑缂栬緫寮规
+        this.unPassDialog = true
+        this.$nextTick(() => {
+          this.$refs.unPassDialog.getInsOrder('resubmit', row)
+        })
+      }else{
+        this.dialogVisible = true
+      }
     },
     // 鏌ョ湅OA娴佺▼
     OAView (row) {
       this.OAProcess = true
       this.$nextTick(() => {
-        this.$refs.OAProcess.getInfo(row.handlerId)
+        this.$refs.OAProcess.getInfo(row.handlerId,row?row.unqualifiedDesc:"")
       })
     },
     // 鍏抽棴鏌ョ湅OA娴佺▼鐨勫脊妗�
@@ -315,7 +678,7 @@
     submitOA(row) {
       // 鎻愪氦OA
       this.submitOALoading = true
-      pushOA({handlerId: this.handlerId,}).then(res => {
+      pushOA({handlerId: this.handlerId,contract:this.contract}).then(res => {
         this.submitOALoading = false
         if (res.code === 200) {
           this.dialogVisible = false
@@ -330,3 +693,10 @@
   }
 };
 </script>
+
+<style scoped>
+.capacity-scope >>> .disabled-selection-row td {
+  background-color: #f5f7fa !important;
+  color: #c0c4cc;
+}
+</style>

--
Gitblit v1.9.3