Эх сурвалжийг харах

Merge branch 'http_mock' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_mock

reedliuqing_i 5 жил өмнө
parent
commit
34b2eaa868

+ 9 - 19
src/views/Platform/presentation/PresentReport.vue

@@ -94,7 +94,6 @@
         </el-col>
       </div>
       <div align="center">
-        <el-button v-show="showButton" size="small" type="primary" @click="getCreateData(dataChange)">保存, 下一步 </el-button>
         <el-button v-show="showButton1" size="small" type="primary" @click="getQueryData(dataChange)">更新, 下一步 </el-button>
       </div>
     </el-form>
@@ -135,8 +134,7 @@ export default {
       showDelay: false,
       showApollo: false,
       showRelyOn: false,
-      showButton: true,
-      showButton1: '',
+      showButton1: false,
       userData: '',
       objData: '',
       userInformation: localStorage.getItem('username'),
@@ -167,16 +165,8 @@ export default {
   },
   methods: {
     getRouterData() {
-      this.showButton = true
-      this.showButton1 = false
-      if (this.$route.query.task) {
-        this.dataChange.projectId = this.$route.query.task.projectId
-        this.bizIdCode = this.$route.query.task.bizId
-        this.projectIdCode = this.$route.query.task.id
-      }
       if (this.$route.query.data) { // 提测编辑
         this.showButton1 = true
-        this.showButton = false
         launchTest({ id: this.$route.query.id }).then((res) => {
           this.dataChange = res.data
           this.DetailsOfProposal.txt.html(this.dataChange.joinTest)
@@ -231,19 +221,19 @@ export default {
         }
       })
     },
-    parentHandleclick() {
-      this.getCreateData(this.dataChange)
+    parentHandleclick(e) { // 判断新建还是编辑
+      e === 1 ? this.getCreateData(this.dataChange) : this.getQueryData(this.dataChange)
     },
     getCreateData(ele) {
+      console.log(ele, '提测客户端吧')
       this.$refs['dataChange'].validate((valid) => {
         if (valid) {
+          var url = location.href // 获取url中"?"符后的字串
+          var arr = url.split('=')
           this.dataChange = ele
           typeof (this.DetailsOfProposal) === 'string' ? this.dataChange.joinTest = this.DetailsOfProposal : ''
-          if (this.$route.query.task) {
-            this.dataChange.projectId = this.$route.query.task.projectId
-            this.dataChange.taskId = this.projectIdCode
-            this.dataChange.bizId = this.bizIdCode
-          }
+          this.dataChange.bizId = Number(localStorage.getItem('bizId'))
+          this.dataChange.taskIds = [Number(arr[1])]
           this.dataChange.lateStatus = this.lateStatus
           this.dataChange.type = 1
           this.userData = { ename: this.userInformation, name: this.userNames }
@@ -251,7 +241,7 @@ export default {
           launchTestCreate(this.objData).then(res => {
             if (res.code === 200) {
               this.$message.success(res.msg)
-              this.$emit('keHu', this.dataChange)
+              this.$emit('fatherMethod', res.data)
             } else {
               this.$message.error(res.msg)
             }

+ 73 - 67
src/views/Platform/presentation/Templates/TestReport.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :visible.sync="dialogVisible1" width="80%" height="100%" top="4vh" :close-on-click-modal="false">
+  <el-dialog :visible.sync="dialogVisible1" width="80%" height="100%" top="4vh" :close-on-click-modal="false" :before-close="handleClose1">
     <div class="flex_start titFont">
       <div class="titIcon" />
       <span style="margin-left: 1%; width: 100px;">提测报告</span>
@@ -26,57 +26,37 @@
         <el-button size="small" type="primary" @click="NextStep()">下一步</el-button>
       </div>
     </div>
-    <el-dialog :visible.sync="showClient" width="80%" top="4vh" :close-on-click-modal="false" append-to-body :before-close="handleClose1">
-      <div class="flex_start titFont">
-        <div class="titIcon" />
-        <span style="margin-left: 1%; width: 100px;">提测报告</span>
-      </div>
-      <div style="margin: 4% 0%; font-size: 16pt; color: #333B4A;">
-        <el-steps :active="active1" align-center finish-status="success">
-          <el-step style="font-size: 16pt; color: #333B4A;" title="选择模版" />
-          <el-step title="填写报告" />
-          <el-step style="font-size: 16pt; color: #333B4A;" title="发送报告" />
-        </el-steps>
-      </div>
+    <div v-show="showTow">
       <div class="descr" style=" margin-bottom: 2%; height: 440px; overflow:scroll; overflow-x: hidden">
-        <Present v-if="Present1" ref="Present" :ke-hu="getKeHu" />
+        <Present v-if="Present1" ref="Present" @fatherMethod="fatherMethod" />
         <presentation v-if="presentation1" ref="presentationRef" />
       </div>
       <div align="center">
         <el-button size="small" type="primary" @click="PreviousStep()">上一步</el-button>
         <el-button size="small" type="primary" @click="created_out()">保存,下一步</el-button>
       </div>
-      <el-dialog :visible.sync="showClientYL" width="80%" top="4vh" :close-on-click-modal="false" append-to-body :before-close="handleClose2">
-        <div class="flex_start titFont">
-          <div class="titIcon" />
-          <span style="margin-left: 1%; width: 100px;">提测报告</span>
+    </div>
+    <div v-if="showThree">
+      <div style="margin: 4% 0%; font-size: 16pt; color: #333B4A;">
+        <div style="margin: 1% 12%;font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
+          邮件列表
         </div>
-        <div style="margin: 4% 0%; font-size: 16pt; color: #333B4A;">
-          <el-steps :active="active2" align-center finish-status="success">
-            <el-step style="font-size: 16pt; color: #333B4A;" title="选择模版" />
-            <el-step title="填写报告" />
-            <el-step style="font-size: 16pt; color: #333B4A;" title="发送报告" />
-          </el-steps>
-          <div style="margin: 1% 12%;font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
-            邮件列表
-          </div>
-          <div class="Layout" style="margin: 2% 12%;">
-            <div class="Layout"><div class="div1">收件人</div> <el-input v-model="value" size="small" clearable filterable placeholder="请输入" /></div>
-            <div class="Layout"><div class="div1">抄送</div> <el-input v-model="value" size="small" clearable filterable placeholder="请输入" /></div>
-          </div>
-          <div style="margin: 0 12%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
-            报告预览
-          </div>
-          <div class="descr" style="margin-bottom: 2%; height: 320px; overflow:scroll; overflow-x: hidden">
-            <acceptthe ref="acceptthe" />
-          </div>
+        <div class="Layout" style="margin: 2% 12%;">
+          <div class="Layout"><div class="div1">收件人</div> <el-input v-model="form.name" size="small" clearable filterable placeholder="请输入" /></div>
+          <div class="Layout"><div class="div1">抄送</div> <el-input v-model="form.names" size="small" clearable filterable placeholder="请输入" /></div>
         </div>
-        <div align="center">
-          <el-button size="small" type="primary" @click="gou_out()">上一步</el-button>
-          <el-button size="small" type="primary">发送</el-button>
+        <div style="margin: 0 12%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
+          报告预览
         </div>
-      </el-dialog>
-    </el-dialog>
+        <div class="descr" style="margin-bottom: 2%; height: 320px; overflow:scroll; overflow-x: hidden">
+          <acceptthe id="resumeId" ref="acceptthe" :message="preview" />
+        </div>
+      </div>
+      <div align="center">
+        <el-button size="small" type="primary" @click="gou_out()">上一步</el-button>
+        <el-button size="small" type="primary" @click="sendReport(form)">发送</el-button>
+      </div>
+    </div>
   </el-dialog>
 </template>
 
@@ -85,6 +65,8 @@ import '@/views/projectManage/publicCss/index.css'
 import Present from '@/views/Platform/presentation/PresentReport'
 import acceptthe from '@/views/Platform/presentation/acceptTheReport'
 import presentation from '@/views/Platform/presentation/presentationReport.vue'
+import { launchTestSendmail } from '@/api/ResultPage'
+import html2canvas from 'html2canvas'
 
 export default {
   components: {
@@ -94,16 +76,17 @@ export default {
   },
   data() {
     return {
-      value: '',
+      form: {},
       Present1: false,
       presentation1: false,
       showOne: true,
+      showTow: false,
+      showThree: false,
       showClient: false,
       showClientYL: false,
       active: 1,
-      active1: 2,
-      active2: 3,
       radio: '3',
+      preview: '',
       src: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
       dialogVisible1: false
     }
@@ -111,51 +94,74 @@ export default {
   methods: {
     init() {
       this.dialogVisible1 = true
-    },
-    handleClose1(e) {
-      this.showClient = false
-      this.dialogVisible1 = false
+      this.showOne = true
+      this.showTow = false
+      this.showThree = false
     },
     PreviousStep() {
-      this.showClient = false
-      this.dialogVisible1 = true
-    },
-    handleClose2() {
-      this.showClientYL = false
-      this.showClient = false
-      this.dialogVisible1 = false
+      this.showTow = false
+      this.showOne = true
+      this.active = 1
     },
     gou_out() {
-      this.showClientYL = false
+      this.showThree = false
+      this.showTow = true
     },
     created_out() {
-      if (this.radio === '2') {
-        this.$refs.presentationRef.parentHandleclick()
+      if (this.radio === '2') { // 服务端
+        this.$refs.presentationRef.parentHandleclick(1)
       }
-      if (this.radio === '1') {
-        this.$refs.Present.parentHandleclick()
+      if (this.radio === '1') { // 客户端
+        this.$refs.Present.parentHandleclick(1)
       }
     },
-    getKeHu(data) {
-      this.showClientYL = true
-      console.log(data)
-    },
     NextStep() {
       switch (Number(this.radio)) {
         case 1:
-          this.showClient = true
+          this.showOne = false
+          this.showTow = true
           this.Present1 = true
           this.presentation1 = false
+          this.active = 2
           break
         case 2:
-          this.showClient = true
+          this.showOne = false
+          this.showTow = true
           this.Present1 = false
           this.presentation1 = true
+          this.active = 2
           break
         case 3:
           this.$message({ message: '请选择要创建的‘模版’', type: 'error', duration: 1000, offset: 150 })
           break
       }
+    },
+    handleClose1() {
+      this.radio = '3'
+      this.dialogVisible1 = false
+    },
+    fatherMethod(e) {
+      this.preview = e
+      console.log(e, '测试')
+      this.showThree = true
+      this.showTow = false
+      this.active = 3
+    },
+    sendReport(e) {
+      var ele = this.preview
+      setTimeout(() => {
+        var that = this
+        html2canvas(document.getElementById('resumeId'), { useCORS: true }).then(function(canvas) {
+          var imgData = canvas.toDataURL('image/png')
+          var sendImgData = imgData.substring(imgData.indexOf(',') + 1)
+          var postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }
+          launchTestSendmail(postData).then(res => {
+            that.dialogFormVisible = false
+            that.dialogTableVisible = false
+            res.code === 200 ? that.$message.success('发送测试报告成功') : that.$message.error('发送测试报告失败,请联系管理员!')
+          })
+        })
+      }, 500)
     }
   }
 }

+ 89 - 83
src/views/Platform/presentation/acceptTheReport.vue

@@ -6,10 +6,10 @@
         <div style="display: flex; white-space: nowrap; font-family:SimSuncss">
           <span style="flex:1;font-weight: bold;font-size: 24px;color: #3a8ee6">{{ fromCreateData.name }}</span>
           <span style="flex:2;margin:1% 0 0 20px;font-size: 17px;">by {{ fromCreateData.submitter }}</span>
-          <span style="flex:1;">
+          <!-- <span style="flex:1;">
             <el-button type="primary" size="mini" style="margin:0 2% 0 0%;" @click="dialogTableVisible = true">发送报告</el-button>
             <el-button size="mini" @click="dialogTableVisible = true">下载测试报告</el-button>
-          </span>
+          </span> -->
         </div>
         <div class="titleStyle" style="margin:1% 0;">一. 提测详情</div>
         <div v-if="oneShow">
@@ -89,17 +89,17 @@
         <el-form>
           <div v-if="oneShow" class="marage">新增配置 : {{ fromCreateData.configInfo }}</div><br>
           <div class="marage">其他 : {{ fromCreateData.others }}</div><br>
-          <el-button style="float:right; margin:8% 50%;" @click="open()"> 返 回 </el-button>
+          <!-- <el-button style="float:right; margin:8% 50%;" @click="open()"> 返 回 </el-button> -->
         </el-form>
       </div>
     </div>
 
     <el-dialog title="邮件预览" width="70%" center :visible.sync="dialogTableVisible" @open="dasd()">
-      <div align="center">
+      <!-- <div align="center">
         <el-button type="primary" size="mini" @click="dialogFormVisible = true">确定发送</el-button>
         <el-button size="mini" @click="download()">确定下载</el-button>
-      </div>
-      <div id="resumeId" class="eleStyle_one">
+      </div> -->
+      <!-- <div id="resumeId" class="eleStyle_one">
         <div style="height:100%;width:94%; background:#ffffff; margin: 3%; border-radius: 4px; overflow: hidden;">
           <div style="padding:2% 9%;">
             <div style="display: flex; white-space: nowrap; font-family:SimSuncss">
@@ -189,10 +189,10 @@
             </el-form>
           </div>
         </div>
-      </div>
+      </div> -->
     </el-dialog>
     <!-- 发送报告 -->
-    <el-dialog title="发送邮件" width="30%" :visible.sync="dialogFormVisible">
+    <!-- <el-dialog title="发送邮件" width="30%" :visible.sync="dialogFormVisible">
       <el-form label-position="center" :model="form" label-width="80px">
         <el-form-item label="发送 : ">
           <el-input v-model="form.name" placeholder="请填写邮箱前缀,邮箱名以 , 分割" />
@@ -201,29 +201,37 @@
           <el-input v-model="form.names" placeholder="请填写邮箱前缀,邮箱名以 , 分割" />
         </el-form-item>
       </el-form>
+      {{ message }}
       <div slot="footer" class="dialog-footer">
+
         <el-button @click="dialogFormVisible = false">取 消</el-button>
         <el-button type="primary" @click="sendReport(form)">确 定</el-button>
       </div>
-    </el-dialog>
+    </el-dialog> -->
   </div>
 </template>
 
 <script>
-import { launchTestSendmail } from '@/api/ResultPage'
-import html2canvas from 'html2canvas'
-import { launchTest } from '@/api/testPresentetion'
+// import { launchTestSendmail } from '@/api/ResultPage'
+// import html2canvas from 'html2canvas'
+// import { launchTest } from '@/api/testPresentetion'
 
 export default {
   name: 'AcceptTheReport',
+  props: {
+    message: {
+      type: Object,
+      required: true
+    }
+  },
   data() {
     return {
       configInfo1: { color: 'green' },
       dependentComponents1: { color: 'green' },
       lateStatus1: { color: 'red' },
       safeStatus1: { color: 'green' },
-      dialogTableVisible: false,
-      dialogFormVisible: false,
+      // dialogTableVisible: false,
+      // dialogFormVisible: false,
       form: {},
       dependentCom: '',
       config: '',
@@ -246,77 +254,75 @@ export default {
     this.idGet()
   },
   methods: {
-    dasd() {
-      this.idGet()
-    },
-    download() {
-      this.getPdf('resumeId', this.name)
-    },
+    // dasd() {
+    //   this.idGet()
+    // },
+    // download() {
+    //   this.getPdf('resumeId', this.name)
+    // },
     idGet() {
-      launchTest({ id: this.$route.query.id }).then((res) => {
-        this.fromCreateData = res.data
-        if (this.fromCreateData.type === 2) {
-          this.towShow = false
-          this.oneShow = true
-        } else {
-          this.oneShow = false
-          this.towShow = true
-        }
-        this.name = this.fromCreateData.name
-        this.joinTestOne = this.fromCreateData.joinTest
-        this.moduleInfoOne = this.fromCreateData.moduleInfo
-        if (this.fromCreateData.safeInfo !== '') {
-          this.showData = true
-          this.safeStatus = '是'
-          this.safeStatus1.color = 'red'
-        } else {
-          this.showData = false
-          this.safeStatus = '否'
-          this.safeStatus1.color = 'green'
-        }
-        if (this.fromCreateData.lateReason !== '') {
-          this.showDelay = true
-          this.lateStatus = '是'
-        } else {
-          this.showDelay = false
-          this.lateStatus = '否'
-          this.lateStatus1.color = 'green'
-        }
-        if (this.fromCreateData.configInfo !== '') {
-          this.showDelay1 = true
-          this.config = '是'
-        } else {
-          this.showDelay1 = false
-          this.config = '否'
-          this.configInfo1.color = 'red'
-        }
-        if (this.fromCreateData.dependentComponents !== '') {
-          this.showDelay2 = true
-          this.dependentCom = '是'
-        } else {
-          this.showDelay2 = false
-          this.dependentCom = '否'
-          this.dependentComponents1.color = 'red'
-        }
-      })
-    },
-    open() { this.$router.push({ path: '/Platform/presentation/Assumptions' }) },
-    sendReport(e) {
-      var ele = this.fromCreateData
-      setTimeout(() => {
-        var that = this
-        html2canvas(document.getElementById('resumeId'), { useCORS: true }).then(function(canvas) {
-          var imgData = canvas.toDataURL('image/png')
-          var sendImgData = imgData.substring(imgData.indexOf(',') + 1)
-          var postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }
-          launchTestSendmail(postData).then(res => {
-            that.dialogFormVisible = false
-            that.dialogTableVisible = false
-            res.code === 200 ? that.$message.success('发送测试报告成功') : that.$message.error('发送测试报告失败,请联系管理员!')
-          })
-        })
-      }, 500)
+      // launchTest({ id: this.$route.query.id }).then((res) => {
+      this.fromCreateData = this.message
+      if (this.fromCreateData.type === 2) {
+        this.towShow = false
+        this.oneShow = true
+      } else {
+        this.oneShow = false
+        this.towShow = true
+      }
+      this.name = this.fromCreateData.name
+      this.joinTestOne = this.fromCreateData.joinTest
+      this.moduleInfoOne = this.fromCreateData.moduleInfo
+      if (this.fromCreateData.safeInfo !== '') {
+        this.showData = true
+        this.safeStatus = '是'
+        this.safeStatus1.color = 'red'
+      } else {
+        this.showData = false
+        this.safeStatus = '否'
+        this.safeStatus1.color = 'green'
+      }
+      if (this.fromCreateData.lateReason !== '') {
+        this.showDelay = true
+        this.lateStatus = '是'
+      } else {
+        this.showDelay = false
+        this.lateStatus = '否'
+        this.lateStatus1.color = 'green'
+      }
+      if (this.fromCreateData.configInfo !== '') {
+        this.showDelay1 = true
+        this.config = '是'
+      } else {
+        this.showDelay1 = false
+        this.config = '否'
+        this.configInfo1.color = 'red'
+      }
+      if (this.fromCreateData.dependentComponents !== '') {
+        this.showDelay2 = true
+        this.dependentCom = '是'
+      } else {
+        this.showDelay2 = false
+        this.dependentCom = '否'
+        this.dependentComponents1.color = 'red'
+      }
+      // })
     }
+    // open() { this.$router.push({ path: '/Platform/presentation/Assumptions' }) }
+    // sendReport(e) {
+    //   var ele = this.fromCreateData
+    //   setTimeout(() => {
+    //     var that = this
+    //     html2canvas(document.getElementById('resumeId'), { useCORS: true }).then(function(canvas) {
+    //       var imgData = canvas.toDataURL('image/png')
+    //       var sendImgData = imgData.substring(imgData.indexOf(',') + 1)
+    //       var postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }
+    //       launchTestSendmail(postData).then(res => {
+    //         res.code === 200 ? that.$message.success('发送测试报告成功') : that.$message.error('发送测试报告失败,请联系管理员!')
+    //       })
+    //     })
+    //   }, 500)
+    // }
   }
 }
 </script>

+ 9 - 20
src/views/Platform/presentation/presentationReport.vue

@@ -92,8 +92,6 @@
           <el-form-item label="其他"><el-input v-model="fromDev.others" style="padding-left: 25px; text-align: right; width: 85vw;" size="small" type="textarea" :rows="5" placeholder="请输入其他内容…" /></el-form-item>
         </el-col>
       </div>
-      <!-- <div v-show="showButton"><el-button type="primary" @click="getCreateData(fromDev)"> 保 存 </el-button></div> -->
-      <div v-show="showButton1"><el-button type="primary" @click="getQueryData(fromDev)"> 更 新 </el-button></div>
     </el-form>
   </div>
 </template>
@@ -132,7 +130,6 @@ export default {
       lateStatusBtn1: 'info',
       getInfoBtn: 'info',
       getInfoBtn1: 'info',
-      showButton1: false,
       userData: '',
       showDelay: false,
       labelWidth: '60px',
@@ -142,7 +139,6 @@ export default {
       editorContent: '',
       showData: false,
       DetailsOfProposal: '',
-      bizIdCode: '',
       projectIdCode: ''
     }
   },
@@ -170,13 +166,7 @@ export default {
   },
   methods: {
     getRouterData() {
-      this.showButton1 = false
-      if (this.$route.query.task) { // 任务提测
-        this.bizIdCode = this.$route.query.task.bizId
-        this.projectIdCode = this.$route.query.task.id
-      }
       if (this.$route.query.data) {
-        this.showButton1 = true
         launchTest({ id: this.$route.query.id }).then((res) => {
           this.fromDev = res.data
           if (this.fromDev.lateReason !== '') {
@@ -223,31 +213,30 @@ export default {
         }
       })
     },
-    parentHandleclick(e) {
-      this.getCreateData(this.fromDev)
+    parentHandleclick(e) { // 判断创建还是编辑
+      e === 1 ? this.getCreateData(this.fromDev) : this.getQueryData(this.fromDev)
     },
     getCreateData(ele) {
       this.$refs['fromDev'].validate((valid) => {
         if (valid) {
+          var url = location.href // 获取url中"?"符后的字串
+          var arr = url.split('=')
           this.fromDev = ele
           typeof (this.editorContent) === 'string' ? this.fromDev.joinTest = this.editorContent : ''
           typeof (this.DetailsOfProposal) === 'string' ? this.fromDev.moduleInfo = this.DetailsOfProposal : ''
           this.fromDev.lateReason = ele.lateReason
           this.fromDev.lateStatus = this.lateStatus
-          this.fromDev.projectId = this.$route.query.task.projectId
-          if (this.$route.query.task) { // 任务提测
-            this.fromDev.bizId = this.bizIdCode
-            this.fromDev.taskId = this.projectIdCode
-          }
+          this.fromDev.bizId = Number(localStorage.getItem('bizId'))
+          this.fromDev.taskIds = [Number(arr[1])]
           this.fromDev.type = 2
           this.userData = { id: '', ename: this.userInformation, name: this.userNames }
           this.objData = { launchTestInfo: this.fromDev, user: this.userData }
           launchTestCreate(this.objData).then(res => {
             if (res.code === 200) {
-              this.$message({ type: 'success', message: '保存成功' })
-              this.$router.go(-1)
+              this.$message.success(res.msg)
+              this.$emit('fatherMethod', res.data)
             } else {
-              this.$message.error('保存失败')
+              this.$message.error(res.msg)
             }
           })
         } else {