zhouhao 2 年之前
父节点
当前提交
51b6da4d04

+ 10 - 18
src/views/sales_control/sales_management/components/customer_sales_form.vue

@@ -146,15 +146,13 @@ export default {
     },
     confirm(selected) {
       console.log(selected)
-      // console.log(this.$refs.dia)
-      // return
       this.dataList = selected
       this.$refs.header.screenForm.customerName = this.dataList[0].customerName
       this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
       this.$refs.header.screenForm.stockType = this.dataList[0].stockType
       this.customerNumber = this.dataList[0].customerNumber
       this.dialogVisible = false
-
+      this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.$refs.tableView.clearSelection()
     },
     handleDel(item, index) {
       this.dataList.splice(index, 1)
@@ -168,23 +166,17 @@ export default {
       //   })
       // }
     },
+    //去掉相同数据
+    resArr(arr1, arr2) {
+      return arr1.filter(v => arr2.every(val => val.id != v.id))
+    },
     delChange() {
 
-      if (this.dataList.length) {
-        this.dataList.forEach((k, i) => {
-          this.selection.forEach((l, e) => {
-            if (k.id === l.id) {
-              this.dataList.splice(i, 1)
-              this.selection.splice(e, 1)
-            }
-          })
-        })
-        // if (this.dataList.length == 1) {
-        //   this.$nextTick(() => {
-        //     Object.assign(this.$refs.header.$data, this.$refs.header.$options.data())
-        //     this.customerNumber = ''
-        //   })
-        // }
+      if (this.dataList.length){
+        this.dataList =  this.resArr(this.dataList,this.selection)
+        if (!this.dataList.length){
+          this.customerNumber = ''
+        }
       }
 
     },

+ 12 - 15
src/views/sales_control/sales_management/components/return_sales_form.vue

@@ -35,7 +35,7 @@
         </el-popconfirm>
       </template>
     </sales-table>
-    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog ref="dia" :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
   </div>
 </template>
 
@@ -164,6 +164,7 @@ export default {
        // this.$refs.header.details.customerNumber = this.dataList[0].phone
        // this.$refs.header.details.customerNumber = this.dataList[0].stockType
       this.dialogVisible = false
+      this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.$refs.tableView.clearSelection()
 
     },
     handleDel(item, index) {
@@ -175,22 +176,18 @@ export default {
       //   })
       // }
     },
+    //去掉相同数据
+    resArr(arr1, arr2) {
+      return arr1.filter(v => arr2.every(val => val.id != v.id))
+    },
     delChange() {
-      this.dataList.forEach((k, i) => {
-        this.selection.forEach((l, e) => {
-          if (k.id === l.id) {
-            this.dataList.splice(i, 1)
-            this.selection.splice(e, 1)
-          }
-        })
-        // if (this.dataList.length ==1){
-        //   this.$nextTick(()=>{
-        //     this.details = {}
-        //     this.customerNumber = ''
-        //   })
-        // }
+      if (this.dataList.length){
+        this.dataList =  this.resArr(this.dataList,this.selection)
+        if (!this.dataList.length){
+          this.customerNumber = ''
+        }
+      }
 
-      })
     },
     handleSelection(data) {
       this.selection = data