|
@@ -78,11 +78,13 @@
|
|
|
components: { countTo, SchedResource, SchedPlan, SchedTask, SchedTime },
|
|
|
props: {
|
|
|
},
|
|
|
+ inject: ['reload'],
|
|
|
data () {
|
|
|
return {
|
|
|
topTongjiData: {"producePlan": 0, "delayPlan": 0,"producePart": 0,"badPart": 0},
|
|
|
activeTab: "task", // 默认选择的tab(任务时间甘特图)
|
|
|
- isShow: true
|
|
|
+ isShow: true,
|
|
|
+ timer: ''
|
|
|
}
|
|
|
},
|
|
|
// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
@@ -100,10 +102,13 @@
|
|
|
mounted () {
|
|
|
this.timerTask()
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ this.clearTimer()
|
|
|
+ },
|
|
|
methods: {
|
|
|
tabClick(e){
|
|
|
console.log("被选择的tab:", e.index)
|
|
|
- // 如果点击的是【任务时间甘特图】 resource
|
|
|
+ // 如果点击的是【订单计划】 resource
|
|
|
if(e.index == 0){
|
|
|
// 加载列表数据
|
|
|
this.clearTimer()
|
|
@@ -115,7 +120,7 @@
|
|
|
this.clearTimer()
|
|
|
this.$refs.resource.fetch()
|
|
|
}
|
|
|
- // 如果点击的是【订单计划】 resource
|
|
|
+ // 如果点击的是【任务池】 resource
|
|
|
if(e.index == 2){
|
|
|
// 加载列表数据
|
|
|
this.timerTask()
|
|
@@ -126,16 +131,16 @@
|
|
|
setChange(){
|
|
|
this.isShow = !this.isShow
|
|
|
},
|
|
|
- timerTask(){
|
|
|
+ timerTask(){
|
|
|
let that = this
|
|
|
that.timer = setInterval(()=>{
|
|
|
- window.location.reload()
|
|
|
- }, 60000)
|
|
|
+ that.reload()
|
|
|
+ }, 60000)
|
|
|
},
|
|
|
- clearTimer(){
|
|
|
+ clearTimer(){
|
|
|
if(this.timer){
|
|
|
- clearInterval(this.timer)
|
|
|
- this.timer = null
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.timer = null
|
|
|
}
|
|
|
},
|
|
|
// 获取统计数据
|
|
@@ -155,7 +160,7 @@
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|