Commit 49e39287 authored by zhoutong's avatar zhoutong

后台出仓详情优化

parent b5a9563c
......@@ -89,7 +89,12 @@
<el-row>
<el-col :span="6" class="totle-info">
<div class="count-info">
<p>{{$t('总计')}}:{{getSumData}}</p>
<p>{{ $t('合包后总箱数')}}:{{ getpkgSunData }}</p>
</div>
</el-col>
<el-col :span="6" class="totle-info">
<div class="count-info">
<p>{{$t('订单总箱数')}}:{{getSumData}}</p>
</div>
<!-- <div>
<p>{{$t('容量')}}:</p>
......@@ -97,6 +102,16 @@
</div>
<div>{{$t('已装')}} {{getInstallNumCount}} {{$t('箱')}}</div> -->
</el-col>
<el-col :span="6" class="totle-info">
<div class="count-info">
<p>{{ $t('合包后已出箱数')}}:{{ getpkgOutData }}</p>
</div>
</el-col>
<el-col :span="6" class="totle-info">
<div class="count-info">
<p>{{ $t('订单已出箱数')}}:{{ getOrderOutData }}</p>
</div>
</el-col>
</el-row>
<el-row style="margin-top: 20px;">
<el-button type="primary" @click="submitCheckout">{{$t('确认出仓')}}</el-button>
......@@ -205,6 +220,8 @@ import {
serviceMsg,
getCapacity,
sumStatistics,
allTotalStatistics,
getAllTotlContent
} from "../../utils";
import Decimal from "decimal.js";
import { getChannelList } from "@/api/ecw/channel";
......@@ -557,8 +574,17 @@ export default {
return getCapacity(cabinetRespVO);
},
/* 总计 */
getpkgSunData() {
return allTotalStatistics(this.listData, ["mergeNum", "mergeVolume", "mergeWeight"]);
},
getSumData() {
return sumStatistics(this.listData);
return allTotalStatistics(this.listData, ["num", "volume", "weight"]);
},
getpkgOutData() {
return allTotalStatistics(this.listData, ["checkoutMergeNum", "checkoutMergeVolume", "checkoutMergeWeight"]);
},
getOrderOutData() {
return allTotalStatistics(this.listData, ["checkoutOrderNum", "checkoutOrderVolume", "checkoutOrderWeight"]);
},
/* 已装总数 */
getInstallNumCount() {
......
......@@ -1420,6 +1420,64 @@ function sumStatistics(val) {
return getTotlContent(count);
}
function allTotalStatistics(val, type = ["num", "volume", "weight"]) {
// let count = { type[0]: 0, type[1]: 0, type[2]: 0 };
let count = {}
count[type[0]] = 0;
count[type[1]] = 0;
count[type[2]] = 0;
if (Array.isArray(val)) {
val.forEach((item) => {
const { secStatistics } = item;
if (secStatistics) {
if (!Number.isNaN(Number(secStatistics[type[0]]))) {
count[type[0]] = Decimal.add(
count[type[0]],
Number(secStatistics[type[0]])
).toNumber();
}
if (!Number.isNaN(Number(secStatistics[type[1]]))) {
console.log(secStatistics[type[1]],count[type[1]],'1111');
count[type[1]] = Decimal.add(
count[type[1]],
Number(secStatistics[type[1]])
).toNumber();;
console.log(secStatistics[type[1]],count[type[1]],'2222');
}
if (!Number.isNaN(Number(secStatistics[type[2]]))) {
count[type[2]] = Decimal.add(
count[type[2]],
Number(secStatistics[type[2]])
).toNumber();;
}
}
});
}
return getAllTotlContent(count, type);
}
function getAllTotlContent(total, keys = ["num", "volume", "weight"]) {
let content = [];
const regexNum = new RegExp('num', 'i');
const regexVolume = new RegExp('volume', 'i');
const regexWeight = new RegExp('weight', 'i');
for (const key of keys) {
if (regexNum.test(key)) {
content.push(`${total[key] ?? 0}${i18n.$t("")}`);
}
if (regexVolume.test(key)) {
let volume = total[key] ?? 0;
content.push(`${volume}m³`);
}
if (regexWeight.test(key)) {
let weight = total[key] ?? 0;
content.push(`${weight}kg`);
}
}
return content.join(" ");
}
export const fileTypes = [
"doc",
"xls",
......@@ -1509,4 +1567,6 @@ export {
toReviewDetail,
downloadFile,
downloadFileByUrl,
allTotalStatistics,
getAllTotlContent
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment