|
|
@ -306,14 +306,37 @@ export default { |
|
|
|
donwReportNameFormat: [], |
|
|
|
reportNameFormat: 0, |
|
|
|
|
|
|
|
intervalId: null, |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.pageTab = this.$route.query.list |
|
|
|
this.getOrderList() |
|
|
|
this.getConfig() |
|
|
|
this.startTimer(); |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
this.stopTimer(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
startTimer() { |
|
|
|
this.intervalId = setInterval(() => { |
|
|
|
this.getOrderList() |
|
|
|
// 每隔5秒执行的代码 |
|
|
|
console.log('这个操作每隔5秒执行一次'); |
|
|
|
}, 10000); |
|
|
|
}, |
|
|
|
stopTimer() { |
|
|
|
if (this.intervalId) { |
|
|
|
clearInterval(this.intervalId); |
|
|
|
} |
|
|
|
}, |
|
|
|
playSound() { |
|
|
|
//const audio = new Audio('/assets/msg.wav'); // 确保路径正确 |
|
|
|
//audio.play(); |
|
|
|
console.log('播放声音'); |
|
|
|
}, |
|
|
|
getFilterParams(){ |
|
|
|
var stime = ''; |
|
|
|
var etime = ''; |
|
|
@ -392,6 +415,10 @@ export default { |
|
|
|
}).then(response => { |
|
|
|
this.tableLoading = false |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.intervalId && response.data.maxid && this.orderListPrevMaxId && response.data.maxid>this.orderListPrevMaxId) { |
|
|
|
console.log('有新订单了'); |
|
|
|
this.playSound(); |
|
|
|
} |
|
|
|
this.orderList = response.data.list |
|
|
|
this.searchStatusList = response.data.search_check_status |
|
|
|
this.orderListTotalRecords = response.data.total_records |
|
|
@ -411,6 +438,7 @@ export default { |
|
|
|
// this.end_page = 1; |
|
|
|
} |
|
|
|
// console.log(this.isHasNextPage, 'isHasNextPage') |
|
|
|
|
|
|
|
}) |
|
|
|
}).catch(error => { |
|
|
|
console.error(error, 'error') |
|
|
|