|
@@ -13,6 +13,7 @@
|
|
|
>
|
|
|
{{ item.StationName }}
|
|
|
</option>
|
|
|
+ <option value="ss">ss</option>
|
|
|
<!-- <option value="">站点一</option>
|
|
|
<option value="">站点一</option> -->
|
|
|
</select>
|
|
@@ -57,17 +58,37 @@ export default {
|
|
|
"$store.state.wsInfo"(val) {
|
|
|
this.messageHandle(val)
|
|
|
},
|
|
|
+ StationID(val) {
|
|
|
+
|
|
|
+ console.log("watch时候的值");
|
|
|
+ console.log(val);
|
|
|
+
|
|
|
+ //监听testStationId是否发生了变化
|
|
|
+ // console.log('监听testStationId是否发生了变化');
|
|
|
+ this.$store.commit("changeStationID", val);
|
|
|
+
|
|
|
+ console.log("放入store的值");
|
|
|
+ console.log(this.getStationId);
|
|
|
+ },
|
|
|
+
|
|
|
},
|
|
|
created() {
|
|
|
- this.global.sendWs( { CMD: "getStationInfo" });
|
|
|
+ this.global.sendWs( { CMD: "getStationInfo" });
|
|
|
+
|
|
|
+this.StationID = this.getStationId;
|
|
|
+
|
|
|
},
|
|
|
mounted() {
|
|
|
this.navs();
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ getStationId(){
|
|
|
+ return this.$store.state.StationID
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
|
|
|
- onload() {},
|
|
|
destroyed() {},
|
|
|
|
|
|
methods: {
|
|
@@ -77,7 +98,19 @@ export default {
|
|
|
// 初始化获取站点下拉数据
|
|
|
if (redata.CMD == "getStationInfo") {
|
|
|
this.siteList = redata.RESULT;
|
|
|
- this.StationID = this.siteList[0].StationID;
|
|
|
+
|
|
|
+ //页面刚初始化时 获取下拉列表的第一个值 放入store里面
|
|
|
+ console.log("created函数里获取store的值=====" + this.getStationId);
|
|
|
+
|
|
|
+ if (!this.getStationId) {
|
|
|
+ console.log("created走没有的逻辑");
|
|
|
+ this.StationID = this.siteList[0].StationID;
|
|
|
+ this.$store.commit("changeStationID", this.StationId);
|
|
|
+ } else {
|
|
|
+ console.log("created走有的逻辑");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
if (redata.CMD == "getStationDetail") {
|
|
|
this.homeData = redata.RESULT.LIST;
|