实时数据展示

newCac1.0
fanluyan 8 months ago
parent 9ad36e2309
commit 78c7f6e5a0

@ -180,6 +180,7 @@ body {
transition: opacity 0.3s, transform 0.3s, left 0.3s, right 0.3s, top 0.4s, transition: opacity 0.3s, transform 0.3s, left 0.3s, right 0.3s, top 0.4s,
bottom 0.3s; bottom 0.3s;
overflow: hidden; overflow: hidden;
z-index: 2004;
.warnTitle { .warnTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

@ -41,19 +41,13 @@ export default {
path: "/home", path: "/home",
name: "首页", name: "首页",
}, },
{
path: "/dataReport",
name: "数据展示",
subs: [
{
path: "/dataReport",
name: "数据报表",
},
{ {
path: "/realtimeData", path: "/realtimeData",
name: "实时数据", name: "实时数据",
}, },
], {
path: "/dataReport",
name: "数据报表",
}, },
{ {

@ -783,6 +783,16 @@ export function updateStateApi(data) {
}); });
} }
// 一键处理 oneKeyUpdateState
export function oneKeyUpdateStateApi(data) {
return request({
url: "/warning/oneKeyUpdateState",
method: "post",
data,
});
}
//I2配置 //I2配置
//字段映射列表 //字段映射列表
export function listFieldConfigApi(data) { export function listFieldConfigApi(data) {

@ -37,6 +37,21 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="处理状态">
<el-select
v-model="formdata.stateVal"
placeholder="请选择"
@change="statechange"
>
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
<el-button <el-button
@ -46,6 +61,13 @@
@click="exportWarn" @click="exportWarn"
>导出数据</el-button >导出数据</el-button
> >
<el-button
type="danger"
icon="el-icon-bell"
class="exportBtn"
@click="clearWarnAll"
>一键处理</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -128,7 +150,11 @@
</template> </template>
<script> <script>
import { warningListApi, updateStateApi } from "@/utils/api/index"; import {
warningListApi,
updateStateApi,
oneKeyUpdateStateApi,
} from "@/utils/api/index";
export default { export default {
name: "warnDialog", name: "warnDialog",
components: {}, components: {},
@ -140,11 +166,23 @@ export default {
}, },
}, },
dialogVisible: false, dialogVisible: false,
formdata: {}, formdata: {
stateVal: 1,
},
tableData: [], tableData: [],
page: 1, // page: 1, //
pageSize: 20, // pageSize: 20, //
total: 0, // total: 0, //
stateOptions: [
{
value: 1,
label: "未处理",
},
{
value: 0,
label: "已处理",
},
],
}; };
}, },
created() { created() {
@ -217,7 +255,13 @@ export default {
console.log(val); console.log(val);
} }
}, },
//
statechange() {
// this.pageSize = 20;
// this.page = 1;
},
onSubmit() { onSubmit() {
this.page = 1;
console.log(this.formdata); console.log(this.formdata);
// //
this.formdata.starttime = this.$moment(this.formdata.starttime).format( this.formdata.starttime = this.$moment(this.formdata.starttime).format(
@ -231,6 +275,7 @@ export default {
params.endTime = this.formdata.endtime; params.endTime = this.formdata.endtime;
params.pageSize = this.pageSize; params.pageSize = this.pageSize;
params.pageNum = this.page; params.pageNum = this.page;
params.state = this.formdata.stateVal;
console.log(params); console.log(params);
this.getwarnList(params); this.getwarnList(params);
}, },
@ -247,6 +292,7 @@ export default {
); );
params.pageSize = this.pageSize; params.pageSize = this.pageSize;
params.pageNum = this.page; params.pageNum = this.page;
params.state = this.formdata.stateVal;
console.log(params); console.log(params);
this.getwarnList(params); this.getwarnList(params);
}, },
@ -263,6 +309,7 @@ export default {
); );
params.pageSize = this.pageSize; params.pageSize = this.pageSize;
params.pageNum = this.page; params.pageNum = this.page;
params.state = this.formdata.stateVal;
console.log(params); console.log(params);
this.getwarnList(params); this.getwarnList(params);
}, },
@ -317,6 +364,29 @@ export default {
}); });
}, 300); }, 300);
}, },
//
clearWarnAll() {
this.$confirm("此操作将一键处理所有告警, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
oneKeyUpdateStateApi()
.then((res) => {
console.log(res);
if (res.success) {
this.$message({
type: "success",
message: "一键处理告警成功!",
});
this.onSubmit();
}
})
.catch((err) => {
console.log(err); //
});
});
},
}, },
}; };
</script> </script>

@ -132,7 +132,6 @@ export default {
methods: { methods: {
lookMore() { lookMore() {
delete this.params.state; // state
this.params.startTime = this.starttime; this.params.startTime = this.starttime;
this.params.endTime = this.endtime; this.params.endTime = this.endtime;
this.params.pageSize = 20; this.params.pageSize = 20;
@ -236,7 +235,7 @@ export default {
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
&:first-child { &:first-child {
width: 12%; width: 13%;
} }
&:nth-child(2) { &:nth-child(2) {
width: 15%; width: 15%;
@ -281,7 +280,7 @@ export default {
width: 100%; width: 100%;
span { span {
&:first-child { &:first-child {
width: 12%; width: 13%;
} }
&:nth-child(2) { &:nth-child(2) {
width: 15%; width: 15%;

@ -1,6 +1,61 @@
<template> <template>
<div class="realtimeData"> <div class="realtimeData">
<div class="realcontain">
<div class="realHead"> <div class="realHead">
<h3>{{ msgTitle }}</h3>
<el-button
@click="handleTypeDraw"
type="primary"
style="margin-left: 16px"
>
选择设备类型
</el-button>
<el-button
@click="handleAreaDraw"
type="primary"
style="margin-left: 16px"
>
选择区域和主设备
</el-button>
<el-button
v-if="msgTitle == '设备类型实时数据'"
@click="exporTypeData"
type="primary"
style="margin-left: 16px"
>
按设备类型导出
</el-button>
<el-button
v-else
@click="exporZsbData"
type="primary"
style="margin-left: 16px"
>
按主设备导出
</el-button>
<el-drawer title="选择条件" :visible.sync="typedrawer" direction="ttb">
<div class="greyBox">
<div class="selectBox">
<h4>选择设备类型</h4>
<el-radio-group
v-model="deviceTypeVal"
size="mini"
@input="handletypeChange"
>
<el-radio
v-for="item in deviceTypeList"
:key="item.id"
:label="item.id"
border
>
{{ item.mc }}
</el-radio>
</el-radio-group>
</div>
</div>
</el-drawer>
<el-drawer title="选择条件" :visible.sync="areadrawer" direction="ttb">
<div class="greyBox"> <div class="greyBox">
<div class="selectBox"> <div class="selectBox">
<h4>选择区域</h4> <h4>选择区域</h4>
@ -41,26 +96,9 @@
<p class="empytBox">暂无数据</p> <p class="empytBox">暂无数据</p>
</div> </div>
</div> </div>
<!-- <div class="selectBox">
<h4>选则监控设备</h4>
<el-radio-group
v-model="jksbVal"
size="small"
@change="handlejksbChange"
>
<el-radio
v-for="item in jksbAllList"
:key="item.id"
:label="item.id"
border
>
{{ item.name }}
</el-radio>
</el-radio-group>
</div> -->
</div> </div>
</el-drawer>
</div> </div>
<div class="realcontain">
<div class="loadingbox" v-loading="dataLoading"> <div class="loadingbox" v-loading="dataLoading">
<div class="cardBox" v-if="jksbAllList.length !== 0"> <div class="cardBox" v-if="jksbAllList.length !== 0">
<el-card <el-card
@ -69,7 +107,9 @@
:key="index" :key="index"
> >
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="headTitle" :title="item.name">{{ item.name }}</span> <span class="headTitle" :title="item.name"
>{{ item.jgName }}/{{ item.zsbName }}/{{ item.name }}</span
>
<el-button <el-button
style="float: right; padding: 3px 0" style="float: right; padding: 3px 0"
type="text" type="text"
@ -171,7 +211,8 @@ import {
areaListAllApi, areaListAllApi,
zsbListAllApi, zsbListAllApi,
monitoringListAllApi, monitoringListAllApi,
getDetailApi, // getDetailApi,
modevtypeListAllApi,
} from "@/utils/api/index"; } from "@/utils/api/index";
import historyDialog from "./components/historyDialog"; import historyDialog from "./components/historyDialog";
export default { export default {
@ -179,14 +220,20 @@ export default {
components: { historyDialog }, components: { historyDialog },
data() { data() {
return { return {
msgTitle: "设备类型实时数据",
typedrawer: false,
areadrawer: false,
deviceTypeVal: null,
deviceTypeList: [], //
areaVal: null, areaVal: null,
areaAllList: [], areaAllList: [], //
zsbVal: null, zsbVal: null,
zsbAllList: [], zsbAllList: [], //
jksbAllList: [], jksbAllList: [], //
dataLoading: false, dataLoading: false,
intervalId: null, // setInterval ID intervalId: null, // setInterval ID
intervalIdType: null,
}; };
}, },
@ -197,10 +244,99 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.areaVal = JSON.parse(localStorage.getItem("areaVal")); this.areaVal = JSON.parse(localStorage.getItem("areaVal"));
this.zsbVal = JSON.parse(localStorage.getItem("zsbVal")); this.zsbVal = JSON.parse(localStorage.getItem("zsbVal"));
this.getAreaAllList(); this.deviceTypeVal = JSON.parse(localStorage.getItem("deviceTypeVal"));
this.getdeviceTypeAll();
}); });
}, },
methods: { methods: {
//
handleTypeDraw() {
this.typedrawer = true;
this.msgTitle = "设备类型实时数据";
this.getdeviceTypeAll();
},
//
handleAreaDraw() {
this.areadrawer = true;
this.msgTitle = "主设备实时数据";
this.getAreaAllList();
},
//
getdeviceTypeAll() {
modevtypeListAllApi()
.then((res) => {
console.log(res);
this.deviceTypeList = res.data;
// localStorage areaVal
const storeddeviceTypeVal = localStorage.getItem("deviceTypeVal");
if (storeddeviceTypeVal) {
// localStorage areaVal id this.areaVal
this.areaVal = JSON.parse(storeddeviceTypeVal);
} else {
// 使 res.data[0].id
this.deviceTypeVal = res.data[0]?.id; // 使 res.data[0] undefined
// areaVal localStorage
localStorage.setItem(
"deviceTypeVal",
JSON.stringify(this.deviceTypeVal)
);
}
this.getTypeAllList();
this.startIntervalIfNeededType();
this.stopInterval();
})
.catch((err) => {
console.log(err); //
});
},
handletypeChange(value) {
this.deviceTypeVal = value;
localStorage.removeItem("deviceTypeVal");
localStorage.setItem("deviceTypeVal", JSON.stringify(value));
this.jksbAllList = [];
this.getTypeAllList();
this.startIntervalIfNeededType();
this.stopInterval();
},
//
getTypeAllList() {
monitoringListAllApi({ typeId: this.deviceTypeVal })
.then((res) => {
console.log(res);
this.jksbAllList = res.data;
this.dataLoading = false;
})
.catch((err) => {
console.log(err); //
});
},
startIntervalIfNeededType() {
//
if (this.intervalIdType === null) {
this.intervalIdType = setInterval(this.getTypeAllList, 10000);
}
},
stopIntervalType() {
//
if (this.intervalIdType !== null) {
clearInterval(this.intervalIdType);
this.intervalIdType = null;
}
},
//
exporTypeData() {
window.location.href =
"/cac-api/nsensor/exportLatest?typeId=" + this.deviceTypeVal;
},
//
exporZsbData() {
window.location.href =
"/cac-api/nsensor/exportLatest?zsbid=" + this.zsbVal;
},
// //
getAreaAllList() { getAreaAllList() {
areaListAllApi() areaListAllApi()
@ -254,9 +390,9 @@ export default {
// localStorage.setItem("zsbVal", JSON.stringify(res.data[0].id)); // localStorage.setItem("zsbVal", JSON.stringify(res.data[0].id));
// getjcsbAllList // getjcsbAllList
this.getjcsbAllList(); this.getjcsbAllList();
// //
this.startIntervalIfNeeded(); this.startIntervalIfNeeded();
this.stopIntervalType();
}) })
.catch((err) => { .catch((err) => {
console.log(err); // console.log(err); //
@ -270,6 +406,8 @@ export default {
// //
this.startIntervalIfNeeded(); this.startIntervalIfNeeded();
this.stopIntervalType();
}, },
// //
getjcsbAllList() { getjcsbAllList() {
@ -309,6 +447,7 @@ export default {
beforeDestroy() { beforeDestroy() {
// //
this.stopInterval(); this.stopInterval();
this.stopIntervalType();
}, },
}; };
</script> </script>
@ -318,21 +457,26 @@ export default {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
.realHead { .realHead {
height: 200px; // height: 200px;
background: rgba(8, 9, 36, 0.28); // background: rgba(8, 9, 36, 0.28);
box-shadow: inset 0 4px 44px 0 #106cde; // box-shadow: inset 0 4px 44px 0 #106cde;
padding: 0px 12px; padding: 0px 12px;
margin-bottom: 20px; margin: 10px 0px;
display: flex;
align-items: center;
.el-drawer__wrapper {
.el-drawer__header {
margin-bottom: 14px;
}
}
.el-drawer {
height: 50% !important;
}
.greyBox { .greyBox {
background: rgba(8, 9, 36, 0.28); color: #000;
-webkit-backdrop-filter: blur(10px); //margin-top: 12px;
backdrop-filter: blur(10px);
box-shadow: inset 0 4px 44px 0 #106cde;
color: #fff;
margin-top: 12px;
margin-bottom: 12px; margin-bottom: 12px;
padding: 8px 0px; padding: 8px 0px;
height: calc(100% - 40px); height: calc(100% - 40px);
.selectBox { .selectBox {
display: flex; display: flex;
@ -340,7 +484,7 @@ export default {
margin-bottom: 12px; margin-bottom: 12px;
h4 { h4 {
color: #fff; color: #000;
margin-right: 12px; margin-right: 12px;
font-weight: normal; font-weight: normal;
width: 100px; width: 100px;
@ -352,21 +496,21 @@ export default {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
flex: 1; flex: 1;
color: #fff; color: #000;
.el-radio { .el-radio {
margin-bottom: 12px; margin-bottom: 12px;
margin-right: 12px; margin-right: 12px;
color: #fff; color: #000;
} }
.el-radio.is-bordered.is-checked { .el-radio.is-bordered.is-checked {
border-color: #66e6ff; border-color: #337ab7;
} }
.el-radio__input.is-checked + .el-radio__label { .el-radio__input.is-checked + .el-radio__label {
color: #66e6ff; color: #337ab7;
} }
.el-radio__input.is-checked .el-radio__inner { .el-radio__input.is-checked .el-radio__inner {
border-color: #66e6ff; border-color: #337ab7;
background: #66e6ff; background: #337ab7;
} }
} }
.zsbBox { .zsbBox {
@ -385,13 +529,14 @@ export default {
} }
} }
.realcontain { .realcontain {
height: calc(100% - 220px); height: calc(100% - 0px);
background: rgba(8, 9, 36, 0.28); background: rgba(8, 9, 36, 0.28);
box-shadow: inset 0 4px 44px 0 #106cde; box-shadow: inset 0 4px 44px 0 #106cde;
padding: 0px 12px; padding: 0px 12px;
overflow: auto;
.loadingbox { .loadingbox {
height: 100%; height: calc(100% - 64px);
overflow: auto;
} }
.cardBox { .cardBox {
display: flex; display: flex;
@ -406,14 +551,15 @@ export default {
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
box-shadow: inset 0 4px 44px 0 #106cde; box-shadow: inset 0 4px 44px 0 #106cde;
color: #fff; color: #fff;
width: 280px; width: 346px;
border: 1px solid #66e6ff; border: 1px solid #66e6ff;
.el-card__header { .el-card__header {
padding: 4px 8px; padding: 4px 8px;
border-bottom: 1px solid #66e6ff; border-bottom: 1px solid #66e6ff;
.headTitle { .headTitle {
font-weight: bold; font-weight: bold;
width: 180px; width: 250px;
font-size: 14px;
display: inline-block; display: inline-block;
overflow: hidden; /*超出部分隐藏*/ overflow: hidden; /*超出部分隐藏*/
text-overflow: ellipsis; /*超出部分省略号表示*/ text-overflow: ellipsis; /*超出部分省略号表示*/

Loading…
Cancel
Save