|
@@ -4,7 +4,8 @@
|
|
|
<!-- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2> -->
|
|
|
</div>
|
|
|
<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" chartType="multiple"
|
|
|
+ :chartData="data.tb"></AgcPanel>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -13,7 +14,6 @@
|
|
|
import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
|
|
|
import AgcPanel from "./components/agc-panel.vue";
|
|
|
|
|
|
-import { datainit, webtest } from "@tools/websocket.js";
|
|
|
import store from "@store/index.js";
|
|
|
|
|
|
export default {
|
|
@@ -27,9 +27,7 @@ export default {
|
|
|
// 数据
|
|
|
data () {
|
|
|
return {
|
|
|
- loadingFlg: false, // 遮罩开关
|
|
|
- websocketServe: null, // websocket 服务实例
|
|
|
- sourceMap: {}, // 核心数据
|
|
|
+ timmer: null, // 计时器
|
|
|
datas: [
|
|
|
{
|
|
|
title: "某某风电场",
|
|
@@ -91,23 +89,69 @@ export default {
|
|
|
// 函数
|
|
|
methods: {
|
|
|
select: function (item) {
|
|
|
- console.log(item);
|
|
|
+ // console.log(item);
|
|
|
},
|
|
|
- },
|
|
|
|
|
|
- created () {
|
|
|
- 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/agc");
|
|
|
+ subUrl: "genreset/getAgcValues",
|
|
|
+ success (res) {
|
|
|
+ let datas = [];
|
|
|
+ if (res.data) {
|
|
|
+ res.data.forEach(pEle => {
|
|
|
+
|
|
|
+ pEle.jcxx.icon = "fa fa-gears";
|
|
|
+ pEle.jcxx.color = pEle.jcxx.zt === 0 ? "red" : "green";
|
|
|
+
|
|
|
+ let keys = ["llgl", "sjgl", "xdzl", "ycgl"];
|
|
|
+
|
|
|
+ let tb = [{
|
|
|
+ title: "理论功率",
|
|
|
+ yAxisIndex: 0,
|
|
|
+ value: [],
|
|
|
+ }, {
|
|
|
+ title: "实际功率",
|
|
|
+ yAxisIndex: 0,
|
|
|
+ value: [],
|
|
|
+ }, {
|
|
|
+ title: "限电指令",
|
|
|
+ yAxisIndex: 0,
|
|
|
+ value: [],
|
|
|
+ }, {
|
|
|
+ title: "预测功率",
|
|
|
+ yAxisIndex: 0,
|
|
|
+ value: [],
|
|
|
+ }];
|
|
|
+
|
|
|
+ keys.forEach((key, keyIndex) => {
|
|
|
+ pEle.tb.forEach((cEle, cIndex) => {
|
|
|
+ tb[keyIndex].value.push({ text: String((cIndex + 1)), value: cEle[keys[keyIndex]] || 0 });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ pEle.tb = tb;
|
|
|
+ datas.push(pEle);
|
|
|
+ });
|
|
|
+ that.datas = datas;
|
|
|
+ } else {
|
|
|
+ that.datas = datas;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ created () {
|
|
|
+ let that = this;
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.requestData(true);
|
|
|
+ that.timmer = setInterval(() => {
|
|
|
+ that.requestData(false);
|
|
|
+ }, that.$store.state.websocketTimeSec);
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -121,24 +165,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
+ unmounted () {
|
|
|
+ clearInterval(this.timmer);
|
|
|
+ this.timmer = null;
|
|
|
}
|
|
|
};
|
|
|
</script>
|