添加首页报表,下载

hn2.0
fanluyan 2 years ago
parent cd0069339a
commit 8589e39db5

@ -15,6 +15,23 @@ export function getTermStatistics(data) {
params: data, params: data,
}); });
} }
//获取一周的装置告警
export function getWeekAlarmStatistics(data) {
return request({
url: "/api/getWeekAlarmStatistics",
method: "get",
params: data,
});
}
//获取当天告警分类统计
export function getTodayAlarmStatistics(data) {
return request({
url: "/api/getTodayAlarmStatistics",
method: "get",
params: data,
});
}
//获取所有杆塔下的图片列表,实时监控 //获取所有杆塔下的图片列表,实时监控
export function getTowerAndPhotoList(data) { export function getTowerAndPhotoList(data) {
@ -747,3 +764,13 @@ export function getTermStatus(data) {
}, },
}); });
} }
//导出数据
export function getTerminalListExcel() {
return request({
url: "/api/getTerminalListExcel",
method: "post",
responseType: "blob",
});
}

@ -0,0 +1,111 @@
<template>
<el-dialog
title="历史图片"
:visible.sync="isShow"
class="historyPic"
width="1192px"
@close="handleclose"
>
<div v-loading="loadingpic">
<el-carousel
:loop="false"
:autoplay="false"
height="650px"
indicator-position="none"
>
<el-carousel-item v-for="(item, index) in imglist" :key="index">
<el-image
:src="item.path"
fit="contain"
v-if="item.mediaType == 0"
></el-image>
<el-image
:src="item.thumb"
fit="contain"
v-if="item.mediaType == 1"
></el-image>
</el-carousel-item>
</el-carousel>
</div>
</el-dialog>
</template>
<script>
import { getHistoryList } from "@/utils/api/index";
export default {
data() {
return {
isShow: false,
imglist: [],
page: 1, //
pageSize: 10, //
total: 0, //
selectnr: "", //
loadingpic: false,
};
},
mounted() {},
methods: {
//
getdataform(val) {
this.selectnr = val;
this.loadingpic = true;
getHistoryList({
channelId: this.selectnr.channelId,
termId: this.selectnr.termId,
pageindex: this.page,
pagesize: this.pageSize,
}).then((res) => {
this.loadingpic = false;
this.imglist = res.data.list;
this.total = res.data.total;
});
},
//
changebtn(e) {
console.log(e);
if (Math.floor(e / 9) == 1) {
this.page++;
getHistoryList({
channelId: this.selectnr.channelId,
termId: this.selectnr.termId,
pageindex: this.page,
pagesize: this.pageSize,
}).then((res) => {
this.imglist.push(res.data.list);
this.total = res.data.total;
});
}
},
display() {
this.isShow = true;
},
hide() {
this.isShow = false;
this.imglist = [];
},
handleclose() {
this.isShow = false;
this.imglist = [];
},
},
};
</script>
<style lang="less">
.historyPic {
.el-image {
width: 1152px;
height: 648px;
img {
width: 1152px;
height: 648px;
}
}
.el-carousel__arrow {
background: rgba(0, 0, 0, 0.5);
height: 40px;
width: 40px;
color: #169e8c;
font-size: 22px;
}
}
</style>

@ -1,46 +1,46 @@
<template> <template>
<el-dialog <el-dialog
title="历史图片"
:visible.sync="isShow"
class="historyPic"
width="1192px"
@close="handleclose" @close="handleclose"
title="历史图片"
:visible.sync="historyPicdialog"
width="1366px"
:close-on-click-modal="false"
class="showDialogHistoryPic"
> >
<div v-loading="loadingpic"> <div class="title">
<el-carousel {{ picInfoData.lineName }}-{{ picInfoData.towerName }}-{{
:loop="false" picInfoData.alias !== null && picInfoData.alias !== ""
:autoplay="false" ? picInfoData.alias
height="650px" : picInfoData.channnelname
indicator-position="none" }} {{ $moment(picInfoData.photoTime).format("YYYY-MM-DD ") }}
>
<el-carousel-item v-for="(item, index) in imglist" :key="index">
<el-image
:src="item.path"
fit="contain"
v-if="item.mediaType == 0"
></el-image>
<el-image
:src="item.thumb"
fit="contain"
v-if="item.mediaType == 1"
></el-image>
</el-carousel-item>
</el-carousel>
</div> </div>
<carouselChart
ref="carouselpic"
:terminalPhoto="terminalPhoto"
v-if="terminalPhoto.length > 0"
v-loading="historyPicLoading"
></carouselChart>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import carouselChart from "../../components/carouselChart.vue";
import { getHistoryList } from "@/utils/api/index"; import { getHistoryList } from "@/utils/api/index";
export default { export default {
components: {
carouselChart,
},
data() { data() {
return { return {
isShow: false,
imglist: [],
page: 1, // page: 1, //
pageSize: 10, // pageSize: 10, //
total: 0, // total: 0, //
selectnr: "", // selectnr: "", //
loadingpic: false, historyPicLoading: false,
historyPicdialog: false,
//
picInfoData: {}, //
terminalPhoto: [], //
nopicPath: require("@/assets/img/nopic.jpg"),
}; };
}, },
mounted() {}, mounted() {},
@ -48,15 +48,18 @@ export default {
// //
getdataform(val) { getdataform(val) {
this.selectnr = val; this.selectnr = val;
this.loadingpic = true; this.historyPicLoading = true;
getHistoryList({ getHistoryList({
channelId: this.selectnr.channelId, channelId: this.selectnr.channelId,
termId: this.selectnr.termId, termId: this.selectnr.termId,
pageindex: this.page, pageindex: this.page,
pagesize: this.pageSize, pagesize: this.pageSize,
}).then((res) => { }).then((res) => {
this.loadingpic = false; console.log(res);
this.imglist = res.data.list;
this.historyPicLoading = false;
this.terminalPhoto = res.data.list;
this.total = res.data.total; this.total = res.data.total;
}); });
}, },
@ -71,41 +74,43 @@ export default {
pageindex: this.page, pageindex: this.page,
pagesize: this.pageSize, pagesize: this.pageSize,
}).then((res) => { }).then((res) => {
this.imglist.push(res.data.list); this.terminalPhoto.push(res.data.list);
this.total = res.data.total; this.total = res.data.total;
}); });
} }
}, },
display() { display(data) {
this.isShow = true; this.historyPicdialog = true;
this.picInfoData = data;
console.log(data);
}, },
hide() { hide() {
this.isShow = false; this.historyPicdialog = false;
this.imglist = []; this.terminalPhoto = [];
}, },
handleclose() { handleclose() {
this.isShow = false; this.historyPicdialog = false;
this.imglist = []; this.terminalPhoto = [];
}, },
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
.historyPic { .showDialogHistoryPic {
.el-image { .el-dialog__body {
width: 1152px; height: 768px;
height: 648px; .title {
img { height: 32px;
width: 1152px; padding-left: 12px;
height: 648px; line-height: 32px;
color: #fff;
font-size: 14px;
background: linear-gradient(180deg, #4cdbc8 10%, #128071 100%);
text-align: center;
}
.thumb-example {
//height: 100%;
} }
}
.el-carousel__arrow {
background: rgba(0, 0, 0, 0.5);
height: 40px;
width: 40px;
color: #169e8c;
font-size: 22px;
} }
} }
</style> </style>

@ -924,8 +924,8 @@ export default {
}, },
// //
handleHistory() { handleHistory(val) {
this.$refs.historyimg_ref.display(); this.$refs.historyimg_ref.display(val);
this.$refs.historyimg_ref.getdataform(this.selectRow); this.$refs.historyimg_ref.getdataform(this.selectRow);
}, },
// //
@ -946,7 +946,7 @@ export default {
handlePicHistory(val) { handlePicHistory(val) {
console.log(val); console.log(val);
this.selectRow = val; this.selectRow = val;
this.handleHistory(); this.handleHistory(val);
}, },
handlePicAlarm(val, index) { handlePicAlarm(val, index) {
console.log(val, index); console.log(val, index);

@ -3,9 +3,20 @@
<div class="photoBox"> <div class="photoBox">
<div class="photoGraphicBtnGroup"> <div class="photoGraphicBtnGroup">
<h4>拍照装置管理</h4> <h4>拍照装置管理</h4>
<el-button type="primary" icon="el-icon-plus" @click="handleAddPhoto()" <div>
>新增</el-button <el-button
> type="primary"
icon="el-icon-plus"
@click="handleAddPhoto()"
>新增</el-button
>
<el-button
type="primary"
icon="el-icon-document"
@click="handleExport()"
>导出</el-button
>
</div>
</div> </div>
<div class="searchBox"> <div class="searchBox">
<el-form :inline="true" :model="formdata" class="demo-form-inline"> <el-form :inline="true" :model="formdata" class="demo-form-inline">
@ -402,6 +413,7 @@ import {
resetTerminalApi, resetTerminalApi,
setTermGPSJoggle, setTermGPSJoggle,
getSearchInfo, getSearchInfo,
getTerminalListExcel,
} from "@/utils/api/index"; } from "@/utils/api/index";
import moment from "moment"; import moment from "moment";
import addPhotoDialog from "./components/addPhotoDialog.vue"; import addPhotoDialog from "./components/addPhotoDialog.vue";
@ -582,6 +594,11 @@ export default {
this.$refs.addPhotoDialogref.display(); this.$refs.addPhotoDialogref.display();
this.$refs.addPhotoDialogref.getdataform(null); this.$refs.addPhotoDialogref.getdataform(null);
}, },
//
handleExport() {
window.location.href = "/api/api/getTerminalListExcel";
},
//handleResive 线 //handleResive 线
handleRevisePhoto(data) { handleRevisePhoto(data) {
this.photoDialogTitle = "修改"; this.photoDialogTitle = "修改";

@ -305,16 +305,16 @@ export default {
: 15; : 15;
this.rowNum = parseInt(localStorage.getItem("row")) this.rowNum = parseInt(localStorage.getItem("row"))
? parseInt(localStorage.getItem("row")) ? parseInt(localStorage.getItem("row"))
: 2; : 4;
this.colNum = parseInt(localStorage.getItem("col")) this.colNum = parseInt(localStorage.getItem("col"))
? parseInt(localStorage.getItem("col")) ? parseInt(localStorage.getItem("col"))
: 2; : 4;
this.rowradio = parseInt(localStorage.getItem("row")) this.rowradio = parseInt(localStorage.getItem("row"))
? parseInt(localStorage.getItem("row")) ? parseInt(localStorage.getItem("row"))
: 2; : 4;
this.colradio = parseInt(localStorage.getItem("col")) this.colradio = parseInt(localStorage.getItem("col"))
? parseInt(localStorage.getItem("col")) ? parseInt(localStorage.getItem("col"))
: 2; : 4;
}, },
submitForm() { submitForm() {
localStorage.setItem("totalTime", this.selSpeed); localStorage.setItem("totalTime", this.selSpeed);
@ -322,10 +322,10 @@ export default {
localStorage.setItem("col", this.colradio); localStorage.setItem("col", this.colradio);
this.rowNum = parseInt(localStorage.getItem("row")) this.rowNum = parseInt(localStorage.getItem("row"))
? parseInt(localStorage.getItem("row")) ? parseInt(localStorage.getItem("row"))
: 2; : 4;
this.colNum = parseInt(localStorage.getItem("col")) this.colNum = parseInt(localStorage.getItem("col"))
? parseInt(localStorage.getItem("col")) ? parseInt(localStorage.getItem("col"))
: 2; : 4;
this.pageSize = this.rowradio * this.colradio; this.pageSize = this.rowradio * this.colradio;
this.setdialog = false; this.setdialog = false;
this.$message.success("设置成功"); this.$message.success("设置成功");
@ -406,10 +406,10 @@ export default {
: 15; : 15;
this.rowradio = this.rowNum = parseInt(localStorage.getItem("row")) this.rowradio = this.rowNum = parseInt(localStorage.getItem("row"))
? parseInt(localStorage.getItem("row")) ? parseInt(localStorage.getItem("row"))
: 2; : 4;
this.colradio = this.colNum = parseInt(localStorage.getItem("col")) this.colradio = this.colNum = parseInt(localStorage.getItem("col"))
? parseInt(localStorage.getItem("col")) ? parseInt(localStorage.getItem("col"))
: 2; : 4;
this.pageSize = this.rowradio * this.colradio; this.pageSize = this.rowradio * this.colradio;
this.toggleCountdown(); this.toggleCountdown();
}, },

@ -314,7 +314,7 @@ export default {
selectDyId: "", //线 selectDyId: "", //线
selectLineId: "", selectLineId: "",
selectTowerId: "", selectTowerId: "",
currentId: "", currentData: "", //
}; };
}, },
watch: { watch: {
@ -375,9 +375,10 @@ export default {
this.towertitle = data.name; this.towertitle = data.name;
this.zzCmdid = data.cmdid; this.zzCmdid = data.cmdid;
this.getChannelList(data.id); this.getChannelList(data.id);
// this.getTerminalPhotoList(id, date, data.id); // this.getTerminalPhotoList(id, date, data.id);
} }
localStorage.setItem("currentId", data.id); localStorage.setItem("currentData", JSON.stringify(this.selectData));
}, },
// //
getLineTreeStatus() { getLineTreeStatus() {
@ -409,22 +410,29 @@ export default {
console.log(this.lineTreeData); console.log(this.lineTreeData);
this.onlineNum = res.data.onlineNum; this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData"));
if (this.lineTreeData[0].list[0].list.length > 0) { if (this.lineTreeData[0].list[0].list.length > 0) {
this.selectData = this.lineTreeData[0]; // if (Object.keys(this.currentData).length !== 0) {
this.emptyText = "暂无数据"; this.currentNodekey = this.currentData.id;
this.currentNodekey = this.lineTreeData[0].id; // this.handleNodeClick(this.currentData);
this.type = 1; } else {
this.newCurrentId = this.lineTreeData[0].id; this.selectData = this.lineTreeData[0]; //
this.previewData = this.lineTreeData[0]; // this.emptyText = "暂无数据";
//localStorage.setItem("currentId", this.currentNodekey); this.currentNodekey = this.lineTreeData[0].id; //
this.$nextTick(() => { this.type = 1;
this.$refs.tree.setCurrentKey(this.currentNodekey); // this.newCurrentId = this.lineTreeData[0].id;
this.previewData = this.lineTreeData[0]; //
this.channelId = this.currentNodekey; this.channelId = this.currentNodekey;
this.$refs.previewRef.getPicList( this.$refs.previewRef.getPicList(
this.currentNodekey, this.currentNodekey,
this.type, this.type,
this.page this.page
); );
}
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentNodekey); //
}); });
} }
}) })
@ -592,6 +600,7 @@ export default {
if (node) { if (node) {
this.$nextTick(() => { this.$nextTick(() => {
// scrollIntoViewdom block: 'center' // scrollIntoViewdom block: 'center'
console.log(node);
node.scrollIntoView({ block: "center" }); node.scrollIntoView({ block: "center" });
}); });
} }
@ -651,6 +660,7 @@ export default {
this.picTime = res.data.taketime; // this.picTime = res.data.taketime; //
console.log(this.requestId); console.log(this.requestId);
this.btnvideoloading = true; this.btnvideoloading = true;
this.getTakePicStatus(this.requestId);
this.statusTimer = window.setInterval(() => { this.statusTimer = window.setInterval(() => {
this.getTakePicStatus(this.requestId); this.getTakePicStatus(this.requestId);
this.statusNum++; this.statusNum++;
@ -693,6 +703,8 @@ export default {
}); });
} else if (res.data == 1) { } else if (res.data == 1) {
this.statusNum = 0; this.statusNum = 0;
this.btnpicloading = false;
this.btnvideoloading = false;
clearInterval(this.statusTimer); clearInterval(this.statusTimer);
this.statusTimer = null; this.statusTimer = null;
this.$message({ this.$message({
@ -707,6 +719,8 @@ export default {
}, 8000); }, 8000);
} else if (res.data == 2) { } else if (res.data == 2) {
this.statusNum = 0; this.statusNum = 0;
this.btnpicloading = false;
this.btnvideoloading = false;
clearInterval(this.statusTimer); clearInterval(this.statusTimer);
this.statusTimer = null; this.statusTimer = null;
this.$message({ this.$message({
@ -982,6 +996,16 @@ export default {
this.timer = null; this.timer = null;
} //vue } //vue
}, },
beforeRouteLeave(to, from, next) {
//
next();
if (this.timer) {
console.log(this.timer);
clearInterval(this.timer);
this.timer = null;
}
},
}; };
</script> </script>
@ -1028,13 +1052,20 @@ export default {
} }
} }
.el-tree { .el-tree {
overflow: auto; overflow-y: auto;
overflow-x: hidden;
.el-tree-node__content { .el-tree-node__content {
height: 32px; height: 32px;
font-size: 12px; font-size: 12px;
} }
.custom-tree-node { .custom-tree-node {
color: #333; color: #333;
overflow: hidden;
span {
display: flex;
display: inline-table;
overflow: hidden;
}
} }
} }
@ -1046,6 +1077,15 @@ export default {
background: #169e8c; background: #169e8c;
.custom-tree-node { .custom-tree-node {
color: #fff; color: #fff;
//overflow: hidden;
span {
display: flex;
//overflow: hidden;
.iconfont {
//width: 30px;
display: inline-table;
}
}
} }
} }

@ -1,216 +0,0 @@
<template>
<div class="parameterArea">
<div class="timeBox"></div>
<div class="monitorItemBox">
<h3>检测项</h3>
<div class="btnBox">
<el-button
type="primary"
v-for="(item, index) in MonitorItem"
:key="index"
icon="el-icon-thumb"
>{{ item.name }}</el-button
>
</div>
</div>
<div class="monitorPointBox">
<h3>监拍点</h3>
<div class="btnBox">
<el-button
type="primary"
v-for="(item, index) in MonitorPoint"
:key="index"
icon="el-icon-thumb"
>{{ item.name }}</el-button
>
</div>
</div>
<div class="actionItem">
<h3>操作项</h3>
<div class="btnBox">
<el-button
type="primary"
v-for="(item, index) in actionItem"
:key="index"
icon="el-icon-thumb"
>{{ item.name }}</el-button
>
</div>
</div>
<div class="configItem">
<h3>配置项</h3>
<div class="btnBox">
<el-button
type="primary"
v-for="(item, index) in configItem"
:key="index"
icon="el-icon-thumb"
>{{ item.name }}</el-button
>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
//
MonitorItem: [
{
name: "图片视频",
},
{
name: "测温",
},
{
name: "微气象",
},
{
name: "倾斜监测",
},
{
name: "风偏监测",
},
{
name: "覆冰检测",
},
{
name: "实时视频",
},
{
name: "弧垂",
},
{
name: "电压检测",
},
],
//
MonitorPoint: [
{
name: "小号侧",
},
{
name: "大号侧",
},
],
//
actionItem: [
{
name: "主动拍照",
},
{
name: "主动录像",
},
{
name: "声光报警",
},
{
name: "图片调阅",
},
{
name: "微信推送",
},
{
name: "历史图片",
},
{
name: "线缆绘制",
},
{
name: "清除绘制",
},
{
name: "主动巡检",
},
{
name: "指令集",
},
{
name: "开启雨刮",
},
{
name: "喊话",
},
{
name: "上一设备",
},
{
name: "下一设备",
},
{
name: "返回",
},
{
name: "历史对比",
},
{
name: "图片标记",
},
{
name: "主动巡航",
},
],
//
configItem: [
{
name: "设置分组",
},
{
name: "隐患类型",
},
{
name: "地图查看",
},
{
name: "监拍点信息",
},
{
name: "告警级别",
},
{
name: "设备信息",
},
{
name: "设置漏告",
},
],
};
},
};
</script>
<style lang="less">
// .parameterArea {
// width: 300px;
// padding: 16px 8px;
// .monitorItemBox,
// .monitorPointBox,
// .actionItem,
// .configItem {
// border: 1px solid @border-color-base;
// padding: 8px 16px 8px 16px;
// margin-bottom: 32px;
// h3 {
// font-size: 16px;
// margin-bottom: 8px;
// background: transparent;
// color: @color-text-regular;
// }
// .btnBox {
// display: flex;
// flex-wrap: wrap;
// justify-content: space-between;
// .el-button {
// width: 84px;
// padding: 6px 0px;
// font-size: 12px;
// margin-bottom: 8px;
// }
// .el-button + .el-button {
// margin-left: 0px;
// }
// }
// }
// }
</style>

@ -107,7 +107,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="pictureBox" v-loading="loading"> <div class="pictureBox" v-loading="loading" v-infinite-scroll>
<div v-if="picList.length !== 0" style="width: 100%"> <div v-if="picList.length !== 0" style="width: 100%">
<el-card <el-card
class="box-card imgList" class="box-card imgList"

@ -1,94 +1,84 @@
<template> <template>
<div class="stritleEchartsPage"> <div class="stritleEchartsPage">
<div class="echart-top"> <div class="echart-top">
<el-card class="box-card"> <el-card class="box-card" v-loading="numloading">
<h3>装置数量统计</h3> <h3>装置数量统计</h3>
<div class="bottomM"> <div class="bottomM">
<div class="infoBox"> <div class="infoBox">
<p> <p>
<span>装置总数</span> <span>装置总数</span>
<span>260</span> <span>{{ termDataNum.totalNum }}</span>
</p> </p>
<p> <p>
<span>在线数量</span> <span>在线数量</span>
<span>4</span> <span>{{ termDataNum.onlineNum }}</span>
</p> </p>
<p> <p>
<span>离线率</span> <span>离线率</span>
<span>99.85%</span> <span>{{ (termDataNum.offlinePercent * 100).toFixed(2) }}%</span>
</p> </p>
<p> <p>
<span>在线率</span> <span>在线率</span>
<span>0.15%</span> <span>{{ (termDataNum.onlinePercent * 100).toFixed(2) }}%</span>
</p> </p>
</div> </div>
</div> </div>
<!-- <div id="echart1" style="width: 100%; height: 100%"></div> -->
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
<h3>装置在线统计</h3> <h3>装置在线统计</h3>
<div id="echart2" style="width: 100%; height: 100%"></div> <div id="echart2" class="chartClass" v-loading="pieloading"></div>
</el-card> </el-card>
</div> </div>
<div class="echart-top"> <div class="echart-top">
<el-card class="box-card"> <el-card class="box-card" v-loading="barloading">
<h3>隐患数量统计</h3> <h3>7天告警数量统计</h3>
<div class="dateBox"> <div class="dateBox">
<span class="datemsg">当前日期前七天</span>
<el-date-picker <el-date-picker
v-model="value1" v-model="dateValue"
type="daterange" align="right"
range-separator="至" type="date"
start-placeholder="开始日期" placeholder="选择日期"
end-placeholder="结束日期" :picker-options="singpickerOptions"
@change="changedate" @change="changedate"
:picker-options="morepickerOptions"
> >
</el-date-picker> </el-date-picker>
</div> </div>
<div id="echart3" style="width: 100%; height: 100%"></div> <div id="echart3" class="chartClass"></div>
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card" v-loading="pie2loading">
<h3>隐患分类统计</h3> <h3>告警类型统计</h3>
<div class="dateBox"> <div class="dateBox">
<el-date-picker <el-date-picker
v-model="value2" v-model="dateValue2"
align="right" align="right"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
:picker-options="singpickerOptions" :picker-options="singpickerOptions"
@change="changedate2"
> >
</el-date-picker> </el-date-picker>
</div> </div>
<div id="echart4" style="width: 100%; height: 100%"></div> <div id="echart4" class="chartClass"></div>
</el-card> </el-card>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getTermStatistics } from "@/utils/api/index"; import {
getTermStatistics,
getWeekAlarmStatistics,
getTodayAlarmStatistics,
} from "@/utils/api/index";
export default { export default {
name: "", name: "",
data() { data() {
return { return {
termDataNum: "", termDataNum: "", //
value1: "", dateValue: "", //7
value2: "", dateValue2: "", //
morepickerOptions: { weekData: [], //7
disabledDate(time) { todayAlarm: [], //
return time.getTime() > Date.now();
},
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
],
},
singpickerOptions: { singpickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() > Date.now(); return time.getTime() > Date.now();
@ -97,12 +87,17 @@ export default {
myChart2: "", myChart2: "",
myChart3: "", myChart3: "",
myChart4: "", myChart4: "",
numloading: false,
pieloading: false,
barloading: false,
pie2loading: false,
}; };
}, },
mounted() { mounted() {
this.getDateTime(); //
this.getTermData(); this.getTermData();
this.init(); this.getWeekAlarmStatistics();
console.log(this.value1); this.getTodayAlarmStatistics();
}, },
watch: { watch: {
"$store.state.collapse"(val) { "$store.state.collapse"(val) {
@ -117,25 +112,68 @@ export default {
}, },
}, },
methods: { methods: {
//
changedate() { changedate() {
console.log(this.value1); console.log(this.dateValue.getTime());
this.dateValue = this.dateValue.getTime();
this.getWeekAlarmStatistics();
},
//
changedate2() {
console.log(this.dateValue2.getTime());
this.dateValue = this.dateValue2.getTime();
this.getTodayAlarmStatistics();
},
//
getDateTime() {
console.log(new Date());
this.dateValue = new Date().getTime();
this.dateValue2 = new Date().getTime();
console.log(this.dateValue);
//console.log(this.$moment(this.dateValue).format("yy-MM-DD"));
}, },
//
getTermData() { getTermData() {
this.numloading = true;
this.pieloading = true;
getTermStatistics() getTermStatistics()
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.termDataNum = res.data; this.termDataNum = res.data;
this.numloading = false;
this.pieloading = false;
this.getEchart2();
}) })
.catch((err) => {}); .catch((err) => {});
}, },
init() { //7
this.getEchart2(); getWeekAlarmStatistics() {
this.getEchart3(); this.barloading = true;
this.getEchart4(); getWeekAlarmStatistics({ starttime: this.dateValue })
.then((res) => {
console.log(res);
this.weekData = res.data.list;
this.barloading = false;
this.getEchart3();
})
.catch((err) => {});
}, },
//
getTodayAlarmStatistics() {
this.pie2loading = true;
getTodayAlarmStatistics({ starttime: this.dateValue2 })
.then((res) => {
console.log(res);
this.todayAlarm = res.data.list;
this.pie2loading = false;
this.getEchart4();
})
.catch((err) => {});
},
//
getEchart2() { getEchart2() {
this.$nextTick(() => { this.$nextTick(() => {
console.log(this.termDataNum);
this.$echarts.init(document.getElementById("echart2")).dispose(); this.$echarts.init(document.getElementById("echart2")).dispose();
this.myChart2 = this.$echarts.init(document.getElementById("echart2")); this.myChart2 = this.$echarts.init(document.getElementById("echart2"));
let option = { let option = {
@ -147,7 +185,7 @@ export default {
}, },
legend: { legend: {
top: "5%", top: "5%",
left: "center", left: "left",
}, },
series: [ series: [
{ {
@ -178,8 +216,8 @@ export default {
show: true, show: true,
}, },
data: [ data: [
{ value: 1048, name: "在线" }, { value: this.termDataNum.onlineNum, name: "在线" },
{ value: 735, name: "离线" }, { value: this.termDataNum.offlineNum, name: "离线" },
], ],
}, },
], ],
@ -190,7 +228,7 @@ export default {
}); });
}); });
}, },
//7
getEchart3() { getEchart3() {
this.$nextTick(() => { this.$nextTick(() => {
this.$echarts.init(document.getElementById("echart3")).dispose(); this.$echarts.init(document.getElementById("echart3")).dispose();
@ -199,14 +237,29 @@ export default {
// title: { // title: {
// text: "", // text: "",
// }, // },
color: ["#169e8c"],
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
xAxis: { xAxis: {
type: "category", type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], data: this.weekData.map((x) => {
return this.$moment(x.date).format("yy-MM-DD");
}),
axisTick: {
alignWithLabel: true,
},
}, },
yAxis: { type: "value" }, yAxis: { type: "value" },
series: [ series: [
{ {
data: [120, 200, 150, 80, 70, 110, 130], name: "告警数量",
data: this.weekData.map((x) => {
return x.num;
}),
type: "bar", type: "bar",
showBackground: true, showBackground: true,
backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" }, backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" },
@ -219,25 +272,92 @@ export default {
}); });
}); });
}, },
//
getEchart4() { getEchart4() {
this.$nextTick(() => { this.$nextTick(() => {
this.$echarts.init(document.getElementById("echart4")).dispose(); this.$echarts.init(document.getElementById("echart4")).dispose();
this.myChart4 = this.$echarts.init(document.getElementById("echart4")); this.myChart4 = this.$echarts.init(document.getElementById("echart4"));
let arr = [];
this.todayAlarm.forEach((element) => {
arr.push({
value: element.num, //numvalue
name: element.enname, //namename
});
});
let option = { let option = {
// title: { // title: {
// text: "", // text: "",
// }, // },
xAxis: { // tooltip: {
type: "category", // trigger: "axis",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], // axisPointer: {
// type: "shadow",
// },
// },
// xAxis: {
// type: "category",
// data: this.todayAlarm.map((item) => {
// return item.enname;
// }),
// axisTick: {
// alignWithLabel: true,
// },
// },
// yAxis: { type: "value" },
// series: [
// {
// name: "",
// data: this.todayAlarm.map((item) => {
// return item.num;
// }),
// type: "bar",
// showBackground: true,
// backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" },
// },
// ],
// title: {
// text: "线",
// },
tooltip: {
trigger: "item",
},
legend: {
type: "scroll",
orient: "vertical",
right: 10,
top: 20,
bottom: 20,
}, },
yAxis: { type: "value" },
series: [ series: [
{ {
data: [120, 200, 150, 80, 70, 110, 130], type: "pie",
type: "bar", radius: ["40%", "70%"],
showBackground: true, avoidLabelOverlap: false,
backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" },
itemStyle: {
borderRadius: 10,
borderColor: "#fff",
borderWidth: 2,
},
label: {
show: true,
fontSize: 16,
fontWeight: "bold",
formatter: "{b}\n{d}%",
},
emphasis: {
label: {
show: true,
fontSize: 26,
fontWeight: "bold",
formatter: "{b}\n{d}%",
},
},
labelLine: {
show: true,
},
data: arr,
}, },
], ],
}; };
@ -270,6 +390,10 @@ export default {
} }
} }
.box-card { .box-card {
.chartClass {
height: calc(100% - 32px);
width: 100%;
}
h3 { h3 {
font-size: 18px; font-size: 18px;
color: #333; color: #333;
@ -285,10 +409,11 @@ export default {
width: 40%; width: 40%;
height: 88px; height: 88px;
text-align: center; text-align: center;
margin: 28px; margin: 4%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
span { span {
color: #333; color: #333;
font-size: 16px; font-size: 16px;
@ -299,57 +424,22 @@ export default {
} }
} }
&:first-child { &:first-child {
//background: url("../../assets/img/border-blue.png"); span {
background: linear-gradient( &:last-child {
to bottom, color: #128071;
rgb(22, 158, 140, 0.3) 0%, }
rgba(255, 255, 255, 0.1) 30%, }
rgba(255, 255, 255, 0.1) 40%,
rgba(255, 255, 255, 0.1) 50%,
rgba(255, 255, 255, 0.1) 60%,
rgba(255, 255, 255, 0.1) 70%,
rgb(22, 158, 140, 0.3) 100%
);
} }
&:nth-child(2) { &:nth-child(2) {
background: url("../../assets/img/border-green.png"); span {
&:last-child {
background: linear-gradient( color: #409eff;
to bottom, }
rgb(0, 234, 27, 0.3) 0%, }
rgba(255, 255, 255, 0.1) 30%,
rgba(255, 255, 255, 0.1) 40%,
rgba(255, 255, 255, 0.1) 50%,
rgba(255, 255, 255, 0.1) 60%,
rgba(255, 255, 255, 0.1) 70%,
rgb(0, 234, 27, 0.3) 100%
);
} }
&:nth-child(3) { &:nth-child(3) {
background: url("../../assets/img/border-yellow.png");
background: linear-gradient(
to bottom,
rgb(207, 222, 44, 0.3) 0%,
rgba(255, 255, 255, 0.1) 30%,
rgba(255, 255, 255, 0.1) 40%,
rgba(255, 255, 255, 0.1) 50%,
rgba(255, 255, 255, 0.1) 60%,
rgba(255, 255, 255, 0.1) 70%,
rgb(207, 222, 44, 0.3) 100%
);
} }
&:nth-child(4) { &:nth-child(4) {
background: url("../../assets/img/border-gray.png");
background: linear-gradient(
to bottom,
rgb(84, 112, 198, 0.3) 0%,
rgba(255, 255, 255, 0.1) 30%,
rgba(255, 255, 255, 0.1) 40%,
rgba(255, 255, 255, 0.1) 50%,
rgba(255, 255, 255, 0.1) 60%,
rgba(255, 255, 255, 0.1) 70%,
rgb(84, 112, 198, 0.3) 100%
);
} }
} }
} }
@ -358,6 +448,10 @@ export default {
position: absolute; position: absolute;
top: 20px; top: 20px;
right: 20px; right: 20px;
.datemsg {
margin-right: 8px;
font-size: 12px;
}
} }
} }
} }

Loading…
Cancel
Save