guochao 6 years ago
parent
commit
206e362a48

+ 8 - 4
src/components/Mine.vue

@@ -194,22 +194,26 @@ export default {
           text: ''
         },
         tooltip: {
-          trigger: 'axis'
+          //trigger: 'axis'
         },
         legend: {
           data:['接收项目数量','完成项目数量','接收任务数量','完成任务数量','发布项目数量']
         },
         grid: {
           left: '5%',
-          right: '10%',
+          right: '8%',
           bottom: '3%',
           top:'10%',
           containLabel: true
         },
         toolbox: {
           feature: {
-            saveAsImage: {}
-          }
+            saveAsImage: {
+              title:'保存为图片',
+              name:'我的众测'
+            }
+          },
+          right:'20px'
         },
         xAxis: {
           type: 'category',

+ 1 - 1
src/components/authen/AgencyAuthentication.vue

@@ -66,7 +66,7 @@
           <el-button v-if="isModifyMode" type="primary" icon="el-icon-circle-plus" plain size="small"
                      @click="addAgencyResource">添加资源
           </el-button>
-          <span v-if="!isModifyMode" v-for="item in authentication.resource" :key="item">
+          <span v-if="!isModifyMode" v-for="item in authentication.resource" :key="item.id">
             资源类型:{{item.type}};&nbsp;&nbsp;资源名称:{{item.name}};&nbsp;&nbsp;资源总量:{{item.totalNum}};&nbsp;&nbsp;可用资源:{{item.availableNum}}<br/>
           </span>
         </el-form-item>

+ 53 - 21
src/components/authen/EnterpriseAuthentication.vue

@@ -1,14 +1,15 @@
 <template>
   <div class="create-container">
-    <div class="create-body">
+    <div class="create-body" v-loading="loading">
       <div class="title">企业信息认证</div>
       <el-form :model="authentication" :rules="rules" ref="authentication" label-width="12%" class="demo-report">
         <el-form-item label="公司名" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.enterpriseName"></el-input>
-          <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
+          <span v-if="!isModifyMode">{{authentication.enterpriseName}}</span>
         </el-form-item>
         <el-form-item label="公司营业执照" prop="file">
           <el-upload
+            v-if="isModifyMode"
             class="avatar-uploader"
             action="https://jsonplaceholder.typicode.com/posts/"
             :show-file-list="false"
@@ -17,6 +18,12 @@
             <img v-if="authentication.businessLicense" :src="authentication.businessLicense" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
+          <span v-if="!isModifyMode">
+          <el-image
+            style="width: 100px;"
+            :src="authentication.businessLicense"
+            fit="scale-down"></el-image>
+        </span>
           <!--<div v-if="!isModifyMode">-->
           <!--<span v-if="authentication.photo==null">暂无文件</span>-->
           <!--<a :href="authentication.photo" v-if="authentication.photo!=null"><i class="fa fa-file-text-o"></i>-->
@@ -25,28 +32,27 @@
         </el-form-item>
         <el-form-item label="公司法人姓名" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.enterpriseBossName"></el-input>
-          <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
+          <span v-if="!isModifyMode">{{authentication.enterpriseBossName}}</span>
         </el-form-item>
         <el-form-item label="对公账户" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
-          <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
+          <span v-if="!isModifyMode">{{authentication.bankAccount}}</span>
         </el-form-item>
         <el-form-item label="统一社会信用代码" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.USCC"></el-input>
-          <!--<span v-if="!isModifyMode">{{authentication.bankAccount}}</span>-->
+          <span v-if="!isModifyMode">{{authentication.USCC}}</span>
         </el-form-item>
         <el-form-item label="公司地址" prop="name">
           <el-input v-if="isModifyMode" v-model="authentication.enterpriseAddress"></el-input>
-          <!--<span v-if="!isModifyMode">{{authentication.address}}</span>-->
+          <span v-if="!isModifyMode">{{authentication.enterpriseAddress}}</span>
         </el-form-item>
 
-        <!--<el-form-item v-if="!isModifyMode">-->
-        <!--<div class="btn btn-medium btn-info" @click="modifyInfo()">修改</div>-->
-        <!--<div class="btn btn-medium" @click="cancelModify()">返回</div>-->
-        <!--</el-form-item>-->
+        <el-form-item v-if="!isModifyMode">
+          <div class="btn btn-medium btn-info" @click="modifyInfo()">修改</div>
+        </el-form-item>
         <el-form-item v-if="isModifyMode">
-          <div class="btn btn-primary btn-info" @click="submitInfo()">提交</div>
-          <!--<div class="btn btn-primary" @click="cancelModify()">取消</div>-->
+          <div class="btn btn-primary btn-info" @click="updateAuthInfo()">提交</div>
+          <div class="btn btn-primary" @click="cancelModify()">取消</div>
         </el-form-item>
       </el-form>
     </div>
@@ -57,7 +63,7 @@
 import Http from '@/js/http'
 import Apis from '@/js/api'
 import {notify} from '@/constants/index'
-import {storageGet} from '@/js/index'
+import {defaultValue, getCurrentAuthenInfo, storageGet, updateEnterpriseAuthInfo} from '@/js/index'
 
 export default {
   name: 'EnterpriseAuthentication',
@@ -65,12 +71,13 @@ export default {
     return {
       userId: 0,
       user: {},
-      isModifyMode: true,
+      isModifyMode: false,
+      loading: false,
       authentication: {
         enterpriseName: '',
         enterpriseBossName: '',
-        bankAccount:'',
-        businessLicense: '',
+        bankAccount: '',
+        businessLicense: defaultValue.image,
         USCC: '',
         enterpriseAddress: ''
       },
@@ -104,17 +111,34 @@ export default {
     //初始化数据
     init () {
       this.setUserInfo()
+      this.getAuthInfo()
     },
     //加载数据
-    loadData: function () {
+    getAuthInfo () {
+      this.showLoading()
+      getCurrentAuthenInfo().then((res) => {
+        //this.authentication.photo = []
+        this.authentication.businessLicense = res.businessLicensePhoto == null ? defaultValue.image : res.businessLicensePhoto
+        this.authentication.enterpriseName = res.companyName == null ? '暂未填写' : res.companyName
+        this.authentication.enterpriseBossName = res.legalPersonName == null ? '暂未填写' : res.legalPersonName
+        this.authentication.bankAccount = res.bankAccount == null ? '暂未填写' : res.bankAccount
+        this.authentication.USCC = res.unifiedSocialCreditCode == null ? '暂未填写' : res.unifiedSocialCreditCode
+        this.authentication.enterpriseAddress = res.address == null ? '暂未填写' : res.address
+        this.hideLoading()
+        console.log(this.authentication)
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '加载认证信息失败:' + error.data)
+      })
     },
     //表单进入可编辑状态,可修改表单,不再使用
     modifyInfo () {
       this.isModifyMode = true
     },
     //提交认证信息
-    submitInfo () {
+    updateAuthInfo () {
       //this.isModifyMode = false
+      this.showLoading()
       const newAuthentication = {
         mobile: this.authentication.mobile,
         evaluationAgencyName: this.authentication.name,
@@ -124,11 +148,13 @@ export default {
         resources: this.authentication.resource,
         agencyPhoto: this.authentication.photoUrl,
       }
-      Http.post(Apis.USER.SUBMIT_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
+      updateEnterpriseAuthInfo.then((res) => {
+        this.hideLoading()
         console.log(res)
-        notify('success', '认证信息上传成功')
+        notify('success', '认证信息修改成功')
       }).catch(error => {
-        notify('error', error.data.msg)
+        this.hideLoading()
+        notify('error', error.data)
       })
     },
     //取消修改表单,表单进入不可编辑状态,不再使用
@@ -179,6 +205,12 @@ export default {
     test () {
 
     },
+    showLoading () {
+      this.loading = true
+    },
+    hideLoading () {
+      this.loading = false
+    },
   },
 }
 </script>

+ 13 - 9
src/components/commons/ProjectItem.vue

@@ -1,19 +1,20 @@
 <template>
   <div class="project-item-container">
-    <span class="col-xl-2 col-lg-3 col-md-4 col-sm-1">
+    <span class="col-xl-2 col-lg-3 col-md-4 col-sm-1" style="width: 15%">
       <img class="project-cover" src="@/assets/img/home_ban1.jpg">
     </span>
-    <span class="project-title col-md-2 col-sm-10">{{project.name}}</span>
-    <span class="project-title col-md-2 col-sm-10">{{project.id}}</span>
-    <span class="col-md-2 col-sm-10">
+    <span class="project-title col-md-2 col-sm-10" style="width: 15%;font-size: 12px">{{project.name}}</span>
+    <span class="project-title col-md-2 col-sm-10" style="width: 10%;font-size: 12px">{{project.id}}</span>
+    <span class="col-md-2 col-sm-10" style="width: 10%">
       <span
+        style="font-size: 10px;"
         v-bind:class="['badge',{ 'ios-platform': item=='IOS','android-platform': item=='ANDROID','web-platform': item=='WEB'}]"
         v-for="item in project.platform"
       >{{item}}</span>
     </span>
-    <span class="col-md-1 col-sm-5">¥{{project.price}}</span>
-    <span class="project-td">
-      <span class="btn btn-medium btn-info" @click="goToProjectDetail(project.id)">查看详情</span>
+    <span class="col-md-1 col-sm-5" style="width: 10%;font-size: 12px"><div class="badge">¥{{project.budget}}</div></span>
+    <span class="project-td" style="width: 15%">
+      <span class="btn btn-small btn-info" @click="goToProjectDetail(project.id)">查看详情</span>
     </span>
   </div>
 </template>
@@ -48,9 +49,12 @@ export default {
 
 <style lang="less" scoped>
   .project-item-container {
-    padding: 20px;
+    /*padding: 20px;*/
+    padding-top: 10px;
+    padding-bottom: 10px;
     border: 1px solid #eee;
-    margin: 15px 5px;
+    margin-top: 5px;
+    margin-bottom: 5px;
     span {
       display: inline-block;
     }

+ 13 - 12
src/components/project/Project.vue

@@ -140,7 +140,7 @@
               <em>点击上传</em>
             </div>
           </el-upload>
-          <span v-if="!isModifyMode"><a :href="project.requireDocUrl">{{project.requireDocUrl.split('/')[project.requireDocUrl.split('/').length-1]}}</a></span>
+          <span v-if="!isModifyMode"><a :href="project.requireDocUrl"><el-link :underline="false" type="primary"><i class="el-icon-document"></i>下载文档</el-link></a></span>
         </el-form-item>
         <el-form-item label="安装包" prop="file">
           <el-upload
@@ -162,7 +162,7 @@
               <em>点击上传</em>
             </div>
           </el-upload>
-          <span v-if="!isModifyMode"><a :href="project.fileUrl">{{project.fileUrl.split('/')[project.fileUrl.split('/').length-1]}}</a></span>
+          <span v-if="!isModifyMode"><a :href="project.fileUrl"><el-link :underline="false" type="primary"><i class="el-icon-document"></i>下载文件</el-link></a></span>
         </el-form-item>
         <el-form-item label="项目截止时间" prop="datetime">
           <div class="block" v-if="isModifyMode">
@@ -177,19 +177,20 @@
           <span v-if="!isModifyMode">{{new Date(project.datetime)}}</span>
         </el-form-item>
         <el-form-item v-if="isModifyMode">
-          <div class="btn btn-medium btn-info" @click="submitForm('project')">确认修改</div>
-          <div class="btn btn-medium" @click="resetForm('project')">重置</div>
-          <div class="btn btn-medium" @click="cancelMode('project')">取消</div>
+          <div class="btn btn-small btn-info" @click="submitForm('project')">确认修改</div>
+          <div class="btn btn-small" @click="resetForm('project')">重置</div>
+          <div class="btn btn-small" @click="cancelMode('project')">取消</div>
         </el-form-item>
         <el-form-item v-if="!isModifyMode">
-          <div class="btn btn-medium btn-info" @click="submitProjectRequest()">结束项目</div>
-          <div class="btn btn-medium btn-info" @click="submitProjectRequest()">发布项目</div>
-          <div class="btn btn-medium btn-info" @click="submitProjectRequest()">提交项目</div>
-          <div class="btn btn-medium btn-info" @click="applyProject()">接受项目</div>
-          <div class="btn btn-medium btn-info" @click="modifyForm()">修改项目</div>
+          <div class="btn btn-small btn-warning-soft" @click="submitProjectRequest()">结束项目</div>
+          <!--<div class="btn btn-small btn-info" @click="submitProjectRequest()">发布项目</div>-->
+          <div class="btn btn-small btn-info" @click="submitProjectRequest()">提交项目</div>
+          <div class="btn btn-small btn-info" @click="applyProject()">接受项目</div>
+          <div class="btn btn-small btn-danger" @click="submitProjectRequest()">拒绝项目</div>
+          <div class="btn btn-small btn-info" @click="modifyForm()">修改项目</div>
           <!--<div class="btn btn-medium btn-info" @click="analyseDemand()">分析需求</div>-->
-          <div class="btn btn-medium btn-info" @click="createTask()">新建任务</div>
-          <div class="btn btn-medium btn-info" @click="createReport()">上传报告</div>
+          <div class="btn btn-small btn-info" @click="createTask()">新建任务</div>
+          <div class="btn btn-small btn-info" @click="createReport()">上传报告</div>
         </el-form-item>
       </el-form>
     </div>

+ 29 - 58
src/components/report/Report.vue → src/components/report/ProjectReport.vue

@@ -60,8 +60,9 @@
           </el-upload>
           <div v-if="!isModifyMode">
             <span v-if="report.fileUrl==null">暂无文件</span>
-            <a :href="report.fileUrl" v-if="report.fileUrl!=null"><i class="fa fa-file-text-o"></i>
-              {{report.fileUrl}}</a>
+            <a :href="report.fileUrl" v-if="report.fileUrl!=null">
+              <el-link :underline="false" type="primary"><i class="el-icon-document"></i>下载文档</el-link>
+            </a>
           </div>
         </el-form-item>
 
@@ -90,7 +91,7 @@ import {notify} from '@/constants/index'
 import {getAllReportTypes, storageGet} from '@/js/index'
 
 export default {
-  name: 'Report-Create',
+  name: 'ProjectReport',
   components: {},
   data () {
     return {
@@ -162,26 +163,15 @@ export default {
         conclusion: this.report.conclusion
       }
       console.log(newReport)
-      if (this.taskId == null) {
-        Http.put(Apis.REPORT.UPDATE_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId), newReport).then((res) => {
-          console.log(res)
-          notify('success', '修改成功')
-          this.hideLoading()
-          this.isModifyMode = false
-        }).catch((error) => {
-          this.hideLoading()
-          notify('error', error.data)
-        })
-      } else {
-        Http.put(Apis.REPORT.UPDATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId), newReport).then((res) => {
-          console.log(res)
-          this.hideLoading()
-          this.isModifyMode = false
-        }).catch((error) => {
-          this.hideLoading()
-          notify('error', error.data)
-        })
-      }
+      Http.put(Apis.REPORT.UPDATE_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId), newReport).then((res) => {
+        console.log(res)
+        notify('success', '修改成功')
+        this.hideLoading()
+        this.isModifyMode = false
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', error.data)
+      })
       // this.$refs[formName].validate(valid => {
       //   if (valid) {
       //     this.isModifyMode = false
@@ -246,41 +236,22 @@ export default {
       //pro1564487183259_task1564487274060
       //pro1564487183259pro1564487183259_task1564487274060_rep1564488510500
       this.showLoading()
-      if (this.taskId == null) {
-        Http.get(Apis.REPORT.GET_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId)).then((res) => {
-          this.report.name = res.crowdReportVO.name
-          this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
-          this.report.scope = res.crowdReportVO.scope
-          this.report.type = res.crowdReportVO.type
-          this.report.description = res.crowdReportVO.description
-          this.report.content = res.crowdReportVO.content
-          this.report.fileUrl = res.crowdReportVO.file
-          this.report.conclusion = res.crowdReportVO.conclusion
-          this.report.target = res.crowdReportVO.target
-          this.hideLoading()
-          //notify('success', '修改成功')
-        }).catch((error) => {
-          this.hideLoading()
-          notify('error', '打开报告失败:' + error.data)
-        })
-      } else {
-        Http.get(Apis.REPORT.GET_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId)).then((res) => {
-          console.log(res)
-          this.report.name = res.crowdReportVO.name
-          this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
-          this.report.scope = res.crowdReportVO.scope
-          this.report.type = res.crowdReportVO.type
-          this.report.description = res.crowdReportVO.description
-          this.report.content = res.crowdReportVO.content
-          this.report.fileUrl = res.crowdReportVO.file
-          this.report.conclusion = res.crowdReportVO.conclusion
-          this.report.target = res.crowdReportVO.target
-          this.hideLoading()
-        }).catch((error) => {
-          this.hideLoading()
-          notify('error', '打开报告失败:' + error.data)
-        })
-      }
+      Http.get(Apis.REPORT.GET_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId)).then((res) => {
+        this.report.name = res.crowdReportVO.name
+        this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
+        this.report.scope = res.crowdReportVO.scope
+        this.report.type = res.crowdReportVO.type
+        this.report.description = res.crowdReportVO.description
+        this.report.content = res.crowdReportVO.content
+        this.report.fileUrl = res.crowdReportVO.file
+        this.report.conclusion = res.crowdReportVO.conclusion
+        this.report.target = res.crowdReportVO.target
+        this.hideLoading()
+        //notify('success', '修改成功')
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '打开报告失败:' + error.data)
+      })
     },
     uploadReportFile (param) {
       this.showLoading()

+ 19 - 14
src/components/report/ReportCreate.vue → src/components/report/ProjectReportCreate.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="create-container">
+  <div class="create-container" v-loading="loading">
     <div class="title h1">创建报告</div>
     <div class="create-body">
       <el-form :model="report" :rules="rules" ref="report" label-width="12%" class="demo-report">
@@ -82,12 +82,13 @@ import {notify} from '@/constants/index'
 import {getAllReportTypes, storageGet} from '@/js/index'
 
 export default {
-  name: 'ReportCreate',
+  name: 'ProjectReportCreate',
   components: {},
   data () {
     return {
       user: {},
       reportType: [],
+      loading: false,
       scope: 0,
       projectId: '',
       taskId: '',
@@ -140,6 +141,7 @@ export default {
       this.setReportType()
     },
     submitForm (formName) {
+      this.showLoading()
       const newReport = {
         name: this.report.name,
         scope: this.scope,
@@ -151,16 +153,13 @@ export default {
         conclusion: this.report.conclusion
       }
       console.log(newReport)
-      if (this.taskId == null) {
-        Http.post(Apis.REPORT.CREATE_PROJECT_REPORT.replace('{projectId}', this.projectId), newReport).then((res) => {
-          this.createReportSuccess(res.crowdReportVO.code)
-        })
-      } else {
-        Http.post(Apis.REPORT.CREATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId), newReport).then((res) => {
-          this.createReportSuccess(res.crowdReportVO.code)
-        })
-      }
-
+      Http.post(Apis.REPORT.CREATE_PROJECT_REPORT.replace('{projectId}', this.projectId), newReport).then((res) => {
+        this.hideLoading()
+        this.createReportSuccess(res.crowdReportVO.code)
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '报告创建失败:' + error.data)
+      })
       // this.$refs[formName].validate(valid => {
       //   if (valid) {
       //
@@ -245,12 +244,18 @@ export default {
         confirmButtonText: '确定',
         callback: action => {
           this.$router.push({
-            name: 'Report',
-            params: {reportId: reportId, projectId: this.projectId, taskId: this.taskId}
+            name: 'ProjectReport',
+            params: {reportId: reportId, projectId: this.projectId}
           })
         }
       })
     },
+    showLoading () {
+      this.loading = true
+    },
+    hideLoading () {
+      this.loading = false
+    }
   },
   watch: {
     reportType (val) {

+ 314 - 0
src/components/report/TaskReport.vue

@@ -0,0 +1,314 @@
+<template>
+  <div class="create-container">
+    <div class="create-body" v-loading="loading">
+      <el-form :model="report" :rules="rules" ref="report" label-width="12%" class="demo-report">
+        <el-form-item label="报告名称" prop="name">
+          <el-input v-if="isModifyMode" v-model="report.name"></el-input>
+          <span v-if="!isModifyMode">{{report.name}}</span>
+        </el-form-item>
+        <el-form-item label="报告类型" prop="type">
+          <el-radio-group v-if="isModifyMode" v-model="report.type">
+            <span v-for="(item,index) in reportType" :key="index">
+              <el-radio :label="item" name="type">{{item}}</el-radio>
+            </span>
+          </el-radio-group>
+          <span v-if="!isModifyMode" class="badge">{{report.type}}</span>
+        </el-form-item>
+        <el-form-item label="摘要" prop="abstract">
+          <div>
+            <el-row :gutter="2">
+              <el-col :span="2">
+                <span>测试对象</span>
+              </el-col>
+              <el-col :span="10">
+                <el-input v-if="isModifyMode" type="textarea" v-model="report.target"></el-input>
+                <span v-if="!isModifyMode">{{report.target}}</span>
+              </el-col>
+            </el-row>
+            <el-row :gutter="2">
+              <el-col :span="2">
+                <span>测试内容</span>
+              </el-col>
+              <el-col :span="10">
+                <el-input v-if="isModifyMode" type="textarea" v-model="report.content"></el-input>
+                <span v-if="!isModifyMode">{{report.content}}</span>
+              </el-col>
+            </el-row>
+          </div>
+        </el-form-item>
+        <el-form-item prop="file" label="报告文件">
+          <el-upload
+            v-if="isModifyMode"
+            drag
+            class="upload-demo"
+            action=""
+            :on-remove="handleRemove"
+            :before-remove="beforeRemove"
+            multiple
+            :limit="1"
+            :on-exceed="handleExceed"
+            :before-upload="beforeFileUpload"
+            :file-list="report.file"
+            :http-request="uploadReportFile"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              将文件拖到此处,或
+              <em>点击上传</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">请上传报告文件</div>
+          </el-upload>
+          <div v-if="!isModifyMode">
+            <span v-if="report.fileUrl==null">暂无文件</span>
+            <a :href="report.fileUrl" v-if="report.fileUrl!=null">
+              <el-link :underline="false" type="primary"><i class="el-icon-document"></i>下载文档</el-link>
+            </a>
+          </div>
+        </el-form-item>
+
+        <el-form-item label="结论" prop="conclusion">
+          <el-input v-if="isModifyMode" type="textarea" v-model="report.conclusion"></el-input>
+          <span v-if="!isModifyMode">{{report.conclusion}}</span>
+        </el-form-item>
+        <el-form-item v-if="!isModifyMode">
+          <div class="btn btn-medium btn-info" @click="modifyForm()">修改</div>
+          <div class="btn btn-medium" @click="back()">返回</div>
+        </el-form-item>
+        <el-form-item v-if="isModifyMode">
+          <div class="btn btn-primary btn-info" @click="submitForm('report')">确认修改</div>
+          <div class="btn btn-primary" @click="resetForm('report')">重置</div>
+          <div class="btn btn-primary" @click="cancelCreate('report')">取消</div>
+        </el-form-item>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import Http from '@/js/http.js'
+import Apis from '@/js/api.js'
+import {notify} from '@/constants/index'
+import {getAllReportTypes, storageGet} from '@/js/index'
+
+export default {
+  name: 'TaskReport',
+  components: {},
+  data () {
+    return {
+      user: {},
+      loading: false,
+      reportId: 0,
+      projectId: '',
+      taskId: '',
+      isModifyMode: false,
+      reportType: [],
+      report: {
+        name: '',
+        type: '',
+        description: '',
+        target: '',
+        content: '',
+        file: [],
+        fileUrl: '',
+        conclusion: ''
+      },
+      rules: {
+        // name: [
+        //   {required: true, message: '请输入报告名称', trigger: 'blur'}
+        //   // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
+        // ],
+        // abstract: [
+        //   {
+        //     required: true,
+        //     message: '请输入摘要信息',
+        //     trigger: 'change'
+        //   }
+        // ],
+        // type: [
+        //   {required: true, message: '请选择报告类型', trigger: 'change'}
+        // ],
+        // conclusion: [
+        //   {required: true, message: '请输入报告结论', trigger: 'blur'}
+        // ]
+      }
+    }
+  },
+  mounted () {
+    this.$nextTick(() => {
+      this.init()
+    })
+  },
+  methods: {
+    init () {
+      this.reportId = this.$route.params.reportId
+      this.projectId = this.$route.params.projectId
+      this.taskId = this.$route.params.taskId
+      this.setReportType()
+      this.setUserInfo()
+      this.loadData()
+    },
+    modifyForm () {
+      this.isModifyMode = true
+    },
+    submitForm (formName) {
+      this.showLoading()
+      const newReport = {
+        name: this.report.name,
+        scope: this.taskId == null ? 0 : 1,
+        type: this.report.type,
+        dependencyCode: this.taskId == null ? this.projectId : this.taskId,
+        target: this.report.target,
+        content: this.report.content,
+        file: '123.pdf',
+        conclusion: this.report.conclusion
+      }
+      console.log(newReport)
+      Http.put(Apis.REPORT.UPDATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId), newReport).then((res) => {
+        console.log(res)
+        this.hideLoading()
+        this.isModifyMode = false
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', error.data)
+      })
+      // this.$refs[formName].validate(valid => {
+      //   if (valid) {
+      //     this.isModifyMode = false
+      //
+      //     //提交 report
+      //   } else {
+      //     console.log('error submit!!')
+      //     return false
+      //   }
+      // })
+    },
+    resetForm (formName) {
+      this.$refs[formName].resetFields()
+      this.report.name = ''
+      this.report.target = ''
+      this.report.content = ''
+      this.report.file = ''
+      this.report.type = ''
+      this.report.conclusion = ''
+    },
+    cancelCreate () {
+      this.isModifyMode = false
+      //请求 report
+    },
+    handleRemove (file, fileList) {
+      console.log(file, fileList)
+    },
+    handleExceed (files, fileList) {
+      this.$message.warning(
+        `当前限制选择 1 个文件,本次选择了 ${
+          files.length
+          } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+      )
+    },
+    beforeRemove (file, fileList) {
+      //return this.$confirm(`确定移除 ${file.name}?`)
+    },
+    beforeFileUpload (file) {
+      console.log(file)
+      const isPDF = file.type === 'application/pdf'
+      const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
+      const isEXCEL = file.type === 'application/vnd.ms-excel'
+      const isXLS = file.type === 'application/x-xls'
+      const isTXT = file.type === 'text/plain'
+      const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+    },
+    back () {
+      if (window.history.length <= 1) {
+        this.$router.push({path: '/'})
+        return false
+      } else {
+        this.$router.go(-1)
+      }
+    },
+    loadData () {
+      //pro1564487183259
+      //pro1564487183259_task1564487274060
+      //pro1564487183259pro1564487183259_task1564487274060_rep1564488510500
+      this.showLoading()
+      Http.get(Apis.REPORT.GET_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId)).then((res) => {
+        console.log(res)
+        this.report.name = res.crowdReportVO.name
+        this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
+        this.report.scope = res.crowdReportVO.scope
+        this.report.type = res.crowdReportVO.type
+        this.report.description = res.crowdReportVO.description
+        this.report.content = res.crowdReportVO.content
+        this.report.fileUrl = res.crowdReportVO.file
+        this.report.conclusion = res.crowdReportVO.conclusion
+        this.report.target = res.crowdReportVO.target
+        this.hideLoading()
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '打开报告失败:' + error.data)
+      })
+    },
+    uploadReportFile (param) {
+      this.showLoading()
+      const formData = new FormData()
+      let config = {
+        //添加请求头
+        headers: {'Content-Type': 'multipart/form-data'},
+      }
+      formData.append('file', param.file)
+      Http.upload(Apis.FILE.UPLOAD_REPORT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
+        console.log('上传成功')
+        this.report.fileUrl = res.data
+        console.log(res)
+        this.hideLoading()
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '文件上传失败:' + error.data)
+      })
+    },
+    setReportType () {
+      getAllReportTypes().then((res) => {
+        this.reportType = res
+      }).catch((error) => {
+        notify('error', '加载报告类型失败')
+      })
+    },
+    setUserInfo () {
+      this.user = storageGet('user')
+    },
+    updateReportSuccess () {
+
+    },
+    showLoading () {
+      this.loading = true
+    },
+    hideLoading () {
+      this.loading = false
+    }
+  },
+  watch: {
+    reportType (val) {
+      this.reportType = val
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .el-radio {
+    margin: 10px 20px 10px 0;
+  }
+
+  .el-form-item /deep/ .el-tabs__content {
+    max-height: 120px !important;
+    overflow: auto;
+  }
+
+  .el-row {
+    margin-bottom: 10px;
+  }
+</style>

+ 287 - 0
src/components/report/TaskReportCreate.vue

@@ -0,0 +1,287 @@
+<template>
+  <div class="create-container" v-loading="loading">
+    <div class="title h1">创建报告</div>
+    <div class="create-body">
+      <el-form :model="report" :rules="rules" ref="report" label-width="12%" class="demo-report">
+        <el-form-item label="报告名称" prop="name">
+          <el-input v-model="report.name"></el-input>
+        </el-form-item>
+        <el-form-item label="报告类型" prop="type">
+          <el-radio-group v-model="report.type">
+            <span v-for="(item,index) in reportType" :key="index">
+              <el-radio :label="item" name="type">{{item}}</el-radio>
+            </span>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="测试对象" prop="name">
+          <el-input style="width: 400px" type="textarea" v-model="report.target"></el-input>
+        </el-form-item>
+        <el-form-item label="测试内容" prop="name">
+          <el-input style="width: 400px" type="textarea" v-model="report.content"></el-input>
+        </el-form-item>
+        <!--<el-form-item label="摘要" prop="abstract">-->
+        <!--<div>-->
+        <!--<el-row :gutter="2">-->
+        <!--<el-col :span="2">-->
+        <!--<span>测试对象</span>-->
+        <!--</el-col>-->
+        <!--<el-col :span="10">-->
+        <!--<el-input type="textarea" v-model="report.target"></el-input>-->
+        <!--</el-col>-->
+        <!--</el-row>-->
+        <!--<el-row :gutter="2">-->
+        <!--<el-col :span="2">-->
+        <!--<span>测试内容</span>-->
+        <!--</el-col>-->
+        <!--<el-col :span="10">-->
+        <!--<el-input type="textarea" v-model="report.content"></el-input>-->
+        <!--</el-col>-->
+        <!--</el-row>-->
+        <!--</div>-->
+        <!--</el-form-item>-->
+        <el-form-item prop="file" label="报告文件">
+          <el-upload
+            drag
+            class="upload-demo"
+            action="https://jsonplaceholder.typicode.com/posts/"
+            :on-remove="handleRemove"
+            :before-remove="beforeRemove"
+            multiple
+            :limit="1"
+            :on-exceed="handleExceed"
+            :before-upload="beforeFileUpload"
+            :file-list="report.file"
+            :http-request="uploadReportFile"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              将文件拖到此处,或
+              <em>点击上传</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">请上传报告文件</div>
+          </el-upload>
+        </el-form-item>
+
+        <el-form-item label="结论" prop="conclusion">
+          <el-input style="width: 400px" type="textarea" v-model="report.conclusion"></el-input>
+        </el-form-item>
+        <el-form-item>
+          <div class="btn btn-primary btn-info" @click="submitForm('report')">提交</div>
+          <div class="btn btn-primary" @click="resetForm('report')">重置</div>
+          <div class="btn btn-primary" @click="cancelCreate('report')">取消</div>
+        </el-form-item>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import Http from '@/js/http.js'
+import Apis from '@/js/api.js'
+import {notify} from '@/constants/index'
+import {getAllReportTypes, storageGet} from '@/js/index'
+
+export default {
+  name: 'TaskReportCreate',
+  components: {},
+  data () {
+    return {
+      user: {},
+      loading: false,
+      reportType: [],
+      scope: 0,
+      projectId: '',
+      taskId: '',
+      dependencyCode: '',
+      report: {
+        name: '',
+        target: '',
+        content: '',
+        file: [],
+        fileUrl: '',
+        type: '',
+        conclusion: ''
+      },
+      rules: {
+        // name: [
+        //   {required: true, message: '请输入报告名称', trigger: 'blur'}
+        //   // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
+        // ],
+        // abstract: [
+        //   {
+        //     required: true,
+        //     message: '请输入摘要信息',
+        //     trigger: 'change'
+        //   }
+        // ],
+        // type: [
+        //   {required: true, message: '请选择报告类型', trigger: 'change'}
+        // ],
+        // file: [
+        //   {required: true, message: '请上传报告文件', trigger: 'change'}
+        // ],
+        // conclusion: [
+        //   {required: true, message: '请输入报告结论', trigger: 'blur'}
+        // ]
+      }
+    }
+  },
+  mounted () {
+    this.$nextTick(() => {
+      this.init()
+    })
+  },
+  methods: {
+    init () {
+      this.scope = this.$route.params.scope
+      this.dependencyCode = this.$route.params.dependencyCode
+      this.projectId = this.$route.params.projectId
+      this.taskId = this.$route.params.taskId
+      this.setUserInfo()
+      this.setReportType()
+    },
+    submitForm (formName) {
+      this.showLoading()
+      const newReport = {
+        name: this.report.name,
+        scope: this.scope,
+        type: this.report.type,
+        dependencyCode: this.dependencyCode,
+        target: this.report.target,
+        content: this.report.content,
+        file: this.report.fileUrl,
+        conclusion: this.report.conclusion
+      }
+      console.log(newReport)
+      Http.post(Apis.REPORT.CREATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId), newReport).then((res) => {
+        this.hideLoading()
+        this.createReportSuccess(res.crowdReportVO.code)
+      }).catch((error) => {
+        this.hideLoading()
+        notify('error', '报告创建失败:' + error.data)
+      })
+
+      // this.$refs[formName].validate(valid => {
+      //   if (valid) {
+      //
+      //     //提交 report
+      //   } else {
+      //     console.log('error submit!!')
+      //     return false
+      //   }
+      // })
+    },
+    resetForm (formName) {
+      this.$refs[formName].resetFields()
+      this.report.name = ''
+      this.report.abstract.target = ''
+      this.report.abstract.content = ''
+      this.report.file = []
+      this.report.type = ''
+      this.report.conclusion = ''
+    },
+    cancelCreate () {
+      if (window.history.length <= 1) {
+        this.$router.push({path: '/'})
+        return false
+      } else {
+        this.$router.go(-1)
+      }
+    },
+    handleRemove (file, fileList) {
+      console.log(file, fileList)
+    },
+    handleExceed (files, fileList) {
+      this.$message.warning(
+        `当前限制选择 1 个文件,本次选择了 ${
+          files.length
+          } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+      )
+    },
+    beforeRemove (file, fileList) {
+      //return this.$confirm(`确定移除 ${file.name}?`)
+    },
+    beforeFileUpload (file) {
+      console.log(file)
+      const isPDF = file.type === 'application/pdf'
+      const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
+      const isEXCEL = file.type === 'application/vnd.ms-excel'
+      const isXLS = file.type === 'application/x-xls'
+      const isTXT = file.type === 'text/plain'
+      const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+    },
+    loadData () {
+    },
+    uploadReportFile (param) {
+      const formData = new FormData()
+      let config = {
+        //添加请求头
+        headers: {'Content-Type': 'multipart/form-data'},
+      }
+      formData.append('file', param.file)
+      Http.upload(Apis.FILE.UPLOAD_REPORT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
+        console.log('上传成功')
+        this.report.fileUrl = res.data
+        console.log(res)
+      })
+    },
+    setReportType () {
+      this.reportType = getAllReportTypes().then((res) => {
+        this.reportType = res
+      }).catch((error) => {
+        notify('error', '获取报告类型列表失败')
+      })
+    },
+    setUserInfo () {
+      this.user = storageGet('user')
+    },
+    createReportSuccess (reportId) {
+      this.$alert('报告创建成功', '创建成功', {
+        confirmButtonText: '确定',
+        callback: action => {
+          this.$router.push({
+            name: 'TaskReport',
+            params: {reportId: reportId, projectId: this.projectId, taskId: this.taskId}
+          })
+        }
+      })
+    },
+    showLoading () {
+      this.loading = true
+    },
+    hideLoading () {
+      this.loading = false
+    }
+  },
+  watch: {
+    reportType (val) {
+      this.reportType = val
+    }
+  }
+
+}
+</script>
+
+<style lang="less" scoped>
+  .el-radio {
+    margin: 10px 20px 10px 0;
+  }
+
+  .el-form-item /deep/ .el-tabs__content {
+    max-height: 120px !important;
+    overflow: auto;
+  }
+
+  .el-row {
+    margin-bottom: 10px;
+  }
+
+  .el-input {
+    width: 400px;
+  }
+</style>

+ 11 - 10
src/components/task/Task.vue

@@ -91,7 +91,7 @@
                 暂无文件
               </span>
               <span v-if="task.requireDocUrl != null">
-                <a :href="task.requireDocUrl">{{task.requireDocUrl}}</a>
+                <a :href="task.requireDocUrl"><el-link :underline="false" type="primary"><i class="el-icon-document"></i>下载文档</el-link></a>
               </span>
             </span>
         </el-form-item>
@@ -108,21 +108,22 @@
           <span v-if="!isModifyMode">{{task.datetime}}</span>
         </el-form-item>
         <el-form-item v-if="isModifyMode">
-          <div class="btn btn-medium btn-info" @click="submitForm('task')">确认修改</div>
-          <div class="btn btn-medium" @click="resetForm('task')">重置</div>
-          <div class="btn btn-medium" @click="cancelMode('task')">取消</div>
+          <div class="btn btn-small btn-info" @click="submitForm('task')">确认修改</div>
+          <div class="btn btn-small" @click="resetForm('task')">重置</div>
+          <div class="btn btn-small" @click="cancelMode('task')">取消</div>
         </el-form-item>
         <el-form-item v-if="!isModifyMode">
-          <div class="btn btn-medium btn-info"
+          <div class="btn btn-small btn-info"
                v-if="taskOperationControl.confirmFinish"
                @click="submitTaskRequest()">确认结束
           </div>
-          <div class="btn btn-medium btn-info" v-if="taskOperationControl.finish" @click="submitTaskRequest()">结束任务
+          <div class="btn btn-small btn-info" v-if="taskOperationControl.finish" @click="submitTaskRequest()">结束任务
           </div>
-          <div class="btn btn-medium btn-info" v-if="taskOperationControl.receive" @click="applyTask()">接收任务</div>
-          <div class="btn btn-medium btn-info" v-if="taskOperationControl.update" @click="modifyForm()">修改任务</div>
-          <div class="btn btn-medium btn-info" v-if="taskOperationControl.uploadReport" @click="createReport()">上传报告</div>
-          <div class="btn btn-medium" @click="toProject()">前往项目</div>
+          <div class="btn btn-small btn-info" v-if="taskOperationControl.receive" @click="applyTask()">接收任务</div>
+          <div class="btn btn-small btn-danger" v-if="taskOperationControl.receive" @click="applyTask()">拒绝任务</div>
+          <div class="btn btn-small btn-info" v-if="taskOperationControl.update" @click="modifyForm()">修改任务</div>
+          <div class="btn btn-small btn-info" v-if="taskOperationControl.uploadReport" @click="createReport()">上传报告</div>
+          <div class="btn btn-small" @click="toProject()">前往项目</div>
         </el-form-item>
       </el-form>
     </div>

+ 11 - 8
src/js/index.js

@@ -341,7 +341,10 @@ export const getProvinceCodeByProvinceName = (provinceName, cityName) => {
       }
     }
   }
-  return null
+  return {
+    'provinceCode': '3200',
+    'cityCode': '3201'
+  }
 }
 
 //获取批量上传项目模板文件
@@ -380,16 +383,16 @@ export const getCurrentAuthenInfo = () => {
     //共有
     id: 1,
     userId: 3,
-    bankAccount: '',
-    address: '',
+    bankAccount: '621000999000999000',
+    address: '江苏科技大厦1901',
     status: '',
     rejectReason: '',
     createTime: '',
     //企业
-    companyName: '',
-    legalPersonName: '',
-    businessLicensePhoto: '',
-    unifiedSocialCreditCode: '',
+    companyName: '慕测呀',
+    legalPersonName: '郭超啊',
+    businessLicensePhoto: null,
+    unifiedSocialCreditCode: '1900000000086',
 
   }
   const agencyData = {
@@ -424,7 +427,7 @@ export const getCurrentAuthenInfo = () => {
     agencyPhoto: 'http://www.mooctest.net/assets/img/mooctest.png',
   }
   return new Promise((resolve) => {
-    resolve(agencyData)
+    resolve(enterpriseData)
   })
 }
 //放弃认证

+ 15 - 8
src/router/index.js

@@ -11,8 +11,6 @@ import Project from '@/components/project/Project'
 import ProjectCreate from '@/components/project/ProjectCreate'
 import AnalyseDemand from '@/components/project/AnalyseDemand'
 
-import Report from '@/components/report/Report'
-import ReportCreate from '@/components/report/ReportCreate'
 import ProjectAdd from '@/components/cheat/ProjectAdd'
 import AgencyAdd from '@/components/cheat/AgencyAdd'
 
@@ -102,9 +100,18 @@ export default new Router({
       },
     },
     {
-      path: '/report/create',
-      name: 'ReportCreate',
-      component: resolve => require(['@/components/report/ReportCreate.vue'], resolve),
+      path: '/project/:projectId/report/create',
+      name: 'ProjectReportCreate',
+      component: resolve => require(['@/components/report/ProjectReportCreate.vue'], resolve),
+      meta: {
+        title: '',
+        requireAuth: false,
+      },
+    },
+    {
+      path: '/project/:projectId/task/:taskId/report/create',
+      name: 'TaskReportCreate',
+      component: resolve => require(['@/components/report/TaskReportCreate.vue'], resolve),
       meta: {
         title: '',
         requireAuth: false,
@@ -112,8 +119,8 @@ export default new Router({
     },
     {
       path: '/project/:projectId/task/:taskId/report/:reportId',
-      name: 'Report',
-      component: resolve => require(['@/components/report/Report.vue'], resolve),
+      name: 'TaskReport',
+      component: resolve => require(['@/components/report/TaskReport.vue'], resolve),
       meta: {
         title: '',
         requireAuth: false,
@@ -122,7 +129,7 @@ export default new Router({
     {
       path: '/project/:projectId/report/:reportId',
       name: 'ProjectReport',
-      component: resolve => require(['@/components/report/Report.vue'], resolve),
+      component: resolve => require(['@/components/report/ProjectReport.vue'], resolve),
       meta: {
         title: '',
         requireAuth: false,