批量导入成本调整

This commit is contained in:
wuteng 2025-11-18 16:36:17 +08:00
parent a7b061e975
commit d90b19ea82

View File

@ -45,7 +45,8 @@
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
show-summary
:summary-method="getSummaries"
>
@ -446,7 +447,8 @@ export default {
// 判断批次是否存在 获取批次信息
let carNo=orderData['运输单号'];
let etd=orderData['成本时间'];
let resBatch=await listBySupplerAndCarNo(supplierCode,carNo,etd);
// let resBatch=await listBySupplerAndCarNo(supplierCode,carNo,etd);
let resBatch=await listBySupplerAndCarNo(supplierCode,carNo);
if(resBatch&&resBatch.code==200){
if(resBatch.rows&&resBatch.rows.length==0){
orderData.uploadStatus=-1;
@ -458,8 +460,13 @@ export default {
}
else{
let batchItem=resBatch.rows[0];
this.$set(orderData,"batchItem",batchItem) ;
this.$set(orderData,"batchNo",batchItem.batchNo) ;
if(etd && batchItem.etd!==etd){
orderData.uploadStatus=-1;
orderData.errorInfo='成本时间不一致';
}else{
this.$set(orderData,"batchItem",batchItem) ;
this.$set(orderData,"batchNo",batchItem.batchNo) ;
}
}
}else{
orderData.uploadStatus=-1;
@ -591,8 +598,8 @@ export default {
}else{
orderItem.uploadStatus=-1;
orderItem.errorInfo='批次不存在';
// orderItem.uploadStatus=-1;
// orderItem.errorInfo='批次不存在';
continue;
}
@ -673,8 +680,40 @@ export default {
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
}
//指定列求和
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
} else if (column.property === 'uploadStatus') {
//计数
sums[index] = data.length+ ' 条';
} else if ( column.property === 'errorInfo') {
sums[index] = '';
} else {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
//保留2位小数
sums[index] = sums[index].toFixed(2);
} else {
sums[index] = '';
}
}
});
return sums;
}
}
};
</script>