Prechádzať zdrojové kódy

预托书多次勾选参照数据校验

jbb 2 rokov pred
rodič
commit
32f7a069e1

+ 4 - 0
src/views/pre-book/addPreBookDrawer.vue

@@ -434,6 +434,10 @@ export default {
   methods: {
     // 参照预装箱单
     referadvancePackingList() {
+      //子表中有数据时,传值给参照数据组件
+      if(this.addPreBook.syLetterDepositItemList.length !== 0){
+        this.$refs.advancePackingListModal.fatherData = this.addPreBook.syLetterDepositItemList
+      }
       this.$refs.advancePackingListModal.advancePackingListModVis = true;
       this.$refs.advancePackingListModal.queryParam = {};
       this.$refs.advancePackingListModal.searchQuery();

+ 20 - 3
src/views/pre-book/advancePackingListModal.vue

@@ -94,7 +94,7 @@ export default {
   data() {
     let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
     return {
-      
+      fatherData:[], //接受父组件的表格数据
       // 查询条件
       queryParam: {
         orderNum: '',
@@ -253,6 +253,7 @@ export default {
       ],
       advancePackingListData: [],
       error:[], // 选中数据不符合的字段名
+      errorFather:[], //选中数据中与父组件表格数据不符合字段名集合
 
       // orderDataform: this.$form.createForm(this),
       confirmLoading: false,
@@ -294,12 +295,19 @@ export default {
     // 弹框确定
     onSubmit() {
       this.dataSet( this.selectedRows)
+      var selectedRow = this.selectedRows[0]
+      if(this.fatherData.length !== 0){
+        this.fatherDataSet(this.fatherData,selectedRow)
+      }
       if (this.selectedRowKeys.length == 0) {
         this.$message.error('请选择数据');
       } else if(this.selectedRows !== 1 && this.error.length !==0){
         var cc =this.error.toString()
         this.$message.error(cc+'必须相同!');
-      } else {
+      } else if(this.fatherData.length !== 0 && this.errorFather.length !==0){
+        var fatherCc = this.errorFather.toString()
+        this.$message.error(fatherCc+'必须相同!');
+      }else{
         var filterDataList = this.advancePackingListData.filter(item=>{
           return this.selectedRowKeys.filter(key=>{
             return item.itemId === key 
@@ -307,12 +315,14 @@ export default {
         });
         this.$emit('callback', filterDataList);
 
+        this.filterDataList = []
         this.advancePackingListModVis = false;
         this.selectedRowKeys = [];
       }
       this.error = []
     },
-
+    
+    //勾选两条以上数据进行校验
     dataSet(){
        var distributionPointTest = [],
        customerTest = []
@@ -324,6 +334,13 @@ export default {
       if([...new Set(customerTest)].length !== 1){this.error.push('客户')}
     },
 
+     //已有参考列表
+    fatherDataSet(fathers,sons){
+      var father = fathers[0]
+      if(father.distributionPoint !== sons.distributionPoint){this.errorFather.push('分销点')}
+      if(father.custor !== sons.customer){this.errorFather.push('客户')}
+    },
+
 
     close() {
       this.$emit('close')