Bladeren bron

Merge remote-tracking branch 'origin/usecase_daily_0.0.2' into usecase_daily_0.0.2

洪海涛 4 jaren geleden
bovenliggende
commit
1c96a81443
34 gewijzigde bestanden met toevoegingen van 1449 en 794 verwijderingen
  1. 8 0
      src/components/input/normalArea.vue
  2. 1 0
      src/components/input/textArea.vue
  3. 9 4
      src/components/select/searchPeople.vue
  4. 4 0
      src/styles/index.less
  5. 3 3
      src/views/dataBigManage/components/drawerModal/index.vue
  6. 6 4
      src/views/monthlyReport/childrenPage/editReport/components/MrTable/Analysis.vue
  7. 2 2
      src/views/monthlyReport/childrenPage/editReport/components/MrTable/TableExpandRow.vue
  8. 18 10
      src/views/monthlyReport/childrenPage/editReport/components/MrTable/index.vue
  9. 2 2
      src/views/monthlyReport/childrenPage/editReport/components/OverallOverviewOfTheClient/onlineQuestion.vue
  10. 1 1
      src/views/monthlyReport/childrenPage/editReport/components/OverallOverviewOfTheClient/qualityProcess.vue
  11. 1 1
      src/views/monthlyReport/childrenPage/editReport/components/Refresh.vue
  12. 2 14
      src/views/monthlyReport/childrenPage/editReport/components/core.vue
  13. 2 2
      src/views/projectManage/bugList/details/index.vue
  14. 17 8
      src/views/projectManage/bugList/file/createdBug.vue
  15. 3 2
      src/views/projectManage/requirement/list/create.vue
  16. 20 1
      src/views/projectManage/taskList/taskIndex.vue
  17. 20 12
      src/views/reportManagement/ReleaseReport/components/releaseDetails.vue
  18. 78 70
      src/views/reportManagement/ReleaseReport/newReleaeTemplate.vue
  19. 27 19
      src/views/reportManagement/ReleaseReport/releaePreview.vue
  20. 18 10
      src/views/reportManagement/Testing/TestingPreview.vue
  21. 6 1
      src/views/reportManagement/Testing/components/deliverDetails.vue
  22. 119 107
      src/views/reportManagement/Testing/newTestingTemplate.vue
  23. 181 0
      src/views/reportManagement/components/Custom/index.vue
  24. 102 121
      src/views/reportManagement/components/DailyReport.vue
  25. 109 133
      src/views/reportManagement/components/ReleaseReport.vue
  26. 111 146
      src/views/reportManagement/components/TestingReport.vue
  27. 178 0
      src/views/reportManagement/components/template/customTemplate.vue
  28. 134 0
      src/views/reportManagement/components/template/index.vue
  29. 42 0
      src/views/reportManagement/components/template/nodule.vue
  30. 4 1
      src/views/reportManagement/daily/components/dailyDetails.vue
  31. 4 1
      src/views/reportManagement/daily/dailyPreview.vue
  32. 56 20
      src/views/reportManagement/daily/dailyTemplate.vue
  33. 53 11
      src/views/reportManagement/daily/newReportTemplate.vue
  34. 108 88
      src/views/reportManagement/testPresentation.vue

+ 8 - 0
src/components/input/normalArea.vue

@@ -23,6 +23,13 @@ import { keepLastIndex, uploadImg } from '@/utils/util'
 // import request from '@/utils/request'
 import tinymce from 'tinymce/tinymce'
 import Editor from '@tinymce/tinymce-vue'
+/* S 插件 */
+import 'tinymce/plugins/lists'
+import 'tinymce/plugins/fullscreen'
+import 'tinymce/plugins/textcolor'
+import 'tinymce/plugins/contextmenu'
+import 'tinymce/plugins/wordcount'
+/* E 插件 */
 import 'tinymce/themes/silver/theme'
 import 'tinymce/icons/default/icons'
 // import { uploadImage } from '@/api/common.js'
@@ -125,6 +132,7 @@ export default {
   },
   methods: {
     async resetImgSrc(str) {
+      if (!str) return
       let newStr = str
       const imgReg = /<img.*?(?:>|\/>)/gi
       const srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i

+ 1 - 0
src/components/input/textArea.vue

@@ -148,6 +148,7 @@ export default {
   },
   methods: {
     async resetImgSrc(str) {
+      if (!str) return
       let newStr = str
       const imgReg = /<img.*?(?:>|\/>)/gi
       const srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i

+ 9 - 4
src/components/select/searchPeople.vue

@@ -5,7 +5,7 @@
     :clearable="clearable"
     remote
     :multiple="multiple"
-    :remote-method="remoteMethod"
+    :remote-method="searchPeople"
     :loading="loading"
     :size="size"
     :placeholder="placeholder"
@@ -28,6 +28,7 @@
   </el-select>
 </template>
 <script>
+const _ = require('lodash')
 import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
 import { getListPerson } from '@/api/onlineproblem'
 
@@ -84,10 +85,9 @@ export default {
         } else {
           this.searchValue = newV
         }
-        console.log(this.searchValue)
         const type = Object.prototype.toString.call(this.searchValue)
         if (type.indexOf('Array') < 0) {
-          this.remoteMethod(this.searchValue)
+          this.searchPeople(this.searchValue)
         } else if (type.indexOf('Array') > 0 && this.searchValue.length > 0 && this.firstGetArr) {
           this.initMore(this.searchValue)
           this.firstGetArr = false
@@ -100,8 +100,12 @@ export default {
     this.initMore(this.searchValue)
   },
   methods: {
-    remoteMethod(query) {
+    remoteMethod: _.debounce(function(query) {
       query !== '' ? this.getMember(query) : this.options = []
+    }, 2000),
+    searchPeople(query) {
+      this.loading = true
+      this.remoteMethod(query)
     },
     initMore(arr) { // 当多人时候,对数组每一个人员进行搜索
       if (this.multiple) {
@@ -123,6 +127,7 @@ export default {
       if (res.data === null) {
         return
       }
+      this.loading = false
       const weakMap = new Map()
       for (const item of res.data) {
         if (!weakMap.has(item.idap)) {

+ 4 - 0
src/styles/index.less

@@ -198,6 +198,10 @@ div:focus {
   -moz-osx-font-smoothing: grayscale;
 }
 
+// reset
+.el-input {
+  padding: 1px;
+}
 @font-face {
   font-family: 'iconfont';  /* Project id 2402558 */
   src: url('//at.alicdn.com/t/font_2402558_538plilwhpo.woff2?t=1620356015326') format('woff2'),

+ 3 - 3
src/views/dataBigManage/components/drawerModal/index.vue

@@ -187,7 +187,7 @@ export default {
 
   watch: {
     drawerData() {
-     this.init()
+      this.init()
     },
     openDrawer(value) {
       this.drawer = value
@@ -208,7 +208,7 @@ export default {
     },
     init() {
       this.headerTitle = this.drawerData.headerTitle
-      this.title = this.headerTitle.search(/质量|效率/) > -1 ? this.drawerData.label || '' : this.drawerData.activeLabel 
+      this.title = this.headerTitle.search(/质量|效率/) > -1 ? this.drawerData.label || '' : this.drawerData.activeLabel
       if (this.headerTitle && this.title) {
         console.log(this.drawerData)
         this.pagingInit()
@@ -228,7 +228,7 @@ export default {
     },
     // 设置标题
     setTitle() {
-     
+      // this.title = this.headerTitle.search(/质量|效率/) > -1 ? this.drawerData.label : this.drawerData.activeLabel
       if (this.headerTitle === '质量') {
         if (this.drawerData.label === '提测打回率') {
           this.title = '提测报告'

+ 6 - 4
src/views/monthlyReport/childrenPage/editReport/components/MrTable/Analysis.vue

@@ -130,7 +130,7 @@ size="small"
       is-succes
       :modal="false"
       :show-dialog="false"
-      :title="'确认月报'"
+      :title="'确认分析反馈'"
       width="319px"
       @cancel="dialogConfirmCancel"
       @succes="updateModule('Submission')"
@@ -177,7 +177,7 @@ export default {
       this.$forceUpdate()
     },
     delItem(index) {
-      console.log('删除')
+      // console.log('删除')
       this.analyticFeedback.analyticContents.splice(index, 1)
     },
     addSubItem(index) {
@@ -193,7 +193,7 @@ export default {
       this.$forceUpdate()
     },
     delSubItem(index, subindex) {
-      console.log(index, subindex)
+      // console.log(index, subindex)
       this.analyticFeedback.analyticContents[index].improvementItems.splice(
         subindex,
         1
@@ -205,7 +205,7 @@ export default {
       this.isBg = true
     },
     normalDialogCancel() {
-      console.log(210, '这里隐藏了时间', this.$refs['dialogConfirm'].visible)
+      // console.log(210, '这里隐藏了时间', this.$refs['dialogConfirm'].visible)
       if (!this.$refs['dialogConfirm'].visible) {
         this.isBg = false
       }
@@ -216,9 +216,11 @@ export default {
       this.$refs.normalDialog.visible = true
     },
     updateModule(key) {
+      // console.log(key)
       const { analyticFeedback, rowIndex } = this
       if (key && key === 'Submission') {
         analyticFeedback.isCommitted = true
+        analyticFeedback.feedbackType = 'feedback_commit'
       }
       this.oldBaseData = _.cloneDeep(this.baseData)
       this.$emit('upData', {

+ 2 - 2
src/views/monthlyReport/childrenPage/editReport/components/MrTable/TableExpandRow.vue

@@ -127,7 +127,7 @@ export default {
   methods: {
     setHold(index, subIndex, subItem) {
       subItem.isProgressEdit = false
-      console.log(this.analyticFeedback)
+      // console.log(this.analyticFeedback)
       if (subItem.isHold) {
         subItem.isHold = false
         this.$forceUpdate()
@@ -136,7 +136,7 @@ export default {
       this.$refs.Hold.open(index, subIndex, subItem.holdReason)
     },
     upHold({ index, subIndex, holdReason }) {
-      console.log({ index, subIndex, holdReason })
+      // console.log({ index, subIndex, holdReason })
       this.analyticFeedback.analyticContents[index].improvementItems[
         subIndex
       ].isHold = true

+ 18 - 10
src/views/monthlyReport/childrenPage/editReport/components/MrTable/index.vue

@@ -450,7 +450,7 @@ export default {
         this.tableData.splice(scope.$index, 1)
       }
       if (btnItem.value === '链接') {
-        console.log(scope)
+        // console.log(scope)
         this.$refs['LinkEdit'].open(scope.row.operationTarget || '', scope.$index)
         // console.log(btnItem, scope, this.columns)
       }
@@ -466,13 +466,13 @@ export default {
         })
       }
       if (btnItem.value === '分析反馈') {
-        console.log(293, btnItem, scope)
+        // console.log(293, btnItem, scope)
         this.$refs.Analysis.open(scope.row.analyticFeedback, scope.$index)
       }
     },
     // 另存为
     saveAsRow(command, row, item) {
-      console.log(414)
+      // console.log(414)
       this.$store.commit('monthlyReportEdit/SAVE_AS', {
         tableHeaders: this.columns,
         tableRows: row,
@@ -481,13 +481,18 @@ export default {
     },
     // 分析反馈问题更新
     upDataAnalysis({ rowIndex, analyticFeedback }) {
+      // console.log({ rowIndex, analyticFeedback })
       if (this.pageType.search(/edit/) < 0) {
-        console.log(rowIndex, analyticFeedback)
+        // console.log(rowIndex, analyticFeedback)
         this.feedbackIndex = rowIndex
         this.tableData[rowIndex].analyticFeedback = _.cloneDeep(
           analyticFeedback
         )
-        this.setAnalyticFeedback()
+        let feedbackType = ''
+        if (analyticFeedback.hasOwnProperty('feedbackType')) {
+          feedbackType = 'feedbackType'
+        }
+        this.setAnalyticFeedback(feedbackType)
       }
     },
     addTableData() {
@@ -565,7 +570,7 @@ export default {
       }
     },
     // 查看页面数据分析
-    setAnalyticFeedback() {
+    setAnalyticFeedback(key = '') {
       if (
         // this.pageType.search(/edit/) < 0 &&
         // this.pageDate.status > 10 &&
@@ -577,13 +582,13 @@ export default {
         const run = (arr) => {
           arr.forEach((elm) => {
             if (elm.domKey === this.domKey) {
-              console.log(elm)
+              // console.log(elm)
               obj = _.cloneDeep(elm)
             }
             if (elm.content.length) {
               elm.content.forEach((item) => {
                 if (item.domKey === this.domKey) {
-                  console.log(elm)
+                  // console.log(elm)
                   obj = _.cloneDeep(elm)
                 }
               })
@@ -606,6 +611,9 @@ export default {
         // console.log(params)
         // 提交数据
         if (obj && obj.content[0].tableRows.length) {
+          if (key && key === 'feedbackType') {
+            params[key] = 'feedback_commit'
+          }
           updateAnalyticFeedback(params).then((res) => {
             if (res.code === 200) {
               this.analyticFeedback = res.data
@@ -687,12 +695,12 @@ export default {
     },
     // 修改链接
     linkEditChange({ rowIndex, addresLink }) {
-      console.log(rowIndex, addresLink)
+      // console.log(rowIndex, addresLink)
       this.tableData[rowIndex].operationTarget = addresLink
     },
     // 页面跳转
     goto(url) {
-      console.log(url)
+      // console.log(url)
       url && window.open(url, '_blank')
     }
   }

+ 2 - 2
src/views/monthlyReport/childrenPage/editReport/components/OverallOverviewOfTheClient/onlineQuestion.vue

@@ -135,8 +135,8 @@ export default {
       this.tabData = this.pageData.filter(
         (elm) => elm.clientType === this.active
       )[0]
-      console.log(this.tabData)
-      console.log(this.tabData.onlineProblemCopywriters)
+      // console.log(this.tabData)
+      // console.log(this.tabData.onlineProblemCopywriters)
 
       this.pieData = this.tabData.onlineProblemCopywriters.filter(elm => elm.total)
       this.option.series[0].data = this.pieData

+ 1 - 1
src/views/monthlyReport/childrenPage/editReport/components/OverallOverviewOfTheClient/qualityProcess.vue

@@ -218,7 +218,7 @@ export default {
       // if (this.pieData.length) {
       //   this.myChart.setOption(this.option)
       // }
-      console.log(this.option)
+      // console.log(this.option)
       this.myChart.setOption(this.option)
     }
   }

+ 1 - 1
src/views/monthlyReport/childrenPage/editReport/components/Refresh.vue

@@ -76,7 +76,7 @@ export default {
     },
     refreshReport() {
       this.$refs.dialogRefresh.visible = false
-      console.log('refreshReport', this.activeName, 30, this.subTabsActive, this.tabKey)
+      // console.log('refreshReport', this.activeName, 30, this.subTabsActive, this.tabKey)
       this.animateClass = 'refresh-animate-start'
       this.$store.dispatch('monthlyReportEdit/refreshReport', {
         domKey: this.domKey,

+ 2 - 14
src/views/monthlyReport/childrenPage/editReport/components/core.vue

@@ -223,7 +223,7 @@ export default {
     }
   },
   mounted() {
-    console.log(212)
+    // console.log(212)
     if (
       this.baseData &&
       this.baseData.children &&
@@ -336,7 +336,7 @@ export default {
       if (this.baseData.content.length) {
         params.normalAreaName = this.baseData.content[0].value
       }
-      console.log(params)
+      // console.log(params)
       this.$nextTick(() => {
         this.$refs.markingIssues.openModal(params)
       })
@@ -373,10 +373,6 @@ export default {
   //bottom: 5px;
 }
 
-/deep/ .el-tabs__active-bar {
-  //bottom: 5px;
-}
-
 .isBar {
   /deep/ .el-tabs__nav-wrap::after {
     display: initial;
@@ -387,14 +383,6 @@ export default {
   }
 }
 
-/deep/ .el-tabs__header {
-  //margin-bottom: 15px;
-}
-
-/deep/ .el-tabs__item {
-  //padding: 0 10px;
-}
-
 /deep/ .el-tabs__content {
   margin-top: -10px;
 }

+ 2 - 2
src/views/projectManage/bugList/details/index.vue

@@ -693,8 +693,8 @@ export default {
       showWordLimit: false,
       showRule: false,
       rules: {
-        assigner: [{ required: true, message: '责任人不可为空', trigger: 'change' }],
-        currentHandler: [{ required: true, message: '修复人不可为空', trigger: 'change' }],
+        assigner: [{ required: true, message: '责任人不可为空', trigger: 'blur' }],
+        currentHandler: [{ required: true, message: '修复人不可为空', trigger: 'blur' }],
         bugName: [{ required: true, message: '标题不可为空', trigger: 'blur' }]
       },
       showCopyFile: false, // 复制文件对话框

+ 17 - 8
src/views/projectManage/bugList/file/createdBug.vue

@@ -51,7 +51,7 @@
                 </el-form-item>
 
                 <el-form-item label="责任人" style="width:100%;" prop="assigner">
-                  <el-select v-model="formInline.assigner" multiple filterable remote :remote-method="remoteMethod" :loading="loading" style="width: 100%" placeholder="请输入姓名或邮箱前缀" @change="getcurrentHandler(formInline.assigner)">
+                  <!-- <el-select v-model="formInline.assigner" multiple filterable remote :remote-method="remoteMethod" :loading="loading" style="width: 100%" placeholder="请输入姓名或邮箱前缀" @change="getcurrentHandler(formInline.assigner)">
                     <el-option v-for="item in options" :key="item.idap" :label="item.name" :value="test2(item, 0)">
                       <div style="display: flex;justify-content: start;">
                         <div style="min-width:100px;color: #8492a6; font-size: 13px; overflow:hidden">{{ item.deptName }}</div>
@@ -59,7 +59,8 @@
                         <div style="min-width:100px;color: #8492a6; font-size: 13px; overflow:hidden">{{ item.idap }}</div>
                       </div>
                     </el-option>
-                  </el-select>
+                  </el-select> -->
+                  <searchPeople :value.sync="formInline.assigner" :multiple="true" :size="'medium'" style="width: 100%;" />
                 </el-form-item>
               </div>
               <div style="width:100%; margin: 0 4%;">
@@ -88,7 +89,7 @@
                   <el-input v-model="formInline.creatorList" :disabled="true" placeholder="请输入姓名或邮箱前缀" style="width:100%;" />
                 </el-form-item>
                 <el-form-item label="修复人" style="width:100%;" prop="currentHandler">
-                  <el-select v-model="formInline.currentHandler" multiple filterable remote :remote-method="remoteMethod" :loading="loading" style="width: 100%" placeholder="请输入姓名或邮箱前缀">
+                  <!-- <el-select v-model="formInline.currentHandler" multiple filterable remote :remote-method="remoteMethod" :loading="loading" style="width: 100%" placeholder="请输入姓名或邮箱前缀">
                     <el-option v-for="item in options" :key="item.idap" :label="item.name" :value="test2(item, 0)">
                       <div style="display: flex;justify-content: start;">
                         <div style="min-width:100px;color: #8492a6; font-size: 13px; overflow:hidden">{{ item.deptName }}</div>
@@ -96,7 +97,8 @@
                         <div style="min-width:100px;color: #8492a6; font-size: 13px; overflow:hidden">{{ item.idap }}</div>
                       </div>
                     </el-option>
-                  </el-select>
+                  </el-select> -->
+                  <searchPeople :value.sync="formInline.currentHandler" :multiple="true" :size="'medium'" style="width: 100%;" />
                 </el-form-item>
               </div>
             </div>
@@ -163,7 +165,7 @@
       <el-button id="pasteUpload" type="primary" style="display: none" @click.stop="pasteUpload">upload</el-button>
       <div slot="footer">
         <el-button @click="modalShow = false">取 消</el-button>
-        <el-button :disabled="dis" type="primary" @click="bug_created(formInline)">创 建</el-button>
+        <el-button :disabled="dis" type="primary" @click="bug_createds(formInline)">创 建</el-button>
       </div>
     </modal>
     <normal-dialog :show-dialog="showCopyFile" :title="'上传截图'" :width="'40%'" :submit-button="'上传'" :top="'5vh'" @confirm="confirmUpload()" @cancel="showCopyFile=false">
@@ -202,6 +204,7 @@ import {
   bugCreate,
   settingQueryBizModuleList
 } from '@/api/defectManage'
+import searchPeople from '@/components/select/searchPeople' // 人员select
 import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
 import normalDialog from '@/components/dialog/normalDialog'
 import '@/views/projectManage/bugList/css/index.css'
@@ -230,7 +233,8 @@ export default {
   components: {
     normalDialog,
     normalArea,
-    modal
+    modal,
+    searchPeople
   },
   filters: {
     limit(e, limit) {
@@ -292,7 +296,7 @@ export default {
           { required: true, message: '发现方式不能为空', trigger: 'change' }
         ],
         assigner: [
-          { required: true, message: '责任人不能为空', trigger: 'change' }
+          { required: true, message: '责任人不能为空', trigger: 'blur' }
         ],
         sysType: [
           { required: true, message: '端类型不能为空', trigger: 'change' }
@@ -307,9 +311,10 @@ export default {
           { required: true, message: '提报人不能为空', trigger: 'change' }
         ],
         currentHandler: [
-          { required: true, message: '修复人不能为空', trigger: 'change' }
+          { required: true, message: '修复人不能为空', trigger: 'blur' }
         ]
       },
+      stopClickLogin: false,
       bugEnumList: [], // bug状态
       appClient: [], // 客户端
       Editionlist: [], // 版本
@@ -495,6 +500,10 @@ export default {
       this.dis = true
     },
 
+    bug_createds: _.throttle(function() {
+      this.bug_created(this.formInline)
+    }, 2000),
+
     bug_created(e) {
       // 创建(提交)
       this.$refs['formInline'].validate(valid => {

+ 3 - 2
src/views/projectManage/requirement/list/create.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" class="copy-task" :visible.sync="isVisible" width="65%" :close-on-click-modal="false" :destroy-on-close="true">
+  <el-dialog :title="title" class="copy-task task" :visible.sync="isVisible" width="65%" :close-on-click-modal="false" :destroy-on-close="true">
     <div class="blueStripe" />
     <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px">
       <el-form-item label="需求名称" prop="name">
@@ -201,6 +201,7 @@ export default {
     visible: function(newVisible, oldVisible) {
       this.isVisible = newVisible
       if (newVisible) {
+        this.form.bizId = this.bizId
         if (this.title === '编辑需求') {
           this.form = JSON.parse(JSON.stringify(this.data))
           if (this.form.referredClientType !== '') {
@@ -241,7 +242,7 @@ export default {
         }
         this.$emit('cancel', false)
       }
-      this.form = { source: 1, type: 0, dependOnRelease: 0, belongingProject: '-1', bizId: this.bizId }
+      // this.form = { source: 1, type: 0, dependOnRelease: 0, belongingProject: '-1', bizId: this.bizId }
     },
     bizId: {
       handler(newV) {

+ 20 - 1
src/views/projectManage/taskList/taskIndex.vue

@@ -398,7 +398,16 @@
           <template slot-scope="scope">{{ scope.row.bugCount }}</template>
         </el-table-column>
         <el-table-column label="所属需求" min-width="250" align="center" show-overflow-tooltip>
-          <template slot-scope="scope">{{ scope.row.requireName }}</template>
+          <template slot-scope="scope">
+            <span
+              v-if="scope.row.requireBizName"
+              class="topq"
+              style="font-size: 12px;">
+              {{ scope.row.requireBizName }}
+            </span>
+            <br>
+            {{ scope.row.requireName }}
+          </template>
         </el-table-column>
         <el-table-column label="所属项目" min-width="250" align="center" show-overflow-tooltip>
           <template slot-scope="scope">{{ scope.row.projectName }}</template>
@@ -1009,6 +1018,16 @@ export default {
 }
 </script>
 <style lang="less" scoped>
+.topq {
+  margin-left: 5px;
+  display: inline-block;
+  padding: 1px 5px 0;
+  border-radius: 8px;
+  height: 16px;
+  line-height: 16px;
+  background: rgba(245, 108, 108, 0.17);
+  color: #f56c6c;
+}
 .chartView {
   .chartSearchTitle {
     width: 50px;

+ 20 - 12
src/views/reportManagement/ReleaseReport/components/releaseDetails.vue

@@ -16,7 +16,7 @@
     </el-header>
     <el-container>
       <el-main class="report-main">
-        <div class="title"><div class="blur-column" />报告内容</div>
+        <div class="title"><div class="blur-column spanColor" />报告内容</div>
         <el-row>
           <el-col :span="24" class="task-bot">
             <span class="from-names">测试结果:</span>
@@ -28,13 +28,13 @@
           <el-col :span="12" class="Layout_space_between task-bot">
             <span class="from-name">
               <span class="test-details">计划准出时间:</span>
-              {{ details.releasePlanTime }}
+              <span class="spanColor">{{ details.releasePlanTime }}</span>
             </span>
           </el-col>
           <el-col :span="12">
             <span class="from-namev">
               <span class="test-details">实际准出时间:</span>
-              {{ details.releaseActualTime }}
+              <span class="spanColor">{{ details.releaseActualTime }}</span>
             </span>
           </el-col>
         </el-row>
@@ -43,7 +43,7 @@
           <el-col :span="24" class="Layout_space_between task-bot">
             <span class="from-namea">
               <span class="test-details">准出延期原因 :</span>
-              {{ details.delayReason }}
+              <span class="spanColor">{{ details.delayReason }}</span>
             </span>
           </el-col>
         </el-row>
@@ -52,13 +52,13 @@
           <el-col :span="12" class="Layout_space_between task-bot">
             <span class="from-name">
               <span class="test-details">计划开发周期:</span>
-              {{ details.devPlanTimeStart }} 至 {{ details.devPlanTimeEnd }}
+              <span class="spanColor">{{ details.devPlanTimeStart }} 至 {{ details.devPlanTimeEnd }}</span>
             </span>
           </el-col>
           <el-col :span="12" class="Layout_space_between">
             <span class="from-namer">
               <span class="test-details">实际开发周期:</span>
-              {{ details.devActualTimeStart }} 至 {{ details.devActualTimeEnd }}
+              <span class="spanColor">{{ details.devActualTimeStart }} 至 {{ details.devActualTimeEnd }}</span>
             </span>
           </el-col>
         </el-row>
@@ -67,23 +67,23 @@
           <el-col :span="12" class="Layout_space_between task-bot">
             <span class="from-name">
               <span class="test-details">计划测试周期:</span>
-              {{ details.testPlanTimeStart }} 至 {{ details.testPlanTimeEnd }}
+              <span class="spanColor">{{ details.testPlanTimeStart }} 至 {{ details.testPlanTimeEnd }}</span>
             </span>
           </el-col>
           <el-col :span="12" class="Layout_space_between task-bot">
             <span class="from-namer">
               <span class="test-details">实际测试周期:</span>
-              {{ details.testActualTimeStart }} 至 {{ details.testActualTimeEnd }}
+              <span class="spanColor">{{ details.testActualTimeStart }} 至 {{ details.testActualTimeEnd }}</span>
             </span>
           </el-col>
         </el-row>
 
-        <el-row class="task-bot">
+        <el-row>
           <el-col :span="12" class="Layout_space_between task-bot">
             <span class="from-name">
               <span class="test-details">开发人员:</span>
               <span v-for="(item, index) in details.devObject" :key="index">
-                {{ item.name }}
+                <span class="spanColor">{{ item.name }}</span>
                 <span v-if="index < details.devObject.length - 1">,</span>
               </span>
             </span>
@@ -92,12 +92,15 @@
             <span class="from-namer">
               <span class="test-details">测试人员:</span>
               <span v-for="(item, index) in details.testerObject" :key="index">
-                {{ item.name }}
+                <span class="spanColor">{{ item.name }}</span>
                 <span v-if="index < details.testerObject.length - 1">,</span>
               </span>
             </span>
           </el-col>
         </el-row>
+
+        <moduleCode :data="details" />
+
         <div v-html="details.content" />
 
         <div class="title">缺陷统计</div>
@@ -177,6 +180,7 @@
 
 <script>
 import { EncryptId, analysisBizId_id } from '@/utils/crypto-js.js'
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 import { mapGetters } from 'vuex'
 import {
   reportreleaseGetReportById,
@@ -189,7 +193,8 @@ export default {
   components: {
     ReleaseReport,
     iconDisplay,
-    drawerIndex
+    drawerIndex,
+    moduleCode
   },
   data() {
     return {
@@ -266,6 +271,9 @@ export default {
   flex-wrap: wrap;
 }
 .BackgroundCloth {
+  .spanColor {
+    color: #333333;
+  }
   .report-Header {
     margin: 10px 10px 0;
     background: #fff;

+ 78 - 70
src/views/reportManagement/ReleaseReport/newReleaeTemplate.vue

@@ -32,7 +32,10 @@
         <el-input v-model="from.reportName" size="small" type="text" maxlength="50" style="width:100%;" placeholder="请输入报告名称" />
       </el-form-item>
 
-      <div class="backStyle">{{ !releaseType ? '报告内容' : '模版内容' }}</div>
+      <div class="backStyle">
+        {{ !releaseType ? '报告内容' : '模版内容' }}
+        <el-button type="text" @click="customDialong">{{ !releaseType? "" : '自定义字段' }}</el-button>
+      </div>
 
       <el-row class="from-margin">
         <el-col :span="12" :class="{ Layout_space_between: !passStatus }">
@@ -88,17 +91,19 @@
         <el-col :span="12" class="Layout_space_between">
           <span class="from-name">开发人员: </span>
           <search-people :value.sync="from.developer" :clearable="true" :multiple="true" :size="'small'" :disabled="releaseType" style="width: 100%;" />
-          <!-- <searchTeam :value.sync="from.developer" :clearable="true" :multiple="true" :disabled="releaseType" :size="'small'" style="width: 100%;" /> -->
         </el-col>
         <el-col :span="12" class="Layout_space_between">
           <span class="from-namer"> 测试人员:</span>
           <search-people :value.sync="from.tester" :clearable="true" :multiple="true" :size="'small'" :disabled="releaseType" style="width: 100%;" />
-          <!-- <searchTeam :value.sync="from.tester" :clearable="true" :multiple="true" :disabled="releaseType" :placeholder="'请输入姓名或邮箱前缀'" :size="'small'" style="width: 100%;" /> -->
         </el-col>
       </el-row>
+
+      <!-- 自定义反显组件 -->
+      <moduleCustom v-if="customList && customList[0]" :custom="customList" :base-from="from" :disab="releaseType" @formData="formData" />
+
       <normal-area
         id="report-template-1"
-        :value.sync="fromData.content"
+        :value.sync="from.content"
         :height="500"
         :full-position-style="{ top:'20px',left:'15%', right: '15%' }"
       />
@@ -115,6 +120,7 @@ import searchPeople from '@/components/select/searchPeople' // 人员select
 import normalArea from '@/components/input/normalArea' // 富文本
 import 'tinymce/plugins/table'// 插入表格插件
 import { taskList } from '@/api/taskIndex'
+import moduleCustom from '@/views/reportManagement/components/template/customTemplate.vue'
 import iconDisplay from '@/views/reportManagement/ReleaseReport/components/iconDisplay.vue'
 import { settingAddReportModule, settingUpdateReportModule, settingGetReportModuleById, reportreleaseInitReportRelease, reportreleaseCreate, reportreleaseUpdate, reportreleaseGetReportById } from '@/api/reportTemplate' // 模版添删改查
 import { getContainImgHTMLNode } from '@/utils/handleTinymce' // 富文本本图片转换
@@ -123,14 +129,17 @@ export default {
   components: {
     normalArea,
     searchPeople,
-    iconDisplay
+    iconDisplay,
+    moduleCustom
   },
   props: {
     templateId: { type: [String, Number, Object], default: null }, // 模版id
+    custom: { type: Array, required: false, default: null },
     taskIds: { type: Array, default: null }
   },
   data() {
     return {
+      customList: this.custom,
       passStatus: true,
       tpltId: '', // 模版id
       reportId: '', // 报告id
@@ -170,14 +179,12 @@ export default {
     },
     templateId: {
       handler(newV) {
-        if (newV === '新建模版') { // 新建模版
-          this.releaseType = true
-          return false
-        }
-        if (newV.set_up) { // 编辑模版
+        console.log(newV, '你恐惧烦恼的你')
+        if (newV.name === '新建模版' || newV.name === '编辑模版') { // 新建、编辑模版
           this.releaseType = true
-          this.settingGetReportModuleById(newV.set_up)
-          return false
+          this.from = { ...this.from, ...newV.from }
+          newV.name === '编辑模版' ? this.settingGetReportModuleById(newV.set_up) : ''
+          return
         }
         this.releaseType = false
         if (newV.id) { // 编辑
@@ -216,17 +223,10 @@ export default {
 
     setDefaultData(dav) {
       const from = dav
-      if (dav.reportName !== null) {
-        this.$set(this.from, 'reportName', from.reportName) // 报告名称
-      }
-      this.$set(this.from, 'releasePlanTime', from.releasePlanTime) // 计划准出时间
-      this.$set(this.from, 'releaseActualTime', from.releaseActualTime) // 实际准出时间
-      this.$set(this.from, 'isDelay', from.isDelay) // 准出是否延期 1 延期,0未延期
-      this.$set(this.from, 'delayReason', from.delayReason) // 是否延期
-      this.$set(this.from, 'content', from.content) // 富文本
-      this.$set(this.from, 'delayReason', from.delayReason) // 延期原因
-      this.$set(this.from, 'passStatus', from.passStatus) // 测试结果
-      this.fromData.content = from.content // 富文本
+      this.from = { ...this.from, ...dav, 'taskIds': from.taskId }
+      // console.log( from.customFields, '编辑')
+      // this.customList = from.customFields
+      console.log(dav, '编辑')
       if (from.devPlanTimeStart) {
         this.$set(this.from, 'devPlanTimeStart', [from.devPlanTimeStart, from.devPlanTimeEnd]) // 计划开发开始时间-计划开发结束时间
       }
@@ -239,9 +239,6 @@ export default {
       if (from.testActualTimeStart) {
         this.$set(this.from, 'testActualTimeStart', [from.testActualTimeStart, from.testActualTimeEnd]) // 实际测试开始时间-实际测试结束时间
       }
-      this.from.taskIds = from.taskId // 关联任务
-      this.from.bizId = from.bizId // 业务线
-      this.from.moduleId = from.moduleId // 模块id
       this.from.developer = from.developer ? from.developer.split() : null // 开发人员
       this.from.tester = from.tester ? from.tester.split() : null // 测试人员
     },
@@ -249,10 +246,15 @@ export default {
     async settingGetReportModuleById(val) { // 获取富文本内容
       const res = await settingGetReportModuleById(val)
       if (res.code === 200) {
-        this.fromData = res.data
+        !this.customList ? this.customList = [] : ''
+        if (res.data.customFields && this.customList.length < 1) {
+          this.customList = [...this.customList, ...res.data.customFields]
+        } else {
+          this.customList = [...this.customList]
+        }
+        this.from = res.data
         this.modelID = res.data.id
-        this.$set(this.from, 'moduleName', res.data.moduleName)
-        this.$set(this.from, 'passStatus', 0)
+        this.from = { ...this.from, 'moduleName': res.data.moduleName, 'passStatus': 0 }
       }
     },
 
@@ -297,22 +299,31 @@ export default {
 
     // 创建准出报告
     reportreleaseCreate(val) {
+      let show = '0'
+      this.from.customFields.map(item => {
+        if (item.bool && item.required && item.type < 4) {
+          item.type < 4 && item.content ? '' : show = item.fieldName
+        }
+        if (item.bool && item.required && item.type === 4) {
+          item.contents ? '' : show = item.fieldName
+        }
+      })
+      if (show !== '0') {
+        this.$message({ type: 'warning', message: `${show}不能为空` })
+        return
+      }
       this.$refs.fromCreateData.validate(async(valid) => {
         if (valid) {
           this.loading = true
           try {
-            this.fromData.content = await getContainImgHTMLNode(this.fromData.content)
+            this.from.content = await getContainImgHTMLNode(this.from.content)
           } catch (error) {
             this.loading = false
             throw error
           }
           this.loading = false
           if (val) {
-            const data = {}
-            data.id = this.reportId
-            data.reportName = this.from.reportName // 报告名称
-            data.releasePlanTime = this.from.releasePlanTime // 计划准出时间
-            data.releaseActualTime = this.from.releaseActualTime // 实际准出时间
+            const data = { ...this.from, 'id': this.reportId }
             if (this.from.releasePlanTime < this.from.releaseActualTime) {
               data.isDelay = 1// 准出是否延期 1 延期,0未延期
               if (this.from.delayReason) {
@@ -346,10 +357,6 @@ export default {
             } else {
               return false
             }
-            data.passStatus = this.from.passStatus // 测试结果
-            data.bizId = this.from.bizId // 业务线
-            data.moduleId = this.from.moduleId // 模块id
-            data.content = this.fromData.content // 富文本
             data.developer = this.from.developer ? this.from.developer.toString() : null // 开发人员
             data.tester = this.from.tester ? this.from.tester.toString() : null // 测试人员
             reportreleaseUpdate(data).then(res => {
@@ -359,10 +366,8 @@ export default {
               }
             })
           } else {
-            const data = {}
-            data.reportName = this.from.reportName // 报告名称
-            data.releasePlanTime = this.from.releasePlanTime // 计划准出时间
-            data.releaseActualTime = this.from.releaseActualTime // 实际准出时间
+            const data = { ...this.from, 'bizId': this.bizId, 'moduleId': this.tpsltId }
+            delete data.id
             if (this.from.releasePlanTime < this.from.releaseActualTime) {
               data.isDelay = 1// 准出是否延期 1 延期,0未延期
               if (this.from.delayReason) {
@@ -395,12 +400,9 @@ export default {
             } else {
               return false
             }
-            data.passStatus = this.from.passStatus // 测试结果
-            data.bizId = this.bizId // 业务线
-            data.moduleId = this.fromData.id // 模块id
-            data.content = this.fromData.content // 富文本
             data.developer = this.from.developer ? this.from.developer.toString() : null // 开发人员
             data.tester = this.from.tester ? this.from.tester.toString() : null // 测试人员
+            console.log(data, this.from, '报告')
             reportreleaseCreate(data).then(res => {
               if (res.code === 200) {
                 this.$emit('SaveNextStep', res.data)
@@ -412,40 +414,46 @@ export default {
       })
     },
 
+    formData({ customs, keys, params }) { // 编辑自定义字段获取content
+      const newFrom = { ...this.from, customFields: customs }
+      newFrom.customFields.forEach(elm => {
+        if (keys.indexOf(elm.conditions) > -1) {
+          elm.content = ''
+          elm.contents = []
+        }
+      })
+      keys.forEach(key => {
+        delete newFrom[key]
+      })
+      this.from = { ...newFrom, ...params }
+      console.log(customs, params, 'customs')
+    },
+
+    customDialong() { // 点击自定义字段
+      this.$emit('setCustom', this.customList || [], this.from)
+    },
+
     // 新建模版
     getCreateData(e) {
       this.$refs.fromCreateData.validate(async(valid) => {
         if (valid) {
-          const data = {}
-          data.bizId = this.bizId
+          const data = { 'bizId': this.bizId, 'moduleName': this.from.moduleName, 'type': 4, 'customFields': this.customList, 'id': e === '新建模版' ? '' : this.modelID }
           this.loading = true
           try {
-            data.content = await getContainImgHTMLNode(this.fromData.content)
+            data.content = await getContainImgHTMLNode(this.from.content)
           } catch (error) {
             this.loading = false
             throw error
           }
           this.loading = false
-          data.moduleName = this.from.moduleName
-          data.type = 4 // 准出报告 4
-          if (e === '新建模版') {
-            settingAddReportModule(data).then(res => {
-              if (res.code === 200) {
-                this.$message({ type: 'success', message: '创建成功' })
-                this.$emit('getreportTemplate')
-                this.$emit('reportReturn')
-              }
-            })
-          } else {
-            data.id = this.modelID
-            settingUpdateReportModule(data).then(res => {
-              if (res.code === 200) {
-                this.$message({ type: 'success', message: '更新成功' })
-                this.$emit('getreportTemplate')
-                this.$emit('reportReturn')
-              }
-            })
-          }
+          const apis = e.name === '新建模版' ? settingAddReportModule : settingUpdateReportModule
+          apis(data).then(res => {
+            if (res.code === 200) {
+              this.$message({ type: 'success', message: `${e.name}成功` })
+              this.$emit('getreportTemplate')
+              this.$emit('reportReturn')
+            }
+          })
         }
       })
     }

+ 27 - 19
src/views/reportManagement/ReleaseReport/releaePreview.vue

@@ -24,49 +24,50 @@
 
       <el-row>
         <el-col :span="24">
-          <span class="from-names">测试结果:</span>
-          <span :class="{'from-value': fromCreateData.passStatus === 0, 'from-value1': fromCreateData.passStatus === 1}"> {{ fromCreateData.passStatus === 0 ? '通过' : '不通过' }}</span>
+          <span class="parent-style">测试结果:
+            <span :class="{'from-value': fromCreateData.passStatus === 0, 'from-value1': fromCreateData.passStatus === 1}"> {{ fromCreateData.passStatus === 0 ? '通过' : '不通过' }}</span>
+          </span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">计划准出时间:{{ fromCreateData.releasePlanTime }}</span>
+          <span class="parent-style">计划准出时间:<span class="spanColor">{{ fromCreateData.releasePlanTime }}</span></span>
         </el-col>
         <el-col :span="12">
-          <span class="parent-style">实际准出时间:{{ fromCreateData.releaseActualTime }}</span>
+          <span class="parent-style">实际准出时间:<span class="spanColor">{{ fromCreateData.releaseActualTime }}</span></span>
         </el-col>
       </el-row>
 
       <el-row v-if="fromCreateData.releasePlanTime < fromCreateData.releaseActualTime">
         <el-col :span="24" class="Layout_space_between">
-          <span class="parent-style">准出延期原因 : {{ fromCreateData.delayReason }}</span>
+          <span class="parent-style">准出延期原因 : <span class="spanColor">{{ fromCreateData.delayReason }}</span></span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">计划开发周期:{{ fromCreateData.devPlanTimeStart }} 至 {{ fromCreateData.devPlanTimeEnd }}</span>
+          <span class="parent-style">计划开发周期:<span class="spanColor">{{ fromCreateData.devPlanTimeStart }} 至 {{ fromCreateData.devPlanTimeEnd }}</span></span>
         </el-col>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">实际开发周期:{{ fromCreateData.devActualTimeStart }} 至 {{ fromCreateData.devActualTimeEnd }}</span>
+          <span class="parent-style">实际开发周期:<span class="spanColor">{{ fromCreateData.devActualTimeStart }} 至 {{ fromCreateData.devActualTimeEnd }}</span></span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">计划测试周期:{{ fromCreateData.testPlanTimeStart }} 至 {{ fromCreateData.testPlanTimeEnd }}</span>
+          <span class="parent-style">计划测试周期:<span class="spanColor">{{ fromCreateData.testPlanTimeStart }} 至 {{ fromCreateData.testPlanTimeEnd }}</span></span>
         </el-col>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">实际测试周期:{{ fromCreateData.testActualTimeStart }} 至 {{ fromCreateData.testActualTimeEnd }}</span>
+          <span class="parent-style">实际测试周期:<span class="spanColor">{{ fromCreateData.testActualTimeStart }} 至 {{ fromCreateData.testActualTimeEnd }}</span></span>
         </el-col>
       </el-row>
 
-      <el-row class="Above">
+      <el-row>
         <el-col :span="12" class="Layout_space_between">
           <div class="parent-style">开发人员:
             <span v-for="(item, index) in fromCreateData.devObject" :key="index">
-              {{ item.name }}
+              <span class="spanColor">{{ item.name }}</span>
               <span v-if="index < fromCreateData.devObject.length - 1">,</span>
             </span>
           </div>
@@ -74,12 +75,15 @@
         <el-col :span="12" class="Layout_space_start">
           <div class="parent-style">测试人员:
             <span v-for="(item, index) in fromCreateData.testerObject" :key="index">
-              {{ item.name }}
+              <span class="spanColor">{{ item.name }}</span>
               <span v-if="index < fromCreateData.testerObject.length - 1">,</span>
             </span>
           </div>
         </el-col>
       </el-row>
+
+      <module-code :data="fromCreateData" />
+
       <div v-html="fromCreateData.content" />
       <div class="backStyle">缺陷统计</div>
       <iconDisplay :task-ids="fromCreateData.taskIds" />
@@ -91,13 +95,15 @@
 import html2canvas from 'html2canvas'
 import searchTeam from '@/components/select/searchTeam'
 import iconDisplay from '@/views/reportManagement/ReleaseReport/components/iconDisplay.vue'
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 import { reportreleaseGetReportById, reportreleaseSendmail } from '@/api/reportTemplate' // 模版添删改查
 
 export default {
   name: 'DailyNewsAdded',
   components: {
     searchTeam,
-    iconDisplay
+    iconDisplay,
+    moduleCode
   },
   props: {
     dailyId: { type: [String, Number], default: null }
@@ -128,11 +134,10 @@ export default {
       const res = await reportreleaseGetReportById(val)
       if (res.code === 200) {
         this.fromCreateData = res.data
-        if (res.data.sendTo) {
-          this.$set(this.form, 'name', [res.data.sendTo])
-        }
-        if (res.data.sendCc) {
-          this.$set(this.form, 'names', [res.data.sendCc])
+        this.from = {
+          ...this.from,
+          'name': res.data.sendTo ? [res.data.sendTo] : '',
+          'names': res.data.sendCc ? [res.data.sendCc] : ''
         }
       }
     },
@@ -167,9 +172,12 @@ export default {
   font-family: Microsoft Sans Serif;
   font-weight: 400;
   line-height: 22px;
-  margin: 10px 0;
+  margin: 0 0 10px;
   color: #666666;
   opacity: 1;
+  .spanColor {
+    color: #333333;
+  }
   .from-value {
     margin-left: 30px;
     color: rgba(126, 211, 33, 1);

+ 18 - 10
src/views/reportManagement/Testing/TestingPreview.vue

@@ -24,50 +24,53 @@
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">计划提测时间:{{ fromCreateData.deliverTestPlanTime }}</span>
+          <span class="parent-style">计划提测时间:<span class="spanColor">{{ fromCreateData.deliverTestPlanTime }}</span></span>
         </el-col>
         <el-col :span="12">
-          <span class="parent-style">实际提测时间:{{ fromCreateData.deliverTestActualTime }}</span>
+          <span class="parent-style">实际提测时间:<span class="spanColor">{{ fromCreateData.deliverTestActualTime }}</span></span>
         </el-col>
       </el-row>
 
       <el-row v-if="fromCreateData.deliverTestPlanTime < fromCreateData.deliverTestActualTime ">
         <el-col :span="24" class="Layout_space_between">
-          <span class="parent-style">提测延期原因 : {{ fromCreateData.delayReason }}</span>
+          <span class="parent-style">提测延期原因 : <span class="spanColor">{{ fromCreateData.delayReason }}</span></span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">计划开发时间:{{ fromCreateData.devPlanTimeStart !== null ? fromCreateData.devPlanTimeStart + '至' + fromCreateData.devPlanTimeEnd : '' }}</span>
+          <span class="parent-style">计划开发时间:<span class="spanColor">{{ fromCreateData.devPlanTimeStart !== null ? fromCreateData.devPlanTimeStart + '至' + fromCreateData.devPlanTimeEnd : '' }}</span></span>
         </el-col>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">实际开发时间:{{ fromCreateData.devActualTimeStart !== null ? fromCreateData.devActualTimeStart + '至' + fromCreateData.devActualTimeEnd : '' }}</span>
+          <span class="parent-style">实际开发时间:<span class="spanColor">{{ fromCreateData.devActualTimeStart !== null ? fromCreateData.devActualTimeStart + '至' + fromCreateData.devActualTimeEnd : '' }}</span></span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">是否跟版:{{ fromCreateData.followVersion === 2 ? '否' : '是' }} </span>
+          <span class="parent-style">是否跟版:<span class="spanColor">{{ fromCreateData.followVersion === 2 ? '否' : '是' }} </span></span>
         </el-col>
         <el-col v-if="fromCreateData.followVersion === 1" :span="12" class="Layout_space_between">
-          <span class="parent-style">跟版客户端:{{ fromCreateData.involveAppString }}</span>
+          <span class="parent-style">跟版客户端:<span class="spanColor">{{ fromCreateData.involveAppString }}</span></span>
         </el-col>
       </el-row>
 
       <el-row>
         <el-col :span="12" class="Layout_space_between">
-          <span class="parent-style">CodeReview:{{ fromCreateData.isCodeReview === 0 ? '否' : '是' }}</span>
+          <span class="parent-style">CodeReview:<span class="spanColor">{{ fromCreateData.isCodeReview === 0 ? '否' : '是' }}</span></span>
         </el-col>
         <el-col v-if="fromCreateData.isCodeReview === 1" :span="12" class="Layout_space_between">
           <div class="parent-style">执行人:
             <span v-for="(item, index) in fromCreateData.codeReviewExecutorObject" :key="index">
-              {{ item.name }}
+              <span class="spanColor">{{ item.name }}</span>
               <span v-if="index < fromCreateData.codeReviewExecutorObject.length - 1">,</span>
             </span>
           </div>
         </el-col>
       </el-row>
+
+      <module-code :data="fromCreateData" />
+
       <div class="backStyle">需求列表</div>
 
       <el-table
@@ -102,12 +105,14 @@ import { EncryptId } from '@/utils/crypto-js.js'
 import { mapGetters } from 'vuex'
 import html2canvas from 'html2canvas'
 import searchTeam from '@/components/select/searchTeam'
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 import { reportdelivertestGetReportById, reportdelivertestSendmail, reportdelivertestGetRequiresByTaskIds } from '@/api/reportTemplate' // 模版添删改查
 
 export default {
   name: 'DailyNewsAdded',
   components: {
-    searchTeam
+    searchTeam,
+    moduleCode
   },
   props: {
     dailyId: { type: [String, Number], default: null }
@@ -197,6 +202,9 @@ export default {
     color:#666666;
     opacity:1;
     margin-bottom: 10px;
+    .spanColor {
+      color: #333333;
+    }
   .report-taskList{
     font-size:14px;
     font-family:MicrosoftYaHei;

+ 6 - 1
src/views/reportManagement/Testing/components/deliverDetails.vue

@@ -71,6 +71,9 @@
             </div>
           </el-col>
         </el-row>
+
+        <moduleCode :data="details" />
+
         <div class="title">需求列表</div>
 
         <el-table
@@ -187,10 +190,12 @@ import { mapGetters } from 'vuex'
 import { reportdelivertestGetReportById, reportreleaseDelete, reportdelivertestGetRequiresByTaskIds, reportdelivertestUpdate, reportdelivertestCheckStatus } from '@/api/reportTemplate'
 import TestingReport from '@/views/reportManagement/components/TestingReport' // 提测
 import drawerIndex from '@/views/reportManagement/drawerCheckList/drawerIndex' // 准出
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 export default {
   components: {
     TestingReport,
-    drawerIndex
+    drawerIndex,
+    moduleCode
   },
   data() {
     return {

+ 119 - 107
src/views/reportManagement/Testing/newTestingTemplate.vue

@@ -2,7 +2,6 @@
   <!-- 新建报告模版 -->
   <div class="report-container">
     <el-form ref="fromCreateData" :model="from">
-
       <div v-if="!releaseType" style=" margin-bottom: 10px;">
         <span style="color: #f56b6c">*</span>
         <span class="backStyle"> 关联任务</span><br>
@@ -28,7 +27,10 @@
       <el-form-item v-if="!releaseType" label="报告名称" prop="reportName" :rules="[{ required: true, message: '报告名称不能为空', trigger: 'change'}]"><br>
         <el-input v-model="from.reportName" size="small" type="text" maxlength="50" style="width:100%;" placeholder="请输入报告名称名称" />
       </el-form-item>
-      <div class="backStyle">{{ !releaseType? "报告内容" : '模版内容' }}</div>
+      <div class="backStyle">
+        {{ !releaseType? "报告内容" : '模版内容' }}
+        <el-button type="text" @click="customDialong">{{ !releaseType? "" : '自定义字段' }}</el-button>
+      </div>
 
       <el-row class="from-margin">
         <el-col :span="12" class="Layout_space_between">
@@ -71,7 +73,7 @@
         <el-col :span="12" class="Layout_flex_start">
           <span class="from-name">是否跟版: </span>
           <template>
-            <el-radio-group v-model="from.followVersion" :disabled="releaseType">
+            <el-radio-group v-model="from.followVersion" :disabled="releaseType" @change="setFrom({ 'followVersion': from.followVersion })">
               <el-radio :label="2">否</el-radio>
               <el-radio :label="1">是</el-radio>
             </el-radio-group>
@@ -89,7 +91,7 @@
         <el-col :span="12" class="Layout_flex_start">
           <span class="from-name"><span style="color: red;">*</span>CodeReview:</span>
           <template>
-            <el-radio-group v-model="from.isCodeReview" :disabled="releaseType">
+            <el-radio-group v-model="from.isCodeReview" :disabled="releaseType" @change="setFrom({ 'isCodeReview': from.isCodeReview })">
               <el-radio :label="0">否</el-radio>
               <el-radio :label="1">是</el-radio>
             </el-radio-group>
@@ -100,7 +102,13 @@
           <search-people :value.sync="from.codeReviewExecutor" :clearable="true" :multiple="true" :size="'small'" :disabled="releaseType" style="width: 100%;" />
         </el-col>
       </el-row>
+
+      <!-- 自定义反显组件 -->
+      <!-- <moduleCustom v-if="customList && customList[0]" ref="moduleCustom" :custom="customList" :disab="releaseType" @formData="formData" /> -->
+      <moduleCustom v-if="customList && customList[0]" ref="moduleCustom" :custom="customList" :base-from="from" :disab="releaseType" @formData="formData" />
+
     </el-form>
+
     <div class="backStyle">需求列表</div>
     <el-table
       :data="tableData"
@@ -124,8 +132,8 @@
     </el-table>
 
     <normal-area
-      id="report-template-2"
-      :value.sync="fromCreateData.content"
+      id="report-template-newtesting"
+      :value.sync="from.content"
       :height="500"
       :full-position-style="{ top:'20px',left:'15%', right: '15%' }"
     />
@@ -138,6 +146,7 @@ import { mapGetters } from 'vuex'
 import searchPeople from '@/components/select/searchPeople' // 人员select
 import normalArea from '@/components/input/normalArea' // 富文本
 import 'tinymce/plugins/table'// 插入表格插件
+import moduleCustom from '@/views/reportManagement/components/template/customTemplate.vue'
 import { taskList } from '@/api/taskIndex'
 import { configShowTaskEnum } from '@/api/taskIndex'
 import { settingAddReportModule, settingUpdateReportModule, settingGetReportModuleById, reportdelivertestInitReportRelease, reportdelivertestCreate, reportdelivertestGetRequiresByTaskIds, reportdelivertestUpdate, reportdelivertestGetReportById } from '@/api/reportTemplate' // 模版添删改查
@@ -146,23 +155,27 @@ import { getContainImgHTMLNode } from '@/utils/handleTinymce' // 富文本本图
 export default {
   components: {
     normalArea,
-    searchPeople
+    searchPeople,
+    moduleCustom
   },
   props: {
     taskIds: { type: Array, default: null },
+    custom: { type: Array, required: false, default: null },
     templateId: { type: [String, Number, Object], default: null } // 模版id
   },
   data() {
     return {
+      customList: this.custom,
       tableData: [],
       tpltId: '', // 模版id
       taskId: [], // 创建提测的任务
-      fromCreateData: {}, // from
       tasksOptions: [], // 关联任务
       tasksDetailList: [], // 关联任务
       selectTask: false,
       from: {
-        reportName: ''
+        reportName: '',
+        moduleName: '',
+        customFields: []
       },
       appClient: [], // 跟版客户端
       releaseType: true, // 新建模版还是新建提测报告
@@ -188,18 +201,17 @@ export default {
     },
     templateId: {
       handler(newV) {
-        if (newV === '新建模版') {
+        if (newV.name === '新建模版' || newV.name === '编辑模版') {
+          console.log(newV, '模版')
           this.releaseType = true
-          return false
-        }
-        if (newV.repot_up) {
-          this.releaseType = true
-          this.settingGetReportModuleById(newV.repot_up)
-          return false
+          this.from = { ...this.from, ...newV.from }
+          newV.name === '编辑模版' ? this.settingGetReportModuleById(newV.repot_up) : ''
+          return
         }
         this.releaseType = false
         if (newV.id) { // 编辑
           this.tpltId = newV.moduleId
+          this.from = { ...this.from, ...newV.from }
           this.reportdelivertestGetReportById(newV.id)
           return false
         }
@@ -219,16 +231,19 @@ export default {
       const res = await reportdelivertestGetReportById(val)
       if (res.code === 200) {
         const from = res.data
-        this.from.id = from.id
-        this.$set(this.from, 'reportName', from.reportName) // 报告名称
-        this.$set(this.from, 'delayReason', from.delayReason) // 延期原因
+        res.data.customFields ? this.customList = [...res.data.customFields] : ''
+        this.from = { ...this.from, 'id': from.id, 'reportName': from.reportName, 'delayReason': from.delayReason } // 报告名称\延期原因
         this.setFromData(from)
-        res.data.taskIds.map(item => {
+        from.taskIds.map(item => {
           this.remoteMethod_data(item)
         })
       }
     },
 
+    setFrom(e) {
+      this.$refs.moduleCustom.CustomSet(e)
+    },
+
     async reportdelivertestInitReportRelease(val) { // 报告时间
       const res = await reportdelivertestInitReportRelease({ taskIds: val })
       if (res.code === 200) {
@@ -243,7 +258,7 @@ export default {
     setFromData(from) {
       this.from.sendCc = from.sendCc
       this.from.sendTo = from.sendTo
-      this.$set(this.fromCreateData, 'content', from.content) // 报告名称
+      this.$set(this.from, 'content', from.content) // 报告名称
       from.deliverTestPlanTime ? this.$set(this.from, 'deliverTestPlanTime', from.deliverTestPlanTime) : '' // 计划提测时间
       if (from.devPlanTimeStart) {
         this.$set(this.from, 'devPlanTimeStart', [from.devPlanTimeStart, from.devPlanTimeEnd]) // 计划开发时间
@@ -268,8 +283,13 @@ export default {
     async settingGetReportModuleById(val) { // 获取自定义模版内容
       const res = await settingGetReportModuleById(val)
       if (res.code === 200) {
-        this.fromCreateData = res.data
-        this.$set(this.from, 'moduleName', res.data.moduleName)
+        !this.customList ? this.customList = [] : ''
+        if (res.data.customFields && this.customList.length < 1) {
+          this.customList = [...this.customList, ...res.data.customFields]
+        } else {
+          this.customList = [...this.customList]
+        }
+        this.from = { ...this.from, ...res.data }
       }
     },
     async remoteMethod_data(query) { // 远程搜索任务
@@ -315,29 +335,51 @@ export default {
       this.$router.push({ name: '需求详情', query: { bizId_id: bizId_id }})
     },
 
+    formData({ customs, keys, params }) { // 编辑自定义字段获取content
+      const newFrom = { ...this.from, customFields: customs }
+      newFrom.customFields.forEach(elm => {
+        if (keys.indexOf(elm.conditions) > -1) {
+          elm.content = ''
+          elm.contents = []
+        }
+      })
+      keys.forEach(key => {
+        delete newFrom[key]
+      })
+      this.from = { ...newFrom, ...params }
+    },
+    customDialong() { // 点击自定义字段
+      this.from = { ...this.from }
+      this.$emit('setCustom', this.customList, this.from)
+    },
+
     // 创建提测报告
     reportreleaseCreate(val) {
+      let show = '0'
+      this.from.customFields.map(item => {
+        if (item.bool && item.required && item.type < 4) {
+          item.type < 4 && item.content ? '' : show = item.fieldName
+        }
+        if (item.bool && item.required && item.type === 4) {
+          item.contents ? '' : show = item.fieldName
+        }
+      })
+      if (show !== '0') {
+        this.$message({ type: 'warning', message: `${show}不能为空` })
+        return
+      }
       this.$refs.fromCreateData.validate(async(valid) => {
         if (valid) {
           this.loading = true
           try {
-            this.fromCreateData.content = await getContainImgHTMLNode(this.fromCreateData.content)
+            this.from.content = await getContainImgHTMLNode(this.from.content)
           } catch (error) {
             this.loading = false
             throw error
           }
           this.loading = false
           if (val) {
-            const data = {}
-            data.id = this.from.id
-            data.reportName = this.from.reportName
-            data.content = this.fromCreateData.content
-            data.taskIds = this.taskId
-            data.bizId = this.bizId
-            data.moduleId = this.tpltId
-            data.delayReason = this.from.delayReason
-            data.deliverTestPlanTime = this.from.deliverTestPlanTime // 计划提测时间
-            data.deliverTestActualTime = this.from.deliverTestActualTime // 实际提测时间
+            const data = { ...this.from, taskIds: this.taskId, bizId: this.bizId, moduleId: this.tpltId }
             if (this.from.deliverTestPlanTime < this.from.deliverTestActualTime && !this.from.delayReason) {
               this.$message({ type: 'warning', message: '提测延期原因不能为空' })
               return false
@@ -352,9 +394,6 @@ export default {
               data.devActualTimeStart = this.from.devActualTimeStart[0] // 实际开发开始时间
               data.devActualTimeEnd = this.from.devActualTimeStart[1] // 实际开发结束时间
             }
-            data.involveAppIds = this.from.involveAppIds // 跟版客户端
-            data.followVersion = this.from.followVersion // 是否跟版1 跟版 2 不跟版
-            data.isCodeReview = this.from.isCodeReview // 是否code review 0:否 1:是
             data.codeReviewExecutor = this.from.codeReviewExecutor ? this.from.codeReviewExecutor.toString() : '' // 执行人
             reportdelivertestUpdate(data).then(res => {
               if (res.code === 200) {
@@ -363,15 +402,7 @@ export default {
               }
             })
           } else {
-            const data = {}
-            data.reportName = this.from.reportName
-            data.content = this.fromCreateData.content
-            data.taskIds = this.taskId
-            data.bizId = this.bizId
-            data.moduleId = this.tpltId
-            data.delayReason = this.from.delayReason
-            data.deliverTestPlanTime = this.from.deliverTestPlanTime // 计划提测时间
-            data.deliverTestActualTime = this.from.deliverTestActualTime // 实际提测时间
+            const data = { ...this.from, id: null, taskIds: this.taskId, bizId: this.bizId, moduleId: this.tpltId, customFields: this.from.customFields }
             if (this.from.deliverTestPlanTime < this.from.deliverTestActualTime && !this.from.delayReason) {
               this.$message({ type: 'warning', message: '提测延期原因不能为空' })
               return false
@@ -386,11 +417,6 @@ export default {
               data.devActualTimeStart = this.from.devActualTimeStart[0] // 实际开发开始时间
               data.devActualTimeEnd = this.from.devActualTimeStart[1] // 实际开发结束时间
             }
-            data.involveAppIds = this.from.involveAppIds // 跟版客户端
-            data.followVersion = this.from.followVersion // 是否跟版1 跟版 2 不跟版
-            data.isCodeReview = this.from.isCodeReview // 是否code review 0:否 1:是
-            data.sendCc = this.from.sendCc
-            data.sendTo = this.from.sendTo
             data.codeReviewExecutor = this.from.codeReviewExecutor ? this.from.codeReviewExecutor.toString() : '' // 执行人
             reportdelivertestCreate(data).then(res => {
               if (res.code === 200) {
@@ -403,30 +429,19 @@ export default {
       })
     },
 
-    // 新建模版
+    // 新建\编辑模版
     getCreateData(e) {
       this.$refs.fromCreateData.validate((valid) => {
         if (valid) {
-          this.fromCreateData.bizId = this.bizId
-          this.fromCreateData.moduleName = this.from.moduleName
-          this.fromCreateData.type = 1
-          if (e === '新建模版') {
-            settingAddReportModule(this.fromCreateData).then(res => {
-              if (res.code === 200) {
-                this.$message({ type: 'success', message: '创建成功' })
-                this.$emit('getreportTemplate')
-                this.$emit('reportReturn')
-              }
-            })
-          } else {
-            settingUpdateReportModule(this.fromCreateData).then(res => {
-              if (res.code === 200) {
-                this.$message({ type: 'success', message: '更新成功' })
-                this.$emit('getreportTemplate')
-                this.$emit('reportReturn')
-              }
-            })
-          }
+          this.from = { ...this.from, bizId: this.bizId, type: 1, customFields: this.customList }
+          const apis = e.name === '新建模版' ? settingAddReportModule : settingUpdateReportModule
+          apis(this.from).then(res => {
+            if (res.code === 200) {
+              this.$message({ type: 'success', message: `${e.name}成功` })
+              this.$emit('getreportTemplate')
+              this.$emit('reportReturn')
+            }
+          })
         }
       })
     }
@@ -435,53 +450,50 @@ export default {
 </script>
 
 <style lang="less" scoped>
+  @import '@/styles/PublicStyle/index.less';
   .backStyle {
     font-size:14px;
-    font-family:MicrosoftYaHei;
     line-height:19px;
     margin: 1% 0;
     color: #333;
     font-weight:700;
   }
-
-.report-container {
-    display: inline-block;
-    font-size:14px;
-    width: 100%;
-    font-family:Microsoft Sans Serif;
-    font-weight:400;
-    line-height:22px;
-    color:#666666;
-    opacity:1;
-    /deep/ .el-form-item__label {
-    color: #333;
-}
-/deep/ .el-date-editor .el-range-separator {
+  .report-container {
+      display: inline-block;
+      font-size:14px;
+      width: 100%;
+      font-weight:400;
+      line-height:22px;
+      color:#666666;
+      opacity:1;
+      /deep/ .el-form-item__label {
+      color: #333;
+  }
+  /deep/ .el-date-editor .el-range-separator {
     padding: 0 5px;
     line-height: 26px;
     width: auto;
     color: #303133;
+  }
+  .from-name {
+    width: 150px !important;
+  }
+  .from-namea {
+    width: 119px !important;
+  }
+  .from-namer {
+    width: 150px !important;
+    margin-left:10px;
+  }
+  .from-namev {
+    margin-left:10px;
+    vertical-align: sub;
+  }
 }
-    .from-name {
-      width: 150px !important;
-    }
-    .from-namea {
-      width: 119px !important;
-    }
-    .from-namer {
-      width: 150px !important;
-      margin-left:10px;
-    }
-    .from-namev {
-      margin-left:10px;
-      vertical-align: sub;
-    }
-}
-.sodu {
-  color:#C0C4CC;
-  margin-left: 20px;
-}
-
+  .sodu {
+    color:#C0C4CC;
+    margin-left: 20px;
+  }
   .from-margin {
     margin-bottom:20px;
   }

+ 181 - 0
src/views/reportManagement/components/Custom/index.vue

@@ -0,0 +1,181 @@
+<template>
+  <!-- <ele-dialog :show-dialog="showCustom" :title="'自定义字段'" :width="'70%'" :submit-button="'确认'" :top="'5vh'" @confirm="confirmUpload()" @cancel="$emit('close')"> -->
+  <div>
+    <div v-for="(item, index) in addCustomContent" :key="index" class="reportManage-custom">
+      <el-row :gutter="20">
+        <el-col :span="12" class="Layout_flex_start">
+          <div class="custom-index" style="margin-right: 10px;">{{ index + 1 }}、</div>
+          <el-input v-model="item.fieldName" type="text" placeholder="请输入字段名称" maxlength="10" show-word-limit />
+        </el-col>
+        <el-col :span="4">
+          <el-select v-model="item.required" style="width: 100%;" placeholder="是否必填">
+            <el-option v-for="i in isRequiredOptions" :key="i.value" :label="i.label" :value="i.value" />
+          </el-select>
+        </el-col>
+        <el-col :span="8">
+          <el-select v-model="item.conditions" style="width: 90%; margin-right: 10px;" placeholder="选择展示条件">
+            <el-option-group label="默认">
+              <el-option v-for="i in options" :key="i.value" :label="i.label" :value="i.value" />
+            </el-option-group>
+            <el-option-group label="按条件展示">
+              <div v-for="(t, i) in addCustomContent" :key="i">
+                <div v-if="i < index && t.fieldName && t.options && t.options.length > 0">
+                  <el-option v-for="g in t.options" :key="g" :label="`${t.fieldName}-${g}`" :value="`${t.fieldKey}_${g}`" />
+                </div>
+              </div>
+            </el-option-group>
+          </el-select>
+          <span class="el-icon-minus icon-design" @click="deleted(item)" />
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12" class="Layout_flex_start">
+          <span style="margin-left: 50px; min-width: 100px;">字段类型</span>
+          <el-select v-model="item.type" placeholder="字段类型" style="width: 100%;">
+            <el-option v-for="i in FieldType" :key="i.value" :label="i.label" :value="i.value" />
+          </el-select>
+        </el-col>
+        <el-col v-show="item.type === 3 || item.type === 4" :span="12">
+          <el-input v-model="item.Select" type="text" clearable style="width: 50%; margin-right: 10px;" placeholder="添加选择项" show-word-limit />
+          <span class="icon-message" style="margin-right: 10px;" @click="setTags(item.Select, index)">添加</span>
+        </el-col>
+      </el-row>
+      <el-row v-show="item.type === 3 || item.type === 4" :gutter="20">
+        <el-col :span="22" class="Layout_flex_start" style="margin-left: 50px; align-items: baseline;">
+          <span style="min-width: 100px;">选择项</span>
+          <span>
+            <el-tag v-for="(tag, k) in item.options" :key="k" closable style="margin: 0 10px 10px 0;" type="info" @close="handleClose(tag, index)">{{ tag }}</el-tag>
+          </span>
+        </el-col>
+      </el-row>
+    </div>
+    <span style="color: #1890ff; cursor: pointer;" @click="setAddCustomContent">
+      <i class="el-icon-plus" style="border: 1px solid #1890ff; font-size: 12px; text-align: center;" /> 新增字段
+    </span>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    custom: { type: Array, default: null },
+    reporttype: { type: String, required: false, default: null }
+  },
+  data() {
+    return {
+      addCustomContent: this.custom || [],
+      fieldForm: {
+        fieldKey: '',
+        fieldName: '',
+        required: false,
+        conditions: '默认展示',
+        type: 1,
+        Select: '',
+        options: []
+      },
+      FieldType: [
+        { value: 1, label: '单行文本框' },
+        { value: 2, label: '多行文本框' },
+        { value: 3, label: '单选' },
+        { value: 4, label: '多选' }
+      ],
+      isRequiredOptions: [
+        { value: false, label: '非必填' },
+        { value: true, label: '必填' }
+      ],
+      options: [
+        { value: '默认展示', label: '默认展示' }
+      ],
+      types: [
+        { value: '是否跟版_1', label: '是否跟版 - 是' },
+        { value: '是否跟版_2', label: '是否跟版 - 否' },
+        { value: '是否codereview_1', label: '是否codereview - 是' },
+        { value: '是否codereview_0', label: '是否codereview - 否' }
+      ]
+    }
+  },
+  watch: {
+    reporttype: {
+      handler(newV) {
+        if (newV) {
+          this.options = [...this.options, ...this.types]
+        }
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    setAddCustomContent(e) {
+      const timestamp = Date.parse(new Date())
+      const num = Math.floor(Math.random() * 1000)
+      this.addCustomContent = [...this.addCustomContent, { ...this.fieldForm, fieldKey: timestamp + '-' + num }]
+    },
+
+    deleted(ele) {
+      this.addCustomContent = this.addCustomContent.filter(item => {
+        ele.options.map(i => {
+          item.conditions === `${ele.fieldName}-${i}` ? item.conditions = '' : ''
+        })
+        return item.fieldKey !== ele.fieldKey
+      })
+    },
+
+    setTags(text, index) {
+      if (text) {
+        const list = new Set([...this.addCustomContent[index].options || [], text])
+        this.addCustomContent[index].options = [...list]
+        this.addCustomContent[index].Select = null
+      }
+    },
+
+    handleClose(text, index) {
+      const options = this.addCustomContent[index].options.filter(item => item !== text)
+      this.addCustomContent[index].options = options
+    },
+
+    confirmUpload() {
+      let bool = 0
+      this.addCustomContent.map(item => {
+        !item.fieldName ? bool = 1 : ''
+        item.type === 3 && item.options.length < 1 || item.type === 4 && item.options.length < 1 ? bool = 2 : ''
+      })
+      if (bool === 1) {
+        this.$message({ message: '字段名称不能为空', type: 'warning' })
+        return
+      } else if (bool === 2) {
+        this.$message({ message: '选择项不能为空', type: 'warning' })
+        return
+      }
+      this.$emit('content', this.addCustomContent)
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+@import '@/styles/PublicStyle/index.less';
+.reportManage-custom {
+  .el-row {
+    margin-bottom: 20px;
+  }
+  .custom-index {
+    width: 40px;
+    // height: 18px;
+    // background: #1890ff;
+    // border-radius: 50%;
+    color: #000;
+    // display: flex;
+    // align-items: center;
+    // padding: 0 5px;
+  }
+  .icon-design {
+    border: 1px solid #1890ff;
+    font-size: 14px;
+    color: #1890ff;
+  }
+  .icon-message {
+    color: #1890ff;
+    cursor: pointer;
+  }
+}
+</style>

+ 102 - 121
src/views/reportManagement/components/DailyReport.vue

@@ -1,82 +1,58 @@
 <template>
-  <!-- <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task report-dialog" :title="reportHome ? '测试日报' : `${tipName}测试日报模版`" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose"> -->
-  <modal :visible="dialogDaliy" :title="reportHome ? '测试日报' : `${tipName}测试日报模版`" :showline="reportHome" @close="handleClose">
-    <!-- <div class="box"> -->
-    <div v-if="reportHome" class="blueStripe" />
-    <i v-if="!reportHome" class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
+  <modal :visible="dialogDaliy" :title="reportHome" :showline="reportHome === '创建测试日报模版' || reportHome === '编辑测试日报模版'?false:true" @close="handleClose">
+    <div v-if="reportHome === '测试日报' || reportHome === '模版管理' || reportHome === '自定义字段'" class="blueStripe" />
+    <i v-else class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
 
-    <el-steps v-if="reportHome" :active="active" align-center finish-status="success" class="report-steps">
+    <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>
 
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
+
     <div class="report-leftRight">
-      <div v-if="showOne" style="min-height: 34vh;">
-        <el-row type="flex" justify="center">
-          <el-col :span="19" class="creator">模版名称</el-col>
-          <el-col :span="5" class="creator" style="margin-right: 17px;"> 创建人 </el-col>
-        </el-row>
-
-        <div ref="refName" style="margin: 20px 0;">
-          <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" style="padding-right: 15px;">
-            <el-col :span="19">
-              <el-radio v-model="fromData.radio" class="creatorList" :label="item.id">{{ item.moduleName }}</el-radio>
-            </el-col>
-            <el-col :span="5" class="creatorList">
-              <div class="Layout_space_between">
-                <span>{{ item.creatorObject.name }}</span>
-                <span v-if="item.creator !== 'SYSTEM' && item.creator !== '系统'" class="operation">
-                  <i class="el-icon-edit-outline didi-hover" @click="open_new_template(item)" />
-                  <el-popover :ref="item.id" placement="bottom" width="300" :visible-arrow="false" trigger="click">
-                    <div><div class="blur-column" /> 删除模版</div>
-                    <div class="blueStripe" />
-                    <div class="deletreport">是否要删除模版{{ item.moduleName }}?</div>
-                    <div style="text-align: right; margin: 0">
-                      <el-button size="mini" type="danger" @click="settingDeleteReportModule(item)">确定</el-button>
-                      <el-button size="mini" @click="closeDefaultPopover()">取消</el-button>
-                    </div>
-                    <i slot="reference" class="el-icon-delete reportModel didi-hover" />
-                  </el-popover>
-                </span>
-              </div>
-            </el-col>
-          </el-row>
-        </div>
-        <el-row type="flex" justify="center">
-          <el-col :span="24">
-            <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creatorList didi-hover" /> <span style="margin-left: 8px; color: #333;">新建模版</span></span>
-          </el-col>
-        </el-row>
-      </div>
+      <!-- 自定义字段组件 -->
+      <custom v-if="reportHome === '自定义字段'" ref="custom" :custom="customList" @content="getCustom" @close="closeCustom" />
 
       <!-- new模版 -->
-      <newReportTemplate v-if="reportTamplate" ref="newReportTemplate" class="daily" :template-id="templateId" @getreportTemplate="getreportTemplate" @reportReturn="reportReturn" />
-      <!-- new模版 -->
-
-      <!-- 新建日报模版 -->
+      <newReportTemplate
+        v-if="reportHome === '创建测试日报模版' || reportHome === '编辑测试日报模版'"
+        ref="newReportTemplate"
+        class="daily"
+        :custom="customList"
+        :template-id="templateId"
+        @getreportTemplate="getreportTemplate"
+        @reportReturn="reportReturn"
+        @setCustom="setCustom"
+      />
+
+      <!-- 日报报告 -->
       <dailyTemplate v-if="newDailyTemplate" ref="dailyTemplate" class="daily" :model-id="fromData.radio" :task-ids="daily_taskIds" @SaveNextStep="SaveNextStep" />
-      <!-- 新建日报模版 -->
 
       <!-- 日报预览 -->
       <dailyPreview v-if="dailyPreview" ref="dailyPreview" class="daily" :daily-id="dailyId" @handleClose="handleClose" @loading="loading = false" />
-      <!-- 日报预览 -->
 
     </div>
-    <div slot="footer" class="dialog-footer" align="center">
+    <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
+      <div v-if="reportHome === `自定义字段`">
+        <el-button size="small" @click="closeCustom">取消</el-button>
+        <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
+      </div>
+      <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
       <!-- 新建模版 -->
-      <el-button v-if="reportTamplate" size="small" type="primary" @click="created_out()">保存</el-button>
+      <el-button v-if="reportTamplate && reportHome === '创建测试日报模版' || reportHome === '编辑测试日报模版'" size="small" type="primary" @click="created_out()">保存</el-button>
+      <div v-if="reportHome === '测试日报'">
       <!-- 第一步 -->
       <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
       <!-- 第二步 -->
-      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="reportReturn">上一步</el-button>
+      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="report_Return">上一步</el-button>
       <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
       <!-- 第三步 -->
       <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
       <el-button v-if="dailyPreview" size="small" type="primary" :loading="loading" @click="sendReport">发送</el-button>
-    </div>
-    <!-- </div> -->
-    <!-- <div class="bg" /> -->
+   </div>
+   </div>
   </modal>
 </template>
 
@@ -86,17 +62,23 @@ import { settingQueryReportModuleList, settingDeleteReportModule, dailyReportGet
 import dailyTemplate from '@/views/reportManagement/daily/dailyTemplate.vue'
 import newReportTemplate from '@/views/reportManagement/daily/newReportTemplate.vue'
 import dailyPreview from '@/views/reportManagement/daily/dailyPreview.vue'
+import custom from '@/views/reportManagement/components/Custom'
 import modal from '@/components/modal'
+import modules from './template/index.vue'
 export default {
   components: {
     dailyTemplate,
     newReportTemplate,
     dailyPreview,
-    modal
+    modal,
+    modules,
+    custom
   },
   data() {
     return {
-      reportHome: true, // 报告主页
+      customList: [],
+      temporary: {},
+      reportHome: '测试日报', // 报告主页
       templateId: '', // 模版id
       modelId: '', // 下一步选择的模版id
       selectTemplate: [], // 模版option
@@ -104,6 +86,7 @@ export default {
         radio: 0
       },
       loading: false,
+      tits: '',
       newDailyTemplate: false, // 新建日报模版
       reportTamplate: false, // new模版
       dailyPreview: false, // 日报预览
@@ -112,7 +95,6 @@ export default {
       dialogDaliy: false,
       showOne: true,
       active: 1,
-      tipName: '创建',
       daily_taskIds: [] // 选择的任务ID
     }
   },
@@ -148,7 +130,7 @@ export default {
             if (res.code === 200) {
               this.daily_taskIds = res.data.taskIds // 关联任务
               this.fromData.radio = res.data // 选择的模块
-              this.reportHome = true // 步骤条
+              this.reportHome = '测试日报' // 步骤条
               this.active = 2 // 步骤条状态第三步
               this.showOne = false // 隐藏第一步
               this.newDailyTemplate = true // 隐藏第二步
@@ -160,7 +142,7 @@ export default {
           break
         case 3: // 发送报告
           this.dailyId = newData.id
-          this.reportHome = true // 步骤条
+          this.reportHome = '测试日报' // 步骤条
           this.active = 3 // 步骤条状态第三步
           this.showOne = false // 隐藏第一步
           this.newDailyTemplate = false // 隐藏第二步
@@ -173,7 +155,7 @@ export default {
               this.daily_taskIds = res.data.taskIds // 关联任务
               data.updateDaily = false
               this.fromData.radio = data // 选择的模块
-              this.reportHome = true // 步骤条
+              this.reportHome = '测试日报' // 步骤条
               this.active = 2 // 步骤条状态第2步
               this.showOne = false // 隐藏第一步
               this.newDailyTemplate = true // 第二步
@@ -184,44 +166,84 @@ export default {
           break
         case 7: // 新建
           this.daily_taskIds = newData
-          this.reportHome = true // 步骤条
+          this.reportHome = '测试日报' // 步骤条
           this.active = 1 // 步骤条状态第三步
           this.showOne = true // 展示第一步
           this.newDailyTemplate = false // 隐藏第二步
           this.dailyPreview = false // 隐藏第三部
           break
+        case 'module': // 模版管理
+          this.getreportTemplate()
+          this.reportHome = '模版管理'
+          this.showOne = true
+          this.reportTamplate = false
       }
     },
 
+    closeCustom() { // 自定义取消
+      this.reportHome = this.temporary.name
+    },
+
+    getCustom(arr) { // 自定义确认
+      console.log(arr, this.temporary.name, '结果')
+      // this.templateId = { ...this.temporary.from }
+      this.customList = [...arr]
+      this.reportHome = this.temporary.name
+    },
+
+    setCustom(modules, from) {
+      this.temporary = { 'name': this.reportHome, 'from': from }
+      this.customList = [...modules]
+      this.reportHome = '自定义字段'
+    },
+
     report_update() { // 编辑模版
       this.$refs.DailyReport.getQueryData(3)
     },
 
     created_out() { // 新建模版
+      // if (this.tits === '模版管理') {
+      //   this.reportHome = '模版管理'
+      //   this.getreportTemplate()
+      //   this.showOne = true
+      // }
       this.$refs.newReportTemplate.getCreateData(3)
     },
 
+    report_Return() {
+      this.fromData.radio = this.selectTemplate[0].id
+      this.reportHome = '测试日报' // 步骤条
+      this.showOne = true // 模版选择
+      this.reportTamplate = false // 编辑区域
+      this.newDailyTemplate = false // 隐藏第二步
+      this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
+    },
+
     reportReturn() { // 新建模版点击返回
       this.fromData.radio = this.selectTemplate[0].id
-      this.reportHome = true // 步骤条
+      this.reportHome = this.tits // 步骤条
       this.showOne = true // 模版选择
       this.reportTamplate = false // 编辑区域
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
     },
 
-    open_new_template(val) { // 点击新建模版
+    open_new_template(val, show) { // 点击新建模版
       val ? this.templateId = val.id : this.templateId = null
+      this.tits = this.reportHome
       if (this.templateId === null) {
-        this.tipName = '创建'
         this.reportTamplate = true // 编辑区域
-        this.reportHome = false // 步骤条
+        this.reportHome = '创建测试日报模版' // 步骤条
         this.showOne = false // 模版选择
+        this.customList = []
       } else {
-        if (val.creator === localStorage.getItem('username')) {
-          this.tipName = '编辑'
+        if (val.creator === localStorage.getItem('username') || show) {
           this.reportTamplate = true // 编辑区域
-          this.reportHome = false // 步骤条
+          this.reportHome = '编辑测试日报模版' // 步骤条
           this.showOne = false // 模版选择
         } else {
           this.$message({ message: '没有权限,请联系创建人执行操作!', type: 'warning', duration: 1000, offset: 150 })
@@ -229,8 +251,8 @@ export default {
       }
     },
 
-    async settingDeleteReportModule(item) {
-      if (item.creator === localStorage.getItem('username')) {
+    async settingDeleteReportModule(item, show) {
+      if (item.creator === localStorage.getItem('username') || show) {
         const res = await settingDeleteReportModule({ id: item.id }, item.id)
         if (res.code === 200) {
           this.getreportTemplate()
@@ -242,6 +264,10 @@ export default {
       }
     },
 
+    getFromData(e) {
+      this.fromData.radio = e
+    },
+
     closeDefaultPopover() { // 模拟点击
       this.$refs.refName.click()
     },
@@ -251,7 +277,8 @@ export default {
     },
 
     NextStep() { // 第一步到第二步
-      this.reportHome = true // 步骤条
+      this.reportHome = '测试日报' // 步骤条
+      this.tits = this.reportHome
       this.active = 2 // 步骤条状态第二步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 展示第二步
@@ -260,7 +287,7 @@ export default {
 
     SaveNextStep(ele, vel) { // 第二步到第三部
       this.dailyId = ele.id // 新建报告id
-      this.reportHome = true // 步骤条
+      this.reportHome = '测试日报' // 步骤条
       this.active = 3 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
@@ -273,7 +300,7 @@ export default {
         this.daily_taskIds = res.data.taskIds // 关联任务
         this.fromData.radio = res.data // 选择的模块
       }
-      this.reportHome = true // 步骤条
+      this.reportHome = '测试日报' // 步骤条
       this.active = 2 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 隐藏第二步
@@ -293,6 +320,7 @@ export default {
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 展示第三部
+      this.customList = []
       this.$emit('getList')
     }
   }
@@ -320,43 +348,10 @@ export default {
     padding: 0 !important;
 }
 
-.reportModel {
-    margin-left: 10px;
-}
-
 .operation {
     margin-left: 30px;
 }
 
-.creator {
-  display: inline-block;
-  font-size:16px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  line-height:22px;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.creatorList {
-  display: inline-block;
-  font-size:14px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  margin-bottom: 15px;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.deletreport {
-  font-size:14px;
-  text-align: center;
-  margin: 30px 0;
-  font-family:MicrosoftYaHei;
-  color:rgba(51,59,74,1);
-  opacity:1;
-}
-
 .report-dialog {
   /deep/.el-dialog__header {
     padding: 20px 20px 10px;
@@ -385,18 +380,4 @@ export default {
   color:rgba(51,51,51,1);
   opacity:1;
 }
-// .daily {
-  //  max-height: 460px;
-  //  overflow:scroll;
-  //  overflow-x: hidden
-// }
-
-.blur-column {
-  width:4px;
-  height:15px;
-  display:inline-block;
-  vertical-align: middle;
-  background:#409EFF;
-  border-radius:1px;
-}
 </style>

+ 109 - 133
src/views/reportManagement/components/ReleaseReport.vue

@@ -1,106 +1,93 @@
 <template>
-  <!-- <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task report-dialog" :title="reportHome ? '准出报告' : `${tipName}准出报告模版`" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose"> -->
-  <modal :visible="dialogDaliy" :title="reportHome ? '准出报告' : `${tipName}准出报告模版`" :showline="reportHome" @close="handleClose">
-    <div v-if="reportHome" class="blueStripe" />
-    <i v-if="!reportHome" class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
+  <modal :visible="dialogDaliy" :title="reportHome" :showline="reportHome === '创建准出报告模版' || reportHome === '编辑准出报告模版'?false:true" @close="handleClose">
+    <div v-if="reportHome === '准出报告' || reportHome === '模版管理' || reportHome === '自定义字段'" class="blueStripe" />
+    <i v-else class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
 
-    <el-steps v-if="reportHome" :active="active" align-center finish-status="success" class="report-steps">
+    <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 class="report-leftRight">
-      <div v-if="showOne" style="min-height: 34vh;">
-        <el-row type="flex" justify="center">
-          <el-col :span="19" class="creator">模版名称</el-col>
-          <el-col :span="5" class="creator">创建人</el-col>
-        </el-row>
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
 
-        <div ref="refName" style="margin: 15px 0;">
-          <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" @mouseover.native="item.operation = true" @mouseleave.native="item.operation = false">
-            <el-col :span="19">
-              <el-radio v-model="fromData.radio" class="creatorList" :label="item.id">{{ item.moduleName }}</el-radio>
-            </el-col>
-            <el-col :span="5" class="creatorList">
-              {{ item.creatorObject.name }}
-              <span v-if="item.creator !== 'SYSTEM' && item.creator !== '系统'" class="operation">
-                <i class="el-icon-edit-outline didi-hover" @click="open_new_template(item)" />
-                <el-popover :ref="item.id" placement="bottom" width="300" trigger="click">
-                  <div><div class="blur-column" /> 删除模版</div>
-                  <div class="blueStripe" />
-                  <div class="deletreport">是否要删除模版{{ item.moduleName }}?</div>
-                  <div style="text-align: right; margin: 0">
-                    <el-button size="mini" type="danger" @click="settingDeleteReportModule(item)">确定</el-button>
-                    <el-button size="mini" @click="closeDefaultPopover()">取消</el-button>
-                  </div>
-                  <i slot="reference" class="el-icon-delete reportModel didi-hover" />
-                </el-popover>
-              </span>
-            </el-col>
-          </el-row>
-        </div>
-        <el-row type="flex" justify="center">
-          <el-col :span="24">
-            <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creatorList didi-hover" /> <span style="margin-left: 8px">新建模版</span></span>
-          </el-col>
-        </el-row>
-      </div>
+    <div class="report-leftRight">
+       <!-- 自定义字段组件 -->
+      <custom v-if="reportHome === '自定义字段'" ref="custom" :custom="customList" @content="getCustom" @close="closeCustom" />
 
       <!-- new模版 -->
-      <newReleaeTemplate v-if="reportTamplate" ref="newReleaeTemplate" class="daily" :template-id="templateId" :task-ids="daily_taskIds" @getreportTemplate="getreportTemplate" @reportReturn="reportReturn" />
-      <!-- new模版 -->
+      <newReleaeTemplate
+        v-if="reportHome === '创建准出报告模版' || reportHome === '编辑准出报告模版'"
+        ref="newReleaeTemplate"
+        class="daily"
+        :custom="customList"
+        :template-id="templateId"
+        :task-ids="daily_taskIds"
+        @getreportTemplate="getreportTemplate"
+        @reportReturn="reportReturn"
+        @setCustom="setCustom"
+      />
 
-      <!-- 新建准出模版 -->
-      <newReleaeTemplate v-if="newDailyTemplate" ref="dailyTemplate" class="daily" :template-id="fromData.radio" :task-ids="daily_taskIds" @SaveNextStep="SaveNextStep" />
-      <!-- 新建准出模版 -->
+      <!-- 准出报告 -->
+      <newReleaeTemplate v-if="newDailyTemplate" ref="dailyTemplate" class="daily" :custom="customList" :template-id="fromData.radio" :task-ids="daily_taskIds" @SaveNextStep="SaveNextStep" />
 
       <!-- 准出预览 -->
       <releaePreview v-if="dailyPreview" ref="dailyPreview" class="daily" :daily-id="dailyId" @handleClose="handleClose" @loading="loading = false" />
-      <!-- 准出预览 -->
 
     </div>
-    <div slot="footer" class="dialog-footer" align="center">
+    <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
+      <div v-if="reportHome === `自定义字段`">
+        <el-button size="small" @click="closeCustom">取消</el-button>
+        <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
+      </div>
+      <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
       <!-- 新建模版 -->
-      <el-button v-if="reportTamplate" size="small" type="primary" @click="created_out()">保存</el-button>
-      <!-- 第一步 -->
-      <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
-      <!-- 第二步 -->
-      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="reportReturn">上一步</el-button>
-      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
-      <!-- 第三步 -->
-      <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
-      <el-button v-if="dailyPreview" size="small" type="primary" :loading="loading" @click="sendReport">发送</el-button>
+      <el-button v-if="reportHome === '创建准出报告模版' || reportHome === '编辑准出报告模版'" size="small" type="primary" @click="created_out()">保存</el-button>
+      <div v-if="reportHome === `准出报告`">
+        <!-- 第一步 -->
+        <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
+        <!-- 第二步 -->
+        <el-button v-if="newDailyTemplate" size="small" type="primary" @click="report_return">上一步</el-button>
+        <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
+        <!-- 第三步 -->
+        <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
+        <el-button v-if="dailyPreview" size="small" type="primary" :loading="loading" @click="sendReport">发送</el-button>
+      </div>
     </div>
-
   </modal>
 </template>
 
 <script>
 import { mapGetters } from 'vuex'
+import custom from '@/views/reportManagement/components/Custom'
 import { settingQueryReportModuleList, settingDeleteReportModule, reportreleaseGetReportById } from '@/api/reportTemplate'
 import newReleaeTemplate from '@/views/reportManagement/ReleaseReport/newReleaeTemplate.vue'
 import releaePreview from '@/views/reportManagement/ReleaseReport/releaePreview.vue'
 import modal from '@/components/modal'
+import modules from './template/index.vue'
 export default {
   components: {
     releaePreview,
     newReleaeTemplate,
-    modal
+    modal,
+    modules,
+    custom
   },
   data() {
     return {
+      customList: [],
+      temporary: {},
       templateStatus: false, // 模版状态
-      reportHome: true, // 报告主页
+      reportHome: '准出报告', // 报告主页
       templateId: '', // 模版id
       modelId: '', // 下一步选择的模版id
       selectTemplate: [],
-      tipName: '创建',
       loading: false,
       fromData: {
         radio: 0
       },
       preview: {},
+      tits: '',
       newDailyTemplate: false, // 新建日报模版
       reportTamplate: false, // new模版
       dailyPreview: false, // 日报预览
@@ -122,22 +109,23 @@ export default {
       const res = await settingQueryReportModuleList({ bizId: this.bizId, type: 4 })
       if (res.code === 200) {
         this.$nextTick(() => {
-          const data = res.data
-          this.selectTemplate = data.map(item => ({
-            ...item,
-            operation: false
-          }))
+          this.selectTemplate = res.data
           this.fromData.radio = this.selectTemplate[0].id
         })
       }
     },
+    getFromData(e) {
+      this.fromData.radio = e
+    },
     init(index, newData) {
       this.dialogDaliy = true
+      console.log(newData, 'fjids')
       switch (index) {
         case 2: // 编辑
+          this.customList = newData.customFields
           this.daily_taskIds = null // 关联任务
           this.fromData.radio = newData // 选择的模块
-          this.reportHome = true // 步骤条
+          this.reportHome = '准出报告' // 步骤条
           this.active = 2 // 步骤条状态第三步
           this.showOne = false // 隐藏第一步
           this.newDailyTemplate = true // 展示第二步
@@ -148,7 +136,7 @@ export default {
         case 3: // 发送报告
           this.getreportTemplate()
           this.dailyId = newData.id
-          this.reportHome = true // 步骤条
+          this.reportHome = '准出报告' // 步骤条
           this.active = 3 // 步骤条状态第三步
           this.showOne = false // 隐藏第一步
           this.newDailyTemplate = false // 隐藏第二步
@@ -157,7 +145,7 @@ export default {
         case 7: // 新建
           this.getreportTemplate()
           this.daily_taskIds = newData // taskList
-          this.reportHome = true // 步骤条
+          this.reportHome = '准出报告' // 步骤条
           this.active = 1 // 步骤条状态第一步
           this.showOne = true // 展示第一步
           this.newDailyTemplate = false // 隐藏第二步
@@ -167,40 +155,60 @@ export default {
         case 8: // 新建
           this.getreportTemplate()
           this.daily_taskIds = newData
-          this.reportHome = true // 步骤条
+          this.reportHome = '准出报告' // 步骤条
           this.active = 1 // 步骤条状态第三步
           this.showOne = true // 展示第一步
           this.newDailyTemplate = false // 隐藏第二步
           this.dailyPreview = false // 隐藏第三部
           break
+        case 'module': // 模版管理
+          this.getreportTemplate()
+          this.reportHome = '模版管理'
+          this.showOne = true
+          this.reportTamplate = false
       }
     },
 
     created_out() { // 新建模版
+      // if (this.tits === '模版管理') {
+      //   this.getreportTemplate()
+      //   this.reportHome = '模版管理'
+      //   this.showOne = true
+      // }
       this.$refs.newReleaeTemplate.getCreateData(this.templateId)
     },
 
+    report_return() {
+      this.reportHome = '准出报告' // 步骤条
+      this.showOne = true // 模版选择
+      this.reportTamplate = false // 编辑区域
+      this.newDailyTemplate = false // 隐藏第二步
+      this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
+    },
+
     reportReturn() { // 新建模版点击返回
-      this.reportHome = true // 步骤条
+      this.reportHome = this.tits // 步骤条
       this.showOne = true // 模版选择
       this.reportTamplate = false // 编辑区域
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
     },
 
-    open_new_template(val) { // 点击新建模版
-      const set_up = val !== undefined ? { set_up: val.id } : ''
-      val !== undefined ? this.templateId = set_up : this.templateId = '新建模版'
-      if (this.templateId === '新建模版') {
-        this.tipName = '创建'
+    open_new_template(val, show) { // 点击新建模版
+      !val ? this.templateId = { 'name': '新建模版', from: this.customList.length !== 0 ? this.temporary.from : {}} : this.templateId = { 'name': '编辑模版', 'set_up': val.id }
+      this.tits = this.reportHome
+      if (this.templateId.name === '新建模版') {
         this.reportTamplate = true // 编辑区域
-        this.reportHome = false // 步骤条
+        this.reportHome = '创建准出报告模版' // 步骤条
         this.showOne = false // 模版选择
       } else {
-        if (val.creator === localStorage.getItem('username')) {
-          this.tipName = '编辑'
+        if (val.creator === localStorage.getItem('username') || show) {
           this.reportTamplate = true // 编辑区域
-          this.reportHome = false // 步骤条
+          this.reportHome = '编辑准出报告模版' // 步骤条
           this.showOne = false // 模版选择
         } else {
           this.$message({ message: '没有权限,请联系创建人执行操作!', type: 'warning', duration: 1000, offset: 150 })
@@ -208,12 +216,11 @@ export default {
       }
     },
 
-    async settingDeleteReportModule(item) {
-      if (item.creator === localStorage.getItem('username')) {
+    async settingDeleteReportModule(item, show) {
+      if (item.creator === localStorage.getItem('username') || show) {
         const res = await settingDeleteReportModule({ id: item.id }, item.id)
         if (res.code === 200) {
           this.getreportTemplate()
-          this.closeDefaultPopover()
           this.$message({ message: '已删除’', type: 'success', duration: 1000, offset: 150 })
         }
       } else {
@@ -221,8 +228,21 @@ export default {
       }
     },
 
-    closeDefaultPopover() { // 模拟点击
-      this.$refs.refName.click()
+    closeCustom() { // 自定义取消
+      this.reportHome = this.temporary.name
+    },
+
+    getCustom(arr) { // 自定义确认
+      console.log(arr, this.temporary.name, '结果')
+      this.templateId = { 'from': this.temporary.from, 'name': this.temporary.name === '创建准出报告模版' ? '新建模版' : '编辑模版' }
+      this.customList = [...arr]
+      this.reportHome = this.temporary.name
+    },
+
+    setCustom(modules, from) {
+      this.temporary = { 'name': this.reportHome, 'from': from }
+      this.customList = [...modules]
+      this.reportHome = '自定义字段'
     },
 
     getCreateData() { // 保存,下一步
@@ -230,7 +250,7 @@ export default {
     },
 
     NextStep() { // 第一步到第二步
-      this.reportHome = true // 步骤条
+      this.reportHome = '准出报告' // 步骤条
       this.active = 2 // 步骤条状态第二步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 展示第二步
@@ -239,7 +259,7 @@ export default {
 
     SaveNextStep(ele) { // 第二步到第三部
       this.dailyId = ele.id // 新建报告id
-      this.reportHome = true // 步骤条
+      this.reportHome = '准出报告' // 步骤条
       this.active = 3 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
@@ -251,9 +271,9 @@ export default {
       if (res.code === 200) {
         this.daily_taskIds = null// 关联任务
         this.fromData.radio = res.data // 选择的模块
+        this.customList = res.data.customFields
       }
-
-      this.reportHome = true // 步骤条
+      this.reportHome = '准出报告' // 步骤条
       this.active = 2 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 隐藏第二步
@@ -273,6 +293,7 @@ export default {
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 展示第三部
+      this.customList = []
       this.$emit('getList')
     }
   }
@@ -298,43 +319,6 @@ export default {
     padding: 0 !important;
 }
 
-.reportModel {
-    margin-left: 10px;
-}
-
-.operation {
-    margin-left: 30px;
-}
-
-.creator {
-  display: inline-block;
-  font-size:16px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  line-height:22px;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.creatorList {
-  display: inline-block;
-  font-size:14px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  line-height: 2.8;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.deletreport {
-  font-size:14px;
-  text-align: center;
-  margin: 30px 0;
-  font-family:MicrosoftYaHei;
-  color:rgba(51,59,74,1);
-  opacity:1;
-}
-
 .report-dialog {
   /deep/.el-dialog__header {
     padding: 20px 20px 10px;
@@ -363,12 +347,4 @@ export default {
   color:rgba(51,51,51,1);
   opacity:1;
 }
-.blur-column {
-  width:4px;
-  height:15px;
-  display:inline-block;
-  vertical-align: middle;
-  background:#409EFF;
-  border-radius:1px;
-}
 </style>

+ 111 - 146
src/views/reportManagement/components/TestingReport.vue

@@ -1,106 +1,91 @@
 <template>
-  <!-- <el-dialog :visible.sync="dialogDaliy" width="70vw" class="public_task report-dialog" :title="reportHome ? '提测报告' : `${tipName}提测报告模版`" :close-on-click-modal="false" :destroy-on-close="true" :before-close="handleClose"> -->
-  <modal :visible="dialogDaliy" :title="reportHome ? '提测报告' : `${tipName}提测报告模版`" :showline="reportHome" @close="handleClose">
-    <div v-if="reportHome" class="blueStripe" />
-    <i v-if="!reportHome" class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
+  <modal :visible="dialogDaliy" :title="reportHome" :showline="reportHome === `创建提测报告模版` || reportHome === '编辑提测报告模版'?false:true" @close="handleClose">
+    <div v-if="reportHome === '提测报告' || reportHome === '模版管理' || reportHome === '自定义字段'" class="blueStripe" />
+    <div v-else class="el-icon-arrow-left report-return didi-hover" @click="reportReturn" />
 
-    <el-steps v-if="reportHome" :active="active" align-center finish-status="success" class="report-steps">
+    <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 class="report-leftRight">
-      <div v-if="showOne" style="min-height: 34vh;">
-        <el-row type="flex" justify="center">
-          <el-col :span="19" class="creator">模版名称</el-col>
-          <el-col :span="5" class="creator">创建人</el-col>
-        </el-row>
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
 
-        <div ref="refName" style="margin: 15px 0;">
-          <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" @mouseover.native="item.operation = true" @mouseleave.native="item.operation = false">
-            <el-col :span="19">
-              <el-radio v-model="fromData.radio" class="creatorList" :label="item.id">{{ item.moduleName }}</el-radio>
-            </el-col>
-            <el-col :span="5" class="creatorList">
-              {{ item.creatorObject.name }}
-              <span v-if="item.creator !== 'SYSTEM' && item.creator !== '系统'" class="operation">
-                <i class="el-icon-edit-outline didi-hover" @click="open_new_template(item)" />
-                <el-popover :ref="item.id" placement="bottom" width="300" trigger="click">
-                  <div><div class="blur-column" /> 删除模版</div>
-                  <div class="blueStripe" />
-                  <div class="deletreport">是否要删除模版{{ item.moduleName }}?</div>
-                  <div style="text-align: right; margin: 0">
-                    <el-button size="mini" type="danger" @click="settingDeleteReportModule(item)">确定</el-button>
-                    <el-button size="mini" @click="closeDefaultPopover()">取消</el-button>
-                  </div>
-                  <i slot="reference" class="el-icon-delete reportModel didi-hover" />
-                </el-popover>
-              </span>
-            </el-col>
-          </el-row>
-        </div>
-        <el-row type="flex" justify="center">
-          <el-col :span="24">
-            <span class="didi-hover" @click="open_new_template()"><i class="el-icon-circle-plus-outline creatorList didi-hover" /> <span style="margin-left: 8px">新建模版</span></span>
-          </el-col>
-        </el-row>
-      </div>
+    <div class="report-leftRight">
+      <!-- 自定义字段组件 -->
+      <custom v-if="reportHome === '自定义字段'" ref="custom" :custom="customList" :reporttype="'提测报告'" @content="getCustom" @close="closeCustom" />
 
       <!-- new模版 -->
-      <newTestingTemplate v-if="reportTamplate" ref="newReportTemplate" class="daily" :template-id="templateId" @getreportTemplate="getreportTemplate" @reportReturn="reportReturn" />
-      <!-- new模版 -->
+      <newTestingTemplate
+        v-if="reportHome === `创建提测报告模版` || reportHome === `编辑提测报告模版`"
+        ref="newReportTemplate"
+        class="daily"
+        :custom="customList"
+        :template-id="templateId"
+        @getreportTemplate="getreportTemplate"
+        @reportReturn="reportReturn"
+        @setCustom="setCustom"
+      />
 
-      <!-- 新建日报模版 -->
+      <!-- 提测报告 -->
       <newTestingTemplate v-if="newDailyTemplate" ref="dailyTemplate" class="daily" :template-id="fromData.radio" :task-ids="daily_taskIds" @SaveNextStep="SaveNextStep" />
-      <!-- 新建日报模版 -->
 
-      <!-- 日报预览 -->
+      <!-- 提测预览 -->
       <TestingPreview v-if="dailyPreview" ref="dailyPreview" class="daily" :daily-id="dailyId" @handleClose="handleClose" @loading="loading = false" />
-      <!-- 日报预览 -->
 
     </div>
-    <div slot="footer" class="dialog-footer" align="center">
+    <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
+      <div v-if="reportHome === `自定义字段`">
+        <el-button size="small" @click="closeCustom">取消</el-button>
+        <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
+      </div>
+      <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
       <!-- 新建模版 -->
-      <el-button v-if="reportTamplate" size="small" type="primary" @click="created_out()">保存</el-button>
-      <!-- 第一步 -->
-      <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
-      <!-- 第二步 -->
-      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="reportReturn">上一步</el-button>
-      <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
-      <!-- 第三步 -->
-      <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
-      <el-button v-if="dailyPreview" size="small" type="primary" :loading="loading" @click="sendReport">发送</el-button>
+      <el-button v-if="reportHome === `创建提测报告模版` || reportHome === `编辑提测报告模版`" size="small" type="primary" @click="created_out()">保存</el-button>
+      <div v-if="reportHome === `提测报告`">
+        <!-- 第一步 -->
+        <el-button v-if="showOne" size="small" type="primary" @click="NextStep()">下一步</el-button>
+        <!-- 第二步 -->
+        <el-button v-if="newDailyTemplate" size="small" type="primary" @click="report_return">上一步</el-button>
+        <el-button v-if="newDailyTemplate" size="small" type="primary" @click="getCreateData">保存, 下一步</el-button>
+        <!-- 第三步 -->
+        <el-button v-if="dailyPreview" size="small" type="primary" @click="sendReportReturn">上一步</el-button>
+        <el-button v-if="dailyPreview" size="small" type="primary" :loading="loading" @click="sendReport">发送</el-button>
+      </div>
     </div>
-
   </modal>
 </template>
 
 <script>
 import { mapGetters } from 'vuex'
+import custom from '@/views/reportManagement/components/Custom'
 import { settingQueryReportModuleList, settingDeleteReportModule, reportdelivertestGetReportById } from '@/api/reportTemplate'
 import newTestingTemplate from '@/views/reportManagement/Testing/newTestingTemplate.vue'
 import TestingPreview from '@/views/reportManagement/Testing/TestingPreview.vue'
 import modal from '@/components/modal'
+import modules from './template/index.vue'
 export default {
   components: {
     newTestingTemplate,
     TestingPreview,
-    modal
+    modal,
+    modules,
+    custom
   },
   data() {
     return {
-      reportHome: true, // 报告主页
+      customList: [],
+      temporary: {},
+      reportHome: '提测报告', // 报告主页
       templateId: {}, // 模版id
       modelId: '', // 下一步选择的模版id
       selectTemplate: [], // 模版option
-      tipName: '创建',
       loading: false,
       fromData: {
         radio: 1
       },
+      tits: '',
       newDailyTemplate: false, // 新建日报模版
-      reportTamplate: false, // new模版
       dailyPreview: false, // 日报预览
       dailyId: '', // 当前创建报告的id
       updateDaily: false, // 编辑
@@ -118,11 +103,7 @@ export default {
       const res = await settingQueryReportModuleList({ bizId: this.bizId, type: 1 }) // 1 提测
       if (res.code === 200) {
         this.$nextTick(() => {
-          const data = res.data
-          this.selectTemplate = data.map(item => ({
-            ...item,
-            operation: false
-          }))
+          this.selectTemplate = res.data
           this.fromData.radio = this.selectTemplate[0].id
         })
       }
@@ -136,7 +117,7 @@ export default {
             if (res.code === 200) {
               this.fromData.radio = res.data // 选择的模块
               this.daily_taskIds = null// 关联任务
-              this.reportHome = true // 步骤条
+              this.reportHome = '提测报告' // 步骤条
               this.active = 2 // 步骤条状态第三步
               this.showOne = false // 隐藏第一步
               this.newDailyTemplate = true // 隐藏第二步
@@ -150,7 +131,7 @@ export default {
             if (res.code === 200) {
               this.fromData.radio = res.data // 选择的模块
               this.daily_taskIds = null// 关联任务
-              this.reportHome = true // 步骤条
+              this.reportHome = '提测报告' // 步骤条
               this.active = 2 // 步骤条状态第三步
               this.showOne = false // 隐藏第一步
               this.newDailyTemplate = true // 隐藏第二步
@@ -165,7 +146,7 @@ export default {
               this.getreportTemplate()
               this.daily_taskIds = res.data.taskIds // 关联任务
               this.fromData.radio = res.data // 选择的模块
-              this.reportHome = true // 步骤条
+              this.reportHome = '提测报告' // 步骤条
               this.active = 2 // 步骤条状态第三步
               this.showOne = false // 隐藏第一步
               this.newDailyTemplate = true // 隐藏第二步
@@ -177,7 +158,7 @@ export default {
         case 3: // 发送报告
           this.getreportTemplate()
           this.dailyId = newData.id
-          this.reportHome = true // 步骤条
+          this.reportHome = '提测报告' // 步骤条
           this.active = 3 // 步骤条状态第三步
           this.showOne = false // 隐藏第一步
           this.newDailyTemplate = false // 隐藏第二步
@@ -185,41 +166,80 @@ export default {
           break
         case 7: // 新建
           this.getreportTemplate()
+          this.fromData.radio = 1
           this.daily_taskIds = newData
-          this.reportHome = true // 步骤条
+          this.reportHome = '提测报告' // 步骤条
           this.active = 1 // 步骤条状态第三步
           this.showOne = true // 展示第一步
           this.newDailyTemplate = false // 隐藏第二步
           this.dailyPreview = false // 隐藏第三部
           break
+        case 'module': // 模版管理
+          this.getreportTemplate()
+          this.reportHome = '模版管理'
+          this.showOne = true
       }
     },
 
+    closeCustom() { // 自定义取消
+      this.reportHome = this.temporary.name
+    },
+
+    getCustom(arr) { // 自定义确认
+      console.log(arr, this.temporary, '结果')
+      this.templateId = { 'from': this.temporary.from, 'name': this.temporary.name === '创建提测报告模版' ? '新建模版' : '编辑模版' }
+      this.customList = [...arr]
+      this.reportHome = this.temporary.name
+    },
+
+    setCustom(modules, from) {
+      this.temporary = { 'name': this.reportHome, 'from': from }
+      this.customList = [...modules]
+      this.reportHome = '自定义字段'
+    },
+
+    getFromData(e) {
+      this.fromData.radio = e
+    },
+
     created_out() { // 新建模版
+      // if (this.tits === '模版管理') {
+      //   this.getreportTemplate()
+      //   this.reportHome = '模版管理'
+      //   this.showOne = true
+      //   this.$refs.newReportTemplate.getCreateData(this.templateId)
+      // } else {
       this.$refs.newReportTemplate.getCreateData(this.templateId)
+      // }
+    },
+    report_return() { // 新建模版点击返回
+      this.reportHome = '提测报告' // 步骤条
+      this.showOne = true // 模版选择
+      this.newDailyTemplate = false // 隐藏第二步
+      this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
     },
 
     reportReturn() { // 新建模版点击返回
-      this.reportHome = true // 步骤条
+      this.reportHome = this.tits // 步骤条
       this.showOne = true // 模版选择
-      this.reportTamplate = false // 编辑区域
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步
+      this.customList = []
+      this.getreportTemplate()
     },
 
-    open_new_template(val) { // 点击新建模版
-      const repot_up = val !== undefined ? { repot_up: val.id } : ''
-      val !== undefined ? this.templateId = repot_up : this.templateId = '新建模版'
-      if (this.templateId === '新建模版') {
-        this.tipName = '创建'
-        this.reportTamplate = true // 编辑区域
-        this.reportHome = false // 步骤条
+    open_new_template(val, show) { // 点击新建模版
+      !val ? this.templateId = { 'name': '新建模版', from: this.customList.length === 0 ? {} : this.temporary.from } : this.templateId = { 'name': '编辑模版', 'repot_up': val.id }
+      this.tits = this.reportHome
+      if (this.templateId.name === '新建模版') {
+        this.reportHome = `创建提测报告模版` // 步骤条
         this.showOne = false // 模版选择
+        this.customList = []
       } else {
-        if (val.creator === localStorage.getItem('username')) {
-          this.tipName = '编辑'
-          this.reportTamplate = true // 编辑区域
-          this.reportHome = false // 步骤条
+        if (val.creator === localStorage.getItem('username') || show) {
+          this.reportHome = `编辑提测报告模版` // 步骤条
           this.showOne = false // 模版选择
         } else {
           this.$message({ message: '没有权限,请联系创建人执行操作!', type: 'warning', duration: 1000, offset: 150 })
@@ -227,12 +247,11 @@ export default {
       }
     },
 
-    async settingDeleteReportModule(item) {
-      if (item.creator === localStorage.getItem('username')) {
+    async settingDeleteReportModule(item, show) {
+      if (item.creator === localStorage.getItem('username') || show) {
         const res = await settingDeleteReportModule({ id: item.id }, item.id)
         if (res.code === 200) {
           this.getreportTemplate()
-          this.closeDefaultPopover()
           this.$message({ message: '已删除’', type: 'success', duration: 1000, offset: 150 })
         }
       } else {
@@ -240,16 +259,12 @@ export default {
       }
     },
 
-    closeDefaultPopover() { // 模拟点击
-      this.$refs.refName.click()
-    },
-
     getCreateData() { // 保存,下一步
       this.$refs.dailyTemplate.reportreleaseCreate(this.updateDaily)
     },
 
     NextStep() { // 第一步到第二步
-      this.reportHome = true // 步骤条
+      this.reportHome = '提测报告' // 步骤条
       this.active = 2 // 步骤条状态第二步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 展示第二步
@@ -258,7 +273,7 @@ export default {
 
     SaveNextStep(ele) { // 第二步到第三部
       this.dailyId = ele.id // 新建报告id
-      this.reportHome = true // 步骤条
+      this.reportHome = '提测报告' // 步骤条
       this.active = 3 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
@@ -271,7 +286,8 @@ export default {
         this.daily_taskIds = []// 关联任务
         this.fromData.radio = res.data // 选择的模块
       }
-      this.reportHome = true // 步骤条
+
+      this.reportHome = '提测报告' // 步骤条
       this.active = 2 // 步骤条状态第三步
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = true // 隐藏第二步
@@ -288,10 +304,10 @@ export default {
       this.loading = false
       this.dialogDaliy = false
       this.updateDaily = false
-      this.reportTamplate = false
       this.showOne = false // 隐藏第一步
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 展示第三部
+      this.customList = []
       this.$emit('getList')
     }
   }
@@ -317,43 +333,6 @@ export default {
     padding: 0 !important;
 }
 
-.reportModel {
-    margin-left: 10px;
-}
-
-.operation {
-    margin-left: 30px;
-}
-
-.creator {
-  display: inline-block;
-  font-size:16px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  line-height:22px;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.creatorList {
-  display: inline-block;
-  font-size:14px;
-  font-family:Microsoft Sans Serif;
-  font-weight:400;
-  line-height: 2.8;
-  color:rgba(51,51,51,1);
-  opacity:1;
-}
-
-.deletreport {
-  font-size:14px;
-  text-align: center;
-  margin: 30px 0;
-  font-family:MicrosoftYaHei;
-  color:rgba(51,59,74,1);
-  opacity:1;
-}
-
 .report-dialog {
   /deep/.el-dialog__header {
     padding: 20px 20px 10px;
@@ -382,18 +361,4 @@ export default {
   color:rgba(51,51,51,1);
   opacity:1;
 }
-// .daily {
-//    max-height: 460px;
-//    overflow:scroll;
-//    overflow-x: hidden
-// }
-
-.blur-column {
-  width:4px;
-  height:15px;
-  display:inline-block;
-  vertical-align: middle;
-  background:#409EFF;
-  border-radius:1px;
-}
 </style>

+ 178 - 0
src/views/reportManagement/components/template/customTemplate.vue

@@ -0,0 +1,178 @@
+<template>
+  <el-row :gutter="20" class="Layout">
+    <el-col v-for="(item, index) in customs" :key="index" :span="12">
+      <span v-if="!show && isShow(item) || show && item.bool" style="margin-bottom:20px;" class="Layout_space_between">
+        <span class="from-name"><span v-if="item.required" style="color: red;">*</span>{{ item.fieldName }} </span>
+        <el-input v-if="item.type === 1" v-model="item.content" size="small" :disabled="disab" style="width:100%;" placeholder="请输入" @change="getFormValue" />
+        <el-input v-if="item.type === 2" v-model="item.content" type="textarea" size="small" :disabled="disab" :rows="1" style="width:100%;" placeholder="请输入" @change="getFormValue" />
+        <el-select v-if="item.type === 3" v-model="item.content" clearable size="small" :disabled="disab" style="width:100%;" placeholder="请选择" @change="getFormValue(item)">
+          <el-option v-for="i in item.options" :key="i" :label="i" :value="i" />
+        </el-select>
+        <el-select v-if="item.type === 4" v-model="item.contents" multiple clearable size="small" :disabled="disab" style="width:100%;" placeholder="请选择" @change="getFormValue(item)">
+          <el-option v-for="(i, c) in item.options" :key="c" :label="i" :value="i" />
+        </el-select>
+      </span>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+export default {
+  props: {
+    custom: { type: Array, required: false, default: null },
+    baseFrom: { type: Object, required: false, default: null },
+    disab: { type: Boolean, default: false }
+  },
+  data() {
+    return {
+      customs: [],
+      show: false
+    }
+  },
+  watch: {
+    custom: {
+      handler(newV) {
+        this.customs = newV.map(e => e)
+        if (newV && newV[0].bool) {
+          this.show = true
+          this.customs.map(item => {
+            this.baseFrom[`${item.fieldKey}_${item.content}`] = item.content
+            if (item.contents && item.contents[0]) {
+              item.contents.map(elm => {
+                this.baseFrom[`${item.fieldKey}_${elm}`] = elm
+              })
+            }
+          })
+          return
+        }
+        this.show = false
+        this.customs = newV.map(item => ({
+          ...item,
+          bool: item.conditions === '默认展示' || this.getBoolValue(item.conditions)
+        }))
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    isShow(item) {
+      if (item.conditions === '默认展示') {
+        return true
+      }
+      if (this.baseFrom[item.conditions] === item.conditions.split('_')[1]) {
+        return true
+      }
+      return false
+    },
+    getBoolValue(conditions) {
+      const checkList = []
+      this.customs.forEach(item => {
+        if (item.content && item.type < 4) {
+          checkList.push(`${item.fieldKey}_${item.content}`)
+        }
+        if (item.contents && item.type === 4) {
+          item.contents.forEach(contentItem => {
+            checkList.push(`${item.fieldKey}_${contentItem}`)
+          })
+        }
+      })
+      return checkList.indexOf(conditions) !== -1
+    },
+    getFormValue(e) {
+      this.show = false
+      const params = {}
+      const keys = []
+      this.customs.map(item => {
+        if (e.type < 4) {
+          if (item.conditions === `${e.fieldKey}_${e.content}`) {
+            item.bool = true
+            item.bools = true
+          } else {
+            if (item.conditions.split('_')[0] === e.fieldKey) {
+              item.bool = false
+              delete item.bools
+            }
+          }
+        } else if (e.type === 4) {
+          e.contents.map(i => {
+            if (item.conditions === `${e.fieldKey}_${i}`) {
+              item.bool = true
+              item.bools = true
+            } else {
+              if (item.conditions.split('_')[0] === e.fieldKey) {
+                item.bool = false
+                delete item.bools
+              }
+            }
+          })
+        }
+      })
+      // 单选
+      if (e.type === 3) {
+        params[`${e.fieldKey}_${e.content}`] = e.content
+      }
+      // 多选
+      if (e.type === 4) {
+        e.contents.forEach(elm => {
+          params[`${e.fieldKey}_${elm}`] = elm
+        })
+      }
+      // 删除多余字段
+      Object.keys(this.baseFrom).forEach(key => {
+        if (key.indexOf(e.fieldKey) > -1) {
+          keys.push(key)
+        }
+      })
+      this.$emit('formData', {
+        customs: this.customs,
+        keys,
+        params
+      })
+    },
+    CustomSet(e) {
+      const key = Object.keys(e)[0]
+      const custom = {
+        followVersion: {
+          key: 'followVersion',
+          label: '是否跟版',
+          values: 0
+        },
+        isCodeReview: {
+          key: 'isCodeReview',
+          label: '是否codereview',
+          values: 1
+        }
+      }
+      const label = custom[key].label
+      const value = e[key]
+      const keys = []
+      const params = {
+        [`${label}_${value}`]: `${value}`
+      }
+      // 删除多余字段
+      Object.keys(this.baseFrom).forEach(key => {
+        if (key.indexOf(label) > -1) {
+          keys.push(key)
+        }
+      })
+      this.$emit('formData', {
+        customs: this.customs.map(e => e),
+        keys,
+        params
+      })
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  @import '@/styles/PublicStyle/index.less';
+  .from-name {
+    width: 150px !important;
+  }
+  .Layout {
+    display: flex;
+    flex-wrap: wrap;
+    // justify-content: space-between;
+  }
+</style>

+ 134 - 0
src/views/reportManagement/components/template/index.vue

@@ -0,0 +1,134 @@
+<template>
+  <div class="report-leftRight">
+     <div style="min-height: 34vh;">
+        <el-row type="flex" justify="center">
+          <el-col :span="19" class="creator">模版名称</el-col>
+          <el-col :span="5" class="creator" style="margin-right: 17px;"> 创建人 </el-col>
+        </el-row>
+
+        <div ref="refName" style="margin: 20px 0;">
+          <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" style="padding-right: 15px;">
+            <el-col :span="19">
+              <span v-if="reportHome === '模版管理'" class="creatorList">{{ item.moduleName }}</span>
+              <el-radio v-else v-model="radio" class="creatorList" :label="item.id" @change="$emit('getFromData', radio)">{{ item.moduleName }}</el-radio>
+            </el-col>
+            <el-col :span="5" class="creatorList">
+              <div class="Layout_space_between">
+                <span>{{ item.creatorObject.name }}</span>
+                <span v-if="item.creator !== 'SYSTEM' && item.creator !== '系统' || show" style="margin-left: 30px;">
+                  <i class="el-icon-edit-outline didi-hover" @click="$emit('createModule', item, show)" />
+                  <el-popover :ref="item.id" placement="bottom" width="300" class="popover-module" :visible-arrow="false" trigger="click">
+                    <div><div class="blur-column" /> 删除模版</div>
+                    <div class="deletreport">是否要删除模版{{ item.moduleName }}?</div>
+                    <div style="text-align: right;">
+                      <el-button size="mini" type="danger" @click="$emit('deleModule', item, show)">确定</el-button>
+                      <el-button size="mini" @click="closeDefaultPopover()">取消</el-button>
+                    </div>
+                    <i slot="reference" class="el-icon-delete didi-hover" style="margin-left: 10px;" />
+                  </el-popover>
+                </span>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <div style="color: #409EFF;cursor: pointer;" @click="$emit('createModule', null)">
+          <i class="el-icon-circle-plus-outline creatorList" style="font-size: 16px;color: #409EFF;" /> 新建模版
+        </div>
+      </div>
+  </div>
+</template>
+
+<script>
+import { verifyIsAdmin } from '@/api/configure.js'
+export default {
+  props: {
+    data: { type: Array, required: true },
+    fromradio: { type: Number, required: true },
+    reportHome: { type: String, required: true }
+  },
+  data() {
+    return {
+      selectTemplate: this.data,
+      radio: this.fromradio,
+      show: false
+    }
+  },
+  watch: {
+    data() {
+      this.selectTemplate = this.data
+    },
+    fromradio() {
+      this.radio = this.fromradio
+    }
+  },
+  created() {
+    this.verifyIsAdmin()
+  },
+  methods: {
+    async verifyIsAdmin() {
+      const res = await verifyIsAdmin()
+      if (res.code === 200) {
+        this.show = res.data
+      }
+    },
+    closeDefaultPopover() { // 模拟点击
+      this.$refs.refName.click()
+    }
+  }
+
+}
+</script>
+<style lang="less" scoped>
+  .report-leftRight {
+    margin: 20px 9% 0%;
+    /deep/ .el-row .el-col {
+      margin: 0;
+  }
+  .creator {
+    display: inline-block;
+    font-size:16px;
+    font-family:Microsoft Sans Serif;
+    font-weight:400;
+    line-height:22px;
+    color:rgba(51,51,51,1);
+    opacity:1;
+  }
+  .creatorList {
+    display: inline-block;
+    font-size:14px;
+    font-family:Microsoft Sans Serif;
+    font-weight:400;
+    margin-bottom: 15px;
+    color:rgba(51,51,51,1);
+    opacity:1;
+  }
+  .didi-hover:hover {
+    color:#409EFF;
+    cursor: pointer;
+  }
+  .Layout_space_between {  // 布局
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+  }
+}
+</style>
+
+<style lang="less" scoped>
+// .popover-module {
+  .deletreport {
+    font-size:14px;
+    text-align: center;
+    margin: 30px 0;
+    color:rgba(51,59,74,1);
+  }
+  .blur-column {
+    width:4px;
+    height:14px;
+    display:inline-block;
+    vertical-align: middle;
+    background:#409EFF;
+    border-radius:1px;
+  }
+// }
+</style>

+ 42 - 0
src/views/reportManagement/components/template/nodule.vue

@@ -0,0 +1,42 @@
+<template>
+  <el-row>
+    <el-col v-for="(item, index) in data.customFields" :key="index" :span="12" class="Layout_space_between">
+      <span v-show="item.bool" class="parent-style">
+        <span class="parent-fieldName">{{ item.fieldName }}:</span>
+        <span v-if="item.type !== 4" class="content">{{ item.content }}</span>
+        <span v-else class="content">{{ item.contents.join(',') }}</span>
+      </span>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+export default {
+  props: {
+    data: { type: Object, required: true }
+  }
+}
+</script>
+
+<style scoped>
+  .parent-style div >>> table {width: 100% !important;}
+</style>
+<style lang="less" scoped>
+.parent-style {
+    width: 100%;
+    display: inline-block;
+    font-size:14px;
+    font-family:Microsoft Sans Serif;
+    font-weight:400;
+    line-height:22px;
+    color:#666666;
+    opacity:1;
+    margin-bottom: 10px;
+    .parent-fieldName {
+      display: inline-block;
+    }
+    .content {
+      color:#333333;
+    }
+}
+</style>

+ 4 - 1
src/views/reportManagement/daily/components/dailyDetails.vue

@@ -17,6 +17,7 @@
     <el-container>
       <el-main class="report-main">
         <div class="title"><div class="blur-column" /> 报告内容</div>
+        <moduleCode :data="details" />
         <div v-html="details.content" />
         <icon-display :details="details" />
       </el-main>
@@ -99,10 +100,12 @@ import { mapGetters } from 'vuex'
 import { dailyReportGetV2, dailyReportDelete } from '@/api/reportTemplate'
 import iconDisplay from '@/views/reportManagement/daily/components/iconDisplay.vue'
 import DailyReport from '@/views/reportManagement/components/DailyReport' // 日报
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 export default {
   components: {
     DailyReport,
-    iconDisplay
+    iconDisplay,
+    moduleCode
   },
   data() {
     return {

+ 4 - 1
src/views/reportManagement/daily/dailyPreview.vue

@@ -31,6 +31,7 @@
         <span class="backStyle report-name">{{ fromCreateData.reportName }}</span>
         <span>报告人:{{ name }}</span>
       </div>
+      <module-code :data="fromCreateData" />
       <div v-html="fromCreateData.content" />
       <icon-display :details="fromCreateData" />
     </div>
@@ -42,13 +43,15 @@ import html2canvas from 'html2canvas'
 import { dailyReportSendmail } from '@/api/ResultPage'
 import searchTeam from '@/components/select/searchTeam'
 import iconDisplay from '@/views/reportManagement/daily/components/iconDisplay.vue'
+import moduleCode from '@/views/reportManagement/components/template/nodule.vue'
 import { dailyReportGetV2 } from '@/api/reportTemplate' // 模版添删改查
 
 export default {
   name: 'DailyNewsAdded',
   components: {
     searchTeam,
-    iconDisplay
+    iconDisplay,
+    moduleCode
   },
   props: {
     dailyId: { type: [String, Number], default: null }

+ 56 - 20
src/views/reportManagement/daily/dailyTemplate.vue

@@ -27,6 +27,10 @@
       </el-form-item>
 
       <el-form-item label="报告内容" style="margin-top: 20px;"><br>
+
+        <!-- 自定义反显组件 -->
+        <moduleCustom v-if="customList && customList[0]" :custom="customList" :base-from="fromCreateData" :disab="false" @formData="formData" />
+
         <normal-area
           id="report-template-4"
           :value.sync="fromCreateData.content"
@@ -44,6 +48,7 @@ import { mapGetters } from 'vuex'
 import normalArea from '@/components/input/normalArea'
 import { taskList as allTaskList } from '@/api/taskIndex'
 import iconDisplay from '@/views/reportManagement/daily/components/iconDisplay.vue'
+import moduleCustom from '@/views/reportManagement/components/template/customTemplate.vue'
 import { settingGetReportModuleById, dailyReportCreate, dailyReportUpdate } from '@/api/reportTemplate' // 模版添删改查
 import { getContainImgHTMLNode } from '@/utils/handleTinymce' // 富文本本图片转换
 
@@ -51,14 +56,17 @@ export default {
   name: 'DailyNewsAdded',
   components: {
     normalArea,
-    iconDisplay
+    iconDisplay,
+    moduleCustom
   },
   props: {
+    custom: { type: Array, required: false, default: null },
     modelId: { type: [String, Number, Object], default: 1 },
     taskIds: { type: Array, default: () => null }
   },
   data() {
     return {
+      customList: this.custom,
       serviceDataRules: {
         reportName: [{ required: true, message: '标题不能为空', trigger: 'change' }]
       },
@@ -84,6 +92,7 @@ export default {
           }
           this.$set(this.fromCreateData, 'taskIds', null)
           this.moduleId = this.fromCreateData.moduleId
+          this.customList = newV.customFields
         } else {
           this.moduleId = newV
           this.settingGetReportModuleById(newV)
@@ -109,6 +118,7 @@ export default {
       const res = await settingGetReportModuleById(val)
       if (res.code === 200) {
         this.fromCreateData = res.data
+        this.customList = res.data.customFields
       }
     },
 
@@ -152,8 +162,36 @@ export default {
       this.tasksDetailList.length <= 0 ? this.selectTask = true : this.selectTask = false
     },
 
+    formData({ customs, keys, params }) { // 编辑自定义字段获取content
+      const newFrom = { ...this.fromCreateData, customFields: customs }
+      newFrom.customFields.forEach(elm => {
+        if (keys.indexOf(elm.conditions) > -1) {
+          elm.content = ''
+          elm.contents = []
+        }
+      })
+      keys.forEach(key => {
+        delete newFrom[key]
+      })
+      this.fromCreateData = { ...newFrom, ...params }
+      console.log(customs, params, 'customs')
+    },
+
     // 新建
     getCreateData(val) {
+      let show = '0'
+      this.fromCreateData.customFields.map(item => {
+        if (item.bool && item.required && item.type < 4) {
+          item.type < 4 && item.content ? '' : show = item.fieldName
+        }
+        if (item.bool && item.required && item.type === 4) {
+          item.contents ? '' : show = item.fieldName
+        }
+      })
+      if (show !== '0') {
+        this.$message({ type: 'warning', message: `${show}不能为空` })
+        return
+      }
       if (this.selectTask) {
         this.$set(this.fromCreateData, 'taskIds', null)
         this.taskid_arr = []
@@ -161,10 +199,7 @@ export default {
       }
       this.$refs.fromCreateData.validate(async(valid) => {
         if (valid) {
-          this.fromCreateData.bizId = this.bizId
-          this.fromCreateData.reportor = localStorage.getItem('usernames')
-          this.fromCreateData.taskIds = this.taskid_arr
-          this.fromCreateData.moduleId = this.moduleId
+          this.fromCreateData = { ...this.fromCreateData, bizId: this.bizId, reportor: localStorage.getItem('usernames'), taskIds: this.taskid_arr, moduleId: this.moduleId }
           this.loading = true
           try {
             this.fromCreateData.content = await getContainImgHTMLNode(this.fromCreateData.content)
@@ -173,21 +208,22 @@ export default {
             throw error
           }
           this.loading = false
-          if (val) { // 编辑
-            dailyReportUpdate(this.fromCreateData).then(res => {
-              if (res.code === 200) {
-                this.$emit('SaveNextStep', res.data)
-                this.$message({ type: 'success', message: '更新成功' })
-              }
-            })
-          } else {
-            dailyReportCreate(this.fromCreateData).then(res => {
-              if (res.code === 200) {
-                this.$emit('SaveNextStep', res.data)
-                this.$message({ type: 'success', message: '创建成功' })
-              }
-            })
-          }
+          const apis = val ? dailyReportUpdate : dailyReportCreate
+          !val ? delete this.fromCreateData.id : ''
+          apis(this.fromCreateData).then(res => {
+            if (res.code === 200) {
+              this.$emit('SaveNextStep', res.data)
+              this.$message({ type: 'success', message: `${val ? '更新' : '创建'}成功` })
+            }
+          })
+          // } else {
+          //   dailyReportCreate(this.fromCreateData).then(res => {
+          //     if (res.code === 200) {
+          //       this.$emit('SaveNextStep', res.data)
+          //       this.$message({ type: 'success', message: '创建成功' })
+          //     }
+          //   })
+          // }
         }
       })
     }

+ 53 - 11
src/views/reportManagement/daily/newReportTemplate.vue

@@ -9,14 +9,20 @@
       <el-form-item label="模版名称" prop="moduleName" label-width="80px">
         <el-input v-model="fromCreateData.moduleName" size="small" style="width:100%;" placeholder="请输入模版名称(不可与现有模版重名)" />
       </el-form-item>
-      <el-form-item label="模版内容"><br>
-        <normal-area
-          id="report-template-3"
-          :value.sync="fromCreateData.content"
-          :height="500"
-          :full-position-style="{ top:'20px',left:'15%', right: '15%' }"
-        />
-      </el-form-item>
+      <div class="backStyles">
+        {{ '模版内容' }}
+        <el-button type="text" @click="customDialong">自定义字段</el-button>
+      </div>
+
+      <!-- 自定义反显组件 -->
+      <moduleCustom v-if="customList && customList[0]" :custom="customList" :base-from="fromCreateData" :disab="true" @formData="formData" />
+
+      <normal-area
+        id="report-template-3"
+        :value.sync="fromCreateData.content"
+        :height="500"
+        :full-position-style="{ top:'20px',left:'15%', right: '15%' }"
+      />
     </el-form>
     <div class="backStyle">缺陷统计</div>
     <el-table
@@ -62,18 +68,22 @@ import { mapGetters } from 'vuex'
 import echarts from 'echarts'
 import normalArea from '@/components/input/normalArea' // 富文本
 import 'tinymce/plugins/table'// 插入表格插件
+import moduleCustom from '@/views/reportManagement/components/template/customTemplate.vue'
 import { settingAddReportModule, settingUpdateReportModule, settingGetReportModuleById } from '@/api/reportTemplate' // 模版添删改查
 import { getContainImgHTMLNode } from '@/utils/handleTinymce'// 富文本本图片转换
 
 export default {
   components: {
-    normalArea
+    normalArea,
+    moduleCustom
   },
   props: {
+    custom: { type: Array, required: false, default: null },
     templateId: { type: [String, Number], default: null } // 模版id
   },
   data() {
     return {
+      customList: this.custom,
       tableData: [{ date: 0 }],
       tpltId: '', // 模版id
       bugP0P1: [], // bugP0P1数据
@@ -91,6 +101,7 @@ export default {
   watch: {
     templateId: {
       handler(newV) {
+        console.log(newV)
         this.tpltId = newV
         this.tpltId ? this.settingGetReportModuleById(newV) : ''
       },
@@ -108,6 +119,12 @@ export default {
     async settingGetReportModuleById(val) {
       const res = await settingGetReportModuleById(val)
       if (res.code === 200) {
+        !this.customList ? this.customList = [] : ''
+        if (res.data.customFields && this.customList.length < 1) {
+          this.customList = [...this.customList, ...res.data.customFields]
+        } else {
+          this.customList = [...this.customList]
+        }
         this.fromCreateData = res.data
       }
     },
@@ -137,12 +154,29 @@ export default {
       }, 200)
     },
 
+    formData({ customs, keys, params }) { // 编辑自定义字段获取content
+      const newFrom = { ...this.fromCreateData, customFields: customs }
+      newFrom.customFields.forEach(elm => {
+        if (keys.indexOf(elm.conditions) > -1) {
+          elm.content = ''
+          elm.contents = []
+        }
+      })
+      keys.forEach(key => {
+        delete newFrom[key]
+      })
+      this.fromCreateData = { ...newFrom, ...params }
+      console.log(customs, params, 'customs')
+    },
+
+    customDialong() { // 点击自定义字段
+      this.$emit('setCustom', this.customList || [], this.fromCreateData)
+    },
+
     // 新建模版
     getCreateData(e) {
       this.$refs['fromCreateData'].validate(async(valid) => {
         if (valid) {
-          this.fromCreateData.bizId = this.bizId
-          this.fromCreateData.type = e
           this.loading = true
           try {
             this.fromCreateData.content = await getContainImgHTMLNode(this.fromCreateData.content)
@@ -151,6 +185,8 @@ export default {
             throw error
           }
           this.loading = false
+          this.fromCreateData = { ...this.fromCreateData, bizId: this.bizId, type: e, customFields: this.customList }
+          console.log(this.tpltId, 'kankan')
           if (this.tpltId) {
             settingUpdateReportModule(this.fromCreateData).then(res => {
               if (res.code === 200) {
@@ -183,6 +219,12 @@ export default {
     color:rgba(51,51,51,1);
     margin: 1% 0;
   }
+  .backStyles {
+    font-size: 14px;
+    font-weight: 700;
+    color: #606266;
+    line-height: 40px;
+  }
 
   .space-between {
     display:flex;

+ 108 - 88
src/views/reportManagement/testPresentation.vue

@@ -6,64 +6,70 @@
       </el-tabs>
       <div class="Layout_space_between Qz_report_query">
         <div class="Layout_space_between">
-          <span style="width: 100px;">{{ title }}</span>
-          <el-input v-if="history" v-model="state" size="small" filterable placeholder="报告名称搜索" style="width:100%;" @change="history ? getList(state) : gethistoryData(state)" />
+          <span style="min-width: 70px;">{{ title }}</span>
+          <el-input v-if="history" v-model="screenForm.reportName" size="small" filterable placeholder="报告名称搜索" style="width:100%;" @change="history ? getList(screenForm.reportName) : gethistoryData(screenForm.reportName)" />
+        </div>
+        <div v-if="history && title !== '测试日报' && title !== '提测报告'" class="Layout_space_between">
+          <span style="min-width: 70px;">通过状态</span>
+          <el-select v-model="screenForm.passStatus" size="medium" clearable filterable placeholder="请选择" style="width:100%;" @change="getList(screenForm.passStatus)">
+            <el-option v-for="item in reportStatusLists" :key="item.code" :label="item.name" :value="item.code" />
+          </el-select>
+        </div>
+         <div v-if="history && title !== '测试日报' && title !== '准出报告'" class="Layout_space_between">
+           <span style="min-width: 70px;">通过状态</span>
+          <el-select v-model="screenForm.status" size="medium" clearable filterable placeholder="请选择" style="width:100%;" @change="getList(screenForm.status)">
+            <el-option v-for="item in reportStatusList" :key="item.code" :label="item.name" :value="item.code" />
+          </el-select>
+        </div>
+        <div v-if="history && title !== '测试日报'" class="Layout_space_between">
+          <span style="min-width: 40px;">延期</span>
+          <el-select v-model="screenForm.isDelay" size="medium" clearable filterable placeholder="请选择" style="width:100%;" @change="getList(screenForm.isDelay)">
+            <el-option v-for="item in isDelayList" :key="item.code" :label="item.name" :value="item.code" />
+          </el-select>
         </div>
         <div class="Layout_space_between">
           <el-button v-if="!history" type="primary" size="small" @click="returnNewest">返回最新</el-button>
           <!-- <el-button v-if="history" type="text" @click="gethistoryData">查看老数据</el-button> -->
           <el-button v-if="history" type="primary" size="small" @click="getQueryData">新建{{ title }}</el-button>
+          <el-button type="text" size="medium" @click="moduleManage">模版管理</el-button>
         </div>
       </div>
     </el-header>
-
     <el-main class="Qz_report_main">
       <ele-tabel :loading="loading" :data="tableDatas" :isshow-select="true" :table-configuration="tableConfiguration">
         <span slot="specialItem" slot-scope="props">
           <div v-if="props.type === 'jumpTips'">
             <a href="javascript:void(0)" style="color:#20a0ff" @click="history ? toReportView(props.row) : OldDaily(props.row)">{{ filterFields(props.row, props.column) }}</a>
-            <div v-if="title === '准出报告' && props.row.passStatus === 1" class="passStatus1">不通过</div>
+            <div v-if="title === '准出报告' && props.row.passStatus === 1" style="color:red;">不通过</div>
             <div v-if="title === '提测报告' && props.row.returnReason" style="color: red;" class="breakText1">打回报告:{{ props.row.returnReason }}</div>
           </div>
           <div v-else>{{ filterFields(props.row, props.column) }}</div>
         </span>
         <template slot="operateBox" slot-scope="scope">
-          <div v-if="title === '测试日报'">
-            <span v-if="scope.row.status === 0" class="btnColor" @click="dailyButtom(3,scope.row)">发送</span>
-            <span v-if="scope.row.status === 0" style="margin: 0 30px;" class="btnColor" @click="dailyButtom(2,scope.row)">编辑</span>
-            <span v-if="scope.row.status === 0" class="btnColor" @click="report_click(4,scope.row )">删除</span>
-            <span v-if="scope.row.status === 3" class="btnColor" @click="dailyButtom(4,scope.row)">复制</span>
+          <div v-if="title === '测试日报' && scope.row.status === 0">
+            <el-button type="text" @click="dailyButtom(3,scope.row)">发送</el-button>
+            <el-button type="text" style="margin: 0 20px 0 30px;" @click="dailyButtom(2,scope.row)">编辑</el-button>
+            <el-button type="text" @click="report_click(4,scope.row )">删除</el-button>
           </div>
-          <div v-if="title === '准出报告'">
-            <div v-if="scope.row.status === 3 ? false : true">
-              <span v-if="scope.row.status === 0" class="btnColor" @click="clientButtom(3,scope.row)">发送</span>
-              <span v-if="scope.row.status === 0" style="margin: 0 30px;" class="btnColor" @click="clientButtom(2, scope.row)">编辑</span>
-              <span v-if="scope.row.status === 0" class="btnColor" @click="report_click(4,scope.row )">删除</span>
-            </div>
+          <el-button v-if="title === '测试日报' && scope.row.status === 3" type="text" @click="dailyButtom(4,scope.row)">复制</el-button>
+          <div v-if="title === '准出报告' && scope.row.status === 0">
+            <el-button type="text" @click="clientButtom(3,scope.row)">发送</el-button>
+            <el-button type="text" style="margin: 0 20px 0 30px;" @click="clientButtom(2, scope.row)">编辑</el-button>
+            <el-button type="text" @click="report_click(4,scope.row )">删除</el-button>
           </div>
-          <div v-if="title === '提测报告'">
-            <div v-if="scope.row.status === 1 ? false : true">
-              <span v-if="scope.row.status === 3" class="btnColor" @click="report_click(1,scope.row)">通过</span>
-              <span v-if="scope.row.status === 3" style="margin-left: 30px;" class="btnColor" @click="report_click(2,scope.row)">打回</span>
-              <span v-if="scope.row.status === 0" class="btnColor" @click="report_click(5,scope.row)">发送</span>
-              <span v-if="scope.row.status === 0" style="margin: 0 30px;" class="btnColor" @click="report_click(6,scope.row)">编辑</span>
-              <span v-if="scope.row.status === 0" class="btnColor" @click="report_click(4,scope.row )">删除</span>
-              <span v-if="scope.row.status === 2" class="btnColor" @click="report_click(3,scope.row)">重新提测</span>
-            </div>
+          <div v-if="title === '提测报告' && scope.row.status === 3">
+            <el-button type="text" @click="report_click(1,scope.row)">通过</el-button>
+            <el-button type="text" style="margin: 0 20px 0 30px;" @click="report_click(2,scope.row)">打回</el-button>
           </div>
+          <div v-if="title === '提测报告' && scope.row.status === 0">
+            <el-button type="text" @click="report_click(5,scope.row)">发送</el-button>
+            <el-button type="text" style="margin: 0 20px 0 30px;" @click="report_click(6,scope.row)">编辑</el-button>
+            <el-button type="text" @click="report_click(4,scope.row )">删除</el-button>
+          </div>
+          <el-button v-if="title === '提测报告' && scope.row.status === 2" type="text" @click="report_click(3,scope.row)">重新提测</el-button>
         </template>
       </ele-tabel>
-      <el-pagination
-        background
-        align="right"
-        :current-page="curIndex"
-        :page-sizes="[15,30,45]"
-        :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="total"
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-      />
+      <el-pagination background align="right" :current-page="curIndex" :page-sizes="[15,30,45]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
     </el-main>
 
     <!-- 日报/准出/提测选择任务 -->
@@ -75,8 +81,9 @@
             <div class="belong-task">
               <div class="task-id">{{ item.taskId }}</div>
               <div class="modules-name">
+                <span :class="[item.statusString === '开发中' || item.statusString === '测试中' ? 'status_top' : 'name']">{{ `【${item.statusString}】` }}</span>
                 <span class="name">{{ item.name }}</span>
-                <span v-if="item.moduleInfoName" class="modules">{{ item.moduleInfoName }}</span>
+                <span v-if="item.moduleInfoName" style="color: #999;">{{ item.moduleInfoName }}</span>
               </div>
             </div>
           </el-option>
@@ -94,9 +101,7 @@
     <el-dialog :title="report_from.titName" :visible.sync="dialog_testData" width="30%" :close-on-click-modal="false">
       <div style="position: absolute; top: 23px; left: 12px;width:4px;height:17px;background:#409EFF;border-radius:1px;" />
       <div align="center">
-        <div v-if="title === '提测报告'">是否{{ report_from.statusString }}以下提测?</div>
-        <div v-if="title === '测试日报'">是否{{ report_from.statusString }}以下测试日报?</div>
-        <div v-if="title === '准出报告'">是否{{ report_from.statusString }}以下准出报告?</div>
+        <div>{{ `是否${report_from.statusString}以下${title}?` }}</div>
         <div style="color: #f79232;">{{ report_from.name }}</div>
       </div>
       <el-input v-show="report_from.statusString === '打回'" v-model="report_from.reason" type="textarea" placeholder="请输入打回原因..." :rows="3" />
@@ -112,14 +117,10 @@
 
     <el-dialog :title="title" :visible.sync="reportDaily" class="public_task" width="70%" :close-on-click-modal="false">
       <div class="blueStripe" />
-      <div v-if="title === '测试日报'" style=" margin-bottom: 2%; height: 600px; overflow:scroll; overflow-x: hidden">
-        <testPresenyL v-if="testPresenyL" :message="message" />
-      </div>
-      <div v-if="title === '准出报告'" style=" margin-bottom: 2%; height: 600px; overflow:scroll; overflow-x: hidden">
-        <ResultPageyL v-if="ResultPageyL" :message="message" />
-      </div>
-      <div v-if="title === '提测报告'" style=" margin-bottom: 2%; height: 600px; overflow:scroll; overflow-x: hidden">
-        <acceptTheReport v-if="acceptTheReport" :message="message" />
+      <div style=" margin-bottom: 2%; height: 600px; overflow:scroll; overflow-x: hidden">
+        <testPresenyL v-if="title === '测试日报' && testPresenyL" :message="message" />
+        <ResultPageyL v-if="title === '准出报告' && ResultPageyL" :message="message" />
+        <acceptTheReport v-if="title === '提测报告' && acceptTheReport" :message="message" />
       </div>
     </el-dialog>
     <checkListStopConfirm
@@ -168,6 +169,9 @@ export default {
       activeName: 'first',
       title: '测试日报', // 报告title
       history: true, // 新老数据
+      isDelayList: [{ code: 0, name: '未延期' }, { code: 1, name: '延期' }],
+      reportStatusLists: [{ code: 0, name: '通过' }, { code: 1, name: '打回' }],
+      reportStatusList: [{ code: 1, name: '通过' }, { code: 2, name: '打回' }],
       userInformation: localStorage.getItem('username'),
       userNames: localStorage.getItem('realname'),
       message: {}, // 老日报数据
@@ -183,7 +187,12 @@ export default {
       pageSize: 15,
       curIndex: 1,
       total: 0,
-      state: '',
+      screenForm: {
+        reportName: '',
+        passStatus: '',
+        status: '',
+        isDelay: ''
+      },
       restaurants: [],
       queryData: {}, // 选择的任务code为id
       report_from: {
@@ -241,14 +250,19 @@ export default {
       switch (Number(tab.index)) {
         case 0:
           this.title = '测试日报'
+          this.screenForm = { ...this.screenForm, status: '', passStatus: '', isDelay: '' }
           this.history ? this.getList() : this.gethistoryData()
           break
         case 1:
           this.title = '准出报告'
+          this.screenForm = { ...this.screenForm, status: '', passStatus: '', isDelay: '' }
+          this.reportStatusLists = [{ code: 0, name: '通过' }, { code: 1, name: '不通过' }]
           this.history ? this.getList() : this.gethistoryData()
           break
         case 2:
           this.title = '提测报告'
+          this.screenForm = { ...this.screenForm, status: '', passStatus: '', isDelay: '' }
+          this.reportStatusList = [{ code: 1, name: '通过' }, { code: 2, name: '打回' }]
           this.history ? this.getList() : this.gethistoryData()
           break
       }
@@ -258,12 +272,11 @@ export default {
       this.loading = true
       this.history = true
       const params = {
+        ...this.screenForm,
         bizId: this.bizId,
         curIndex: this.curIndex,
         pageSize: this.pageSize
-
       }
-      e ? params.reportName = this.state : ''
       if (this.title === '测试日报') {
         const res = await dailyReportListV2(params)
         if (res.code === 200) {
@@ -294,7 +307,7 @@ export default {
     returnNewest() { // 返回最新
       this.pageSize = 10
       this.curIndex = 1
-      this.state = ''
+      this.screenForm = {}
       this.getList()
     },
 
@@ -363,17 +376,13 @@ export default {
     dailyButtom(e, data) { // 测试报告
       this.report_data = data
       this.dialogDaily = true
-      this.$nextTick(() => {
-        this.$refs.DailyReport.init(e, data)
-      })
+      this.$nextTick(() => this.$refs.DailyReport.init(e, data))
     },
 
     clientButtom(e, data) { // 准出报告
       this.report_data = data
       this.dialogClient = true
-      this.$nextTick(() => {
-        this.$refs.ClientReport.init(e, data)
-      })
+      this.$nextTick(() => this.$refs.ClientReport.init(e, data))
     },
 
     async report_click(e, data) { // 提测报告
@@ -382,13 +391,11 @@ export default {
       switch (e) {
         case 1:
           this.dialog_testData = true
-          this.report_from.titName = '提测确认'
-          this.report_from.statusString = '通过'
+          this.report_from = { ...this.report_from, titName: '提测确认', statusString: '通过' }
           break
         case 2:
           this.dialog_testData = true
-          this.report_from.titName = '提测打回确认'
-          this.report_from.statusString = '打回'
+          this.report_from = { ...this.report_from, titName: '提测打回确认', statusString: '打回' }
           break
         case 3:
           reportdelivertestGetReportById(data.id).then(res => {
@@ -403,9 +410,7 @@ export default {
                     return
                   }
                   this.dialogVisible1 = true
-                  this.$nextTick(() => {
-                    this.$refs.TestReport.init(4, data)
-                  })
+                  this.$nextTick(() => this.$refs.TestReport.init(4, data))
                 }
               })
             }
@@ -413,20 +418,15 @@ export default {
           break
         case 4:
           this.dialog_testData = true
-          this.report_from.titName = '删除确认'
-          this.report_from.statusString = '删除'
+          this.report_from = { ...this.report_from, titName: '删除确认', statusString: '删除' }
           break
         case 5:
           this.dialogVisible1 = true
-          this.$nextTick(() => {
-            this.$refs.TestReport.init(3, data)
-          })
+          this.$nextTick(() => this.$refs.TestReport.init(3, data))
           break
         case 6:
           this.dialogVisible1 = true
-          this.$nextTick(() => {
-            this.$refs.TestReport.init(2, data)
-          })
+          this.$nextTick(() => this.$refs.TestReport.init(2, data))
           break
       }
     },
@@ -450,6 +450,31 @@ export default {
     debounceQuery: _.debounce(function() {
       this.getTaskList(...arguments)
     }, 500),
+    async moduleManage() {
+      if (this.title === '测试日报') {
+        this.centerDialogVisible = false
+        this.dialogDaily = true
+        this.$nextTick(() => {
+          this.$refs.DailyReport.init('module')
+        })
+      }
+      if (this.title === '准出报告') {
+        this.centerDialogVisible = false
+        this.dialogClient = true
+        this.$nextTick(() => this.$refs.ClientReport.init('module'))
+      }
+      if (this.title === '提测报告') {
+        this.centerDialogVisible = false
+        // if (res.data) {
+        //   this.checklistStopVisible = true
+        //   this.firstChecklistTaskId = res.data
+        //   this.goDataReport = vel
+        //   return
+        // }
+        this.dialogVisible1 = true
+        this.$nextTick(() => this.$refs.TestReport.init('module'))
+      }
+    },
     async createPresentation(vel) {
       if (vel !== '') {
         if (this.title === '测试日报') {
@@ -469,9 +494,7 @@ export default {
           if (res.code === 200) {
             this.centerDialogVisible = false
             this.dialogClient = true
-            this.$nextTick(() => {
-              this.$refs.ClientReport.init(7, [vel])
-            })
+            this.$nextTick(() => this.$refs.ClientReport.init(7, [vel]))
           } else {
             this.centerDialogVisible = true
           }
@@ -487,9 +510,7 @@ export default {
               return
             }
             this.dialogVisible1 = true
-            this.$nextTick(() => {
-              this.$refs.TestReport.init(7, [vel])
-            })
+            this.$nextTick(() => this.$refs.TestReport.init(7, [vel]))
           } else {
             this.centerDialogVisible = true
           }
@@ -524,7 +545,7 @@ export default {
       this.loading = true
       this.history = false
       const indexPage = { bizId: this.bizId, pageSize: this.pageSize, curIndex: this.curIndex }
-      e ? indexPage.reportName = this.state : ''
+      e ? indexPage.reportName = this.screenForm.reportName : ''
       if (this.title === '测试日报') {
         const res = await dailyReportList(indexPage)
         if (res.code === 200) {
@@ -541,7 +562,7 @@ export default {
       }
       if (this.title === '提测报告') {
         const data = { bizId: this.bizId, pageSize: this.pageSize, curIndex: this.curIndex }
-        e ? data.name = this.state : ''
+        e ? data.name = this.screenForm.reportName : ''
         const res = await launchTestList(data)
         if (res.code === 200) {
           this.tableData = res.data
@@ -631,8 +652,9 @@ export default {
     background: #FFF;
     border-radius: 4px;
     padding: .3% 1% 1% 1%;
-    .btnColor {
-      color: #409eff;
+    /deep/.el-button {
+      font-weight: 400;
+      padding: 0 0;
     }
   }
 }
@@ -650,9 +672,6 @@ export default {
     text-overflow: ellipsis;
     white-space: nowrap;
   }
-  .modules {
-    color: #999999;
-  }
   .task-id {
     color: #999999;
     width: 80px;
@@ -662,9 +681,10 @@ export default {
     color: #333333;
     margin-right: 20px;
   }
-}
-.passStatus1 {
-  color:red;
+  .status_top {
+    color: #FAAD14;
+    margin-right: 20px;
+  }
 }
 </style>
 <style lang="stylus">