|
@@ -15,7 +15,7 @@
|
|
|
</div>
|
|
|
<div class="panel-item-gf-right">
|
|
|
<div class="panel-item-gf-up">{{ panelData.first.text }}</div>
|
|
|
- <div class="panel-item-gf-down">{{ panelData.first.num }}</div>
|
|
|
+ <div class="panel-item-gf-down">{{ sourceMap[panelData.first.key] || '---' }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</Col>
|
|
@@ -29,7 +29,7 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="panel-item-li">
|
|
|
- <span>{{ data.num }}</span>
|
|
|
+ <span>{{ sourceMap[data.key] || '---'}}</span>
|
|
|
<span class="svg-icon svg-icon-sm" :class="'svg-icon-' + data.color">
|
|
|
<SvgIcon :svgid="data.numIcon"></SvgIcon>
|
|
|
</span>
|
|
@@ -108,6 +108,9 @@ import Col from "@com/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";
|
|
|
+
|
|
|
export default {
|
|
|
// 名称
|
|
|
name: "LightMatrix",
|
|
@@ -120,78 +123,81 @@ export default {
|
|
|
// 数据
|
|
|
data () {
|
|
|
return {
|
|
|
+ loadingFlg: false, // 遮罩开关
|
|
|
+ websocketServe: null, // websocket 服务实例
|
|
|
+ sourceMap: {}, // 核心数据
|
|
|
panelData: {
|
|
|
first: {
|
|
|
icon: "svg-photovoltaic",
|
|
|
text: "接入光伏",
|
|
|
- num: 256,
|
|
|
+ key: "fcjrnum",
|
|
|
},
|
|
|
datas: [
|
|
|
{
|
|
|
color: "green",
|
|
|
name: "待机",
|
|
|
nameIcon: "svg-standby",
|
|
|
- num: 50,
|
|
|
+ key: "fcdjnum",
|
|
|
numIcon: "svg-manual",
|
|
|
text1: "待风",
|
|
|
- num1: 30,
|
|
|
+ key1: "fcddfum",
|
|
|
text2: "手动停机",
|
|
|
- num2: 30,
|
|
|
+ key2: "fcsdtjnum",
|
|
|
},
|
|
|
{
|
|
|
color: "blue",
|
|
|
name: "运行",
|
|
|
nameIcon: "svg-normal-power",
|
|
|
- num: 50,
|
|
|
+ key: "fcyxnum",
|
|
|
numIcon: "svg-drop-output",
|
|
|
text1: "正常发电",
|
|
|
- num1: 30,
|
|
|
+ key1: "fczcfdnum",
|
|
|
text2: "降出力",
|
|
|
- num2: 30,
|
|
|
+ key2: "fcjclnum",
|
|
|
},
|
|
|
{
|
|
|
color: "purple",
|
|
|
name: "限电",
|
|
|
nameIcon: "svg-limit-power",
|
|
|
- num: 50,
|
|
|
+ key: "fcxdnum",
|
|
|
numIcon: "svg-downtime",
|
|
|
text1: "降出力",
|
|
|
- num1: 30,
|
|
|
+ key1: "fcjclum",
|
|
|
text2: "停机",
|
|
|
- num2: 30,
|
|
|
+ key2: "fctjnum",
|
|
|
},
|
|
|
{
|
|
|
color: "red",
|
|
|
name: "故障",
|
|
|
nameIcon: "svg-gz-downtime",
|
|
|
- num: 50,
|
|
|
+ key: "fcgznum",
|
|
|
numIcon: "svg-field-involved",
|
|
|
text1: "故障停机",
|
|
|
- num1: 30,
|
|
|
+ key1: "fcgztjnum",
|
|
|
text2: "场内受累",
|
|
|
- num2: 30,
|
|
|
+ key2: "fccnslnum",
|
|
|
},
|
|
|
{
|
|
|
color: "orange",
|
|
|
name: "检测",
|
|
|
nameIcon: "svg-jx-downtime",
|
|
|
- num: 50,
|
|
|
+ key: "fcjcnum",
|
|
|
numIcon: "svg-field-involved",
|
|
|
text1: "检修停机",
|
|
|
- num1: 30,
|
|
|
+ key1: "fcjxtjnum",
|
|
|
text2: "产内受累",
|
|
|
- num2: 30,
|
|
|
+ key2: "fccnslnum",
|
|
|
},
|
|
|
{
|
|
|
color: "gray",
|
|
|
name: "离线",
|
|
|
nameIcon: "svg-offline",
|
|
|
- num: 50,
|
|
|
+ key: "fclxnum",
|
|
|
numIcon: "svg-unknown",
|
|
|
text1: "离线",
|
|
|
- num1: 30,
|
|
|
+ key1: "asd",
|
|
|
text2: "未知",
|
|
|
- num2: 30,
|
|
|
+ key2: "fcwznum",
|
|
|
},
|
|
|
{
|
|
|
color: "write",
|
|
@@ -322,10 +328,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- // 生命周期钩子
|
|
|
- beforeCreate () {
|
|
|
- // 创建前
|
|
|
- },
|
|
|
+
|
|
|
created () {
|
|
|
// 创建后
|
|
|
let tempData = [];
|
|
@@ -356,18 +359,46 @@ export default {
|
|
|
this.tables.push(util.copy(this.tables[0]));
|
|
|
}
|
|
|
},
|
|
|
- beforeMount () {
|
|
|
- // 渲染前
|
|
|
- },
|
|
|
+
|
|
|
mounted () {
|
|
|
let that = this;
|
|
|
- that.$nextTick(() => { });
|
|
|
+ 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/matrixdetialpushtask");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
- beforeUpdate () {
|
|
|
- // 数据更新前
|
|
|
+
|
|
|
+ beforeDestroy () {
|
|
|
+ // 离开页面,销毁 websocket 实例
|
|
|
+ this.websocketServe && this.websocketServe.disconnect();
|
|
|
},
|
|
|
- updated () {
|
|
|
- // 数据更新后
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ // 监听 websocket 回调并包装数据用于展示
|
|
|
+ '$store.state.windturbineMap': function (res) {
|
|
|
+ this.loadingFlg && this.BASE.closeLoading();
|
|
|
+ this.loadingFlg = false;
|
|
|
+ if (res) {
|
|
|
+ let sourceMap = JSON.parse(res);
|
|
|
+ for (let key in sourceMap) {
|
|
|
+ if (key !== 'fczbmap' && key !== 'jmap') {
|
|
|
+ sourceMap[key] += '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.sourceMap = sourceMap;
|
|
|
+ } else {
|
|
|
+ this.sourceMap = {};
|
|
|
+ }
|
|
|
+ console.log(222, JSON.parse(res));
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|