|
|
@@ -1,28 +1,70 @@
|
|
|
<template>
|
|
|
- <div class="lineEchartsClass" style="padding-left: 1vw;padding-top: 1vh;">
|
|
|
+ <div class="lineEchartsClass" style="padding-left: 1vw; padding-top: 1vh">
|
|
|
<div class="title">电子站台统计</div>
|
|
|
- <div style="display: flex;flex-direction: row;margin-top: 1vh;padding-left: 1vw;">
|
|
|
- <div ref="stationchart" style="width:11vw;height: 20vh;"></div>
|
|
|
- <div style="width:10vw;margin-left: 1vw;padding-right: 1vw;height: 20vh;justify-content: center;display: flex;flex-direction: column;">
|
|
|
- <div style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;">
|
|
|
+ <div style="display: flex; flex-direction: row; margin-top: 1vh; padding-left: 1vw">
|
|
|
+ <div ref="stationchart" style="width: 11vw; height: 20vh; min-width: 170px"></div>
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ width: 10vw;
|
|
|
+ margin-left: 1vw;
|
|
|
+ padding-right: 1vw;
|
|
|
+ height: 20vh;
|
|
|
+ justify-content: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ min-width: 200px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: start;
|
|
|
+ "
|
|
|
+ >
|
|
|
<div class="stationkeyClass">设备总数</div>
|
|
|
<div class="stationvalueClass">{{ totaldevice }}</div>
|
|
|
<div class="stationunitClass">台</div>
|
|
|
</div>
|
|
|
<img class="imageDiv" src="@/assets/images/home/Bg(4).png" />
|
|
|
- <div style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: start;
|
|
|
+ margin-top: 1vh;
|
|
|
+ "
|
|
|
+ >
|
|
|
<div class="stationkeyClass">在线设备</div>
|
|
|
<div class="stationvalueClass">{{ onlinedevice }}</div>
|
|
|
<div class="stationunitClass">台</div>
|
|
|
</div>
|
|
|
<img class="imageDiv" src="@/assets/images/home/Bg(7).png" />
|
|
|
- <div style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: start;
|
|
|
+ margin-top: 1vh;
|
|
|
+ "
|
|
|
+ >
|
|
|
<div class="stationkeyClass">箱体总数</div>
|
|
|
<div class="stationvalueClass">{{ totalcabinet }}</div>
|
|
|
<div class="stationunitClass">台</div>
|
|
|
</div>
|
|
|
<img class="imageDiv" src="@/assets/images/home/Bg(5).png" />
|
|
|
- <div style="display: flex;flex-direction: row;justify-content: space-around;align-items: start;margin-top: 1vh;">
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: start;
|
|
|
+ margin-top: 1vh;
|
|
|
+ "
|
|
|
+ >
|
|
|
<div class="stationkeyClass">空闲箱体</div>
|
|
|
<div class="stationvalueClass">{{ kxcabinet }}</div>
|
|
|
<div class="stationunitClass">台</div>
|
|
|
@@ -33,8 +75,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup name="Index">
|
|
|
-import { cabinetboxstatic,devicestatic } from '@/api/gpsData';
|
|
|
-import * as echarts from 'echarts';
|
|
|
+import { cabinetboxstatic, devicestatic } from "@/api/gpsData";
|
|
|
+import * as echarts from "echarts";
|
|
|
|
|
|
const stationchart = ref();
|
|
|
|
|
|
@@ -44,7 +86,6 @@ const kxcabinet = ref(0);
|
|
|
const totaldevice = ref(0);
|
|
|
const onlinedevice = ref(0);
|
|
|
|
|
|
-
|
|
|
const getBoxs = () => {
|
|
|
cabinetboxstatic().then((res) => {
|
|
|
totalcabinet.value = 0;
|
|
|
@@ -54,7 +95,7 @@ const getBoxs = () => {
|
|
|
kxcabinet.value += res[key].unuse ?? 0;
|
|
|
}
|
|
|
});
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
const getdevices = () => {
|
|
|
devicestatic().then((res) => {
|
|
|
@@ -62,135 +103,133 @@ const getdevices = () => {
|
|
|
onlinedevice.value = 0;
|
|
|
for (let key in res) {
|
|
|
if (res[key]["name"] == "快递柜") {
|
|
|
- totaldevice.value += 1;
|
|
|
- onlinedevice.value += res[key].offline =="1"?0:1;
|
|
|
+ totaldevice.value += 1;
|
|
|
+ onlinedevice.value += res[key].offline == "1" ? 0 : 1;
|
|
|
}
|
|
|
}
|
|
|
- drawEchart()
|
|
|
+ drawEchart();
|
|
|
});
|
|
|
-}
|
|
|
-
|
|
|
+};
|
|
|
|
|
|
const drawEchart = () => {
|
|
|
- let echartsObj = echarts.init(stationchart.value, "macarons");
|
|
|
- var option = {
|
|
|
- color:['#707070','#26EB96'],
|
|
|
- title: {
|
|
|
- // 图形标题(如果想要换行则使用ES6 `` 模板字符串)
|
|
|
- // 例如: `示例
|
|
|
- // 这里的文字会变为第二行(因为会保留格式)
|
|
|
- text: `${((onlinedevice.value/totaldevice.value)*100).toFixed(0)}%`,
|
|
|
- subtext: "在线率",
|
|
|
- left: "center",//对齐方式居中
|
|
|
- top: "35%",//距离顶部
|
|
|
- textStyle: {//文字配置
|
|
|
- color: "#000000",//文字颜色
|
|
|
- fontSize: 30,//字号
|
|
|
- align: "center"//对齐方式
|
|
|
- },
|
|
|
- subtextStyle:{
|
|
|
- color:"#000000"
|
|
|
- }
|
|
|
+ let echartsObj = echarts.init(stationchart.value, "macarons");
|
|
|
+ var option = {
|
|
|
+ color: ["#707070", "#26EB96"],
|
|
|
+ title: {
|
|
|
+ // 图形标题(如果想要换行则使用ES6 `` 模板字符串)
|
|
|
+ // 例如: `示例
|
|
|
+ // 这里的文字会变为第二行(因为会保留格式)
|
|
|
+ text: `${((onlinedevice.value / totaldevice.value) * 100).toFixed(0)}%`,
|
|
|
+ subtext: "在线率",
|
|
|
+ left: "center", //对齐方式居中
|
|
|
+ top: "35%", //距离顶部
|
|
|
+ textStyle: {
|
|
|
+ //文字配置
|
|
|
+ color: "#000000", //文字颜色
|
|
|
+ fontSize: 30, //字号
|
|
|
+ align: "center", //对齐方式
|
|
|
+ },
|
|
|
+ subtextStyle: {
|
|
|
+ color: "#000000",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "Access From",
|
|
|
+ type: "pie",
|
|
|
+ radius: ["80%", "100%"],
|
|
|
+ avoidLabelOverlap: false,
|
|
|
+ label: {
|
|
|
+ show: false,
|
|
|
+ position: "center",
|
|
|
},
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: 'Access From',
|
|
|
- type: 'pie',
|
|
|
- radius: ['80%', '100%'],
|
|
|
- avoidLabelOverlap: false,
|
|
|
- label: {
|
|
|
- show: false,
|
|
|
- position: 'center'
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: [
|
|
|
- { value: totaldevice.value-onlinedevice.value, name: '在线' },
|
|
|
- { value: onlinedevice.value, name: '不在线' },
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- echartsObj.setOption(option);
|
|
|
-}
|
|
|
+ labelLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ { value: totaldevice.value - onlinedevice.value, name: "在线" },
|
|
|
+ { value: onlinedevice.value, name: "不在线" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ echartsObj.setOption(option);
|
|
|
+};
|
|
|
|
|
|
const getRecentDays = () => {
|
|
|
- const oneDay = 24 * 60 * 60 * 1000; // 这里定义一天的毫秒数
|
|
|
- const resultArray = [];
|
|
|
- for (let i = 6; i >= 0; i--) {
|
|
|
- const currentDate = new Date(Date.now() - i * oneDay); // 计算出每天的日期
|
|
|
- const year = currentDate.getFullYear();
|
|
|
- const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // 月份需要补零
|
|
|
- const day = String(currentDate.getDate()).padStart(2, "0"); // 日期也需要补零
|
|
|
- const formattedDate = `${month}-${day}`; // 格式化日期为 yyyy-mm-dd 的形式
|
|
|
- resultArray.push(formattedDate);
|
|
|
- }
|
|
|
- return resultArray;
|
|
|
-}
|
|
|
-
|
|
|
+ const oneDay = 24 * 60 * 60 * 1000; // 这里定义一天的毫秒数
|
|
|
+ const resultArray = [];
|
|
|
+ for (let i = 6; i >= 0; i--) {
|
|
|
+ const currentDate = new Date(Date.now() - i * oneDay); // 计算出每天的日期
|
|
|
+ const year = currentDate.getFullYear();
|
|
|
+ const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // 月份需要补零
|
|
|
+ const day = String(currentDate.getDate()).padStart(2, "0"); // 日期也需要补零
|
|
|
+ const formattedDate = `${month}-${day}`; // 格式化日期为 yyyy-mm-dd 的形式
|
|
|
+ resultArray.push(formattedDate);
|
|
|
+ }
|
|
|
+ return resultArray;
|
|
|
+};
|
|
|
|
|
|
onMounted(() => {
|
|
|
getBoxs();
|
|
|
getdevices();
|
|
|
- drawEchart();
|
|
|
-})
|
|
|
+ drawEchart();
|
|
|
+});
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.lineEchartsClass {
|
|
|
- height: 28vh;
|
|
|
- background: rgba(255, 255, 255, 0.85);
|
|
|
- border-radius: 8px 8px 8px 8px;
|
|
|
- box-shadow: 6px 6px 6px 6px rgba(0, 0, 0, 0.3);
|
|
|
-
|
|
|
- .title {
|
|
|
- font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
- font-weight: bold;
|
|
|
- font-size: 20px;
|
|
|
- color: #000000;
|
|
|
- line-height: 24px;
|
|
|
- text-align: left;
|
|
|
- font-style: normal;
|
|
|
- text-transform: none;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+ height: 28vh;
|
|
|
+ background: rgba(255, 255, 255, 0.85);
|
|
|
+ border-radius: 8px 8px 8px 8px;
|
|
|
+ box-shadow: 6px 6px 6px 6px rgba(0, 0, 0, 0.3);
|
|
|
|
|
|
-.stationkeyClass {
|
|
|
+ .title {
|
|
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 20px;
|
|
|
color: #000000;
|
|
|
- line-height: 15px;
|
|
|
+ line-height: 24px;
|
|
|
text-align: left;
|
|
|
font-style: normal;
|
|
|
text-transform: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.stationkeyClass {
|
|
|
+ font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 15px;
|
|
|
+ text-align: left;
|
|
|
+ font-style: normal;
|
|
|
+ text-transform: none;
|
|
|
}
|
|
|
|
|
|
.stationvalueClass {
|
|
|
- font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
- font-weight: bold;
|
|
|
- font-size: 24px;
|
|
|
- color: #000000;
|
|
|
- line-height: 11px;
|
|
|
- text-align: right;
|
|
|
- font-style: normal;
|
|
|
- text-transform: none;
|
|
|
+ font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 24px;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 11px;
|
|
|
+ text-align: right;
|
|
|
+ font-style: normal;
|
|
|
+ text-transform: none;
|
|
|
}
|
|
|
|
|
|
.stationunitClass {
|
|
|
- font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 12px;
|
|
|
- color: #000000;
|
|
|
- line-height: 11px;
|
|
|
- text-align: left;
|
|
|
- font-style: normal;
|
|
|
- text-transform: none;
|
|
|
+ font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 11px;
|
|
|
+ text-align: left;
|
|
|
+ font-style: normal;
|
|
|
+ text-transform: none;
|
|
|
}
|
|
|
|
|
|
-.imageDiv{
|
|
|
- width: 9vw;
|
|
|
- margin-top: 1vh;
|
|
|
+.imageDiv {
|
|
|
+ width: 9vw;
|
|
|
+ margin-top: 1vh;
|
|
|
}
|
|
|
</style>
|