forked from github/dataease
Merge pull request #310 from dataease/pr@v1.1@fix_消息跳转任务加载延时
fix: 消息跳转到同步任务记录后加载有延时
This commit is contained in:
commit
e74463a462
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
<el-row style="height: 100%;overflow-y: hidden;width: 100%;">
|
||||
<el-tabs v-model="tabActive" @tab-click="changeTab">
|
||||
<el-tab-pane :label="$t('dataset.task.list')" name="DatasetTaskList" >
|
||||
<dataset-task-list :param="task" @jumpTaskRecord="jumpTaskRecord" v-if="tabActive=='DatasetTaskList'" />
|
||||
<el-tab-pane :label="$t('dataset.task.list')" name="DatasetTaskList">
|
||||
<dataset-task-list v-if="tabActive=='DatasetTaskList'" :param="task" @jumpTaskRecord="jumpTaskRecord" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
|
||||
<task-record :param="task" @jumpTask="jumpTask" v-if="tabActive=='TaskRecord'" />
|
||||
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
|
||||
<task-record v-if="tabActive=='TaskRecord'" ref="task_record" :param="task" @jumpTask="jumpTask" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-row>
|
||||
@ -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'
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user