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

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(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false

View File

@ -471,8 +471,12 @@ export default {
}, },
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true this.loading = true;
this.contractMaterialList = this.batchChosenMaterial; 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false

View File

@ -393,7 +393,11 @@ export default {
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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.materialList.forEach(item=>{
this.$set(item,"unitPrice",item.unitPrice/100) this.$set(item,"unitPrice",item.unitPrice/100)
}) })

View File

@ -626,8 +626,12 @@ export default {
}, },
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false

View File

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

View File

@ -428,7 +428,11 @@ export default {
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false

View File

@ -417,8 +417,12 @@ export default {
}, },
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false

View File

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

View File

@ -426,7 +426,11 @@ export default {
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true 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(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false