Browse Source

增加数据面板的跳转

wangJJ 4 years ago
parent
commit
4975fa2ed4
1 changed files with 14 additions and 7 deletions
  1. 14 7
      src/components/task/Task.vue

+ 14 - 7
src/components/task/Task.vue

@@ -141,7 +141,7 @@
         <el-form-item v-if="editShortLink && task.endPoint.serverCode && taskOperationControl.confirmFinish" label="报告短链接" props="shortLink">
           <el-input v-model="shortLink" placeholder="请输入短链接生成任务报告" style="width: 400px">
             <template slot="append">
-              <el-button onClick="getTaskDataBoard()">点击生成</el-button>
+              <el-button @click="getTaskDataBoard()">点击生成</el-button>
             </template>
           </el-input>
         </el-form-item>
@@ -205,6 +205,9 @@
           <el-button v-if="taskOperationControl.uploadReport" type="primary" size="mini" @click="toCreateReport()">
             上传报告
           </el-button>
+          <el-button v-if="taskOperationControl.taskDemonstrate" type="success" size="mini" @click="gotoDataboard()">
+            数据面板
+          </el-button>
           <!--<div class="btn btn-small btn-info"-->
           <!--v-if="taskOperationControl.confirmFinish"-->
           <!--@click="endTask()">确认结束-->
@@ -395,7 +398,7 @@
         },
         acceptedUserList: [],
         shortLink:'',
-        editShortLink:true
+        editShortLink:true,
       }
     },
     watch: {
@@ -431,11 +434,15 @@
       })
     },
     methods: {
+      //跳转到任务对应的数据面板
+      gotoDataboard(){
+        window.open(this.task.endPoint.token)
+      },
       //根据短链接获取生成databoard
       getTaskDataBoard(){
-        Http.get(`/api/project/${this.projectId}/task/${this.taskId}/addToken/${this.shortLink}`).then((res)=>{
-          console.log(res);
-
+        Http.put(`/api/project/${this.projectId}/task/${this.taskId}/addToken`,{"token":this.shortLink}).then((res)=>{
+          this.taskOperationControl = res.taskOperationControl;
+          this.task.endPoint = res.crowdTaskVO.endPointVO;
         })
       },
       getServiceByCode(code){
@@ -564,13 +571,13 @@
         this.task.endPoint = res.crowdTaskVO.endPointVO ? res.crowdTaskVO.endPointVO : {
           serverCode: '',
         }
-        this.taskOperationControl = res.taskOperationControl
+        this.taskOperationControl = res.taskOperationControl;
         this.acceptedUserList = res.acceptedUserList;
         this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
         this.handleFormatReport(this.acceptedUserList);
         this.handleTestTypeChange(res.crowdTaskVO.serviceType);
         this.serviceName = this.getServiceByCode(res.crowdTaskVO.serviceType);
-        this.shortLink = res.crowdTaskVO.endPointVO && res.crowdTaskVO.endPointVO.token
+        this.shortLink = res.crowdTaskVO.endPointVO && res.crowdTaskVO.endPointVO.token;
       },
       //获取任务详情失败时回调函数
       getTaskDetailFail(error) {