|
@@ -35,7 +35,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="query-actions">
|
|
|
- <button class="btn green" @click="query(0)">查询</button>
|
|
|
+ <button class="btn green" @click="query(false)">查询</button>
|
|
|
+ <button class="btn green" @click="reset">实时更新</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -154,7 +155,6 @@
|
|
|
date: [],
|
|
|
uniformCodes: ['CI0671', 'AI041','YWCH','LLYW'],
|
|
|
interval: null,
|
|
|
- interval2: null,
|
|
|
flag: 1,
|
|
|
ccS: [],
|
|
|
ywS: [],
|
|
@@ -163,13 +163,16 @@
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- let end = new Date().valueOf();
|
|
|
- this.startTs = new Date(new Date().getTime() - (3600 * 1000 * 2)).valueOf();
|
|
|
- this.endTs = end;
|
|
|
- this.date = [this.startTs, this.endTs];
|
|
|
+ this.resetDate();
|
|
|
this.startAjax();
|
|
|
},
|
|
|
methods: {
|
|
|
+ resetDate(){//重置时间
|
|
|
+ let end = new Date().valueOf();
|
|
|
+ this.startTs = new Date(new Date().getTime() - (3600 * 1000 * 2)).valueOf();
|
|
|
+ this.endTs = end;
|
|
|
+ this.date = [this.startTs, this.endTs];
|
|
|
+ },
|
|
|
async history(thingId, uniformCode) { //油温chart历史
|
|
|
let that = this;
|
|
|
let items = [];
|
|
@@ -201,7 +204,7 @@
|
|
|
that.ccChart[1].value = items;
|
|
|
}
|
|
|
},
|
|
|
- async list(thingId) { //一秒一次
|
|
|
+ async list(thingId) { //一分钟一次
|
|
|
let that = this;
|
|
|
const {
|
|
|
data
|
|
@@ -232,33 +235,34 @@
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- query() {
|
|
|
- this.ywYc();
|
|
|
+ query(a) {
|
|
|
+ this.ywYc(a);
|
|
|
this.mxjl();
|
|
|
},
|
|
|
- ywYc() { //油温预测记录
|
|
|
+ reset(){
|
|
|
+ this.resetDate();
|
|
|
+ this.query(true);//传个true,重置,开启每秒执行,else停
|
|
|
+ },
|
|
|
+ ywYc(a) { //油温预测记录
|
|
|
this.ccChart[0].value = [];
|
|
|
this.ccChart[1].value = [];
|
|
|
this.ccLineChart[0].value = [];
|
|
|
+
|
|
|
+ this.ywChart[0].value = [];
|
|
|
+ this.ywChart[1].value = [];
|
|
|
+ this.stopInterval();
|
|
|
this.uniformCodes.forEach(ele => {
|
|
|
this.history(this.fj, ele);
|
|
|
})
|
|
|
- clearInterval(this.interval2);
|
|
|
- this.interval2 = null;
|
|
|
- this.interval2 = setInterval(() => {
|
|
|
- this.uniformCodes.forEach(ele => {
|
|
|
- this.history(this.fj, ele);
|
|
|
- })
|
|
|
- }, 60000);
|
|
|
-//////上面残差,下面油温
|
|
|
- this.ywChart[0].value = [];
|
|
|
- this.ywChart[1].value = [];
|
|
|
this.list(this.fj);
|
|
|
- clearInterval(this.interval);
|
|
|
- this.interval = null;
|
|
|
- this.interval = setInterval(() => {
|
|
|
- this.list(this.fj)
|
|
|
- }, 60000);
|
|
|
+ if(a){//实时更新
|
|
|
+ this.interval = setInterval(() => {
|
|
|
+ this.uniformCodes.forEach(ele => {
|
|
|
+ this.history(this.fj, ele);
|
|
|
+ })
|
|
|
+ this.list(this.fj)
|
|
|
+ }, 60000);
|
|
|
+ }
|
|
|
},
|
|
|
mxjl() { //模型记录
|
|
|
let that = this;
|
|
@@ -301,13 +305,14 @@
|
|
|
}
|
|
|
},
|
|
|
});
|
|
|
+ },
|
|
|
+ stopInterval(){
|
|
|
+ clearInterval(this.interval);
|
|
|
+ this.interval = null;
|
|
|
}
|
|
|
},
|
|
|
unmounted() {
|
|
|
- clearInterval(this.interval);
|
|
|
- this.interval = null;
|
|
|
- clearInterval(this.interval2);
|
|
|
- this.interval2 = null;
|
|
|
+ this.stopInterval();
|
|
|
},
|
|
|
watch: {
|
|
|
// YWCH 油温残差
|
|
@@ -327,7 +332,7 @@
|
|
|
that.fjArr = res.data;
|
|
|
that.fj = res.data[0].id;
|
|
|
if (that.flag === 1) {
|
|
|
- that.query();
|
|
|
+ that.query(true);
|
|
|
}
|
|
|
that.flag = 2;
|
|
|
},
|