-
{{ item.name }}
+
+ {{ item.jgName }}/{{ item.zsbName }}/{{ item.name }}
+
采集时间:
@@ -212,7 +216,7 @@ import {
zsbListAllApi,
monitoringListAllApi,
// getDetailApi,
- modevtypeListAllApi,
+ getlistAllCountApi,
} from "@/utils/api/index";
import historyDialog from "./components/historyDialog";
export default {
@@ -221,6 +225,7 @@ export default {
data() {
return {
msgTitle: "设备类型实时数据",
+ deviceTitle: "",
typedrawer: false,
areadrawer: false,
deviceTypeVal: null,
@@ -263,24 +268,32 @@ export default {
},
//获取所有的设备类型
getdeviceTypeAll() {
- modevtypeListAllApi()
+ getlistAllCountApi()
.then((res) => {
console.log(res);
- this.deviceTypeList = res.data;
+ this.deviceTypeList = res.data.filter(
+ (item) => item.sensorCount !== 0
+ );
// 尝试从 localStorage 获取 areaVal
const storeddeviceTypeVal = localStorage.getItem("deviceTypeVal");
+ const deviceInfoVal = localStorage.getItem("deviceTitle");
if (storeddeviceTypeVal) {
// 如果 localStorage 中有 areaVal,则将其解析为数字(假设 id 是数字)并赋值给 this.areaVal
this.areaVal = JSON.parse(storeddeviceTypeVal);
+ this.deviceTitle = JSON.parse(deviceInfoVal);
} else {
// 否则,使用 res.data[0].id
this.deviceTypeVal = res.data[0]?.id; // 使用可选链操作符避免 res.data[0] 为 undefined 的情况
-
+ this.deviceTitle = res.data[0].mc;
// 同时,将新获取的 areaVal 存储到 localStorage 中
localStorage.setItem(
"deviceTypeVal",
JSON.stringify(this.deviceTypeVal)
);
+ localStorage.setItem(
+ "deviceTitle",
+ JSON.stringify(this.deviceTitle)
+ );
}
this.getTypeAllList();
this.startIntervalIfNeededType();
@@ -292,8 +305,12 @@ export default {
},
handletypeChange(value) {
this.deviceTypeVal = value;
+ const typeArr = this.deviceTypeList.find((item) => item.id === value);
+ console.log(typeArr.mc);
+ this.deviceTitle = typeArr.mc;
localStorage.removeItem("deviceTypeVal");
localStorage.setItem("deviceTypeVal", JSON.stringify(value));
+ localStorage.setItem("deviceTitle", JSON.stringify(typeArr.mc));
this.jksbAllList = [];
this.getTypeAllList();
this.startIntervalIfNeededType();
@@ -401,6 +418,7 @@ export default {
handlezsbChange(value) {
this.zsbVal = value;
localStorage.setItem("zsbVal", JSON.stringify(value));
+
// 调用 getjcsbAllList 方法获取监测设备列表
this.getjcsbAllList();
@@ -464,6 +482,9 @@ export default {
margin: 10px 0px;
display: flex;
align-items: center;
+ .rightbtn {
+ margin-left: auto !important;
+ }
.el-drawer__wrapper {
.el-drawer__header {
margin-bottom: 14px;