供应链新增编辑时选择货品时和已选货品去重合并

This commit is contained in:
zzyuan 2025-08-07 13:10:39 +08:00
parent 1e0755f2fe
commit 90bc9c21c1
9 changed files with 62 additions and 30 deletions

View File

@ -529,8 +529,12 @@ export default {
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
this.loading = true
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -471,8 +471,12 @@ export default {
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.contractMaterialList = this.batchChosenMaterial;
this.loading = true;
let items = [...this.contractMaterialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.contractMaterialList = uniqueItems
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -393,7 +393,11 @@ export default {
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",item.unitPrice/100)
})

View File

@ -626,8 +626,12 @@ export default {
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
this.loading = true
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -390,21 +390,22 @@ export default {
});
},
handleSelectionChange2(selection) {
this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{
this.$set(item,"purchaseNum",0)
this.$set(item,"unitPrice",item.unitPrice)
this.batchChosenMaterial = [];
selection.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
this.$set(obj,"purchaseNum",0)
this.batchChosenMaterial.push(obj)
})
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true;
this.materialList = []
this.batchChosenMaterial.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
this.materialList.push(obj)
})
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -428,7 +428,11 @@ export default {
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -417,8 +417,12 @@ export default {
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
this.loading = true
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -482,20 +482,23 @@ export default {
});
},
handleSelectionChange2(selection) {
this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{
this.$set(item,"purNum",0)
this.$set(item,"supplierId",null)
this.$set(item,"unitPrice",item.unitPrice)
this.batchChosenMaterial = [];
selection.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
this.$set(obj,"purNum",0)
this.$set(obj,"supplierId",null)
this.batchChosenMaterial.push(obj)
})
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",item.unitPrice/100)
})
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false

View File

@ -426,7 +426,11 @@ export default {
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.materialList = this.batchChosenMaterial;
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
this.materialList = uniqueItems;
setTimeout(()=>{
this.loading = false
this.openDialog=false