From f9512a0896752ef3e4c17a05c871f315041be111 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 27 十一月 2023 11:24:37 +0800
Subject: [PATCH] 采购订单按钮显隐

---
 src/views/purchaseManage/purchase/components/AddPurchase.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 97e8b19..3d78de0 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -125,6 +125,8 @@
                     :disabled="editConfig.isDisabled"
                     v-model="editConfig.infomation.phone"
                     placeholder="璇峰~鍐�"
+                    maxlength="11"
+                    show-word-limit
                     clearable
                   ></el-input>
                 </el-form-item>
@@ -175,6 +177,7 @@
           <div class="basic-info-title" style="display: flex">浜у搧淇℃伅</div>
           <div class="product-view">
             <CommonFormTableView
+              :detailEnter=editCommonConfig.detailEnter
               :show-summary="showSummary"
               :recalculateShow="false"
               :product-table-list="productTableList"
@@ -184,6 +187,8 @@
               @addProductClick="addProductClick"
               @emptyProductClick="emptyProductClick"
               @clearupProduct="clearupProduct"
+              @rowClick="rowClick"
+              @handleProduct="handleProduct"
             />
           </div>
           <div class="table-bottom">
@@ -250,10 +255,10 @@
       </el-form>
       <div slot="footer" class="dialog-footer">
         <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> -->
-        <el-button type="primary" size="small" @click="saveClick('form')"
+        <el-button type="primary" v-if="this.editConfig.title != '鏌ョ湅'" size="small" @click="saveClick('form')"
           >淇濆瓨</el-button
         >
-        <el-button size="small" @click="editConfig.visible = false"
+        <el-button size="small" v-if="this.editConfig.title != '鏌ョ湅'" @click="editConfig.visible = false"
           >鍙栨秷</el-button
         >
       </div>
@@ -278,6 +283,7 @@
 <script>
 import CommonFormTableView from "@/components/makepager/CommonFormTableView";
 import BomDialog from "@/components/makepager/BomDialog";
+import { getProductList } from "@/api/productManage/product"
 
 import {
   addPurchase,
@@ -287,6 +293,7 @@
 } from "@/api/purchaseManage/purchase";
 
 import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog";
+// import { formToJSON } from "axios";
 export default {
   name: "QuotationDialog",
   components: { SelectSupplierDialog, CommonFormTableView,BomDialog },
@@ -295,6 +302,7 @@
       type: Object,
       default: () => {
         return {
+          detailEnter:true,
           visible: false,
           title: "鍒涘缓",
           infomation: {},
@@ -358,7 +366,8 @@
       },
       supplierId: this.editCommonConfig.infomation.supplierId,
       tableData: [],
-      productId: 1,
+      productIndex: 0,
+      productId:'',
       isNoProduct: true,
       clientList: [],
       plcBrandList:[],
@@ -367,6 +376,7 @@
       },
       total:0,
       totalTwo:0,
+      productListIdx:0
     };
   },
   created() {
@@ -571,6 +581,7 @@
     },
     // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
     querySearchAsync(queryString, cb, value) {
+      this.productTableList.tableProductList=[]
       var restaurants = [];
       if (value === "supplier") {
         restaurants = this.supplierList;
@@ -587,11 +598,22 @@
         );
       };
     },
-    handleSelectClient(value, item) {
+    async handleSelectClient(value, item) {
+      this.productTableList.supplierId=item.ID
       if (value === "client") {
         this.supplierId = item.id;
         this.editConfig.infomation.supplierId=item.ID
       }
+      await getProductList({
+        supplierId:item.ID,
+        page:1,
+        pageSize:100
+      }).then((res)=>{
+        if(res.code===200){
+          this.productTableList.tableProductList = res.data.list
+          console.log(this.productTableList.tableProductList,"pop")
+        }
+      })
     },
     selClientClick() {
       this.editSelectSupplierConfig.editVisible = true;
@@ -604,6 +626,7 @@
     },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
     clearupClient(value) {
+      this.emptyProductClick()
       if (value == "client") {
         this.$set(this.editConfig.infomation, "supplierName", "");
         this.supplierId = null;
@@ -618,6 +641,7 @@
         this.tableData = [
           {
             productId: this.productId,
+            productIndex:this.productIndex,
             id: 0,
             amount: 0,
             desc: "",
@@ -634,6 +658,8 @@
         // });
       }
       this.productTableList = {
+        tableProductList:[],
+        supplierId:undefined,
         tableData: this.tableData,
         disabled:this.editConfig.isDisabled,
         tableColumn: [
@@ -665,9 +691,11 @@
     },
     // 浜у搧鍒楄〃杈撳叆
     inputContent(val, prop, row) {
-      this.productId = row.productId;
+      // this.productId = row.productId;
+      this.productIndex=row.productIndex;
+      console.log(row,val,prop,"浜у搧ID",this.tableData)
       this.tableData.map((item) => {
-        if (item.productId === row.productId) {
+        if (item.productIndex === row.productIndex) {
           item[prop] = val;
         }
       });
@@ -699,9 +727,10 @@
     },
     // 浜у搧鏂板
     addProductClick() {
-      this.productId++;
+      this.productIndex++;
       this.tableData.push({
-        productId: this.productId,
+        productIndex: this.productIndex,
+        productId:'',
         id: 0,
         amount: 0,
         desc: "",
@@ -714,10 +743,11 @@
     },
     //  浜у搧娓呯┖
     emptyProductClick() {
-      this.productId = 1;
+      this.productIndex = 1;
       this.tableData = [
         {
-          productId: this.productId,
+          productId: '',
+          productIndex:this.productIndex,
           id: 0,
           amount: 0,
           desc: "",
@@ -733,6 +763,16 @@
       this.tableData = data;
       this.productTableList.tableData = this.tableData;
     },
+    //閫夋嫨琛�
+    rowClick(row){
+      console.log(row,"xuanze")
+      this.productListIdx=row.productIndex
+    },
+    //閫変腑浜у搧
+    handleProduct(item){
+      this.tableData[this.productListIdx].productId=item.ID
+      console.log(item,"閫変腑浜у搧",this.tableData)
+    }
   },
 };
 </script>

--
Gitblit v1.8.0