From 50478b84da86ef020c2fcb6de2855644a95fee10 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期一, 26 五月 2025 14:34:29 +0800 Subject: [PATCH] 1.首页开发联调 --- src/views/index.vue | 99 ++++++++++++++++++++++++++++++++++++++++++++++--- src/api/viewIndex.js | 13 +++++- 2 files changed, 102 insertions(+), 10 deletions(-) diff --git a/src/api/viewIndex.js b/src/api/viewIndex.js index 8ac39e4..23bddd8 100644 --- a/src/api/viewIndex.js +++ b/src/api/viewIndex.js @@ -25,21 +25,28 @@ // 瀹㈡埛鍚堝悓閲戦TOP5缁熻 export const getTopFiveList = () => { return request({ - url: 'sales/ledger/getTopFiveList', + url: '/sales/ledger/getTopFiveList', method: 'get' }) } // 鍥炴楗肩姸鍥� export const getAmountMouth = () => { return request({ - url: 'receiptPayment/getAmountMouth', + url: '/receiptPayment/getAmountMouth', method: 'get' }) } -// 鍥炴楗肩姸鍥� +// 浠樻楗肩姸鍥� export const paymentMonthList = () => { return request({ url: '/purchase/paymentRegistration/paymentMonthList', method: 'get' }) +} +// 绾垮舰鍥� +export const getAmountHalfYear = () => { + return request({ + url: '/sales/ledger/getAmountHalfYear', + method: 'get' + }) } \ No newline at end of file diff --git a/src/views/index.vue b/src/views/index.vue index 4f5b35c..1fbed5d 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -112,7 +112,7 @@ :grid="grid" :legend="barLegend" :series="lineSeries" - :tooltip="tooltip" + :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 27vh;"></Echarts> @@ -128,6 +128,7 @@ import * as echarts from 'echarts'; import Echarts from "@/components/Echarts/echarts.vue"; import { + getAmountHalfYear, getAmountMouth, getContractAmount, getInvoiceAmount, @@ -232,6 +233,9 @@ type: 'shadow' } } +const tooltipLine = { + trigger: 'axis', +} const yAxis1 = ref([ { type: 'value', @@ -313,26 +317,22 @@ materialPieSeries1.value[0].data[1].value = payableAmount.value }) } -// 瀹㈡埛 +// 瀹㈡埛top5 const getTopFiveListNum = async () => { const res = await getTopFiveList() - const customerName = [] const totalAmount = [] - res.data.forEach(item => { customerName.push(item.customerName) totalAmount.push(item.totalAmount) }) - -// 鉁� 姝g‘鍝嶅簲寮忚祴鍊硷細鍒涘缓鏂扮殑 xAxis 鍜� series 瀵硅薄 +// 姝g‘鍝嶅簲寮忚祴鍊硷細鍒涘缓鏂扮殑 xAxis 鍜� series 瀵硅薄 xAxis1.value = [ { type: 'category', data: customerName } ] - barSeries.value = [ { type: 'bar', @@ -353,12 +353,97 @@ } ] } +// 绾垮舰鍥� +const getAmountHalfYearNum = async () => { + const res = await getAmountHalfYear() + console.log(res) + const monthName = [] + const receiptAmount = [] + const invoiceAmount = [] + res.data.forEach(item => { + monthName.push(item.month) + receiptAmount.push(item.receiptAmount) + invoiceAmount.push(item.invoiceAmount) + }) +// 姝g‘鍝嶅簲寮忚祴鍊硷細鍒涘缓鏂扮殑 xAxis 鍜� series 瀵硅薄 + xAxis2.value = [ + { + type: 'category', + data: monthName + } + ] + lineSeries.value = [ + { + name: '寮�绁�', + type: 'line', + data: receiptAmount, + smooth: true, + stack: 'Total', + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: 'rgba(131, 207, 255, 1)' + }, + { + offset: 1, + color: 'rgba(186, 228, 255, 1)' + } + ]) + }, + // 璁剧疆灏忓渾鐐圭殑棰滆壊 + itemStyle: { + color: '#2D99FF', // 灏忓渾鐐归鑹茶缃负#2D99FF + borderColor: '#2D99FF' // 濡傛灉闇�瑕佺殑璇濓紝鍙互璁剧疆杈规棰滆壊 + }, + emphasis: { + focus: 'series' + }, + lineStyle: { + width: 0 + }, + showSymbol: false, + }, + { + name: '鍥炴', + type: 'line', + data: invoiceAmount, + smooth: true, + stack: 'Total', + lineStyle: { + width: 0 + }, + // 璁剧疆灏忓渾鐐圭殑棰滆壊 + itemStyle: { + color: '#83CFFF', // 灏忓渾鐐归鑹茶缃负#83CFFF + borderColor: '#83CFFF' // 濡傛灉闇�瑕佺殑璇濓紝鍙互璁剧疆杈规棰滆壊 + }, + showSymbol: false, + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: 'rgba(54, 153, 255, 1)' + }, + { + offset: 1, + color: 'rgba(89, 169, 254, 1)' + } + ]) + }, + emphasis: { + focus: 'series' + }, + } + ] +} getContractAmountNum() getInvoiceAmountNum() getReceiptAmountNum() getTopFiveListNum() getAmountMouthNum() paymentMonthListNum() +getAmountHalfYearNum() </script> <style scoped> -- Gitblit v1.9.3