|
@@ -3,7 +3,7 @@
|
|
:title="'应用日志'"
|
|
:title="'应用日志'"
|
|
:visible.sync="visible"
|
|
:visible.sync="visible"
|
|
width="80%"
|
|
width="80%"
|
|
- @close="cancel"
|
|
|
|
|
|
+ :before-close="handleClose"
|
|
>
|
|
>
|
|
<el-form>
|
|
<el-form>
|
|
|
|
|
|
@@ -23,11 +23,15 @@ export default {
|
|
loading:true,
|
|
loading:true,
|
|
name: "",
|
|
name: "",
|
|
applicationLog: "",
|
|
applicationLog: "",
|
|
|
|
+ timer:null,
|
|
eventsData: [], //定义应用事件数据结构体
|
|
eventsData: [], //定义应用事件数据结构体
|
|
totalPage: 0,
|
|
totalPage: 0,
|
|
pageIndex: 1,
|
|
pageIndex: 1,
|
|
pageSize: this.$store.state.settings.pageSize,
|
|
pageSize: this.$store.state.settings.pageSize,
|
|
};
|
|
};
|
|
|
|
+ },
|
|
|
|
+ activated(){
|
|
|
|
+
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
init(name) {
|
|
init(name) {
|
|
@@ -60,7 +64,52 @@ export default {
|
|
console.log("获取日志信息错误", error);
|
|
console.log("获取日志信息错误", error);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ this.timer=window.setInterval(()=>{
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ console.log("执行定时任务");
|
|
|
|
+ this.getOutput();
|
|
|
|
+ },0)
|
|
|
|
+ },1000);
|
|
},
|
|
},
|
|
|
|
+ getOutput(){
|
|
|
|
+ this.$http({
|
|
|
|
+ url: this.$http.adornUrl(
|
|
|
|
+ `/generator/applications/appRunningLog/${this.name}`
|
|
|
|
+ ),
|
|
|
|
+ method: "get",
|
|
|
|
+ //
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if(res.data.code==500){
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'info',
|
|
|
|
+ message: '暂无数据'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.applicationLog=res.data.log;
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.log("获取日志信息错误", error);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handleClose(){
|
|
|
|
+ if (this.timer) {
|
|
|
|
+ clearInterval(this.timer);
|
|
|
|
+ this.timer = null;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ this.visible=false;
|
|
|
|
+ },
|
|
|
|
+ //切换路由时,清楚定时器
|
|
|
|
+ beforeRouteLeave(to, from, next){
|
|
|
|
+ next();
|
|
|
|
+ if (this.timer) {
|
|
|
|
+ clearInterval(this.timer);
|
|
|
|
+ this.timer = null;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|