<template>
|
<div class="chart-wrapper">
|
<div class="">
|
<el-select v-model="value" placeholder="请选择" @change="changeDay()">
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
<div class="haocai-title"></div>
|
<el-row :gutter="10">
|
<el-col :xs="24" :sm="100" :lg="8">
|
<ring-chart ref="ringchartOne" :ring-color="'#ff6699'" :ring-value="numStatistics.noAcceptWayBillNum" :ring-proportion="numStatistics.noAcceptWayBillProportion" />
|
<div class="haocai-title">未揽收运单</div>
|
</el-col>
|
<el-col :xs="24" :sm="24" :lg="8">
|
<ring-chart ref="ringchartTwo" :ring-color="'#cc0066'" :ring-value="numStatistics.acceptWayBillNum" :ring-proportion="numStatistics.acceptWayBillNumProportion" />
|
<div class="haocai-title">已揽收运单</div>
|
</el-col>
|
<el-col :xs="24" :sm="24" :lg="8">
|
<ring-chart ref="ringchartThree" :ring-value="numStatistics.endWayBillNum" :ring-proportion="numStatistics.endWayBillNumProportion" />
|
<div class="haocai-title">已完成运单</div>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script>
|
import RingChart from "../components/RingChart";
|
|
export default {
|
components: {
|
RingChart
|
},
|
data() {
|
return {
|
value: "近三月",
|
options: [
|
{
|
value: "今日",
|
label: "今日"
|
},
|
{
|
value: "近两日",
|
label: "近两日"
|
},
|
{
|
value: "近一星期",
|
label: "近一星期"
|
},
|
{
|
value: "近一月",
|
label: "近一月"
|
},
|
{
|
value: "近三月",
|
label: "近三月"
|
},
|
{
|
value: "近半年",
|
label: "近半年"
|
},
|
{
|
value: "近一年",
|
label: "近一年"
|
}
|
],
|
numStatistics: {
|
noAcceptWayBillNum: 0,
|
acceptWayBillNum: 0,
|
endWayBillNum: 0,
|
noAcceptWayBillProportion: 0,
|
acceptWayBillNumProportion: 0,
|
endWayBillNumProportion: 0
|
}
|
};
|
},
|
mounted() {
|
this.getWayBillNumStatistics();
|
},
|
methods: {
|
getWayBillNumStatistics() {
|
var the = this;
|
var dateType = this.value;
|
const url = "/api/dashboard/tms/getWayBillNumStatistics";
|
const params = { dateType: dateType };
|
var callback = res => {
|
if (res.result) {
|
this.$set(
|
this.numStatistics,
|
"noAcceptWayBillNum",
|
res.data.noAcceptWayBillNum
|
);
|
this.$set(
|
this.numStatistics,
|
"acceptWayBillNum",
|
res.data.acceptWayBillNum
|
);
|
this.$set(
|
this.numStatistics,
|
"endWayBillNum",
|
res.data.endWayBillNum
|
);
|
var noAcceptWayBillProportion = 0;
|
if (res.data.WayBillNum !== 0) {
|
noAcceptWayBillProportion = parseFloat(
|
(res.data.noAcceptWayBillNum / res.data.WayBillNum) * 100
|
);
|
}
|
var acceptWayBillNumProportion = 0;
|
if (res.data.WayBillNum !== 0) {
|
acceptWayBillNumProportion = parseFloat(
|
(res.data.acceptWayBillNum / res.data.WayBillNum) * 100
|
);
|
}
|
var endWayBillNumProportion = 0;
|
if (res.data.WayBillNum !== 0) {
|
endWayBillNumProportion = parseFloat(
|
(res.data.endWayBillNum / res.data.WayBillNum) * 100
|
);
|
}
|
this.$set(
|
this.numStatistics,
|
"noAcceptWayBillProportion",
|
noAcceptWayBillProportion
|
);
|
this.$set(
|
this.numStatistics,
|
"acceptWayBillNumProportion",
|
acceptWayBillNumProportion
|
);
|
this.$set(
|
this.numStatistics,
|
"endWayBillNumProportion",
|
endWayBillNumProportion
|
);
|
window.setTimeout(function() {
|
the.$refs.ringchartOne.initChart();
|
the.$refs.ringchartTwo.initChart();
|
the.$refs.ringchartThree.initChart();
|
}, 10);
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
changeDay() {
|
this.getWayBillNumStatistics();
|
}
|
}
|
};
|
</script>
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
.chart-wrapper {
|
background: #fff;
|
padding: 16px 16px;
|
margin-bottom: 10px;
|
.haocai-title {
|
text-align: center;
|
color: #888;
|
font-size: 18px;
|
}
|
}
|
</style>
|