From fe95d034e69c59d3e1a003615a65a0fb945ba55f Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 25 四月 2024 17:07:57 +0800
Subject: [PATCH] 获取供应商对应产品的列表接口修改和联调+获取产品相关供应商的接口修改和联调

---
 src/views/purchaseManage/purchase/components/TestingAll.vue |   77 ++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/src/views/purchaseManage/purchase/components/TestingAll.vue b/src/views/purchaseManage/purchase/components/TestingAll.vue
index 07208f3..e4a1b47 100644
--- a/src/views/purchaseManage/purchase/components/TestingAll.vue
+++ b/src/views/purchaseManage/purchase/components/TestingAll.vue
@@ -2,22 +2,20 @@
   <div class="add-quotation">
     <el-dialog :visible.sync="editConfig.visible" width="70%" append-to-body custom-class="iframe-dialog">
       <el-header>
-        <el-button type="primary" v-if="this.editConfig.title != '鏌ョ湅'" size="small"
-          @click="saveClick()">鎵归噺鍚堟牸鍏ュ簱</el-button>
-        <el-button type="primary" v-if="this.editConfig.title != '鏌ョ湅'" size="small"
-          @click="saveNoClick()">鎵归噺涓嶅悎鏍�</el-button>
+        <el-button type="primary" :disabled="isDisabled" size="small" @click="saveClick()">鎵归噺鍚堟牸鍏ュ簱</el-button>
+        <el-button type="primary" :disabled="isDisabled" size="small" @click="saveNoClick()">鎵归噺涓嶅悎鏍�</el-button>
       </el-header>
       <el-form ref="form" :model="editConfig.infomation" label-position="right" label-width="130px" size="mini"
         style="height: 60vh; overflow-x: hidden">
         <div class="basic-info">
           <div class="product-view">
-            <CommonFormTableView :isBoder="true" :selectBox="true" :detailEnter="true" :recalculateShow="false"
-              :addTypeIdMultiple="true" :product-table-list="productTableList" sign="purchase" @rowClick="rowClick"
-              @getSelectArray="getSelectArray" @toFiltering="toFiltering">
+            <CommonFormTableView :isBoder="true" name="rework" :selectBox="true" :detailEnter="true"
+              :recalculateShow="false" :addTypeIdMultiple="true" :product-table-list="productTableList" sign="purchase"
+              @rowClick="rowClick" @getSelectArray="getSelectArray" @toFiltering="toFiltering">
 
               <template slot="tableButton">
                 <el-table-column label="鎿嶄綔" width="120" align="center">
-                  <template slot-scope="scope">
+                  <template slot-scope="scope" v-if="scope.row.status == 1">
                     <el-button type="text" size="small" @click="saveClick(scope.row)"
                       style="margin-right: 5px">鍚堟牸</el-button>
                     <el-button type="text" size="small" @click="saveNoClick(scope.row)"
@@ -42,6 +40,7 @@
   savePurchaseQualityInspectionInfo
 } from "@/api/purchaseManage/purchase"
 import CommonFormTableView from "@/components/makepager/CommonFormTableView"
+import { getDataByType } from "@/api/data"
 export default {
   name: "ArrivalConfirmation",
   components: { CommonFormTableView },
@@ -96,7 +95,9 @@
       ],
       thatStatus: [],
       thatTimes: [],
-      selectList: []
+      selectList: [],
+      qualityStatusList: getDataByType("qualityStatus"),
+      isDisabled: false,
     }
   },
   created() {
@@ -129,14 +130,14 @@
 
       } else {
         this.savePurchaseQualityInspectionInfo({
-          purchaseId:  Number(this.editConfig.infomation.id),
+          purchaseId: Number(this.editConfig.infomation.id),
           ids: this.selectList,
           status: 2,
         })
       }
     },
     // 涓嶅悎鏍�
-    saveNoClick(row){
+    saveNoClick(row) {
       if (row) {
         this.savePurchaseQualityInspectionInfo({
           purchaseId: Number(this.editConfig.infomation.id),
@@ -146,25 +147,34 @@
 
       } else {
         this.savePurchaseQualityInspectionInfo({
-          purchaseId:  Number(this.editConfig.infomation.id),
+          purchaseId: Number(this.editConfig.infomation.id),
           ids: this.selectList,
           status: 3,
         })
       }
     },
     async savePurchaseQualityInspectionInfo(params) {
-      await savePurchaseQualityInspectionInfo(params).then((res) => {
-        if (res.code === 200) {
-          this.editConfig.visible = false
-          if(params.status===2){
-            this.$message.success("璐ㄦ鍚堟牸!")
-          }else if(params.status===3){
-            this.$message.success("宸茶缃负涓嶅悎鏍�!")
+      if (params.ids.length > 0) {
+        await savePurchaseQualityInspectionInfo(params).then((res) => {
+          if (res) {
+            if (res.code === 200) {
+              this.editConfig.visible = false
+              if (params.status === 2) {
+                this.$message.success("璐ㄦ鍚堟牸!")
+              } else if (params.status === 3) {
+                this.$message.success("宸茶缃负涓嶅悎鏍�!")
 
+              }
+              this.$parent.getData()
+            }
           }
-          this.$parent.getData()
-        }
-      })
+        })
+      }else{
+        this.$message({
+          message: "鑷冲皯閫夋嫨涓�鏉★紒",
+          type: "warning",
+        });
+      }
     },
     handleClose() {
       this.editConfig.visible = false
@@ -174,6 +184,7 @@
         tableProductList: [],
         tableData: this.tableData,
         disabled: this.editConfig.isDisabled,
+        key: 'id',
         isReturn: true,
         tableColumn: [
           {
@@ -189,10 +200,13 @@
           { label: "鏁伴噺", prop: "amount" },
           { label: "鍗曚綅", prop: "unit" },
           {
-            label: "鐘舵��", prop: "status",
+            label: "鐘舵��",
+            prop: "status",
             isFilter: true,
             isFilterList: this.statusList,
             selectedListDefault: this.getSelectedOperateStatus([], this.statusList),
+            isCallMethod: true,
+            getCallMethod: this.getpurchaseStatus
           },
         ]
       }
@@ -215,8 +229,12 @@
     async getPurchaseQualityInspectionInfo(params) {
       await getPurchaseQualityInspectionInfo(params).then((res) => {
         this.timeList = []
+        this.isDisabled = true // 鍒ゆ柇鏈夋病鏈夊緟璐ㄦ鐨�
         res.data.map((item) => {
           this.timeList.push({ id: item.createTime, name: item.createTime })
+          if (item.status === 1) {
+            this.isDisabled = false
+          }
         })
         this.setTableForm()
         this.productTableList.tableData = res.data
@@ -265,7 +283,18 @@
     falseClick(row) {
       console.log(row, "row")
 
-    }
+    },
+    getpurchaseStatus(val) {
+      if (val) {
+        for (let i in this.qualityStatusList) {
+          if (this.qualityStatusList[i].id == val) {
+            return this.qualityStatusList[i].name
+          }
+        }
+      } else {
+        return "--"
+      }
+    },
   }
 }
 </script>

--
Gitblit v1.8.0