this.$set(this.detailList[params.index], '_checked', true) //選中
this.$set(this.detailList[params.index], '_checked', true) //選中
disabled: params.row.totalStockNum==0 //禁用input
this.$set(this.detailList[params.index], '_checked', true) //選中
this.multipleSelection[params.index] = this.detailList[params.index] //自動選中雙向綁定
{ title: '領(lǐng)取數(shù)量', key: 'takeQuantity', tooltip: true, align: 'center', width: 130,
render:(h,params) => {
return h('Input',{
props: {
value: params.row.takeQuantity,
type: 'number',
placeholder:'領(lǐng)取數(shù)量必填',
size:'small',
disabled: params.row.totalStockNum==0 //禁用input
},
on: {
'on-blur': (event,index) => {
let totalStockNum= this.detailList[params.index].totalStockNum
//領(lǐng)取數(shù)量不能大于庫存數(shù)量
if(event.target.value > totalStockNum){
event.target.value =''
this.$Notice.warning({
title: this.$t('public.title.warningTitle'),
desc: '領(lǐng)取數(shù)量不能大于庫存數(shù)量褥伴,請重新輸入濒翻!'
})
return
}
//大于0正常
if(event.target.value > 0){
params.row.quantity = event.target.value
this.detailList[params.index].quantity = Number(event.target.value) //雙向綁定
this.$set(this.detailList[params.index], '_checked', true) //選中
this.multipleSelection[params.index] = this.detailList[params.index] //自動選中雙向綁定
this.$set(this.detailList[params.index], 'quantity', Number(event.target.value)) //添加值
}else{
event.target.value =''
this.$Notice.warning({
title: this.$t('public.title.warningTitle'),
desc: '領(lǐng)取數(shù)量必須是正整數(shù)牵寺!'
})
return
}
}
},
})
}
//給原數(shù)組新增屬性
this.$set(rows,{taker:takerArr[0].name,takerId:takerArr[0].name})
let takerArr=this.recipientsList ? this.recipientsList.filter(ele=>ele.id === this.recipientsForm.recipients) : [] //組裝領(lǐng)取人id和name
//組裝數(shù)據(jù)
let checkedArr = []
this.multipleSelection.filter(ele => {
checkedArr.push({
warehouseCode: ele.warehouseCode,
warehouseId: ele.warehouseId,
warehouseName: ele.warehouseName,
takeQuantity: ele.quantity,
taker: takerArr[0].name,
takerId: takerArr[0].id,
packageMaterialId: ele.id,
packageMaterialCode: ele.packageMaterialCode,
packageMaterialName: ele.packageMaterialName,
packageMaterialType: ele.packageMaterialType
})
});
console.log('參數(shù): ', checkedArr);
checkedArr//想要的數(shù)組