批量导入成本调整

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" @queryTable="getList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@sort-change="handleSortChange" @sort-change="handleSortChange"
show-summary
:summary-method="getSummaries"
> >
@ -446,7 +447,8 @@ export default {
// 判断批次是否存在 获取批次信息 // 判断批次是否存在 获取批次信息
let carNo=orderData['运输单号']; let carNo=orderData['运输单号'];
let etd=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&&resBatch.code==200){
if(resBatch.rows&&resBatch.rows.length==0){ if(resBatch.rows&&resBatch.rows.length==0){
orderData.uploadStatus=-1; orderData.uploadStatus=-1;
@ -458,9 +460,14 @@ export default {
} }
else{ else{
let batchItem=resBatch.rows[0]; let batchItem=resBatch.rows[0];
if(etd && batchItem.etd!==etd){
orderData.uploadStatus=-1;
orderData.errorInfo='成本时间不一致';
}else{
this.$set(orderData,"batchItem",batchItem) ; this.$set(orderData,"batchItem",batchItem) ;
this.$set(orderData,"batchNo",batchItem.batchNo) ; this.$set(orderData,"batchNo",batchItem.batchNo) ;
} }
}
}else{ }else{
orderData.uploadStatus=-1; orderData.uploadStatus=-1;
orderData.errorInfo='获取批次异常'; orderData.errorInfo='获取批次异常';
@ -591,8 +598,8 @@ export default {
}else{ }else{
orderItem.uploadStatus=-1; // orderItem.uploadStatus=-1;
orderItem.errorInfo='批次不存在'; // orderItem.errorInfo='批次不存在';
continue; continue;
} }
@ -673,7 +680,39 @@ export default {
getIndex($index) { getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1 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> </script>