qinzhipeng_v 5 lat temu
rodzic
commit
1a18222f55

+ 31 - 0
src/api/reportTemplate.js

@@ -0,0 +1,31 @@
+import request from '@/utils/request'
+import { Presentation } from '@/apiConfig/api'
+
+// 报告模块部分
+
+// 获取模板列表,分业务线和类型
+export function settingQueryReportModuleList(data) {
+  return request({
+    url: Presentation + '/setting/queryReportModuleList',
+    method: 'post',
+    data
+  })
+}
+
+// 创建模板,需校验名称是否重复
+export function settingAddReportModule(data) {
+  return request({
+    url: Presentation + '/setting/addReportModule',
+    method: 'post',
+    data
+  })
+}
+
+// 修改模板,需校验名称是否重复
+export function settingUpdateReportModule(data) {
+  return request({
+    url: Presentation + '/setting/updateReportModule',
+    method: 'post',
+    data
+  })
+}

+ 7 - 0
src/router/index.js

@@ -195,6 +195,13 @@ export const constantRoutes = [{
       component: (resolve) => require(['@/views/Platform/presentation/testPresentation'], resolve),
       meta: { title: '报告' }
     },
+    {
+      path: 'Templates/BugDetails',
+      name: '报告详情',
+      hidden: true,
+      component: (resolve) => require(['@/views/Platform/presentation/Templates/BugDetails'], resolve),
+      meta: { title: '报告详情' }
+    },
     {
       path: 'DailyNewsAdded',
       name: '新增测试日报',

+ 123 - 0
src/views/Platform/presentation/Templates/BugDetails.vue

@@ -0,0 +1,123 @@
+<template>
+  <el-container class="BackgroundCloth">
+    <el-header class="public_header setLine">
+      <div class="Layout_space_between">
+        <div class="Layout_flex_start">
+          <div>baogaoID</div>
+          <div>{{ '测试日报' }}</div>
+          <el-button size="mini">已发送</el-button>
+        </div>
+        <div>
+          <el-button type="text">通过</el-button>
+          <el-button type="text">打回</el-button>
+        </div>
+      </div>
+    </el-header>
+    <el-container>
+      <el-main class="report-main">
+        <div><div class="blur-column" /> 报告内容</div>
+        <hr>
+        <div class="Layout_flex_start">
+          <div>报告人 : </div>
+          <div>{{ '秦志鹏' }}</div>
+        </div>
+        <div class="Layout_flex_start">
+          <div>收件人 : </div>
+          <div>{{ '秦志鹏, 张杰, 余霖, 廖子君' }}</div>
+        </div>
+        <div class="Layout_flex_start">
+          <div :span="12">抄送人 : </div>
+          <div :span="12">{{ '秦志鹏' }}</div>
+        </div>
+      </el-main>
+      <el-aside width="400px">
+        <el-container>
+          <el-header class="report-mains">
+            <div><div class="blur-column" /> 用户信息</div>
+            <hr>
+            <div class="Layout_flex_start">
+              <div>报告人 : </div>
+              <div>{{ '秦志鹏' }}</div>
+            </div>
+            <div class="Layout_flex_start">
+              <div>收件人 : </div>
+              <div>{{ '秦志鹏, 张杰, 余霖, 廖子君' }}</div>
+            </div>
+            <div class="Layout_flex_start">
+              <div :span="12">抄送人 : </div>
+              <div :span="12">{{ '秦志鹏' }}</div>
+            </div>
+          </el-header>
+          <el-main class="report-mains">
+            <div><div class="blur-column" /> 时间</div>
+            <hr>
+            <div class="Layout_flex_start">
+              <div>创建时间 : </div>
+              <div>{{ '2020-10-10 12:20' }}</div>
+            </div>
+            <div class="Layout_flex_start">
+              <div>发送时间 : </div>
+              <div>{{ '2020-10-10 12:20' }}</div>
+            </div>
+          </el-main>
+          <el-footer class="report-mains">
+            <div><div class="blur-column" /> 关联任务</div>
+            <hr>
+            <div class="Layout_flex_start">
+              <div>报告人 : </div>
+              <div>{{ '秦志鹏' }}</div>
+            </div>
+            <div class="Layout_flex_start">
+              <div>收件人 : </div>
+              <div>{{ '秦志鹏, 张杰, 余霖, 廖子君' }}</div>
+            </div>
+            <div class="Layout_flex_start">
+              <div :span="12">抄送人 : </div>
+              <div :span="12">{{ '秦志鹏' }}</div>
+            </div>
+          </el-footer>
+        </el-container>
+      </el-aside>
+    </el-container>
+  </el-container>
+</template>
+
+<script>
+import '@/styles/PublicStyle/index.scss'
+export default {
+
+}
+</script>
+
+<style lang="scss" scoped>
+.BackgroundCloth {
+.report-Header {
+  margin: 10px 10px 0;
+  background: #FFF;
+  border-radius:4px;
+}
+.report-main {
+  margin: 10px;
+  background: #FFF;
+  border-radius:4px;
+}
+.report-mains {
+  min-height: 150px;
+  padding: 20px ;
+  margin: 10px 10px 0 0;
+  background: #FFF;
+  border-radius:4px;
+}
+.blur-column {
+  width:4px;
+  height:15px;
+  display:inline-block;
+  vertical-align: middle;
+  background:#409EFF;
+  border-radius:1px;
+}
+}
+.setLine {
+  padding: 10px 20px;
+}
+</style>

+ 179 - 113
src/views/Platform/presentation/Templates/DailyReport.vue

@@ -1,84 +1,82 @@
 <template>
-  <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task" title="测试日报" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose">
-    <div class="blueStripe" />
-    <div v-if="reportHome">
-      <div style="margin: 2% 0%; font-size: 16pt; color: #333B4A;">
-        <el-steps :active="active" align-center finish-status="success">
-          <el-step title="选择模版" />
-          <el-step title="填写报告" />
-          <el-step title="发送报告" />
-        </el-steps>
-      </div>
-      <div v-if="showOne">
-        <el-row type="flex" class="row-bg" justify="center">
-          <el-col :span="7">模版名称</el-col>
-          <el-col :span="6" />
-          <el-col :span="5" class="creator">创建人</el-col>
-        </el-row>
-        <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" class="row-bg" justify="center">
-          <el-col :span="7"><el-radio v-model="fromData.radio" class="_radio" :label="item.id" @change="selectRepot(item.id)">{{ item.name }}</el-radio></el-col>
-          <el-col :span="6" />
-          <el-col :span="5" class="creator">
-            {{ item.value }}
-            <span v-if="item.value !== '系统'" class="operation">
-              <i class="el-icon-edit didi-hover" />
-              <el-popover v-model="visible" placement="bottom" width="300">
-                <div>删除模版</div>
-                <hr>
-                <p>是否要删除模版{{ item.name }}?</p>
-                <div style="text-align: right; margin: 0">
-                  <el-button size="mini" type="primary" @click="visible = false">删除</el-button>
-                  <el-button type="primary" size="mini" @click="visible = false">取消</el-button>
-                </div>
-                <i slot="reference" class="el-icon-delete reportModel didi-hover" />
-              </el-popover>
-            </span>
-          </el-col>
-        </el-row>
-        <el-row type="flex" class="row-bg" justify="center">
-          <el-col :span="18">
-            <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creator" /> 新建模版</span>
-          </el-col>
-        </el-row>
-      </div>
-    </div>
+  <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task report-dialog" :title="reportHome ? title : `创建${title}模版`" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose">
+    <div v-if="reportHome" class="blueStripe" />
+    <i v-if="!reportHome" class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
 
-    <div v-if="reportTamplate">
-      <div class="descr" style=" margin-bottom: 2%; height: 435px; overflow:scroll; overflow-x: hidden">
-        <NewReportTemplate ref="DailyReport" :message="dailyNewData" @daily="daily" />
-      </div>
+    <el-steps v-if="reportHome" :active="active" align-center finish-status="success" class="report-steps">
+      <el-step title="选择模版" />
+      <el-step title="填写报告" />
+      <el-step title="发送报告" />
+    </el-steps>
 
-      <div v-if="showTow">
-        <div class="descr" style=" margin-bottom: 2%; height: 435px; overflow:scroll; overflow-x: hidden">
-          <DailyReport ref="DailyReport" :message="dailyNewData" @daily="daily" />
-        </div>
-        <div align="center">
-          <el-button size="small" type="primary" @click="handleClose1()">上一步</el-button>
-          <el-button size="small" type="primary" @click="created_out()">保存,下一步</el-button>
-        </div>
+    <div v-if="showOne" style="min-height: 50vh;">
+      <el-row type="flex" class="row-bg" justify="center">
+        <el-col :span="7">模版名称</el-col>
+        <el-col :span="6" />
+        <el-col :span="5" class="creator">创建人</el-col>
+      </el-row>
+      <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" class="row-bg" justify="center">
+        <el-col :span="7">
+          <el-radio v-model="fromData.radio" class="_radio" :label="item.id" @change="selectRepot(item.id)">{{ item.name }}</el-radio>
+        </el-col>
+        <el-col :span="6" />
+        <el-col :span="5" class="creator">
+          {{ item.value }}
+          <span v-if="item.value !== '系统'" class="operation">
+            <i class="el-icon-edit didi-hover" @click="report_update(item.id)" />
+            <el-popover v-model="visible" placement="bottom" width="300">
+              <div>删除模版</div>
+              <hr>
+              <p>是否要删除模版{{ item.name }}?</p>
+              <div style="text-align: right; margin: 0">
+                <el-button size="mini" type="primary" @click="visible = false">删除</el-button>
+                <el-button type="primary" size="mini" @click="visible = false">取消</el-button>
+              </div>
+              <i slot="reference" class="el-icon-delete reportModel didi-hover" />
+            </el-popover>
+          </span>
+        </el-col>
+      </el-row>
+      <el-row type="flex" class="row-bg" justify="center">
+        <el-col :span="18">
+          <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creator" /> 新建模版</span>
+        </el-col>
+      </el-row>
+    </div>
+
+    <!-- 创建模版 -->
+    <div v-if="reportTamplate" class="descr" style=" margin-bottom: 2%; height: 435px; overflow:scroll; overflow-x: hidden">
+      <NewReportTemplate ref="DailyReport" :message="dailyNewData" :template-status="templateStatus" @getreportTemplate="getreportTemplate" />
+    </div>
+    <!-- 创建模版 -->
 
+    <div v-if="showThree">
+      <div style="margin: 0% 5%;font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
+        邮件列表
       </div>
-      <div v-if="showThree">
-        <div style="margin: 0% 5%;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: 1% 5% 3%;">
-          <div class="Layout" style="margin-bottom: 10px;"><div class="div1">收件人</div><searchTeam :value.sync="form.name" :clearable="true" :multiple="true" style="width:100%" /></div>
-          <div class="Layout"><div class="div1">抄送</div><searchTeam :value.sync="form.names" :clearable="true" :multiple="true" style="width:100%" /></div>
-        </div>
-        <div style="margin: 0 5%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
-          报告预览
+      <div style="margin: 1% 5% 3%;">
+        <div class="Layout" style="margin-bottom: 10px;">
+          <div class="div1">收件人</div>
+          <searchTeam :value.sync="form.name" :clearable="true" :multiple="true" style="width:100%" />
         </div>
-        <div class="descr" style=" margin-bottom: 2%; height: 300px; overflow:scroll; overflow-x: hidden">
-          <testPresenyL id="Gambol" :message="preview" style="width: 100%" />
-        </div>
-        <div align="center">
-          <el-button size="small" type="primary" @click="gou_out()">上一步</el-button>
-          <el-button :disabled="send" :loading="send" size="small" type="primary" @click="sendReport(form)">发送</el-button>
+        <div class="Layout">
+          <div class="div1">抄送</div>
+          <searchTeam :value.sync="form.names" :clearable="true" :multiple="true" style="width:100%" />
         </div>
       </div>
+      <div style="margin: 0 5%; 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: 300px; overflow:scroll; overflow-x: hidden">
+        <testPresenyL id="Gambol" :message="preview" style="width: 100%" />
+      </div>
+      <div align="center">
+        <el-button size="small" type="primary" @click="gou_out()">上一步</el-button>
+        <el-button :disabled="send" :loading="send" size="small" type="primary" @click="sendReport(form)">发送</el-button>
+      </div>
     </div>
-    <div align="center">
+
+    <div slot="footer" class="dialog-footer" align="center">
       <el-button size="small" type="primary" @click="clickTheButton === '下一步'? NextStep() : created_out()">{{ clickTheButton }}</el-button>
     </div>
   </el-dialog>
@@ -87,22 +85,27 @@
 <script>
 import '@/views/projectManage/publicCss/index.css'
 import '@/styles/PublicStyle/index.scss'
-import DailyReport from '@/views/Platform/presentation/DailyNewsAdded.vue'
+// import DailyReport from '@/views/Platform/presentation/DailyNewsAdded.vue'
 import testPresenyL from '@/views/Platform/presentation/testPresenyL.vue'
 import { dailyReportSendmail } from '@/api/ResultPage'
+import { settingQueryReportModuleList } from '@/api/reportTemplate'
 import html2canvas from 'html2canvas'
 import searchTeam from '@/components/select/searchTeam'
 import NewReportTemplate from '@/views/Platform/presentation/Templates/NewReportTemplate.vue'
 
 export default {
   components: {
-    DailyReport,
+    // DailyReport,
     testPresenyL,
     searchTeam,
     NewReportTemplate
   },
+  props: {
+    title: { type: String, default: '' }
+  },
   data() {
     return {
+      templateStatus: false, // 模版状态
       visible: false, // delete
       clickTheButton: '下一步', // 点击按钮
       reportHome: true, // 报告主页
@@ -116,10 +119,11 @@ export default {
       fromData: {
         radio: 1
       },
+      bizJson: localStorage.getItem('bizId'),
       send: false,
       form: {},
       preview: {},
-      dailyNewData: {},
+      dailyNewData: {}, // 新建模版
       dialogDaliy: false,
       showOne: true,
       showTow: false,
@@ -129,9 +133,21 @@ export default {
       newIndex: '',
       active: 1,
       daily_task: [],
+      num: 0,
       dailys: this.$route.query.id
     }
   },
+  watch: {
+    title: {
+      handler(newV) {
+        newV === '测试日报' ? this.num = 3 : ''
+        newV === '准出报告' ? this.num = 4 : ''
+        newV === '提测报告' ? this.num = 1 : ''
+        this.getreportTemplate()
+      },
+      immediate: true
+    }
+  },
   created() {
     this.reportSelectTemplate()
   },
@@ -139,6 +155,12 @@ export default {
     this.showThree = false
   },
   methods: {
+    async getreportTemplate() { // 获取模版list
+      const res = await settingQueryReportModuleList({ bizId: this.bizJson, type: this.num })
+      if (res.code === 200) {
+        console.log(res)
+      }
+    },
     reportSelectTemplate() {
       this.$nextTick(() => {
         this.selectTemplate = this.selectTemplate.concat(this.reportModel)
@@ -161,8 +183,8 @@ export default {
           this.active = 1
           break
         case 2:
-          this.dailyNewData = newData
-          this.dailyNewData.creatask = '编辑'
+          // this.dailyNewData = newData
+          // this.dailyNewData.creatask = '编辑'
           this.newIndex = 2
           this.showOne = false
           this.showTow = true
@@ -179,8 +201,8 @@ export default {
           break
         case 4:
           this.daily_task = [Number(arr[1])]
-          this.dailyNewData = newData
-          this.dailyNewData.creatask = '复制'
+          // this.dailyNewData = newData
+          // this.dailyNewData.creatask = '复制'
           this.newIndex = 1
           this.showOne = false
           this.showTow = true
@@ -189,7 +211,7 @@ export default {
           break
         case 7:
           this.daily_task = newData
-          this.dailyNewData.taskIds = newData
+          // this.dailyNewData.taskIds = newData
           this.showOne = true
           this.showTow = false
           this.showThree = false
@@ -203,18 +225,20 @@ export default {
       this.showOne = false
       this.showTow = false
       this.radio = '1'
+      this.reportTamplate = false // 第二步false
     },
-    handleClose1() {
-      this.active = 1
-      this.showOne = true
-      this.showTow = false
+
+    report_update() { // 编辑模版
+      this.$refs.DailyReport.getQueryData(3)
     },
-    created_out() {
-      this.$refs.DailyReport.parentHandleclick(this.newIndex, this.daily_task, this.dailys)
+
+    created_out() { // 新建模版
+      this.$refs.DailyReport.getCreateData(3)
     },
+
     gou_out() {
-      this.dailyNewData = this.preview
-      this.dailyNewData.creatask = '编辑'
+      // this.dailyNewData = this.preview
+      // this.dailyNewData.creatask = '编辑'
       this.active = 2
       this.newIndex = 2
       this.showOne = false
@@ -230,17 +254,28 @@ export default {
       this.form = {}
       this.active = 3
     },
-    open_new_template() {
-      this.reportTamplate = true
-      this.clickTheButton = '保存'
-      this.reportHome = false
+    reportReturn() { // 新建模版点击返回
+      this.reportHome = true // 步骤条
+      this.showOne = true // 模版选择
+      this.reportTamplate = false // 编辑区域
+      this.clickTheButton = '下一步' // 底部按钮
+    },
+    open_new_template() { // 点击新建模版
+      this.templateStatus = false // 模版状态
+      this.dailyNewData = {}
+      this.reportHome = false // 步骤条
+      this.showOne = false // 模版选择
+      this.reportTamplate = true // 编辑区域
+      this.clickTheButton = '保存' // 底部按钮
     },
     NextStep() {
       switch (Number(this.radio)) {
         case 1:
+          this.templateStatus = true // 模版状态
           this.dailyNewData = {}
           this.dailyNewData.taskIds = this.daily_task
           this.dailyNewData.creatask = '新建'
+          this.reportTamplate = true
           this.showOne = false
           this.showTow = true
           this.active = 2
@@ -275,43 +310,74 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 ._radio {
-  margin: 3% 0;
-  color: #333B4A;
-  font-size: 16pt
+    margin: 3% 0;
+    color: #333B4A;
+    font-size: 16pt
 }
+
 .descr {
-  width: 94%;
-  margin: auto;
+    width: 94%;
+    margin: auto;
 }
-.descr::-webkit-scrollbar{
-  width:0;
+
+.descr::-webkit-scrollbar {
+    width: 0;
 }
+
 .div1 {
-  width: 60px;
-  font-size: 14px;
-  font-family: MicrosoftYaHei;
-  color: rgba(51,51,51,1);
-  line-height: 19px;
+    width: 60px;
+    font-size: 14px;
+    font-family: MicrosoftYaHei;
+    color: rgba(51, 51, 51, 1);
+    line-height: 19px;
 }
+
 .titIcon {
-  width:4px;
-  height:17px;
-  background:#409EFF;
-  border-radius:1px;
+    width: 4px;
+    height: 17px;
+    background: #409EFF;
+    border-radius: 1px;
 }
+
 .el-dialog__header {
     padding: 0 !important;
 }
+
 .reportModel {
-  margin-left: 10px;
+    margin-left: 10px;
 }
+
 .operation {
-   margin-left: 30px;
+    margin-left: 30px;
 }
+
 .creator {
-  display: inline-block;
-  line-height: 3;
+    display: inline-block;
+    line-height: 3;
+}
+
+.report-dialog {
+  >>>.el-dialog__header {
+      padding: 20px 20px 10px;
+      border-bottom: 1px solid red;
+  }
+  >>>.el-dialog__footer {
+      padding: 15px 20px;
+      text-align: right;
+      border-top: 1px solid red;
+  }
+}
+.report-return {
+  font-size: 18px;
+  position: absolute;
+  top: 23px;
+  left: 11px;
+}
+.report-steps {
+  margin-bottom: 1%;
+  font-size: 16pt;
+  color: #333B4A;
 }
 </style>

+ 90 - 59
src/views/Platform/presentation/Templates/NewReportTemplate.vue

@@ -1,12 +1,45 @@
 <template>
   <!-- 新增测试日报 -->
   <div class="eleStyle">
-    <el-form ref="fromCreateData" :inline="true" :model="fromCreateData" :rules="serviceDataRules">
-      <el-form-item label="模版名称" prop="reportName">
-        <el-input v-model="fromCreateData.reportName" size="small" style="width:15vw;" placeholder="请输入模版名称(不可与现有模版重名)" />
+    <el-form ref="fromCreateData" :model="fromCreateData" :rules="serviceDataRules">
+      <el-form-item v-if="TLstatus" label="关联任务" prop="selectTask" label-width="80px">
+        <el-select
+          v-model="fromCreateData.selectTask"
+          filterable
+          remote
+          reserve-keyword
+          placeholder="请输入任务名称或ID"
+          :remote-method="remoteMethod"
+          :loading="loading"
+          style="width: 100%"
+          size="small"
+          :disabled="disabled"
+          @change="tasksChange"
+        >
+          <el-option
+            v-for="item in tasksOptions"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+            :disabled="item.isScheduleLocked === 1"
+          >
+            <div class="Layout_space_between">
+              <span>{{ item.name }}</span>
+            </div>
+          </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="模版内容" prop="ownner">
-        <normal-area id="report-template" :value.sync="fromCreateData.ownner" :height="500" />
+      <el-form-item v-if="TLstatus" label="标题" prop="reportName" label-width="80px">
+        <div class="Layout_space_between">
+          <el-input v-model="fromCreateData.reportName" size="small" style="width: 80%;" placeholder="请输入报告名称" />
+          <span>报告人:{{ '秦志鹏' }}</span>
+        </div>
+      </el-form-item>
+      <el-form-item label="模版名称" prop="moduleName" label-width="80px">
+        <el-input v-model="fromCreateData.moduleName" size="small" style="width:15vw;" placeholder="请输入模版名称(不可与现有模版重名)" />
+      </el-form-item>
+      <el-form-item label="模版内容" prop="content"><br>
+        <normal-area id="report-template" :value.sync="fromCreateData.content" :height="500" />
       </el-form-item>
     </el-form>
     <div class="backStyle">缺陷统计</div>
@@ -37,9 +70,11 @@
 </template>
 
 <script>
+import '@/styles/PublicStyle/index.scss'
 import echarts from 'echarts'
-import { dailyReportCreate, dailyReportUpdate, bugDailyList } from '@/api/testPresentetion'
+import { bugDailyList } from '@/api/testPresentetion'
 import normalArea from '@/components/input/normalArea'
+import { settingAddReportModule, settingUpdateReportModule } from '@/api/reportTemplate' // 模版添删改查
 
 export default {
   name: 'DailyNewsAdded',
@@ -47,35 +82,23 @@ export default {
     normalArea
   },
   props: {
-    message: {
-      type: Object,
-      required: true
-    }
+    message: { type: Object, required: true },
+    templateStatus: { type: Boolean, default: false } // 判断模版是新建/还是下一步
   },
   data() {
     return {
       tableData: [{
         date: 0
       }],
-      // content: this.message.creatask === '编辑' ? this.message.testExplain : '<div style="color: #606266"><h3>一. 进度和风险</h3><p>1、项目整体进度</p><p>2、项目风险与问题</p><table border="1" style="border: 1px solid #DEE2E7" width="100%"><colgroup><col width="8%"><col width="8%"><col width="8%"><col width="8%"></colgroup><thead><tr><th>风险等级</th><th>风险项</th><th>当前状态</th><th>跟进人</th></tr></thead><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table><h3>二. 测试情况</h3><p>1、测试进展</p><table border="1" style="border: 1px solid #DEE2E7" width="100%"><colgroup><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"></colgroup><thead><tr><th>标题1</th><th>标题2</th><th>标题3</th><th>标题4</th><th>标题5</th><th>标题6</th><th>标题7</th></tr></thead><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table><p>2、测试说明</p></div>',
       userInformation: localStorage.getItem('username'),
       userNames: localStorage.getItem('realname'),
       serviceDataRules: {
-        reportName: [{ required: true, message: '报告标题不能为空', trigger: 'change' }],
-        ownner: [{ required: true, message: 'by不能为空', trigger: 'change' }]
+        selectTask: [{ required: true, message: '关联任务不能为空', trigger: 'change' }],
+        moduleName: [{ required: true, message: '报告标题不能为空', trigger: 'change' }],
+        content: [{ required: true, message: '模版内容不能为空', trigger: 'change' }]
       },
       fromCreateData: {
-        id: '',
-        bizId: '',
-        taskId: '',
-        status: '',
-        reportName: '',
-        ownner: '',
-        progressExplain: '', //  项目节点
-        testExplain: '', // 测试情况
-        bugNumCount: '', // bug统计
-        bugExplain: '', //  bug说明
-        problemRisks: ''// 进度和风险
+        content: `<div style="color: #606266"><h3>一. 进度和风险</h3><p>项目整体进度</p><p>项目风险与问题</p><table border="1" style="border: 1px solid #DEE2E7" width="100%"><colgroup><col width="8%"><col width="8%"><col width="8%"><col width="8%"></colgroup><thead><tr><th>风险等级</th><th>风险项</th><th>当前状态</th><th>跟进人</th></tr></thead><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table><h3>二. 测试情况</h3><p>1、测试进展</p><table border="1" style="border: 1px solid #DEE2E7" width="100%"><colgroup><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"><col width="8%"></colgroup><thead><tr><th>标题1</th><th>标题2</th><th>标题3</th><th>标题4</th><th>标题5</th><th>标题6</th><th>标题7</th></tr></thead><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table><p>2、测试说明</p></div>`
       },
       userData: '',
       objData: '',
@@ -85,12 +108,27 @@ export default {
       statusMap: [],
       statusList: [],
       dailys: '',
-      xaxisTotal: 0
+      xaxisTotal: 0,
+      TLstatus: false // 模版状态
     }
   },
-  created() {
-    this.getRouterData()
+  watch: {
+    message: {
+      handler(newV) {
+        newV ? this.getRouterData() : ''
+      },
+      immediate: true
+    },
+    templateStatus: {
+      handler(newV) {
+        this.TLstatus = newV
+      },
+      immediate: true
+    }
   },
+  // created() {
+  //   this.getRouterData()
+  // },
   mounted() {
     const myChart = echarts.init(document.getElementById('lineShow'))
     const myChartA = echarts.init(document.getElementById('barShow'))
@@ -149,32 +187,29 @@ export default {
         }, 500)
       })
     },
-    parentHandleclick(e, task, id) {
-      console.log(this.fromCreateData, 'cdcdscdcd')
-      if (e === 1) {
-        this.ids = task
-        delete this.fromCreateData.id
-        this.getCreateData(this.fromCreateData)
-      } else {
-        this.dailys = id
-        this.getQueryData(this.fromCreateData)
-      }
-    },
+    // parentHandleclick(e, task, id) {
+    //   console.log(this.fromCreateData, 'cdcdscdcd')
+    //   if (e === 1) {
+    //     this.ids = task
+    //     delete this.fromCreateData.id
+    //     this.getCreateData(this.fromCreateData)
+    //   } else {
+    //     this.dailys = id
+    //     this.getQueryData(this.fromCreateData)
+    //   }
+    // },
 
-    // 新建bug提交
-    getCreateData(ele) {
+    // 新建模版
+    getCreateData(e) {
       this.$refs['fromCreateData'].validate((valid) => {
         if (valid) {
-          this.fromCreateData = ele
-          this.fromCreateData.testExplain = this.$store.state.data.RichText
-          this.fromCreateData.bizId = Number(localStorage.getItem('bizId'))
-          this.fromCreateData.taskIds = this.ids
-          this.userData = { id: '', ename: this.userInformation, name: this.userNames }
-          this.objData = { dailyTestReport: this.fromCreateData, user: this.userData }
-          dailyReportCreate(this.objData).then(res => {
+          alert(1)
+          this.fromCreateData.bizId = localStorage.getItem('bizId')
+          this.fromCreateData.type = e
+          settingAddReportModule(this.fromCreateData).then(res => {
             if (res.code === 200) {
               this.$message.success(res.msg)
-              this.$emit('daily', res.data)
+              this.$emit('getreportTemplate')
             }
           })
         } else {
@@ -183,19 +218,15 @@ export default {
       })
     },
 
-    // 更新bug提交
-    getQueryData(ele) {
-      this.fromCreateData = ele
-      this.fromCreateData.testExplain = this.$store.state.data.RichText
-      this.fromCreateData.id === undefined ? this.fromCreateData.id = this.dailys : ''
-      this.userData = { id: '', ename: this.userInformation, name: this.userNames }
-      this.objData = { dailyTestReport: this.fromCreateData, user: this.userData }
-      dailyReportUpdate(this.objData).then(res => {
+    // 编辑模版
+    getQueryData(e) {
+      this.fromCreateData.bizId = localStorage.getItem('bizId')
+      this.fromCreateData.type = e
+      this.fromCreateData.id = e
+      settingUpdateReportModule(this.fromCreateData).then(res => {
         if (res.code === 200) {
           this.$message({ type: 'success', message: '更新成功' })
-          this.$emit('daily', res.data)
-        } else {
-          this.$message.error('更新失败')
+          this.$emit('getreportTemplate')
         }
       })
     }

+ 32 - 63
src/views/Platform/presentation/testPresentation.vue

@@ -14,7 +14,7 @@
             <span style="width: 100px;">{{ title }}</span>
             <el-input v-model="state" size="medium" filterable placeholder="报告名称搜索" style="width:100%;" @change="getList(state)" />
           </div>
-          <el-button type="primary" size="medium" @click="getQueryData(1), centerDialogVisible = true">新建{{ title }}</el-button>
+          <el-button type="primary" size="medium" @click="getQueryData">新建{{ title }}</el-button>
         </div>
         <el-table v-loading="loading" :data="tableData" size="mini" :header-cell-style="{ background: '#F2F3F6' }" border style="width: 100%" :show-overflow-tooltip="true">
           <el-table-column label="报告名称" min-width="280" align="center" show-overflow-tooltip>
@@ -97,7 +97,7 @@
     </el-dialog>
 
     <TestReport v-if="dialogVisible1" ref="TestReport" />
-    <DailyReport v-if="dialogDaily" ref="DailyReport" />
+    <DailyReport v-if="dialogDaily" ref="DailyReport" :title="title" />
     <ClientReport v-if="dialogClient" ref="ClientReport" />
   </div>
 </template>
@@ -126,7 +126,7 @@ export default {
       userInformation: localStorage.getItem('username'),
       userNames: localStorage.getItem('realname'),
       bizJson: localStorage.getItem('bizId'),
-      centerDialogVisible: false,
+      centerDialogVisible: false, // 新建报告选择任务
       dialog_testData: false, // 操作弹窗
       report_data: {}, // 当前点击数据
       userData: { id: '', ename: this.userInformation, name: this.userNames },
@@ -136,9 +136,7 @@ export default {
       total: 0,
       state: '',
       restaurants: [],
-      queryData: {
-        state: ''
-      },
+      queryData: {}, // 选择的任务code为id
       report_from: {
         name: '',
         titName: '',
@@ -163,9 +161,9 @@ export default {
     this.getList()
     this.$store.state.data.status = true
   },
-  mounted() {
-    this.getQueryData()
-  },
+  // mounted() {
+  //   this.getQueryData()
+  // },
   methods: {
     handleClick(tab, event) {
       this.curIndex = 1
@@ -338,62 +336,36 @@ export default {
           break
       }
     },
-    // queryPresentation(data) { // 报告编辑
-    //   switch (this.title) {
-    //     case '测试日报':
-    //       this.dialogDaily = true
-    //       this.$nextTick(() => {
-    //         this.$refs.DailyReport.init(2, data)
-    //       })
-    //       break
-    //     case '准出报告':
-    //       this.dialogClient = true
-    //       this.$nextTick(() => {
-    //         this.$refs.ClientReport.init(2, data)
-    //       })
-    //       break
-    //     case '提测报告':
-    //       this.dialogVisible1 = true
-    //       this.$nextTick(() => {
-    //         this.$refs.TestReport.init(2, data)
-    //       })
-    //       break
-    //   }
-    // },
     // 获取任务数据
-    getQueryData() {
-      this.$set(this.queryData, 'TestReport', '')
-      this.$set(this.queryData, 'ClientReport', '')
+    async getQueryData() { // 获取任务数据
+      this.centerDialogVisible = true
       this.$set(this.queryData, 'code', '')
-      this.restaurants = []
-      taskListCreate({ bizId: localStorage.getItem('bizId') }).then(res => {
+      const res = await taskListCreate({ bizId: localStorage.getItem('bizId') })
+      if (res.code === 200) {
         this.restaurants = res.data.taskInfoList
-      })
+      }
     },
 
-    createPresentation(e) {
-      if (e !== '') {
-        switch (this.title) {
-          case '测试日报':
-            this.dialogDaily = true
-            this.$nextTick(() => {
-              this.$refs.DailyReport.init(7, [e])
-            })
-            break
-          case '准出报告':
-            this.dialogClient = true
-            this.$nextTick(() => {
-              this.$refs.ClientReport.init(7, [e])
-            })
-            break
-          case '提测报告':
-            this.dialogVisible1 = true
-            this.$nextTick(() => {
-              this.$refs.TestReport.init(7, [e])
-            })
-            break
+    createPresentation(vel) {
+      if (vel !== '') {
+        if (this.title === '测试日报') {
+          this.dialogDaily = true
+          this.$nextTick(() => {
+            this.$refs.DailyReport.init(7, [vel])
+          })
+        }
+        if (this.title === '准出报告') {
+          this.dialogClient = true
+          this.$nextTick(() => {
+            this.$refs.ClientReport.init(7, [vel])
+          })
+        }
+        if (this.title === '提测报告') {
+          this.dialogVisible1 = true
+          this.$nextTick(() => {
+            this.$refs.TestReport.init(7, [vel])
+          })
         }
-        this.$set(this.queryData, 'code', '')
         this.centerDialogVisible = false
       } else {
         this.$message({ message: '提示,请选择要添加的任务ID', type: 'warning' })
@@ -409,10 +381,7 @@ export default {
     toReportView(ele) {
       switch (this.title) {
         case '测试日报':
-          this.dialogDaily = true
-          this.$nextTick(() => {
-            this.$refs.DailyReport.init(3, ele)
-          })
+          this.$router.push({ name: '报告详情', query: { data: ele }})
           break
         case '准出报告':
           this.dialogClient = true