|
@@ -132,9 +132,9 @@ import Col from "@/components/coms/grid/col.vue";
|
|
|
import SvgIcon from '@com/coms/icon/svg-icon.vue';
|
|
|
import util from '@/helper/util.js';
|
|
|
|
|
|
-import { datainit, webtest } from "@tools/websocket.js";
|
|
|
import store from "@store/index.js";
|
|
|
import { isNumber } from 'util';
|
|
|
+import { setInterval, clearInterval } from 'timers';
|
|
|
|
|
|
export default {
|
|
|
// 名称
|
|
@@ -145,11 +145,11 @@ export default {
|
|
|
Col,
|
|
|
SvgIcon
|
|
|
},
|
|
|
+
|
|
|
// 数据
|
|
|
data () {
|
|
|
return {
|
|
|
- loadingFlg: false, // 遮罩开关
|
|
|
- websocketServe: null, // websocket 服务实例
|
|
|
+ timmer: null, // 计时器
|
|
|
sourceMap: {}, // 核心数据
|
|
|
fillCategory: null, // 过滤条件
|
|
|
fillFjzt: null, // 过滤条件
|
|
@@ -216,6 +216,7 @@ export default {
|
|
|
}]
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// 函数
|
|
|
methods: {
|
|
|
// 根据风机状态码返回对应 class
|
|
@@ -277,58 +278,56 @@ export default {
|
|
|
});
|
|
|
this.sourceMap.fjmap = fjmap;
|
|
|
},
|
|
|
- },
|
|
|
|
|
|
- mounted () {
|
|
|
- let that = this;
|
|
|
- that.loadingFlg = true;
|
|
|
- that.BASE.showLoading();
|
|
|
- that.$nextTick(() => {
|
|
|
- that.websocketServe && that.websocketServe.disconnect();
|
|
|
+ // 请求服务
|
|
|
+ requestData (showLoading) {
|
|
|
+ let that = this;
|
|
|
that.API.requestData({
|
|
|
+ showLoading,
|
|
|
method: "POST",
|
|
|
- subUrl: "admin/websocketdisconnect",
|
|
|
- success () {
|
|
|
- that.websocketServe = datainit("/topic/matrixpushtask");
|
|
|
+ subUrl: "matrix/matrixPush",
|
|
|
+ success (res) {
|
|
|
+ if (res) {
|
|
|
+ let sourceMap = res.data;
|
|
|
+ let fjmap = [];
|
|
|
+ for (let key in sourceMap) {
|
|
|
+ if (key !== 'fczbmap' && key !== 'fjmap') {
|
|
|
+ sourceMap[key] += '';
|
|
|
+ } else if (key === 'fjmap') {
|
|
|
+ sourceMap[key].forEach(pItem => {
|
|
|
+ pItem.forEach(cItem => {
|
|
|
+ cItem.color = that.getColor(cItem.fjzt);
|
|
|
+ cItem.isShow = true;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.sourceMap = sourceMap;
|
|
|
+ if (that.fillCategory) {
|
|
|
+ that.changeShow(that.fillCategory, that.fillFjzt, true);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ that.sourceMap = {};
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- beforeDestroy () {
|
|
|
- // 离开页面,销毁 websocket 实例
|
|
|
- this.websocketServe && this.websocketServe.disconnect();
|
|
|
+ created () {
|
|
|
+ let that = this;
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.requestData(true);
|
|
|
+ that.timmer = setInterval(() => {
|
|
|
+ that.requestData(false);
|
|
|
+ }, that.$store.state.websocketTimeSec);
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
- watch: {
|
|
|
- // 监听 websocket 回调并包装数据用于展示
|
|
|
- '$store.state.windturbineMap': function (res) {
|
|
|
-
|
|
|
- this.loadingFlg && this.BASE.closeLoading();
|
|
|
- this.loadingFlg = false;
|
|
|
- if (res) {
|
|
|
- let sourceMap = JSON.parse(res);
|
|
|
- let fjmap = [];
|
|
|
- for (let key in sourceMap) {
|
|
|
- if (key !== 'fczbmap' && key !== 'fjmap') {
|
|
|
- sourceMap[key] += '';
|
|
|
- } else if (key === 'fjmap') {
|
|
|
- sourceMap[key].forEach(pItem => {
|
|
|
- pItem.forEach(cItem => {
|
|
|
- cItem.color = this.getColor(cItem.fjzt);
|
|
|
- cItem.isShow = true;
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- this.sourceMap = sourceMap;
|
|
|
- if (this.fillCategory) {
|
|
|
- this.changeShow(this.fillCategory, this.fillFjzt, true);
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.sourceMap = {};
|
|
|
- }
|
|
|
- }
|
|
|
+ unmounted () {
|
|
|
+ clearInterval(this.timmer);
|
|
|
+ this.timmer = null;
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -438,7 +437,7 @@ export default {
|
|
|
}
|
|
|
&:last-child {
|
|
|
font-size: @fontsize;
|
|
|
- font-family: "Bicubik";
|
|
|
+ font-family: 'Bicubik';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -468,7 +467,7 @@ export default {
|
|
|
position: relative;
|
|
|
|
|
|
&::after {
|
|
|
- content: "";
|
|
|
+ content: '';
|
|
|
position: absolute;
|
|
|
width: 1.481vh;
|
|
|
height: 0.556vh;
|
|
@@ -516,7 +515,7 @@ export default {
|
|
|
|
|
|
.sub-count {
|
|
|
font-size: @fontsize-s;
|
|
|
- font-family: "Bicubik";
|
|
|
+ font-family: 'Bicubik';
|
|
|
font-weight: 500;
|
|
|
|
|
|
&.write {
|