|
@@ -194,7 +194,18 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
+
|
|
|
<el-col :xs="24" :sm="10" :lg="6">
|
|
|
+ <span style="margin-right: 25px; float:right;">
|
|
|
+ <span>自动刷新:</span>
|
|
|
+ <el-switch v-model="switchOn"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ @change="switchClick"
|
|
|
+ >
|
|
|
+ </el-switch>
|
|
|
+
|
|
|
+ </span>
|
|
|
<div class="colCls">
|
|
|
<div class="lastRow">
|
|
|
<!-- 登录监控 -->
|
|
@@ -235,6 +246,7 @@
|
|
|
components: {countTo, BarChart},
|
|
|
data() {
|
|
|
return {
|
|
|
+ switchOn: false,
|
|
|
btnActive: "4",
|
|
|
timeRange: null,
|
|
|
isMachine: '0',
|
|
@@ -257,6 +269,7 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ this.switchOn = false
|
|
|
// 查询数据
|
|
|
this.searchBarData("4")
|
|
|
// 查询企业、产线、生产资源统计
|
|
@@ -274,9 +287,17 @@
|
|
|
computed: {
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.startPolling();
|
|
|
+ this.startPolling();
|
|
|
},
|
|
|
methods: {
|
|
|
+ switchClick(value){
|
|
|
+ if(!value){
|
|
|
+ this.$emit('switchOff')
|
|
|
+ }else{
|
|
|
+ this.$emit('switchOn')
|
|
|
+ }
|
|
|
+ this.switchOn = value
|
|
|
+ },
|
|
|
// 【今日、本周、本月、全年】按钮-事件
|
|
|
searchDate(flag){
|
|
|
this.btnActive = flag;
|
|
@@ -291,11 +312,12 @@
|
|
|
this.searchBarData(this.btnActive);
|
|
|
},
|
|
|
startPolling() {
|
|
|
- // 使用 setInterval 每 5 秒调用一次接口
|
|
|
- this.interval = setInterval(() => {
|
|
|
- this.getWarning()
|
|
|
|
|
|
- }, 20000);
|
|
|
+ // 使用 setInterval 每 5 秒调用一次接口
|
|
|
+ this.interval = setInterval(() => {
|
|
|
+ this.getWarning()
|
|
|
+
|
|
|
+ }, 20000);
|
|
|
|
|
|
// 立即调用一次接口以初始化数据
|
|
|
this.getWarning();
|
|
@@ -399,7 +421,10 @@
|
|
|
}
|
|
|
}).finally(() => this.loading = false);
|
|
|
},
|
|
|
- getWarning(params = {}) {
|
|
|
+ getWarning() {
|
|
|
+ if(!this.switchOn){
|
|
|
+ return
|
|
|
+ }
|
|
|
this.loading = true;
|
|
|
/*this.queryParams.current = params.current ? params.current : this.queryParams.current;
|
|
|
this.queryParams.size = params.size ? params.size : this.queryParams.size;*/
|