2024-07-06 17:03:43 +08:00

175 lines
4.3 KiB
Vue

<template>
<el-card style="width: 49.9%;">
<template #header>
<div class="card-header">
<span>项目付款统计</span>
</div>
</template>
<div style="height:40px">
<el-date-picker v-model="year" @change='getCustom' value-format="YYYY" type="year" style="float:right"
:placeholder="year" />
</div>
<div style="display: flex;justify-content: space-around;">
<router-link :to="{
path: item.url,
query: item.query ? { year } : null
}" v-for=" item in customList" :key="item" class="header-btn">
<div>
<div>{{ item.value }}</div>
<div>{{ item.name }}</div>
</div>
</router-link>
</div>
<div class="chart">
<v-charts style="height: 300px" :option="visitorOption" :autoresize="true" />
</div>
</el-card>
</template>
<script setup>
import vCharts from 'vue-echarts'
import { apistatisticsprojectPayment } from '@/api/statistics'
const year = ref(new Date().getFullYear())
let visitorOption = ref({})
const showChart = ref(true)
const customList = reactive([
{
name: "年度回票金额",
value: 0,
url: "/construction/finance/payment/finance_receipt_record"
},
{
name: "年度付款金额",
value: 0,
url: "/construction/finance/payment/finance_payment_plan"
},
{
name: "年度付款计划金额",
value: 0,
url: "/construction/finance/payment/finance_payment_plan"
},
])
const labelOption = {
show: true,
rich: {
name: {}
}
};
const getCustom = async () => {
showChart.value = false
let res = await apistatisticsprojectPayment({ year: year.value })
showChart.value = true
await nextTick()
var option4 = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [res.invoice_series.name, res.payment_plan_series.name, res.payment_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'
},
data: res.invoice_series.data,
itemStyle: {
normal: {
label: {
}
}
}
},
{
name: res.payment_plan_series.name,
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: res.payment_plan_series.data,
itemStyle: {
normal: {
label: {
}
}
}
},
{
name: res.payment_series.name,
type: 'bar',
label: labelOption,
emphasis: {
focus: 'series'
},
data: res.payment_series.data,
itemStyle: {
normal: {
label: {
}
}
}
},
]
};
visitorOption.value = option4
customList[0].value = res.year_invoicing_amount
customList[1].value = res.year_payment_amount
customList[2].value = res.year_payment_plan_amount
}
onMounted(() => {
getCustom()
})
</script>
<style lang="scss" scoped>
.chart {
width: 100%;
height: 300px;
}
.header-btn {
text-align: center;
cursor: pointer;
padding: 0px 10px;
}
.header-btn:active {
background-color: #EDEFFF;
}
</style>