施工管控添加定时刷新数据

This commit is contained in:
cwchen 2024-09-19 17:09:29 +08:00
parent 434743dc43
commit 4e5127aa75
3 changed files with 57 additions and 14 deletions

View File

@ -184,10 +184,8 @@ export default {
pageNum: 0,
pageSize: 10
},
//
//
intervalId: null,
//
checkDevCode: null
};
},
created() {
@ -207,7 +205,7 @@ export default {
methods: {
startRefresh() {
// 10
this.intervalId = setInterval(this.refreshData, 1000 * 60 * 10);
this.intervalId = setInterval(this.refreshData, 1000 * 60 * 5);
},
stopRefresh() {
if (this.intervalId) {

View File

@ -314,10 +314,10 @@ export default {
this.getPersonsTree();
},
mounted(){
alert('页面初始化完成');
// alert('');
},
destroyed(){
alert('页面销毁了');
// alert('');
},
methods: {
//
@ -440,14 +440,19 @@ export default {
}
},
//
getCheckConfigDetail() {
getCheckConfig().then((res) => {
async getCheckConfigDetail() {
let loading = this.$loading({
lock: true,
text: "数据加载中,请稍候...",
background: 'rgba(0,0,0,0.2)'
})
await getCheckConfig().then((res) => {
if (res.data && res.data.length > 0) {
const data = res.data;
const configType = data[0].configType + '';
if (configType === '1') {
data.forEach((item, index) => {
this.form.times.push({ value: item.time, key: Date.now() })
this.form.times.push({ value: item.time, key: Date.now() + index })
})
} else if (configType === '2') {
this.form.timeNum = parseInt(res.data[0].time);
@ -456,9 +461,11 @@ export default {
} else {
this.form.configType = '1';
}
}).catch((res) => {
})
loading.close();
this.dialogVisible2 = true;
},
// -

View File

@ -76,7 +76,7 @@
</div>
<!-- 违章识别 -->
<div class="vio-box">
<el-carousel height="200px" indicator-position="outside" :interval="100000" @change="loadVioInfos"
<el-carousel height="200px" indicator-position="outside" :interval="15000" @change="loadVioInfos"
v-if="vioArr.length > 0">
<el-carousel-item v-for="(itemArr, arrIndex) in vioArr" :key="arrIndex">
<div class="vio-box-info layout">
@ -164,7 +164,11 @@ export default {
//
boxNum: 1,//14
boxIndex:1,//
classStyle: 'ball-content'
classStyle: 'ball-content',
//
intervalId: null,
// ID
checkNodeId:null
};
},
created() {
@ -175,11 +179,45 @@ export default {
this.$nextTick(() => {
this.busy = false;
});
this.startRefresh();
},
destroyed() {
this.stopRefresh();
},
methods: {
startRefresh() {
// 10
this.intervalId = setInterval(this.refreshData, 1000 * 60 * 10);
},
stopRefresh() {
if (this.intervalId) {
clearInterval(this.intervalId);
this.intervalId = null;
}
},
async refreshData() {
//
this.treeData.splice(0);
this.idArr.splice(0);
await this.laodBallDeviceLists();
if(this.filterText){
this.$refs.tree.filter();
}
if(this.checkNodeId){
this.$refs.tree.setCurrentKey(this.checkNodeId);
}
//
this.warnInfoArr.splice(0);
this.queryParams.pageNum = 0;
this.isHasData = true;
this.loadWarnInfoData();
//
this.vioArr.splice(0);
this.loadBallWarnLists();
},
/* 加载球机树 */
laodBallDeviceLists() {
getBallDeviceLists().then(res => {
async laodBallDeviceLists() {
await getBallDeviceLists().then(res => {
const treeData = res.data;
if (treeData && treeData.length > 0) {
this.treeData = treeData
@ -293,7 +331,7 @@ export default {
},
//
handleNodeClick(data, node, item) {//
console.log(node)
this.checkNodeId = data.id;
if (node.level === 2) {
if(this.boxNum==1){
this.$refs[`monitor`+1].closeVideo()