164 lines
4.4 KiB
Vue
Raw Normal View History

2024-01-24 23:15:59 +08:00
<template>
<el-card style="width: 49.9%;">
<template #header>
<div class="card-header">
<span>项目回款</span>
</div>
</template>
2024-01-26 00:20:03 +08:00
<div style="height:40px">
<el-date-picker v-model="year" @change='getCustom' value-format="YYYY" type="year" style="float:right"
2024-01-26 09:10:54 +08:00
:placeholder="year" />
2024-01-26 00:20:03 +08:00
</div>
2024-01-24 23:15:59 +08:00
<div style="display: flex;justify-content: space-around;">
<div v-for=" item in customList" :key="item" style="text-align: center;">
<div>{{ item.value }}</div>
<div>{{ item.name }}</div>
</div>
</div>
2024-01-26 00:20:03 +08:00
<div id="ProjectPayment" class="chart" v-if="showChart"></div>
2024-01-24 23:15:59 +08:00
</el-card>
</template>
<script setup>
import * as echarts from 'echarts';
import { apistatisticsprojectRefund } from '@/api/statistics'
2024-01-26 09:10:54 +08:00
const year = ref(new Date().getFullYear())
2024-01-26 00:20:03 +08:00
const showChart = ref(true)
2024-01-26 18:15:54 +08:00
/* CtrlA
上的全部文字都被选择并变色于是隐藏在黑背景里的黑色文字浮现了出来你需要有一张交通卡一日之间在一线和环线上的每个地铁站进入各一次每次都要刷这张卡然后你就会看见卡片变成金色的
刷这张地铁卡就能到达隐藏的站点*/
2024-01-24 23:15:59 +08:00
const customList = reactive([
{
2024-01-25 16:31:34 +08:00
name: "年度开票金额",
2024-01-24 23:15:59 +08:00
value: 3
},
{
2024-01-25 16:31:34 +08:00
name: "年度回款金额",
2024-01-24 23:15:59 +08:00
value: 3
},
{
2024-01-25 16:31:34 +08:00
name: "年度回款计划金额",
2024-01-24 23:15:59 +08:00
value: 3
},
])
const labelOption = {
show: true,
rich: {
name: {}
}
};
const initChart = (id, opt) => {
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
myChart.setOption(opt);
}
const getCustom = async () => {
2024-01-26 00:20:03 +08:00
showChart.value = false
2024-01-24 23:15:59 +08:00
2024-01-26 00:20:03 +08:00
let res = await apistatisticsprojectRefund()
showChart.value = true
await nextTick()
2024-01-24 23:15:59 +08:00
var option4 = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [res.invoice_series.name, res.refund_plan_series.name, res.refund_series
.name,]
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
},
xAxis: [
{
type: 'category',
axisTick: { show: false },
data: res.column
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: res.invoice_series.name,
type: 'bar',
barGap: 0,
label: labelOption,
emphasis: {
focus: 'series'
},
2024-01-25 16:31:34 +08:00
data: res.invoice_series.data,
2024-01-24 23:15:59 +08:00
itemStyle: {
normal: {
label: {
}
}
}
},
{
name: res.refund_plan_series.name,
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: res.refund_plan_series.data,
itemStyle: {
normal: {
label: {
}
}
}
},
{
name: res.refund_series.name,
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: res.refund_series.data,
itemStyle: {
normal: {
label: {
}
}
}
},
]
};
initChart("ProjectPayment", option4)
customList[0].value = res.year_invoicing_amount
customList[1].value = res.year_refund_amount
customList[2].value = res.year_refund_plan_amount
}
getCustom()
</script>
<style lang="scss" scoped>
.chart {
width: 100%;
height: 300px;
}
</style>