Commit e386c6c7 authored by lei's avatar lei

7日报警信息接口对接

parent 8e383cdf
......@@ -42,3 +42,12 @@ export function getDeviceStatus(query) {
params: query,
});
}
// 查询近7日报警信息
export function getRecentSevDaysAlarms(query) {
return request({
url: "/business/screen/env/recentSevDaysAlarms",
method: "get",
params: query,
});
}
......@@ -86,14 +86,14 @@
<div class="sidebar-item H286 alert-analysis">
<div class="sub-title por">
<span>历史数据图</span>
<span class="scroll-title">{{ sssjName }}</span>
<span class="scroll-title">{{ rightTopLssjData.name }}</span>
</div>
<div class="sub-con">
<div class="sub-con">
<span
v-for="(item, i) in sssjData"
v-for="(item, i) in rightTopLssjData.list"
:key="i"
:class="i == sssjMark ? 'active' : ''"
:class="i == rightTopLssjData.mark ? 'active' : ''"
>{{ item.name }}
<p class="subscript"></p>
</span>
......@@ -105,14 +105,14 @@
<div class="sidebar-item H286 alert-analysis">
<div class="sub-title por">
<span>历史数据图</span>
<span class="scroll-title">1</span>
<span class="scroll-title">{{ rightCenterLssjData.name }}</span>
</div>
<div class="sub-con">
<div class="sub-con">
<span
v-for="(item, i) in sssjData"
v-for="(item, i) in rightCenterLssjData.list"
:key="i"
:class="i == sssjMark ? 'active' : ''"
:class="i == rightCenterLssjData.mark ? 'active' : ''"
>{{ item.name }}
<p class="subscript"></p>
</span>
......@@ -178,6 +178,8 @@ import {
getRtData,
getDeviceStatus,
getDeviceData,
getRcData,
getRecentSevDaysAlarms,
} from "@/api/tyler/hjjc";
import ScrollTable from "@/components/Tyler/ScrollTable.vue";
import screenfull from "screenfull";
......@@ -206,34 +208,60 @@ export default {
autoPlay: true,
},
// 设备定位分类开关
checkList: ["1", "2"],
checkList: ["2"],
// 右下滚动 参数
classOption2: {
singleHeight: 47,
hoverStop: true,
},
// 左侧实施数据列表
sssjData: [
{
name: "",
value: [
{
data: {
xData: {
data: [],
rightTopLssjData: {
list: [
{
name: "",
value: [
{
data: {
xData: {
data: [],
},
yData: {
data: [],
},
},
yData: {
data: [],
},
],
},
],
// 右上设备轮播下标
mark: 0,
// 右上设备轮播名称
name: "",
},
// 左侧实施数据列表
rightCenterLssjData: {
list: [
{
name: "",
value: [
{
data: {
xData: {
data: [],
},
yData: {
data: [],
},
},
},
},
],
},
],
// 右上设备轮播下标
sssjMark: 0,
// 右上设备轮播名称
sssjName: "",
],
},
],
// 右上设备轮播下标
mark: 0,
// 右上设备轮播名称
name: "",
},
// 右下 列表数据
tableData2: [
{
......@@ -309,14 +337,24 @@ export default {
}
// this.initEchartBox("right", this.salvProName, this.salvProValue, 28);
// this.initEchartBox("sssj", this.salvProName, this.salvProValue, 28);
this.initRealData();
getRtData().then((res) => {
this.sssjData = res.data;
this.playFun(this.sssjData);
this.rightTopLssjData.list = res.data || [];
this.rtPlayFun(this.rightTopLssjData);
});
getRcData().then((res) => {
this.rightCenterLssjData.list = res.data || [];
this.rcPlayFun(this.rightTopLssjData);
});
getDeviceStatus().then((res) => {
this.equipmentList = res.data;
});
getRecentSevDaysAlarms().then((res) => {
//数据空
});
//初始化获取左侧环境监测实施数据
getRealData().then((res) => {
this.tableData1 = res.data;
});
},
created() {},
methods: {
......@@ -324,16 +362,10 @@ export default {
getItemField(item, fieldKey) {
return item[this.fieldMap[fieldKey]] || "";
},
//初始化获取左侧环境监测实施数据
initRealData() {
getRealData().then((res) => {
this.tableData1 = res.data;
});
},
// 初始化eChartDOM
initEchartBox(id, xData = [], yData = [], mkData = 28, step = 4, grid) {
let that = this;
let myChart = echarts.init(document.getElementById(id));
let myChart = null;
myChart = echarts.init(document.getElementById(id));
let option = {
grid: grid,
xAxis: {
......@@ -363,6 +395,7 @@ export default {
},
yAxis: {
type: "value",
max: 50,
boundaryGap: false,
axisTick: {
alignWithLabel: true,
......@@ -433,10 +466,16 @@ export default {
setTimeout(() => {
myChart.resize();
}, 600);
this.$on("hook:deactivated", () => {
if (myChart != null && myChart != "" && myChart != undefined) {
myChart.dispose();
}
myChart = null;
});
},
// 轮播eChart
// 更改数据达到轮播效果
playFun(list = []) {
rtPlayFun(data) {
// 启动定时器,每隔 3 秒执行一次
let i = 0;
let l = 0;
......@@ -448,17 +487,21 @@ export default {
containLabel: true,
};
const timer = setInterval(() => {
if (i < list.length) {
if (Array.isArray(list[i].value) && l < list[i].value.length) {
this.sssjMark = i;
this.sssjName = list[i].value[l].tpName;
// this.initEchartBox(
// "sssj",
// list[i].value[l].data.xData.data,
// list[i].value[l].data.yData.data,
// "",
// grid
// );
if (i < data.list.length) {
if (
Array.isArray(data.list[i].value) &&
l < data.list[i].value.length
) {
this.rightTopLssjData.mark = i;
this.rightTopLssjData.name = data.list[i].value[l].tpName;
this.initEchartBox(
"sssj",
data.list[i].value[l].data.xData.data,
data.list[i].value[l].data.yData[0].data,
"",
1,
grid
);
l++;
} else {
i++;
......@@ -468,6 +511,114 @@ export default {
l = 0;
}
}, 15000);
this.$on("hook:activated", () => {
if (timer === null) {
// 避免重复开启定时器
timer = setInterval(() => {
if (i < data.list.length) {
if (
Array.isArray(data.list[i].value) &&
l < data.list[i].value.length
) {
this.rightTopLssjData.mark = i;
this.rightTopLssjData.name = data.list[i].value[l].tpName;
this.initEchartBox(
"sssj",
data.list[i].value[l].data.xData.data,
data.list[i].value[l].data.yData[0].data,
"",
1,
grid
);
l++;
} else {
i++;
}
} else {
i = 0;
l = 0;
}
}, 15000);
}
});
this.$on("hook:deactivated", () => {
clearInterval(timer);
timer = null;
});
},
// 更改数据达到轮播效果
rcPlayFun(data) {
// 启动定时器,每隔 3 秒执行一次
let i = 0;
let l = 0;
let grid = {
left: "4%",
right: "5%",
bottom: "4%",
top: "7%",
containLabel: true,
};
const timer = setInterval(() => {
if (i < data.list.length) {
if (
Array.isArray(data.list[i].value) &&
l < data.list[i].value.length
) {
this.rightCenterLssjData.mark = i;
this.rightCenterLssjData.name = data.list[i].value[l].tpName;
this.initEchartBox(
"right",
data.list[i].value[l].data.xData.data,
data.list[i].value[l].data.yData[0].data,
"",
1,
grid
);
l++;
} else {
i++;
}
} else {
i = 0;
l = 0;
}
}, 15000);
this.$on("hook:activated", () => {
if (timer === null) {
// 避免重复开启定时器
timer = setInterval(() => {
if (i < data.list.length) {
if (
Array.isArray(data.list[i].value) &&
l < data.list[i].value.length
) {
this.rightCenterLssjData.mark = i;
this.rightCenterLssjData.name = data.list[i].value[l].tpName;
this.initEchartBox(
"right",
data.list[i].value[l].data.xData.data,
data.list[i].value[l].data.yData[0].data,
"",
1,
grid
);
l++;
} else {
i++;
}
} else {
i = 0;
l = 0;
}
}, 15000);
}
});
this.$on("hook:deactivated", () => {
clearInterval(timer);
timer = null;
});
},
//自动滚动
autoScroll() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment