供应链新增编辑时选择货品时和已选货品去重合并
This commit is contained in:
parent
1e0755f2fe
commit
90bc9c21c1
|
|
@ -530,7 +530,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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -627,7 +627,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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue