|
@@ -153,9 +153,9 @@ import { allConfig2, allConfig } from "./craftConfig";
|
|
|
import siteIndex from "./siteIndex";
|
|
|
import mxgraph from "mxgraph";
|
|
|
import request from "@/utils/request"; // 请求
|
|
|
-import { parseTime } from '@/utils/index'
|
|
|
+import { parseTime } from "@/utils/index";
|
|
|
import Echarts from "echarts";
|
|
|
-import { getScadaAlarmDataPage } from "@/api/mbsys/scada"
|
|
|
+import { getScadaAlarmDataPage } from "@/api/mbsys/scada";
|
|
|
export default {
|
|
|
name: "CraftMap2",
|
|
|
components: { Echarts },
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
isAlarm: false,
|
|
|
dontShow: true,
|
|
|
twinkle: null,
|
|
|
- indexCodes:[],
|
|
|
+ indexCodes: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -199,14 +199,14 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- created(){
|
|
|
- this.indexCodes = [] //存储配置的指标编码
|
|
|
- for(var i=0;i<siteIndex.deviceValue.length;i++){
|
|
|
- const deviceValue = siteIndex.deviceValue[i]
|
|
|
- if(deviceValue){
|
|
|
- deviceValue.value.map(item=>{
|
|
|
- if(item.itnm && item.itnm!== '')this.indexCodes.push(item.itnm)
|
|
|
- })
|
|
|
+ created() {
|
|
|
+ this.indexCodes = []; //存储配置的指标编码
|
|
|
+ for (var i = 0; i < siteIndex.deviceValue.length; i++) {
|
|
|
+ const deviceValue = siteIndex.deviceValue[i];
|
|
|
+ if (deviceValue) {
|
|
|
+ deviceValue.value.map((item) => {
|
|
|
+ if (item.itnm && item.itnm !== "") this.indexCodes.push(item.itnm);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -453,7 +453,8 @@ export default {
|
|
|
'<li class="tf-li" data="' +
|
|
|
(text.itnm || "") +
|
|
|
'"><div class="' +
|
|
|
- (node.class || "title") + " tfStyleTitle"+
|
|
|
+ (node.class || "title") +
|
|
|
+ " tfStyleTitle" +
|
|
|
'"><span>' +
|
|
|
text.name +
|
|
|
'</span></div><span class="value tfStyle">' +
|
|
@@ -761,7 +762,8 @@ export default {
|
|
|
'<li class="tf-li" data="' +
|
|
|
(text.itnm || "") +
|
|
|
'"><div class="' +
|
|
|
- (node.class || "title") + " tfStyleTitle" +
|
|
|
+ (node.class || "title") +
|
|
|
+ " tfStyleTitle" +
|
|
|
'"><span>' +
|
|
|
text.name +
|
|
|
'</span></div><span class="value tfStyle">' +
|
|
@@ -905,24 +907,27 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- this.getAlarmData()
|
|
|
+ this.getAlarmData();
|
|
|
},
|
|
|
|
|
|
- getAlarmData(){
|
|
|
- if(this.indexCodes.length < 1) return;
|
|
|
- const frontHelfTime = parseTime(new Date(new Date().getTime() - 24 * 60 * 30 * 1000),'{y}-{m}-{d} {h}:{i}:{s}');
|
|
|
- const nowTime = parseTime(new Date(),'{y}-{m}-{d} {h}:{i}:{s}');
|
|
|
+ getAlarmData() {
|
|
|
+ if (this.indexCodes.length < 1) return;
|
|
|
+ const frontHelfTime = parseTime(
|
|
|
+ new Date(new Date().getTime() - 24 * 60 * 30 * 1000),
|
|
|
+ "{y}-{m}-{d} {h}:{i}:{s}"
|
|
|
+ );
|
|
|
+ const nowTime = parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}");
|
|
|
const params = {
|
|
|
- codes:this.indexCodes.toString(), //指标编码
|
|
|
- status:0, //处理状态未处理
|
|
|
- start:frontHelfTime,
|
|
|
- end:nowTime,
|
|
|
- current:1,
|
|
|
- size:20,
|
|
|
- }
|
|
|
- getScadaAlarmDataPage(params).then(res=>{
|
|
|
-
|
|
|
- }).catch(ex=>{})
|
|
|
+ codes: this.indexCodes.toString(), //指标编码
|
|
|
+ status: 0, //处理状态未处理
|
|
|
+ start: frontHelfTime,
|
|
|
+ end: nowTime,
|
|
|
+ current: 1,
|
|
|
+ size: 20,
|
|
|
+ };
|
|
|
+ // getScadaAlarmDataPage(params)
|
|
|
+ // .then((res) => {})
|
|
|
+ // .catch((ex) => {});
|
|
|
},
|
|
|
|
|
|
setSide() {
|
|
@@ -954,45 +959,66 @@ export default {
|
|
|
this.$nextTick(loadInfo);
|
|
|
};
|
|
|
var loadInfo = () => {
|
|
|
- //this.loading = true;
|
|
|
- request({
|
|
|
- url: "/tofly-scada/scada/app/data",
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- type: 1,
|
|
|
- },
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 1) {
|
|
|
- res = res.result;
|
|
|
- for (var item in res) {
|
|
|
- var di = res[item];
|
|
|
- if (di.allocations) {
|
|
|
- for (const i in di.allocations) {
|
|
|
- var t = di.allocations[i].variableCode;
|
|
|
- if (infos.hasOwnProperty(t)) {
|
|
|
- let n = di.allocations[i]
|
|
|
- ? di.allocations[i].scada.value
|
|
|
- : "null";
|
|
|
- if (n == "null") n = "-";
|
|
|
- if (t == "S7.300.1#F_POWER_FAULT") n = n == "1" ? "开" : "关";
|
|
|
- if (t == "S7.300.1#F_OPEN") n = n == "1" ? "开" : "关";
|
|
|
- if (t == "S7.300.2#F_OPEN") n = n == "1" ? "开" : "关";
|
|
|
- if (t == "S7.300.2#F_POWER_FAULT") n = n == "1" ? "开" : "关";
|
|
|
- if (t == "S7.300.CHU_SS") n = parseFloat(n).toFixed(3);
|
|
|
- if (t == "S7.300.CHU_CL") n = parseFloat(n).toFixed(3);
|
|
|
- if (t == "S7.300.CHU_FT") n = parseFloat(n).toFixed(3);
|
|
|
- if (t == "S7.300.1#QSYW") n = parseFloat(n).toFixed(3);
|
|
|
- if (t == "S7.300.2#QSYW") n = parseFloat(n).toFixed(3);
|
|
|
- infos[t].innerHTML = n;
|
|
|
+ try {
|
|
|
+ //this.loading = true;
|
|
|
+ request({
|
|
|
+ url: "/tofly-scada/scada/app/data",
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ type: 1,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res && res.code && res.code == 1) {
|
|
|
+ res = res.result;
|
|
|
+ for (var item in res) {
|
|
|
+ var di = res[item];
|
|
|
+ if (di.allocations) {
|
|
|
+ for (const i in di.allocations) {
|
|
|
+ var t = di.allocations[i].variableCode;
|
|
|
+ if (infos.hasOwnProperty(t)) {
|
|
|
+ let n = di.allocations[i]
|
|
|
+ ? di.allocations[i].scada.value
|
|
|
+ : "null";
|
|
|
+ if (n == "null") n = "-";
|
|
|
+ if (t == "S7.300.1#F_POWER_FAULT")
|
|
|
+ n = n == "1" ? "开" : "关";
|
|
|
+ if (t == "S7.300.1#F_OPEN")
|
|
|
+ n = n == "1" ? "开" : "关";
|
|
|
+ if (t == "S7.300.2#F_OPEN")
|
|
|
+ n = n == "1" ? "开" : "关";
|
|
|
+ if (t == "S7.300.2#F_POWER_FAULT")
|
|
|
+ n = n == "1" ? "开" : "关";
|
|
|
+ if (t == "S7.300.CHU_SS")
|
|
|
+ n = parseFloat(n).toFixed(3);
|
|
|
+ if (t == "S7.300.CHU_CL")
|
|
|
+ n = parseFloat(n).toFixed(3);
|
|
|
+ if (t == "S7.300.CHU_FT")
|
|
|
+ n = parseFloat(n).toFixed(3);
|
|
|
+ if (t == "S7.300.1#QSYW")
|
|
|
+ n = parseFloat(n).toFixed(3);
|
|
|
+ if (t == "S7.300.2#QSYW")
|
|
|
+ n = parseFloat(n).toFixed(3);
|
|
|
+ infos[t].innerHTML = n;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ this.nextDo = setTimeout(loadInfo, 1000 * 10); //1分钟一次
|
|
|
+ this.setAlarm(res, infos);
|
|
|
+ } else {
|
|
|
+ this.$message.error("获取指标失败:" + res.message);
|
|
|
+ this.nextDo = setTimeout(loadInfo, 1000 * 10); //1分钟一次
|
|
|
}
|
|
|
- }
|
|
|
- this.nextDo = setTimeout(loadInfo, 1000 * 10); //1分钟一次
|
|
|
- this.setAlarm(res, infos);
|
|
|
- } else this.$message.error("获取指标失败:" + res.message);
|
|
|
- //this.loading = false;
|
|
|
- });
|
|
|
+ //this.loading = false;
|
|
|
+ })
|
|
|
+ .catch((ex) => {
|
|
|
+ this.$message.error("连接异常:" + ex);
|
|
|
+ this.nextDo = setTimeout(loadInfo, 1000 * 10); //1分钟一次
|
|
|
+ });
|
|
|
+ } catch (ex) {
|
|
|
+ this.nextDo = setTimeout(loadInfo, 1000 * 10); //1分钟一次
|
|
|
+ }
|
|
|
};
|
|
|
this.$nextTick(loadSite);
|
|
|
}
|
|
@@ -1268,15 +1294,15 @@ export default {
|
|
|
font-size: 17px;
|
|
|
}
|
|
|
|
|
|
->>>.tfStyleTitle{
|
|
|
+>>> .tfStyleTitle {
|
|
|
font-size: 24px !important;
|
|
|
- margin-bottom:10px !important;
|
|
|
+ margin-bottom: 10px !important;
|
|
|
}
|
|
|
->>>.tfStyle{
|
|
|
+>>> .tfStyle {
|
|
|
font-size: 24px !important;
|
|
|
- margin-bottom:10px !important;
|
|
|
+ margin-bottom: 10px !important;
|
|
|
}
|
|
|
->>>.tf-li{
|
|
|
- margin-bottom:16px !important;
|
|
|
+>>> .tf-li {
|
|
|
+ margin-bottom: 16px !important;
|
|
|
}
|
|
|
</style>
|