From e526b174afb7b3d1f3d1cbc764d003a19b6a2d9e Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 13 三月 2026 13:30:23 +0800
Subject: [PATCH] 产品需求量统计页面数据加单位、加合计行、加搜索
---
src/views/productionPlan/summaryByProduct/index.vue | 78 +++++++++++++++++++++++++++++++++++---
1 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/src/views/productionPlan/summaryByProduct/index.vue b/src/views/productionPlan/summaryByProduct/index.vue
index 62b8010..97c5001 100644
--- a/src/views/productionPlan/summaryByProduct/index.vue
+++ b/src/views/productionPlan/summaryByProduct/index.vue
@@ -1,13 +1,33 @@
<template>
<div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鐗╂枡缂栫爜锛�</span>
+ <el-input v-model="searchForm.materialCode"
+ style="width: 200px"
+ placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�"
+ clearable />
+ <span class="search_title ml10">浜у搧鍚嶇О锛�</span>
+ <el-input v-model="searchForm.productName"
+ style="width: 200px"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ <el-button @click="handleReset">閲嶇疆</el-button>
+ </div>
+ </div>
<div class="table_list">
<PIMTable rowKey="materialCode"
:column="tableColumn"
:tableData="tableData"
:page="page"
- height="calc(100vh - 200px)"
+ height="calc(100vh - 280px)"
:tableLoading="tableLoading"
:isSelection="false"
+ :isShowSummary="true"
+ :summaryMethod="summaryMethod"
@pagination="pagination">
</PIMTable>
</div>
@@ -46,26 +66,31 @@
label: "闀�",
prop: "length",
className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
},
{
label: "瀹�",
prop: "width",
className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
},
{
label: "楂�",
prop: "height",
className: "dimension-cell",
+ formatData: cell => (cell ? `${cell}mm` : ""),
},
{
label: "鍧楁暟",
prop: "quantity",
className: "quantity-cell",
+ formatData: cell => (cell ? `${cell}鍧梎 : ""),
},
{
label: "鏂规暟",
prop: "volume",
className: "volume-cell",
+ formatData: cell => (cell ? `${cell}鏂筦 : ""),
},
]);
const tableData = ref([]);
@@ -78,13 +103,21 @@
// 鎼滅储琛ㄥ崟
const searchForm = reactive({
+ materialCode: "",
productName: "",
- productSpec: "",
});
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+
+ /** 閲嶇疆鎸夐挳鎿嶄綔 */
+ const handleReset = () => {
+ searchForm.materialCode = "";
+ searchForm.productName = "";
page.current = 1;
getList();
};
@@ -109,6 +142,31 @@
.catch(() => {
tableLoading.value = false;
});
+ };
+
+ // 姹囨�绘柟娉�
+ const summaryMethod = ({ columns, data }) => {
+ const sums = [];
+ columns.forEach((column, index) => {
+ if (index === 0) {
+ sums[index] = "鎬昏";
+ return;
+ }
+ if (column.property === "quantity") {
+ const total = data.reduce((acc, item) => {
+ return acc + (Number(item.quantity) || 0);
+ }, 0);
+ sums[index] = `${total}鍧梎;
+ } else if (column.property === "volume") {
+ const total = data.reduce((acc, item) => {
+ return acc + (Number(item.volume) || 0);
+ }, 0);
+ sums[index] = `${total.toFixed(4)}鏂筦;
+ } else {
+ sums[index] = "";
+ }
+ });
+ return sums;
};
onMounted(() => {
@@ -137,6 +195,16 @@
&:hover {
box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
}
+
+ .search_title {
+ color: #606266;
+ font-size: 14px;
+ font-weight: 500;
+ }
+
+ .ml10 {
+ margin-left: 10px;
+ }
}
.table_list {
@@ -144,7 +212,7 @@
border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
- height: calc(100vh - 150px);
+ height: calc(100vh - 230px);
}
:deep(.el-table) {
@@ -162,7 +230,6 @@
color: #ffffff;
border-bottom: none;
padding: 16px 0;
- font-size: 14px;
letter-spacing: 0.5px;
}
}
@@ -185,7 +252,6 @@
border-bottom: 1px solid #f0f0f0;
padding: 14px 0;
color: #303133;
- font-size: 13px;
}
}
@@ -204,7 +270,6 @@
font-weight: 600;
color: #409eff;
font-family: "Courier New", monospace;
- font-size: 14px;
text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2);
}
@@ -228,7 +293,6 @@
// 鏃ユ湡瀛楁鏍峰紡
.date-cell {
color: #909399;
- font-size: 12px;
font-style: italic;
}
}
--
Gitblit v1.9.3