|  |  |  | 
|---|
|  |  |  | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 | 
|---|
|  |  |  | events: { | 
|---|
|  |  |  | matList: function(data) { | 
|---|
|  |  |  | that.dataList.push(data.data) | 
|---|
|  |  |  | // that.checkMat(data.data) | 
|---|
|  |  |  | // that.dataList.push(data.data) | 
|---|
|  |  |  | that.checkMat(data.data) | 
|---|
|  |  |  | that.focuss() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | that.matnr = '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | checkMat(mat) { | 
|---|
|  |  |  | var len = this.dataList.length | 
|---|
|  |  |  | var add = true ,sameItem = false | 
|---|
|  |  |  | for (var i = 0; i < len; i++) { | 
|---|
|  |  |  | let num = 0; | 
|---|
|  |  |  | let index = 0; | 
|---|
|  |  |  | mat.containerCode = '' | 
|---|
|  |  |  | mat.csocode = '' | 
|---|
|  |  |  | mat.isoseq = '' | 
|---|
|  |  |  | for (let i = 0; i < this.dataList.length; i++) { | 
|---|
|  |  |  | if (mat.matnr == this.dataList[i].matnr) { | 
|---|
|  |  |  | for (var j = 0; j < len; j++) { | 
|---|
|  |  |  | if (mat.batch == this.dataList[j].batch) { | 
|---|
|  |  |  | sameItem = true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 相同物料 不同批号  新加列表 | 
|---|
|  |  |  | if (mat.batch != this.dataList[i].batch) { | 
|---|
|  |  |  | this.$forceUpdate() // 强制刷新 | 
|---|
|  |  |  | if (sameItem) { | 
|---|
|  |  |  | add = false | 
|---|
|  |  |  | if (mat.batch == this.dataList[i].batch) { | 
|---|
|  |  |  | index = i; | 
|---|
|  |  |  | num++; | 
|---|
|  |  |  | if (mat.containerCode != this.dataList[i].containerCode | 
|---|
|  |  |  | || mat.csocode != this.dataList[i].csocode | 
|---|
|  |  |  | || mat.isoseq != this.dataList[i].isoseq) { | 
|---|
|  |  |  | num = 0; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | add = true | 
|---|
|  |  |  | num++; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 相同物料相同批号 数量累加 | 
|---|
|  |  |  | this.dataList[i].anfme += mat.anfme | 
|---|
|  |  |  | this.$forceUpdate() // 强制刷新 | 
|---|
|  |  |  | add = false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (add) { | 
|---|
|  |  |  | if (num == 0) { | 
|---|
|  |  |  | this.dataList.unshift(mat) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.dataList[index].anfme += mat.anfme | 
|---|
|  |  |  | this.$forceUpdate() // 强制刷新 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // var len = this.dataList.length | 
|---|
|  |  |  | // var add = true ,sameItem = false | 
|---|
|  |  |  | // for (var i = 0; i < len; i++) { | 
|---|
|  |  |  | //    if (mat.matnr == this.dataList[i].matnr) { | 
|---|
|  |  |  | //       // for (var j = 0; j < len; j++) { | 
|---|
|  |  |  | //       //    if (mat.batch == this.dataList[j].batch) { | 
|---|
|  |  |  | //       //       sameItem = true | 
|---|
|  |  |  | //       //    } | 
|---|
|  |  |  | //       // } | 
|---|
|  |  |  | //       // 相同物料 不同批号  新加列表 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //       if (mat.batch != this.dataList[i].batch) { | 
|---|
|  |  |  | //          this.$forceUpdate() // 强制刷新 | 
|---|
|  |  |  | //          if (sameItem) { | 
|---|
|  |  |  | //             add = false | 
|---|
|  |  |  | //          } else { | 
|---|
|  |  |  | //             add = true | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //       } else { | 
|---|
|  |  |  | //          // 相同物料相同批号 数量累加 | 
|---|
|  |  |  | //          console.log(mat.containerCode); | 
|---|
|  |  |  | //          console.log(this.dataList[i].containerCode); | 
|---|
|  |  |  | //          if (this.dataList[i].containerCode != mat.containerCode | 
|---|
|  |  |  | //             || this.dataList[i].csocode != mat.csocode | 
|---|
|  |  |  | //             || this.dataList[i].isoseq != mat.isoseq) { | 
|---|
|  |  |  | //             add = true | 
|---|
|  |  |  | //          } else { | 
|---|
|  |  |  | //             this.dataList[i].anfme += mat.anfme | 
|---|
|  |  |  | //             this.$forceUpdate() // 强制刷新 | 
|---|
|  |  |  | //             add = false | 
|---|
|  |  |  | //          } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //       } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (add) { | 
|---|
|  |  |  | //    this.dataList.unshift(mat) | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // 修改批号 | 
|---|
|  |  |  | revise(item, i) { | 
|---|
|  |  |  | this.matnr = this.dataList[i].matnr | 
|---|