前端定时刷新状态信息

tech2024-04-10  59

<template v-if="componentResult.data.length>0"> 执行进度【{{componentResult.process}}】: <template v-for="(item, index) in componentResult.data"> <li style="margin-left: 15px"> 实例{{index+1}}: {{ item.node}} <template v-if="item.status==sysConstant.CommonStatusEnum.UNKONWN.code"> <Icon type="question-circle" color="red" size="10"></Icon> </template> <template v-else-if="item.status==sysConstant.CommonStatusEnum.RUNNING.code"> <Loading size="13px"></Loading> </template> <template v-else-if="item.status==sysConstant.CommonStatusEnum.SUCCESS.code"> <Icon type="check" color="green" size="10"></Icon> </template> <template v-else-if="item.status==sysConstant.CommonStatusEnum.SKIP.code"> <Icon type="exclamation-circle" size="10"></Icon> </template> <template v-else> <Icon type="exclamation-circle" color="red" size="10"></Icon> </template> <label> {{sysConstant.CommonStatusEnum.getLabelByCode(item.status)}} </label> <label v-if="item.status!=sysConstant.CommonStatusEnum.SUCCESS.code&&item.status!=sysConstant.CommonStatusEnum.SKIP.code" style="color: red"> {{item.description}} </label> <label v-if="item.status==sysConstant.CommonStatusEnum.SKIP.code"> {{item.description}} </label> <label v-if="!item.isExpected" style="color: red">proxy/observer实例在admin数据库中不存在,请核对!</label> <template v-if="item.timeCost>3"> <label style="color: red">超过{{item.timeCost}}分钟未收到proxy的响应,请核对proxy是否启动或真实存在!</label> <a class="text-btn" href="javascript: void 0" @click.stop="skipProxy(item)">跳过</a> </template> </li> </template> </template> //定时刷新状态信息 refreshTaskData() { this.refreshCurrentStep(); this.intervalid1 = setInterval(() => { var taskId = this.currentTaskEntity.taskId; var status = this.currentTaskEntity.status; //console.log("do interval check result...."); //显示详细模态框时 才实时刷新。 //if ((status == this.sysConstant.CommonStatusEnum.RUNNING.code)) { this.refreshTaskStatus(taskId); this.refreshTaskComponent(taskId); this.refreshCurrentStep(); //} }, 3000); }, refreshTaskComponent(taskId) { //console.log("refresh task component") this.$api.queryPubTaskComponentByTaskId({ 'taskId': taskId }).then(returnMap => { //console.log(returnMap); this.componentResult.data = returnMap.resultData; this.componentResult.process = returnMap.others.process; }); }, refreshTaskStatus(taskId) { //console.log("refresh task status") this.$api.getByTaskId({ 'taskId': taskId }).then(returnMap => { if (returnMap.resultData != null) { this.currentTaskEntity = { taskId: returnMap.resultData.taskId, auditFlag: returnMap.resultData.auditFlag, status: returnMap.resultData.status, type: returnMap.resultData.type, info: returnMap.resultData.info }; } }); }, refreshCurrentStep() { if (this.currentTaskEntity.status == this.sysConstant.CommonStatusEnum.SUCCESS.code || this.currentTaskEntity.status == this.sysConstant.CommonStatusEnum.FAILED.code) { this.currentStep = 2; } },
最新回复(0)