From 446909448e77be9c61c072aa52178a50b8e8a292 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期五, 22 十二月 2023 17:49:55 +0800
Subject: [PATCH] 报价单和销售明细单的产品信息新增为可以多选的功能

---
 src/components/makepager/TableCommonView.vue           |    2 
 src/views/sales/quotation/AddQuotationDialog.vue       |   43 +++++++++-----
 src/components/makepager/CommonFormTableView.vue       |   19 ++++++
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue |   43 +++++++++-----
 src/views/other/commonDialog/SelectCommonDialog.vue    |   24 +++++++-
 5 files changed, 96 insertions(+), 35 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 1b9765c..4476b95 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -201,6 +201,7 @@
       :edit-common-config="editSelCommonConfig"
       :quotationNumber="quotationNumber"
       @selClient="selClient"
+      @getSelectArray="getSelectArray"
     />
   </div>
 </template>
@@ -224,6 +225,11 @@
     pageName:{
       type:String,
       default:''
+    },
+    // 鍒楄〃鏂板鏄惁澶氶��
+    addTypeIdMultiple:{
+      type:Boolean,
+      default:false,
     },
     // 鏍规嵁鎶ヤ环鍗曟煡璇骇鍝�
     quotationNumber:{
@@ -268,6 +274,7 @@
       tableList: [],
       editSelCommonConfig: {
         editVisible: false,
+        isSelectBox:false,
         title: "",
         infomation: {}
       },
@@ -399,7 +406,13 @@
     },
     // 鏂板
     add() {
-      this.$emit("addProductClick")
+      if(this.addTypeIdMultiple){
+        this.editSelCommonConfig.title = "浜у搧鍚嶇О"
+        this.editSelCommonConfig.isSelectBox=true;
+        this.editSelCommonConfig.editVisible = true
+      }else{
+        this.$emit("addProductClick")
+      }
     },
     commonInputChange(val, prop, row,scope) {
       if (prop === "amount") {
@@ -487,6 +500,7 @@
       console.log(row, prop)
       this.productIndex = row.productId - 1
       this.editSelCommonConfig.title = "浜у搧鍚嶇О"
+      this.editSelCommonConfig.isSelectBox=false;
       this.editSelCommonConfig.editVisible = true
     },
     selClient(item) {
@@ -505,6 +519,9 @@
         }
       })
     },
+    getSelectArray(val){
+      this.$emit("getSelectArray",val)
+    },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
     clearupClient(row) {
       this.productIndex = row.productId - 1
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 11e0d00..9cf911e 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -18,8 +18,8 @@
       @row-click="tableRowClick"
       :row-class-name="tableRowClassName"
     >
-      <el-table-column v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"></el-table-column>
       <el-table-column v-if="selectBox" type="selection" width="40"> </el-table-column>
+      <el-table-column v-if="tableList.selectIndex" type="index" label="搴忓彿" width="50"></el-table-column>
       <el-table-column
         v-for="(item, i) in tableList.tableColumn"
         :key="i"
diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue
index aad1584..4da1e9c 100644
--- a/src/views/other/commonDialog/SelectCommonDialog.vue
+++ b/src/views/other/commonDialog/SelectCommonDialog.vue
@@ -31,9 +31,10 @@
         <TableCommonView
           ref="tableListRef"
           :table-list="tableList"
-          :select-box="false"
+          :select-box="editCommonConfig.isSelectBox"
           @selCommonClick="selNameClick"
           @selTableCol="selTableCol"
+          @getSelectArray="getSelectArray"
         >
         </TableCommonView>
         <div slot="footer" class="dialog-footer">
@@ -42,6 +43,10 @@
             <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
           </div>
         </div>
+      </div>
+      <div slot="footer" class="dialog-footer" v-if="editCommonConfig.isSelectBox">
+        <el-button type="primary" size="small" @click="saveClick()">纭畾</el-button>
+        <el-button size="small" @click="editConfig.editVisible = false">鍙栨秷</el-button>
       </div>
     </el-dialog>
   </div>
@@ -66,6 +71,7 @@
       default: () => {
         return {
           editVisible: false,
+          isSelectBox:false,
           title: "",
           clientId: 0,
           client_name: "",
@@ -97,7 +103,8 @@
       keyword: "",
       keywordType: "",
       tableColumn: [],
-      showCol: []
+      showCol: [],
+      selectArray:[],
     }
   },
   created() {
@@ -195,7 +202,7 @@
         this.searchSel = { value: "serviceNumber", label: "鏈嶅姟鍗曠紪鍙�" }
       } else if (this.editConfig.title === "浜у搧鍚嶇О") {
         this.tableColumn = [
-          { label: "浜у搧鍚嶇О", prop: "name", isClick: true, default: true }, // 浜у搧鍚嶇О
+          { label: "浜у搧鍚嶇О", prop: "name", isClick: this.editCommonConfig.isSelectBox?false:true, default: true }, // 浜у搧鍚嶇О
           { label: "浜у搧缂栧彿", prop: "number" }
         ]
         this.showCol = ["浜у搧鍚嶇О", "浜у搧缂栧彿"]
@@ -257,6 +264,14 @@
     selTableCol(val) {
       this.showcol = val
       this.tableList.tableColumn = this.setColumnVisible(val)
+    },
+    // 鍒楄〃澶氶��
+    getSelectArray(val){
+      this.selectArray=val;
+    },
+    saveClick(){
+      this.$emit('getSelectArray',this.selectArray)
+      this.editConfig.editVisible = false
     },
     // 璇锋眰鏁版嵁
     async getData() {
@@ -491,6 +506,9 @@
       this.editConfig.editVisible = false
     },
     selNameClick(row) {
+      if(this.editCommonConfig.isSelectBox){
+        return true;
+      }
       this.editConfig.editVisible = false
       if (this.editConfig.title === "閿�鍞�诲崟") {
         this.$emit("selClient", row, "master")
diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue
index f347bca..f51a995 100644
--- a/src/views/sales/quotation/AddQuotationDialog.vue
+++ b/src/views/sales/quotation/AddQuotationDialog.vue
@@ -250,9 +250,11 @@
             <CommonFormTableView
               :show-summary="showSummary"
               pageName="quotation"
+              :addTypeIdMultiple="false"
               :product-table-list="productTableList"
               @inputContent="inputContent"
               @addProductClick="addProductClick"
+              @getSelectArray="getSelectArray"
               @emptyProductClick="emptyProductClick"
               @recalculateProductClick="recalculateProductClick"
               @clearupProduct="clearupProduct"
@@ -664,21 +666,32 @@
     },
     // 浜у搧鏂板
     addProductClick() {
-      this.productId++
-      this.tableData.push({
-        productId: this.productId,
-        id: 0,
-        amount: 0,
-        desc: "",
-        name: "",
-        number: "",
-        price: 0,
-        cost:'',
-        profit:'',
-        margin:'',
-        total: 0,
-        unit: ""
-      })
+      // this.productId++
+      // this.tableData.push({
+      //   productId: this.productId,
+      //   id: 0,
+      //   amount: 0,
+      //   desc: "",
+      //   name: "",
+      //   number: "",
+      //   price: 0,
+      //   cost:'',
+      //   profit:'',
+      //   margin:'',
+      //   total: 0,
+      //   unit: ""
+      // })
+      // this.showSummary.show = true
+    },
+    // 鏂板鏂瑰紡淇敼
+    getSelectArray(val){
+      if(val.length>0){
+        val.map((item, index) => {
+          item.productId = this.tableData.length + index+1
+        })
+      }
+      this.tableData=this.tableData.concat(val);
+      this.productTableList.tableData=this.tableData
       this.showSummary.show = true
     },
     //  浜у搧娓呯┖
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index a6efeb0..626a2b9 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -407,6 +407,7 @@
               ref="commonFormTableView"
               :detail-enter="isView?true:false"
               :selectBox="false"
+              :addTypeIdMultiple="false"
               :show-summary="showSummary"
               pageName="quotation"
               :isOperate="((autoCodeHeadersObj.Bjd=='yes'&&editConfig.infomation.quotation_number)||autoCodeHeadersObj.Bjd!='yes')?true:false"
@@ -414,6 +415,7 @@
               :product-table-list="productTableList"
               @inputContent="inputContent"
               @addProductClick="addProductClick"
+              @getSelectArray="getSelectArray"
               @emptyProductClick="emptyProductClick"
               @clearupProduct="clearupProduct"
             ></CommonFormTableView>
@@ -995,21 +997,32 @@
     },
     // 浜у搧鏂板
     addProductClick() {
-      this.productId++
-      this.tableData.push({
-        productId: this.productId,
-        id: 0,
-        amount: 0,
-        desc: "",
-        name: "",
-        number: "",
-        price: 0,
-        cost:'',
-        profit:'',
-        margin:'',
-        total: 0,
-        unit: ""
-      })
+      // this.productId++
+      // this.tableData.push({
+      //   productId: this.productId,
+      //   id: 0,
+      //   amount: 0,
+      //   desc: "",
+      //   name: "",
+      //   number: "",
+      //   price: 0,
+      //   cost:'',
+      //   profit:'',
+      //   margin:'',
+      //   total: 0,
+      //   unit: ""
+      // })
+      // this.showSummary.show = true
+    },
+    // 鏂板鏂瑰紡淇敼
+    getSelectArray(val){
+      if(val.length>0){
+        val.map((item, index) => {
+          item.productId = this.tableData.length + index+1
+        })
+      }
+      this.tableData=this.tableData.concat(val);
+      this.productTableList.tableData=this.tableData
       this.showSummary.show = true
     },
     //  浜у搧娓呯┖

--
Gitblit v1.8.0