| | |
| | | <template>
|
| | | <div class="app-container home">
|
| | | <div>
|
| | | <div style="display: flex;">
|
| | | <div>
|
| | | <div class="card-top-left">
|
| | | <div class="title">
|
| | |
| | | <div class="card-group">
|
| | | <div class="info-card">
|
| | | <div class="info-message">
|
| | | <div class="info-number">6789,000</div>
|
| | | <div class="info-number">{{contractAmount}}</div>
|
| | | <div class="info-title">ååéé¢(å
)</div>
|
| | | </div>
|
| | | <img src="@/assets/images/icon1.png" alt="" style="width: 63px;height: 63px">
|
| | | </div>
|
| | | <div class="info-card1">
|
| | | <div class="info-message">
|
| | | <div class="info-number">6789,000</div>
|
| | | <div class="info-number">{{invoiceAmount}}</div>
|
| | | <div class="info-title">å¼ç¥¨éé¢(å
)</div>
|
| | | </div>
|
| | | <img src="@/assets/images/icon2.png" alt="" style="width: 63px;height: 63px">
|
| | | </div>
|
| | | <div class="info-card2">
|
| | | <div class="info-message">
|
| | | <div class="info-number">6789,000</div>
|
| | | <div class="info-number">{{receiptAmount}}</div>
|
| | | <div class="info-title">忬¾éé¢(å
)</div>
|
| | | </div>
|
| | | <img src="@/assets/images/icon%203.png" alt="" style="width: 63px;height: 63px">
|
| | |
| | | </div>
|
| | | <div class="info-message2">
|
| | | <div class="info-message1">
|
| | | <div class="pie-title">æ¬æåæ¬¾æ°é</div>
|
| | | <div class="pie-info"><span class="pie-number">8,000</span>å
<span class="pie-number">15.0</span>%</div>
|
| | | <div class="pie-title">æ¬æåæ¬¾éé¢</div>
|
| | | <div class="pie-info"><span class="pie-number">{{receiveAmount}}</span>å
<span class="pie-number">{{receiveAmountPercentage}}</span>%</div>
|
| | | </div>
|
| | | <div class="info-message1">
|
| | | <div class="pie-title">åºæ¶æ¬¾éé¢</div>
|
| | | <div class="pie-info"><span class="pie-number">8,000</span>å
<span class="pie-number">15.0</span>%</div>
|
| | | <div class="pie-info"><span class="pie-number">{{contractAmountMonth}}</span>å
</div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | :options="options"
|
| | | :legend="pieLegend"
|
| | | :chartStyle="chartStyle"
|
| | | :series="materialPieSeries"
|
| | | :tooltip="pieTooltip"></Echarts>
|
| | | :series="materialPieSeries1"
|
| | | :tooltip="pieTooltip1"></Echarts>
|
| | | </div>
|
| | | <div class="info-message2">
|
| | | <div class="info-message1">
|
| | | <div class="pie-title">æ¬æåæ¬¾æ°é</div>
|
| | | <div class="pie-info"><span class="pie-number">8,000</span>å
<span class="pie-number">15.0</span>%</div>
|
| | | <div class="pie-title1">æ¬æä»æ¬¾éé¢</div>
|
| | | <div class="pie-info"><span class="pie-number1">{{paymentAmount}}</span>å
<span class="pie-number1">{{payableAmountPercentage}}</span>%</div>
|
| | | </div>
|
| | | <div class="info-message1">
|
| | | <div class="pie-title">åºæ¶æ¬¾éé¢</div>
|
| | | <div class="pie-info"><span class="pie-number">8,000</span>å
<span class="pie-number">15.0</span>%</div>
|
| | | <div class="pie-title1">åºä»æ¬¾éé¢</div>
|
| | | <div class="pie-info"><span class="pie-number1">{{payableAmount}}</span>å
</div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div></div>
|
| | | <div>
|
| | | <div class="card-top-right">
|
| | | <div class="title">
|
| | | <span style="font-weight: bold">客æ·ååéé¢TOP5ç»è®¡</span>
|
| | | </div>
|
| | | <div>
|
| | | <Echarts ref="chart"
|
| | | :chartStyle="chartStyle1"
|
| | | :grid="grid"
|
| | | :legend="barLegend"
|
| | | :series="barSeries"
|
| | | :tooltip="tooltip"
|
| | | :xAxis="xAxis1"
|
| | | :yAxis="yAxis1"
|
| | | style="height: 42vh;"></Echarts>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <div>
|
| | | |
| | | <div>
|
| | | <div class="card-bottom">
|
| | | <div class="title">
|
| | | <span style="font-weight: bold">忬¾ãå¼ç¥¨è¿åå¹´èµ°å¿å¾</span>
|
| | | </div>
|
| | | <div>
|
| | | <Echarts ref="chart"
|
| | | :chartStyle="chartStyle1"
|
| | | :grid="grid"
|
| | | :legend="barLegend"
|
| | | :series="lineSeries"
|
| | | :tooltip="tooltip"
|
| | | :xAxis="xAxis2"
|
| | | :yAxis="yAxis2"
|
| | | style="height: 27vh;"></Echarts>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script setup name="Index">
|
| | | const { proxy } = getCurrentInstance()
|
| | | import * as echarts from 'echarts';
|
| | | import Echarts from "@/components/Echarts/echarts.vue";
|
| | | import {
|
| | | getAmountMouth,
|
| | | getContractAmount,
|
| | | getInvoiceAmount,
|
| | | getReceiptAmount,
|
| | | getTopFiveList, paymentMonthList
|
| | | } from "@/api/viewIndex.js";
|
| | |
|
| | | const pieLegend = reactive({
|
| | | show: false,
|
| | | })
|
| | | const contractAmount = ref(0)
|
| | | const invoiceAmount = ref(0)
|
| | | const receiptAmount = ref(0)
|
| | | const receiveAmount = ref(0)
|
| | | const contractAmountMonth = ref(0)
|
| | | const receiveAmountPercentage = ref(0)
|
| | | const paymentAmount = ref(0)
|
| | | const payableAmount = ref(0)
|
| | | const payableAmountPercentage = ref(0)
|
| | | const options = reactive({
|
| | | graphic: {
|
| | | type: 'circle',
|
| | |
| | | shape: {
|
| | | r: '70%' // åå½¢åå¾ä¸é¥¼å¾å¤åç¸å
|
| | | },
|
| | | style: {
|
| | | fill: 'none',
|
| | | stroke: '#ccc', // ç°è²è¾¹æ¡
|
| | | lineWidth: 2
|
| | | },
|
| | | z: -10 // ç¡®ä¿è¾¹æ¡å¨é¥¼å¾ä¸é¢
|
| | | }
|
| | | })
|
| | | const pieTooltip = reactive({
|
| | | trigger: 'item',
|
| | | formatter: function (params) {
|
| | | // å¨æçææç¤ºä¿¡æ¯ï¼åºäºæ°æ®é¡¹ç name 屿§
|
| | | const description = params.name === 'æ¬æåæ¬¾æ°é' ? 'æ¬æåæ¬¾æ°é' : 'åºæ¶æ¬¾éé¢';
|
| | | const description = params.name === 'æ¬æåæ¬¾éé¢' ? 'æ¬æåæ¬¾éé¢' : 'åºæ¶æ¬¾éé¢';
|
| | | return `${description} ${formatNumber(params.value)}å
${params.percent}%`;
|
| | | },
|
| | | position: 'right'
|
| | | })
|
| | | const pieTooltip1 = reactive({
|
| | | trigger: 'item',
|
| | | formatter: function (params) {
|
| | | // å¨æçææç¤ºä¿¡æ¯ï¼åºäºæ°æ®é¡¹ç name 屿§
|
| | | const description = params.name === 'æ¬æä»æ¬¾éé¢' ? 'æ¬æä»æ¬¾éé¢' : 'åºä»æ¬¾éé¢';
|
| | | return `${description} ${formatNumber(params.value)}å
${params.percent}%`;
|
| | | },
|
| | | position: 'right'
|
| | |
| | | show:false
|
| | | },
|
| | | data: [
|
| | | { value: 0, name: 'æ¬æåæ¬¾æ°é', itemStyle: { color: '#2D99FF' } },
|
| | | { value: 0, name: 'æ¬æåæ¬¾éé¢', itemStyle: { color: '#2D99FF' } },
|
| | | { value: 0, name: 'åºæ¶æ¬¾éé¢', itemStyle: { color: '#D4DDFF' } },
|
| | | ]
|
| | | }
|
| | | ])
|
| | | const materialPieSeries1 = ref([
|
| | | {
|
| | | type: 'pie',
|
| | | radius: '92%',
|
| | | avoidLabelOverlap: false,
|
| | | itemStyle: {
|
| | | borderColor: '#fff',
|
| | | borderWidth: 2
|
| | | },
|
| | | label: {
|
| | | show:false
|
| | | },
|
| | | data: [
|
| | | { value: 0, name: 'æ¬æä»æ¬¾éé¢', itemStyle: { color: '#1EBFAC' } },
|
| | | { value: 0, name: 'åºä»æ¬¾éé¢', itemStyle: { color: '#D0EFE1' } },
|
| | | ]
|
| | | }
|
| | | ])
|
| | |
| | | width: '150%',
|
| | | height: '120%' // 设置å¾è¡¨å®¹å¨çé«åº¦
|
| | | }
|
| | | const chartStyle1 = {
|
| | | width: '100%',
|
| | | height: '100%' // 设置å¾è¡¨å®¹å¨çé«åº¦
|
| | | }
|
| | | const grid = {
|
| | | show: false
|
| | | }
|
| | | const tooltip = {
|
| | | trigger: 'axis',
|
| | | axisPointer: {
|
| | | type: 'shadow'
|
| | | }
|
| | | }
|
| | | const yAxis1 = ref([
|
| | | {
|
| | | type: 'value',
|
| | | }
|
| | | ])
|
| | | const xAxis1 = ref([
|
| | | {
|
| | | type: 'category',
|
| | | data: []
|
| | | }
|
| | | ])
|
| | | const yAxis2 = ref([
|
| | | {
|
| | | type: 'value',
|
| | | }
|
| | | ])
|
| | | const xAxis2 = ref([
|
| | | {
|
| | | type: 'category',
|
| | | data: []
|
| | | }
|
| | | ])
|
| | | const barLegend = reactive({})
|
| | | const barSeries = ref([
|
| | | {
|
| | | type: 'bar',
|
| | | data: [],
|
| | | label: {
|
| | | show: true
|
| | | },
|
| | | },
|
| | | ])
|
| | | const lineSeries = ref([
|
| | | {
|
| | | type: 'line',
|
| | | data: [],
|
| | | label: {
|
| | | show: true
|
| | | },
|
| | | },
|
| | | ])
|
| | | // ååéé¢
|
| | | const getContractAmountNum = () => {
|
| | | getContractAmount().then((res) => {
|
| | | contractAmount.value = res.data
|
| | | })
|
| | | }
|
| | | // å¼ç¥¨éé¢
|
| | | const getInvoiceAmountNum = () => {
|
| | | getInvoiceAmount().then((res) => {
|
| | | invoiceAmount.value = res.data
|
| | | })
|
| | | }
|
| | | // 忬¾éé¢
|
| | | const getReceiptAmountNum = () => {
|
| | | getReceiptAmount().then((res) => {
|
| | | receiptAmount.value = res.data
|
| | | })
|
| | | }
|
| | | // æå款éé¢é¥¼å¾
|
| | | const getAmountMouthNum = () => {
|
| | | getAmountMouth().then((res) => {
|
| | | receiveAmount.value = res.data.receiveAmount
|
| | | contractAmountMonth.value = res.data.contractAmount
|
| | | const percentage = (receiveAmount.value / contractAmountMonth.value) * 100;
|
| | | receiveAmountPercentage.value = percentage.toFixed(2)
|
| | | materialPieSeries.value[0].data[0].value = receiveAmount.value
|
| | | materialPieSeries.value[0].data[1].value = contractAmountMonth.value
|
| | | })
|
| | | }
|
| | | // æä»æ¬¾éé¢é¥¼å¾
|
| | | const paymentMonthListNum = () => {
|
| | | paymentMonthList().then((res) => {
|
| | | paymentAmount.value = res.data.paymentAmount
|
| | | payableAmount.value = res.data.payableAmount
|
| | | const percentage = (paymentAmount.value / payableAmount.value) * 100;
|
| | | payableAmountPercentage.value = percentage.toFixed(2)
|
| | | materialPieSeries1.value[0].data[0].value = paymentAmount.value
|
| | | materialPieSeries1.value[0].data[1].value = payableAmount.value
|
| | | })
|
| | | }
|
| | | // 客æ·
|
| | | const getTopFiveListNum = async () => {
|
| | | const res = await getTopFiveList()
|
| | | |
| | | const customerName = []
|
| | | const totalAmount = []
|
| | | |
| | | res.data.forEach(item => {
|
| | | customerName.push(item.customerName)
|
| | | totalAmount.push(item.totalAmount)
|
| | | })
|
| | |
|
| | | // â
æ£ç¡®ååºå¼èµå¼ï¼å建æ°ç xAxis å series 对象
|
| | | xAxis1.value = [
|
| | | {
|
| | | type: 'category',
|
| | | data: customerName
|
| | | }
|
| | | ]
|
| | | |
| | | barSeries.value = [
|
| | | {
|
| | | type: 'bar',
|
| | | data: totalAmount,
|
| | | itemStyle: {
|
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
| | | { offset: 0, color: '#F7D2FF' },
|
| | | { offset: 1, color: '#826AF9' }
|
| | | ])
|
| | | },
|
| | | emphasis: {
|
| | | itemStyle: {
|
| | | color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
| | | { offset: 1, color: '#826AF9' }
|
| | | ])
|
| | | }
|
| | | },
|
| | | }
|
| | | ]
|
| | | }
|
| | | getContractAmountNum()
|
| | | getInvoiceAmountNum()
|
| | | getReceiptAmountNum()
|
| | | getTopFiveListNum()
|
| | | getAmountMouthNum()
|
| | | paymentMonthListNum()
|
| | | </script>
|
| | |
|
| | | <style scoped>
|
| | |
| | | background: #fff;
|
| | | height: 24vh;
|
| | | width: 56vw;
|
| | | margin-bottom: 20px;
|
| | | }
|
| | | .card-top-right {
|
| | | padding: 16px;
|
| | | background: #fff;
|
| | | height: 50.6vh;
|
| | | width: 28vw;
|
| | | margin-bottom: 20px;
|
| | | margin-left: 20px;
|
| | | }
|
| | | .card-bottom {
|
| | | padding: 16px;
|
| | | background: #fff;
|
| | | height: 34vh;
|
| | | width: 85.2vw;
|
| | | margin-bottom: 20px;
|
| | | }
|
| | | .title {
|
| | |
| | | left: 0; /* å®ä½å°å·¦è¾¹ */
|
| | | top: 9px; /* åç´å±
ä¸å¯¹é½ï¼æ ¹æ®è¡é«è°æ´ */
|
| | | }
|
| | | .pie-title1 {
|
| | | font-size: 14px;
|
| | | line-height: 24px;
|
| | | color: #1EBFAC;
|
| | | padding-left: 16px;
|
| | | position: relative;
|
| | | }
|
| | | .pie-title1::before {
|
| | | content: '';
|
| | | width: 6px; /* èç¹ç宽度 */
|
| | | height: 6px; /* èç¹çé«åº¦ */
|
| | | background-color: #1EBFAC; /* èç¹çé¢è² */
|
| | | border-radius: 50%; /* å°æ£æ¹å½¢å为åå½¢ */
|
| | | position: absolute;
|
| | | left: 0; /* å®ä½å°å·¦è¾¹ */
|
| | | top: 9px; /* åç´å±
ä¸å¯¹é½ï¼æ ¹æ®è¡é«è°æ´ */
|
| | | }
|
| | | .pie-info {
|
| | | padding-left: 16px;
|
| | | font-size: 14px;
|
| | |
| | | .pie-number {
|
| | | color: #2853FD;
|
| | | }
|
| | | .info-group {
|
| | | display: flex;
|
| | | flex-direction: column;
|
| | | justify-content: center;
|
| | | align-items: center;
|
| | | .pie-number1 {
|
| | | color: #1EBFAC;
|
| | | }
|
| | | </style>
|
| | |
|