|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="agc">
|
|
<div class="agc">
|
|
<div class="btn-group-tabs">
|
|
<div class="btn-group-tabs">
|
|
- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2>
|
|
|
|
|
|
+ <!-- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2> -->
|
|
</div>
|
|
</div>
|
|
<div class="panel-groups">
|
|
<div class="panel-groups">
|
|
<AgcPanel class="panel-item" v-for="(data, index) of datas" :key="index" :data="data"></AgcPanel>
|
|
<AgcPanel class="panel-item" v-for="(data, index) of datas" :key="index" :data="data"></AgcPanel>
|
|
@@ -12,6 +12,10 @@
|
|
<script>
|
|
<script>
|
|
import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
|
|
import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
|
|
import AgcPanel from "./components/agc-panel.vue";
|
|
import AgcPanel from "./components/agc-panel.vue";
|
|
|
|
+
|
|
|
|
+import { datainit, webtest } from "@tools/websocket.js";
|
|
|
|
+import store from "@store/index.js";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
// 名称
|
|
// 名称
|
|
name: "Agc",
|
|
name: "Agc",
|
|
@@ -21,8 +25,11 @@ export default {
|
|
AgcPanel,
|
|
AgcPanel,
|
|
},
|
|
},
|
|
// 数据
|
|
// 数据
|
|
- data() {
|
|
|
|
|
|
+ data () {
|
|
return {
|
|
return {
|
|
|
|
+ loadingFlg: false, // 遮罩开关
|
|
|
|
+ websocketServe: null, // websocket 服务实例
|
|
|
|
+ sourceMap: {}, // 核心数据
|
|
datas: [
|
|
datas: [
|
|
{
|
|
{
|
|
title: "某某风电场",
|
|
title: "某某风电场",
|
|
@@ -83,21 +90,28 @@ export default {
|
|
},
|
|
},
|
|
// 函数
|
|
// 函数
|
|
methods: {
|
|
methods: {
|
|
- select: function(item) {
|
|
|
|
|
|
+ select: function (item) {
|
|
console.log(item);
|
|
console.log(item);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- // 生命周期钩子
|
|
|
|
- beforeCreate() {
|
|
|
|
- // 创建前
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- // 创建后
|
|
|
|
- },
|
|
|
|
- beforeMount() {
|
|
|
|
- // 渲染前
|
|
|
|
|
|
+
|
|
|
|
+ created () {
|
|
|
|
+ let that = this;
|
|
|
|
+ that.loadingFlg = true;
|
|
|
|
+ that.BASE.showLoading();
|
|
|
|
+ that.$nextTick(() => {
|
|
|
|
+ that.websocketServe && that.websocketServe.disconnect();
|
|
|
|
+ that.API.requestData({
|
|
|
|
+ method: "POST",
|
|
|
|
+ subUrl: "admin/websocketdisconnect",
|
|
|
|
+ success () {
|
|
|
|
+ that.websocketServe = datainit("/topic/agc");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
|
|
+
|
|
|
|
+ mounted () {
|
|
// 渲染后
|
|
// 渲染后
|
|
for (let i = 1; i < 12; i++) {
|
|
for (let i = 1; i < 12; i++) {
|
|
this.datas.push(JSON.parse(JSON.stringify(this.datas[0])));
|
|
this.datas.push(JSON.parse(JSON.stringify(this.datas[0])));
|
|
@@ -106,12 +120,26 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- beforeUpdate() {
|
|
|
|
- // 数据更新前
|
|
|
|
- },
|
|
|
|
- updated() {
|
|
|
|
- // 数据更新后
|
|
|
|
|
|
+
|
|
|
|
+ beforeDestroy () {
|
|
|
|
+ // 离开页面,销毁 websocket 实例
|
|
|
|
+ this.websocketServe && this.websocketServe.disconnect();
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ watch: {
|
|
|
|
+ // 监听 websocket 回调并包装数据用于展示
|
|
|
|
+ '$store.state.windturbineMap': function (res) {
|
|
|
|
+ this.loadingFlg && this.BASE.closeLoading();
|
|
|
|
+ this.loadingFlg = false;
|
|
|
|
+ if (res) {
|
|
|
|
+ let sourceMap = JSON.parse(res);
|
|
|
|
+ this.sourceMap = sourceMap;
|
|
|
|
+ } else {
|
|
|
|
+ this.sourceMap = {};
|
|
|
|
+ }
|
|
|
|
+ console.log(111, this.sourceMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|