From f40073a8cadfa2975ced0f717fb3fa90e81822ea Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 23 Jul 2021 13:35:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E6=81=AF=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=88=B0=E5=90=8C=E6=AD=A5=E4=BB=BB=E5=8A=A1=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=90=8E=E5=8A=A0=E8=BD=BD=E6=9C=89=E5=BB=B6=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/system/task/TaskRecord.vue | 47 ++++++++++++++----- frontend/src/views/system/task/dataset.vue | 12 ++--- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/frontend/src/views/system/task/TaskRecord.vue b/frontend/src/views/system/task/TaskRecord.vue index 113768729a..1e9027484d 100644 --- a/frontend/src/views/system/task/TaskRecord.vue +++ b/frontend/src/views/system/task/TaskRecord.vue @@ -61,7 +61,7 @@ import TableSelector from '@/views/chart/view/TableSelector' export default { name: 'TaskRecord', - components: { ComplexTable, LayoutContent, cron, TableSelector}, + components: { ComplexTable, LayoutContent, cron, TableSelector }, props: { param: { type: Object, @@ -85,7 +85,7 @@ export default { components: [ { field: 'dataset_table_task.name', label: this.$t('dataset.task_name'), component: 'DeComplexInput' }, { field: 'dataset_table.name', label: this.$t('dataset.name'), component: 'DeComplexInput' }, - { field: 'dataset_table_task_log.status', label: this.$t('commons.status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false} + { field: 'dataset_table_task_log.status', label: this.$t('commons.status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false } ] }, paginationConfig: { @@ -118,28 +118,43 @@ export default { computed: { }, created() { - if(this.param == null){ + if (this.param == null) { this.last_condition = {} this.search() - }else { + } else { this.last_condition = { 'dataset_table_task.name': { - field: "dataset_table_task.name", - operator: "eq", - value: this.param.name + field: 'dataset_table_task.name', + operator: 'eq', + value: this.param.name } } - this.search(this.last_condition) + this.search(this.last_condition) } - this.timer = setInterval(() => { - this.search(this.last_condition, false) - }, 5000) + // this.timer = setInterval(() => { + // this.search(this.last_condition, false) + // }, 5000) + this.createTimer() }, beforeDestroy() { - clearInterval(this.timer) + // clearInterval(this.timer) + this.destroyTimer() }, methods: { + createTimer() { + if (!this.timer) { + this.timer = setInterval(() => { + this.search(this.last_condition, false) + }, 5000) + } + }, + destroyTimer() { + if (this.timer) { + clearInterval(this.timer) + this.timer = null + } + }, msg2Current(routerParam) { if (!routerParam || !routerParam.taskId) return const taskId = routerParam.taskId @@ -151,7 +166,13 @@ export default { value: taskId } } + // 先把定时器干掉 否则会阻塞下面的search + this.destroyTimer() + this.search(current_condition) + + // 查询完再开启定时器 + this.createTimer() }, sortChange({ column, prop, order }) { this.orderConditions = [] @@ -186,7 +207,7 @@ export default { this.show_error_massage = true this.error_massage = massage }, - jumpTask(item){ + jumpTask(item) { this.$emit('jumpTask', item) } } diff --git a/frontend/src/views/system/task/dataset.vue b/frontend/src/views/system/task/dataset.vue index 0fb9712b58..2198ee8fda 100644 --- a/frontend/src/views/system/task/dataset.vue +++ b/frontend/src/views/system/task/dataset.vue @@ -3,11 +3,11 @@ - - + + - - + + @@ -52,11 +52,11 @@ export default { }) }, methods: { - changeTab(){ + changeTab() { this.task = null console.log(this.tabActive) }, - jumpTaskRecord(task){ + jumpTaskRecord(task) { this.task = task this.tabActive = 'TaskRecord' },