瀏覽代碼

Merge branch 'feature-2.0' into 'master'

Feature 2.0

See merge request crowd-2019/crowd-test-service-front!113
郭超 5 年之前
父節點
當前提交
c2ad9af64f
共有 4 個文件被更改,包括 168 次插入98 次删除
  1. 3 1
      src/components/project/ProjectCreate.vue
  2. 72 32
      src/components/task/Task.vue
  3. 31 3
      src/components/task/TaskCreate.vue
  4. 62 62
      src/main.js

+ 3 - 1
src/components/project/ProjectCreate.vue

@@ -51,6 +51,7 @@
             <span v-for="(item,index) in serviceType" :key="index">
               <el-checkbox :label="item.code" name="type">{{item.name}}&nbsp;&nbsp;&nbsp;&nbsp;</el-checkbox>
             </span>
+            <el-button type="primary" size="mini" @click="dialogVisible = true" v-if="project.type&&project.type.indexOf('BDSPT') > -1">测试配置</el-button>
           </el-checkbox-group>
         </el-form-item>
 
@@ -173,6 +174,7 @@ export default {
       }
     }
     return {
+      dialogVisible: false,
       user: {},
       loading: false,
       tabPosition: 'top',
@@ -303,7 +305,7 @@ export default {
           },
         ],
         datetime:[{required: true, message: '截止时间不可为空', trigger: 'blur'}],
-      }
+      },
     }
   },
   mounted () {

+ 72 - 32
src/components/task/Task.vue

@@ -3,17 +3,20 @@
     <div class="title h1" v-if="!isModifyMode">任务</div>
     <div class="create-body">
       <div class="title h2" v-if="!isModifyMode">基本信息</div>
-      <el-form :model="task" :rules="rules" ref="task" label-width="12%" class="demo-task">
-        <el-form-item label="任务名称" prop="title">
+      <el-form :model="task" :rules="rules" ref="task" label-width="120px" class="demo-task"
+               style="margin:0 100px;">
+        <el-form-item label="任务名称" prop="title" style="width: 700px;">
           <el-input size="small" v-if="isModifyMode" v-model="task.title"></el-input>
-              <span v-if="!isModifyMode">{{task.title}}</span>
-          <el-tag v-if="!isModifyMode" :type="task.statusVO&&task.statusVO.style">{{task.statusVO ? task.statusVO.text:''}}</el-tag>
+          <span v-if="!isModifyMode">{{task.title}}</span>
+          <el-tag v-if="!isModifyMode" :type="task.statusVO&&task.statusVO.style">{{task.statusVO ?
+            task.statusVO.text:''}}
+          </el-tag>
         </el-form-item>
-        <el-form-item label="任务描述" prop="desc">
+        <el-form-item label="任务描述" prop="desc" style="width: 700px;">
           <el-input autosize v-if="isModifyMode" type="textarea" v-model="task.description"></el-input>
-            <span v-if="!isModifyMode">{{task.description}}</span>
+          <span v-if="!isModifyMode">{{task.description}}</span>
         </el-form-item>
-        <el-form-item label="任务报价" prop="quotePrice">
+        <el-form-item label="任务报价" prop="quotePrice" style="width: 700px;">
           <el-input size="small" type="number" v-if="isModifyMode" v-model="task.quotePrice">
             <template slot="append">¥</template>
           </el-input>
@@ -33,7 +36,20 @@
           </el-radio-group>
           <span class="badge" v-if="!isModifyMode">{{task.serviceType}}</span>
         </el-form-item>
-        <el-form-item label="任务可见性" prop="resource">
+
+        <el-form-item label="examId" prop="endPointVO.examId" style="width: 700px;" v-if="showBD&&task.endPointVO&&task.serviceType=='北斗众测'" required>
+          <el-input v-if="isModifyMode" v-model="task.endPointVO.examId" label="examId"></el-input>
+          <span v-if="!isModifyMode&&showBD">{{task.endPointVO.examId}}</span>
+        </el-form-item>
+
+
+        <el-form-item label="caseId" prop="endPointVO.caseId" style="width: 700px;" v-if="showBD&&task.endPointVO&&task.serviceType=='北斗众测'" required>
+          <el-input v-if="isModifyMode" v-model.number="task.endPointVO.caseId" label="caseId"></el-input>
+          <span v-if="!isModifyMode&&showBD">{{task.endPointVO.caseId}}</span>
+        </el-form-item>
+
+
+        <el-form-item label="任务可见性" prop="resource" style="width: 700px;">
           <div v-if="!isModifyMode">
             <!--<div v-if="task.resource=='1'">{{updateLocation(task.location)}}</div>-->
             <div v-if="task.resource==0">定向</div>
@@ -169,6 +185,8 @@
             </el-button>
           </el-popover>
 
+          <el-button v-if="taskOperationControl.writeReport" type="primary" size="mini" @click="gotoWriteReport()">填写报告
+          </el-button>
 
           <el-button v-if="taskOperationControl.update" type="primary" size="mini" @click="modifyForm()">修改任务
           </el-button>
@@ -199,9 +217,9 @@
               <el-col :span="6">{{item.userVO.userName}}</el-col>
               <el-col :span="6">{{item.userVO.email}}</el-col>
               <el-col :span="6">
-              <el-tag type="success" v-if="item.crowdReportVOS">已提交报告</el-tag>
-              <el-tag type="info" v-if="!item.crowdReportVOS">未提交报告</el-tag>
-            </el-col>
+                <el-tag type="success" v-if="item.crowdReportVOS">已提交报告</el-tag>
+                <el-tag type="info" v-if="!item.crowdReportVOS">未提交报告</el-tag>
+              </el-col>
               <el-col :span="6">
                 <el-tag type="success" v-if="item.isCommitted">已提交任务</el-tag>
                 <el-tag type="info" v-if="!item.isCommitted">未提交任务</el-tag>
@@ -211,8 +229,8 @@
           <report-list v-bind:reports="item.crowdReportVOS" v-bind:taskId="taskId" v-bind:projectId="projectId"/>
         </el-collapse-item>
       </el-collapse>
-<!--      <report-list v-if="isAgency" v-bind:reports="reportList" v-bind:taskId="taskId" v-bind:projectId="projectId"/>-->
-<!--      <report-list v-bind:reports="reportList" v-bind:taskId="taskId" v-bind:projectId="projectId"/>-->
+      <!--      <report-list v-if="isAgency" v-bind:reports="reportList" v-bind:taskId="taskId" v-bind:projectId="projectId"/>-->
+      <!--      <report-list v-bind:reports="reportList" v-bind:taskId="taskId" v-bind:projectId="projectId"/>-->
     </div>
   </div>
 </template>
@@ -248,6 +266,7 @@
     data() {
       return {
         user: {},
+        showBD:true,
         rolesPermissions: {},
         loading: false,
         isModifyMode: false,
@@ -264,6 +283,7 @@
           update: false,
           uploadReport: false
         },
+        crowdReportUrl: '',
         task: {
           agencyId: '',
           status: '',
@@ -278,9 +298,13 @@
           fixedPrice: '',
           doc: [],
           requireDocUrl: '',
-          participantCount:1,
-          title:'',
-          description:''
+          participantCount: 1,
+          title: '',
+          description: '',
+          endPointVO: {
+            caseId: '',
+            examId: ''
+          }
         },
         reportList: [],
         pickerOptions: {
@@ -314,7 +338,7 @@
             {required: true, message: '请输入任务名称', trigger: 'blur'},
             {min: 5, max: 50, message: '任务名称长度在 5 到 50 个字符', trigger: 'blur'}
           ],
-            serviceType: [
+          serviceType: [
             {required: true, message: '测试类型不可为空', trigger: 'change'},
           ],
           desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
@@ -345,7 +369,7 @@
           ],
           datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
         },
-        acceptedUserList:[],
+        acceptedUserList: [],
       }
     },
     watch: {
@@ -391,6 +415,11 @@
         this.setInstitutions()
       },
 
+      //北斗测试报告填写跳转
+      gotoWriteReport() {
+        window.open(this.crowdReportUrl, '_blank');
+      },
+
       //跳转至项目详情页面
       toProject() {
         this.$router.push({
@@ -420,6 +449,8 @@
         this.task.institution = ''
         this.task.datetime = ''
         this.task.participantCount = 1
+        // this.task.endPointVO.caseId = ''
+        // this.task.endPointVO.examId = ''
       },
       //显示页面加载画面
       showLoading() {
@@ -433,6 +464,11 @@
       setUserInfo() {
         this.user = storageGet('user')
         this.rolesPermissions = storageGet('rolesPermissions')
+        if(storageGet('rolesPermissions').isRegionManager || storageGet('rolesPermissions').isSystemAdministrator){
+          this.showBD = true;
+        }else {
+          this.showBD = false;
+        }
       },
       //加载任务的测试类型
       setServiceType() {
@@ -457,7 +493,7 @@
       },
       //获取任务详情成功时回调函数
       getTaskDetailSuccess(res) {
-        console.log(res);
+        console.log('获取task信息')
         this.hideLoading()
         console.log(res.crowdTaskVO)
         this.taskId = res.crowdTaskVO.id
@@ -478,8 +514,10 @@
         this.task.agencyId = res.crowdTaskVO.agencyId
         this.task.status = res.crowdTaskVO.status
         this.task.statusVO = res.crowdTaskVO.statusVO
+        this.task.endPointVO = res.crowdTaskVO.endPointVO
         this.taskOperationControl = res.taskOperationControl
         this.acceptedUserList = res.acceptedUserList;
+        this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
         this.handleFormatReport(this.acceptedUserList);
       },
       //获取任务详情失败时回调函数
@@ -498,18 +536,18 @@
         })
       },
 
-      dateFormat (date, format) {
+      dateFormat(date, format) {
         date = new Date(date)
         let o = {
-          'M+' : date.getMonth() + 1, //month
-          'd+' : date.getDate(), //day
-          'H+' : date.getHours(), //hour+8小时
-          'm+' : date.getMinutes(), //minute
-          's+' : date.getSeconds(), //second
-          'q+' : Math.floor((date.getMonth() + 3) / 3), //quarter
-          'S' : date.getMilliseconds() //millisecond
+          'M+': date.getMonth() + 1, //month
+          'd+': date.getDate(), //day
+          'H+': date.getHours(), //hour+8小时
+          'm+': date.getMinutes(), //minute
+          's+': date.getSeconds(), //second
+          'q+': Math.floor((date.getMonth() + 3) / 3), //quarter
+          'S': date.getMilliseconds() //millisecond
         }
-        if (/(y+)/.test(format)){
+        if (/(y+)/.test(format)) {
           format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
         }
 
@@ -536,7 +574,8 @@
               quotePrice: this.task.quotePrice,
               fixedPrice: this.task.fixedPrice,
               requirementFile: this.task.requireDocUrl,
-              participantCount: this.task.participantCount
+              participantCount: this.task.participantCount,
+              endpoint: this.task.endPointVO
             }
             //console.log(newTask)
             updateTask(this.projectId, this.taskId, newTask, this.updateTaskSuccess, this.updateTaskFail)
@@ -563,6 +602,7 @@
         this.task.datetime = new Date(res.crowdTaskVO.datetime)
         this.task.quotePrice = res.crowdTaskVO.quotePrice
         this.task.fixedPrice = res.crowdTaskVO.fixedPrice
+        // this.task.endPointVO = res.crowdTaskVO.endPointVO
         this.task.doc = []
         this.task.requireDocUrl = res.crowdTaskVO.requirementFile,
           this.task.participantCount = res.crowdTaskVO.participantCount
@@ -585,10 +625,10 @@
         }
         formData.append('file', param.file)
         Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
-            notify('success', '上传成功')
+          notify('success', '上传成功')
           this.uploadRequireDocSuccess(res)
         }).catch((error) => {
-            notify('error', '上传失败:' + error.data)
+          notify('error', '上传失败:' + error.data)
           this.uploadRequireDocFail(error)
         })
       },
@@ -798,7 +838,7 @@
     overflow: auto;
   }
 
-  .el-collapse-item__content{
+  .el-collapse-item__content {
     padding-bottom: 0 !important;
   }
 </style>

+ 31 - 3
src/components/task/TaskCreate.vue

@@ -2,7 +2,7 @@
   <div class="create-container" v-loading="loading">
     <div class="title h1">创建任务</div>
     <div class="create-body">
-      <el-form :model="task" :rules="rules" ref="task" label-width="12%" class="demo-task">
+      <el-form :model="task" :rules="rules" ref="task" label-width="120px" class="demo-task" style="margin-left: 100px;width: 700px">
         <el-form-item label="任务名称" prop="name">
           <el-input size="small" v-model="task.name"></el-input>
         </el-form-item>
@@ -26,6 +26,16 @@
             </span>
           </el-radio-group>
         </el-form-item>
+
+
+        <el-form-item label="examId" prop="endpoint.examId" v-if="task.type=='BDSPT'" required>
+          <el-input v-model="task.endpoint.examId" label="examId"></el-input>
+        </el-form-item>
+        <el-form-item label="caseId" prop="endpoint.caseId" v-if="task.type=='BDSPT'" required>
+          <el-input v-model="task.endpoint.caseId" label="caseId"></el-input>
+        </el-form-item>
+
+
         <el-form-item label="任务可见性" prop="resource">
           <el-tabs :tab-position="tabPosition" v-model="task.resource" style="width: 800px">
             <el-tab-pane :label="resourceType[0]" name="0">
@@ -130,7 +140,11 @@ export default {
         fixedPrice: '',
         doc: [],
         requireDocUrl: '',
-        participantCount: 1
+        participantCount: 1,
+        endpoint:{
+          caseId:'',
+          examId:''
+        }
       },
       pickerOptions: {
         shortcuts: [
@@ -192,6 +206,19 @@ export default {
             }, trigger: 'change'
           },
         ],
+        endpoint:[
+          {
+            validator: (rule, value, callback) => {
+              if (this.task.type=== 'BDSPT' && this.task.endpoint.caseId === '') {
+                callback(new Error('请填写对应得caseID'))
+              } else if (this.task.type=== 'BDSPT' && this.task.endpoint.examId === ''){
+                callback(new Error('请填写对应得examID'))
+              } else {
+                callback()
+              }
+            }, trigger: 'change'
+          },
+        ],
         datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
       }
     }
@@ -266,7 +293,8 @@ export default {
             quotePrice: this.task.quotePrice,
             fixedPrice: this.task.fixedPrice,
             requirementFile: this.task.requireDocUrl,
-            participantCount: this.task.participantCount
+            participantCount: this.task.participantCount,
+            endpoint:this.task.endpoint
           }
           Http.post(Apis.TASK.CREATE_TASK.replace('{projectId}', this.projectId), newTask).then((res) => {
             console.log(res)

+ 62 - 62
src/main.js

@@ -78,68 +78,68 @@ function getCurrentUserSuccess(res){
 //   var s = document.getElementsByTagName("script")[0];
 //   s.parentNode.insertBefore(hm, s);
 // })();
-router.beforeEach((to, from, next) => {
-  // if (_hmt) {
-  //   if (to.path) {
-  //     _hmt.push(['_trackPageview', '/#' + to.fullPath]);
-  //   }
-  // }
-  const urls = getAuthUrls()
-  if (storageGet('user') == null) {
-    getCurrentUser().then((res) => {
-      storageSave('user', res)
-      storageSave('rolesPermissions', getRolesPermissions(res.roleList))
-      if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
-        if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
-          next()
-        } else {
-          next({
-            path: '/',
-            query: {
-              redirect: to.fullPath
-            } // 将跳转的路由path作为参数,登录成功后跳转到该路由
-          })
-        }
-      } else {
-        next()
-      }
-    }).catch((error) => {
-      // notify('warning', '请登录')
-      if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
-        if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
-          next()
-        } else {
-          next({
-            path: '/',
-            query: {
-              redirect: to.fullPath
-            } // 将跳转的路由path作为参数,登录成功后跳转到该路由
-          })
-        }
-      } else {
-        next()
-      }
-    })
-  } else {
-    if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
-      if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
-        next()
-      } else {
-        next({
-          path: '/',
-          query: {
-            redirect: to.fullPath
-          } // 将跳转的路由path作为参数,登录成功后跳转到该路由
-        })
-      }
-    } else {
-      next()
-    }
-  }
-  //console.log(to.matched[0].path)
-  //console.log(urls.includes(to.matched[0].path))
-
-})
+// router.beforeEach((to, from, next) => {
+//   // if (_hmt) {
+//   //   if (to.path) {
+//   //     _hmt.push(['_trackPageview', '/#' + to.fullPath]);
+//   //   }
+//   // }
+//   const urls = getAuthUrls()
+//   if (storageGet('user') == null) {
+//     getCurrentUser().then((res) => {
+//       storageSave('user', res)
+//       storageSave('rolesPermissions', getRolesPermissions(res.roleList))
+//       if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
+//         if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
+//           next()
+//         } else {
+//           next({
+//             path: '/',
+//             query: {
+//               redirect: to.fullPath
+//             } // 将跳转的路由path作为参数,登录成功后跳转到该路由
+//           })
+//         }
+//       } else {
+//         next()
+//       }
+//     }).catch((error) => {
+//       // notify('warning', '请登录')
+//       if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
+//         if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
+//           next()
+//         } else {
+//           next({
+//             path: '/',
+//             query: {
+//               redirect: to.fullPath
+//             } // 将跳转的路由path作为参数,登录成功后跳转到该路由
+//           })
+//         }
+//       } else {
+//         next()
+//       }
+//     })
+//   } else {
+//     if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
+//       if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName  //在登录的时候设置它的值
+//         next()
+//       } else {
+//         next({
+//           path: '/',
+//           query: {
+//             redirect: to.fullPath
+//           } // 将跳转的路由path作为参数,登录成功后跳转到该路由
+//         })
+//       }
+//     } else {
+//       next()
+//     }
+//   }
+//   //console.log(to.matched[0].path)
+//   //console.log(urls.includes(to.matched[0].path))
+//
+// })
 
 // require('./mock.js')
 Vue.use(Carousel)