前端定时刷新状态信息

<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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值