|
@@ -20,6 +20,7 @@
|
|
|
<!-- 当前时间 -->
|
|
|
<time-menu></time-menu>
|
|
|
|
|
|
+ <!-- 电子巡检小图标 -->
|
|
|
<img
|
|
|
class="time-icon"
|
|
|
@click="goRecordTime()"
|
|
@@ -35,22 +36,20 @@
|
|
|
import TimeMenu from "@/components/TimeMenu";
|
|
|
|
|
|
export default {
|
|
|
- // name: "header",
|
|
|
+ name: "topHeader",
|
|
|
components: {
|
|
|
TimeMenu,
|
|
|
},
|
|
|
- props: {},
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
title: "智慧安防数据分析看板",
|
|
|
+ //当前路由
|
|
|
routeName: this.$route.name,
|
|
|
-
|
|
|
+ //站点数据
|
|
|
siteList: [],
|
|
|
- flag: true,
|
|
|
StationID: "",
|
|
|
- isOpen: false,
|
|
|
- msg: 1,
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -59,12 +58,13 @@ export default {
|
|
|
},
|
|
|
|
|
|
StationID(newVal, oldVal) {
|
|
|
- console.log("watch时候的值");
|
|
|
- console.log(newVal + ":" + oldVal);
|
|
|
+ // console.log("watch时候的值");
|
|
|
+ // console.log(newVal + ":" + oldVal);
|
|
|
this.$store.commit("changeStationID", newVal);
|
|
|
- console.log("放入store的值");
|
|
|
- console.log(this.getStationId);
|
|
|
+ // console.log("放入store的值");
|
|
|
+ // console.log(this.getStationId);
|
|
|
|
|
|
+ //判断如果有站带,并且站点切换时,跳转至首页
|
|
|
if (oldVal.length > 0) {
|
|
|
if (this.$route.path == "/index") {
|
|
|
this.$router.go(0);
|
|
@@ -76,9 +76,7 @@ export default {
|
|
|
deep: true,
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
this.global.sendWs({ CMD: "getStationInfo" });
|
|
|
-
|
|
|
this.StationID = this.getStationId;
|
|
|
},
|
|
|
mounted() {
|
|
@@ -96,34 +94,30 @@ export default {
|
|
|
messageHandle(e) {
|
|
|
if (e.data.search("{") != -1) {
|
|
|
const redata = JSON.parse(e.data);
|
|
|
- // 初始化获取站点下拉数据
|
|
|
+
|
|
|
if (redata.CMD == "getStationInfo") {
|
|
|
this.siteList = redata.RESULT;
|
|
|
-
|
|
|
- //页面刚初始化时 获取下拉列表的第一个值 放入store里面
|
|
|
- console.log("created函数里获取store的值=====" + this.getStationId);
|
|
|
if (this.getStationId.length == 0) {
|
|
|
console.log("created走没有的逻辑");
|
|
|
+ // 初始化时,获取下拉列表的第一个值 放入store里
|
|
|
this.StationID = this.siteList[0].StationID;
|
|
|
- this.$store.commit("changeStationID", this.StationID);
|
|
|
+ this.$store.commit("changeStationID", this.StationID);
|
|
|
} else {
|
|
|
console.log("created走有的逻辑");
|
|
|
}
|
|
|
}
|
|
|
- // if (redata.CMD == "getStationDetail") {
|
|
|
- // this.homeData = redata.RESULT.LIST;
|
|
|
- // }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 页面跳转至recordTime
|
|
|
goRecordTime() {
|
|
|
if (this.$route.path != "/recordTime") {
|
|
|
this.$router.push("/recordTime");
|
|
|
- // this.$refs.indexChartstyle.display='none'
|
|
|
- // this.$refs.abc.style.cssText
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ //根据路由判断显示不同的标题内容
|
|
|
navs() {
|
|
|
switch (this.$route.name) {
|
|
|
case "recordTime":
|