|
@@ -25,6 +25,7 @@
|
|
|
</template>
|
|
|
<template #inOutStorageBomList>
|
|
|
<div style="width: 100%; padding: 0 20px">
|
|
|
+ <div style="margin-bottom: 10px">{{ statisticalQuantity() }}</div>
|
|
|
<el-table :data="inOutStorageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
|
|
|
<el-table-column label="BOM品号" prop="bomSpecCode" width="180" />
|
|
|
<el-table-column label="BOM品名" prop="bomSpecName" min-width="220" />
|
|
@@ -155,6 +156,42 @@ const changeDepartment = () => {
|
|
|
inOutStorageBomList.value = Object.freeze(res);
|
|
|
});
|
|
|
};
|
|
|
+const statisticalQuantity = () => {
|
|
|
+ let quantity = 0;
|
|
|
+ let material = {};
|
|
|
+ if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
|
|
|
+ let principal = formData.data.inOutStorageBomList.filter((item) => item.classifyParentId == "1");
|
|
|
+ if (principal && principal.length > 0) {
|
|
|
+ for (let j = 0; j < principal.length; j++) {
|
|
|
+ if (principal[j].outQuantity) {
|
|
|
+ quantity = Number(Math.round(quantity + principal[j].outQuantity));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let auxiliaryMaterial = formData.data.inOutStorageBomList.filter((item) => item.classifyParentId != "1");
|
|
|
+ if (auxiliaryMaterial && auxiliaryMaterial.length > 0) {
|
|
|
+ for (let i = 0; i < auxiliaryMaterial.length; i++) {
|
|
|
+ if (material[auxiliaryMaterial[i].classifyId]) {
|
|
|
+ material[auxiliaryMaterial[i].classifyId].quantity = Number(
|
|
|
+ Math.round(material[auxiliaryMaterial[i].classifyId].quantity + auxiliaryMaterial[i].outQuantity)
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ material[auxiliaryMaterial[i].classifyId] = {
|
|
|
+ name: auxiliaryMaterial[i].classifyName,
|
|
|
+ quantity: auxiliaryMaterial[i].outQuantity,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let text = "主材数量: " + quantity;
|
|
|
+ for (let key in material) {
|
|
|
+ if (key && material[key].name) {
|
|
|
+ text = text + ", " + material[key].name + ": " + material[key].quantity;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return text;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|