From 70e08980b2fcf49dc0505984cc310ce9850c761b Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期四, 10 七月 2025 18:16:16 +0800 Subject: [PATCH] 首页模块 销售数据 月度对比 --- src/views/index.vue | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/views/index.vue b/src/views/index.vue index 473aff0..37989a6 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -121,18 +121,21 @@ :header-cell-style="tableHeaderStyle" > <el-table-column - prop="product" + prop="coalName" label="浜у搧" + align="center" mini-width="50" ></el-table-column> <el-table-column - prop="quantity" + prop="inventoryQuantity" label="鏁伴噺" + align="center" mini-width="50" ></el-table-column> <el-table-column - prop="amount" + prop="totalAmount" label="閲戦" + align="center" mini-width="50" ></el-table-column> </el-table> @@ -233,13 +236,7 @@ } // 閿�鍞暟鎹師濮� -const salesData = [ - { product: "鍘熺叅", quantity: "1234鍚�", amount: "楼456789", status: "宸插畬鎴�" }, - { product: "绮剧叅", quantity: "567鍚�", amount: "楼234567", status: "宸插畬鎴�" }, - { product: "鐒︾叅", quantity: "890鍚�", amount: "楼345678", status: "杩涜涓�" }, - { product: "鍧楃叅", quantity: "432鍚�", amount: "楼123456", status: "宸插畬鎴�" }, - { product: "鐓ゆ偿", quantity: "20000鍚�", amount: "楼234567", status: "杩涜涓�" }, -]; +const salesData = ref([]); const tableHeaderStyle = { backgroundColor: "#f5f7fa", @@ -398,7 +395,7 @@ }, xAxis: { type: "category", - data: ["鍘熺叅", "绮剧叅", "鐒︾叅", "鍧楃叅", "鐓ゆ偿"], + data: resultMonthList.value.Xkeys || [], axisLabel: { fontSize: 11, }, @@ -413,7 +410,7 @@ { name: "閿�閲�", type: "bar", - data: [320, 302, 301, 334, 290], + data: resultMonthList.value.Yvalues || [], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "#409EFF" }, @@ -464,7 +461,18 @@ Yvalues: inventoryListYvalues, }; } - console.log(inventoryList.value) + if(homePageData.value.resultMouth){ + let resultMonthXkeys = Object.keys(homePageData.value.resultMouth); + let resultMonthYvalues = Object.values(homePageData.value.resultMouth); + resultMonthList.value = { + Xkeys: resultMonthXkeys, + Yvalues: resultMonthYvalues, + }; + console.log(resultMonthList.value); + } + if(homePageData.value.salesResults){ + salesData.value = homePageData.value.salesResults; + } // 鏁版嵁鍔犺浇瀹屾垚鍚庨噸鏂板垵濮嬪寲鍥捐〃 nextTick(() => { initCharts(); @@ -474,6 +482,7 @@ } }; const inventoryList = ref([]); +const resultMonthList = ref([]); const supplyTrend = ref({}); const searchMonth = async () => { -- Gitblit v1.9.3