|
@@ -870,21 +870,47 @@ export default {
|
|
|
|
|
|
// 选择规格型号
|
|
// 选择规格型号
|
|
changeSpec(index, row) {
|
|
changeSpec(index, row) {
|
|
- let item = this.goodsSpecList.find(o => o.id == row.goodsMaterialId);
|
|
|
|
- this.goodsList[index].goodsMaterialId = item.id;
|
|
|
|
- this.goodsList[index].brandId = item.brandId;
|
|
|
|
- this.goodsList[index].brandName = item.brandName;
|
|
|
|
- this.goodsList[index].mainId = item.mainId;
|
|
|
|
- this.goodsList[index].mainName = item.mainName;
|
|
|
|
- this.goodsList[index].smallId = item.smallId;
|
|
|
|
- this.goodsList[index].smallName = item.smallName;
|
|
|
|
- this.goodsList[index].goodsName = item.goodsName;
|
|
|
|
- this.goodsList[index].specsName = item.specsName;
|
|
|
|
- this.goodsList[index].unit = item.unit;
|
|
|
|
- this.goodsList[index].insideNum = item.insideQty;
|
|
|
|
- this.goodsList[index].outNum = item.outQty;
|
|
|
|
- this.goodsList[index].partsNum = item.partsQty;
|
|
|
|
- this.goodsList[index].stockQty = item.stockQty;
|
|
|
|
|
|
+ // 判断对象数组中是否存在该对象
|
|
|
|
+ let ids = this.goodsList.map(o => {
|
|
|
|
+ return o.goodsMaterialId
|
|
|
|
+ });
|
|
|
|
+ let fIdx = ids.indexOf(row.goodsMaterialId);
|
|
|
|
+ let lIdx = ids.lastIndexOf(row.goodsMaterialId);
|
|
|
|
+ if(fIdx !== lIdx) {
|
|
|
|
+ this.goodsList[index].goodsMaterialId = '';
|
|
|
|
+ this.goodsList[index].brandId = '';
|
|
|
|
+ this.goodsList[index].brandName = '';
|
|
|
|
+ this.goodsList[index].mainId = '';
|
|
|
|
+ this.goodsList[index].mainName = '';
|
|
|
|
+ this.goodsList[index].smallId = '';
|
|
|
|
+ this.goodsList[index].smallName = '';
|
|
|
|
+ this.goodsList[index].goodsName = '';
|
|
|
|
+ this.goodsList[index].specsName = '';
|
|
|
|
+ this.goodsList[index].unit = '';
|
|
|
|
+ this.goodsList[index].insideNum = '';
|
|
|
|
+ this.goodsList[index].outNum = '';
|
|
|
|
+ this.goodsList[index].partsNum = '';
|
|
|
|
+ this.goodsList[index].stockQty = '';
|
|
|
|
+ this.$message.error('该规格型号已存在');
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ let item = this.goodsSpecList.find(o => o.id == row.goodsMaterialId);
|
|
|
|
+ this.goodsList[index].goodsMaterialId = item.id;
|
|
|
|
+ this.goodsList[index].brandId = item.brandId;
|
|
|
|
+ this.goodsList[index].brandName = item.brandName;
|
|
|
|
+ this.goodsList[index].mainId = item.mainId;
|
|
|
|
+ this.goodsList[index].mainName = item.mainName;
|
|
|
|
+ this.goodsList[index].smallId = item.smallId;
|
|
|
|
+ this.goodsList[index].smallName = item.smallName;
|
|
|
|
+ this.goodsList[index].goodsName = item.goodsName;
|
|
|
|
+ this.goodsList[index].specsName = item.specsName;
|
|
|
|
+ this.goodsList[index].unit = item.unit;
|
|
|
|
+ this.goodsList[index].insideNum = item.insideQty;
|
|
|
|
+ this.goodsList[index].outNum = item.outQty;
|
|
|
|
+ this.goodsList[index].partsNum = item.partsQty;
|
|
|
|
+ this.goodsList[index].stockQty = item.stockQty;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
creatCode(data, orderId) {
|
|
creatCode(data, orderId) {
|