Kaynağa Gözat

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

wenbobowen 4 yıl önce
ebeveyn
işleme
41fec30ff4

+ 10 - 0
src/api/qualityMonthlyReport/edit.js

@@ -216,3 +216,13 @@ export function downloadMonthlyReport(reportId) {
     method: 'get'
   })
 }
+
+// 拉取subtitle /monthlyReport/pullSubTitle
+export function pullSubTitle(data) {
+  return request({
+    url: projectManagementUrl + '/monthlyReport/pullSubTitle',
+    method: 'post',
+    timeout: '20000',
+    data
+  })
+}

+ 67 - 1
src/store/modules/monthlyReport/edit/index.js

@@ -13,7 +13,8 @@ import {
   publishReport,
   getSubReportInfo,
   updateSubReport,
-  pullDataAgain
+  pullDataAgain,
+  pullSubTitle
 } from '@/api/qualityMonthlyReport/edit'
 // import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
 import { getAvaliableInfo, getMonthlyReportVersion } from '@/api/qualityMonthlyReport'
@@ -1003,6 +1004,71 @@ export default {
           state.userNames = userNames
         }
       }, 100)
+    },
+    // 重新拉取线上问题的 SubTitle,只在tableData数据变化时更新
+    async pullOnlineQuestion({ state }, { domKey, route }) {
+      // 获取数据
+      let baseData = {}
+      let { subReportId } = route.query
+      const [tabKey, subTabKey] = state.subTabsActive
+      if (!subReportId) {
+        subReportId = state.tabsActive.replace(/tab_/, '')
+      }
+      //
+      const tabDataObj = {
+        tabKey: '',
+        subTabKey: ''
+      }
+      const setValue = (item, key, value) => {
+        if (item.domKey === value) {
+          tabDataObj[key] = item
+        }
+      }
+      const find = (arr) => {
+        arr &&
+          arr.length &&
+          arr.forEach((elm) => {
+            setValue(elm, 'tabKey', tabKey)
+            setValue(elm, 'subTabKey', subTabKey)
+            if (elm.domKey === domKey) {
+              baseData = _.cloneDeep(elm)
+            }
+            if (elm.content && elm.content.length) {
+              find(elm.content)
+            }
+            if (elm.children && elm.children.length) {
+              find(elm.children)
+            }
+          })
+      }
+      find(state.tabPageData.children)
+      // 转换数据
+      const tableRows = objToArr(baseData.content[1].tableRows, baseData.content[1].tableHeaders)
+      const res = await pullSubTitle({
+        subReportId,
+        catalogTitle: '线上问题',
+        isServer: tabDataObj.tabKey.title ? tabDataObj.tabKey.title === '服务端' : false,
+        tableRows
+      })
+      // 覆盖数据
+      const setSubTitle = (arr) => {
+        arr &&
+          arr.length &&
+          arr.forEach((elm) => {
+            if (elm.domKey === domKey) {
+              elm.subTitles = res.data
+            }
+            if (elm.content && elm.content.length) {
+              setSubTitle(elm.content)
+            }
+            if (elm.children && elm.children.length) {
+              setSubTitle(elm.children)
+            }
+          })
+      }
+      const tabPageData = { ...state.tabPageData }
+      setSubTitle(tabPageData.children)
+      state.tabPageData = { ...tabPageData }
     }
   }
 }

+ 0 - 1
src/store/modules/monthlyReport/edit/utils.js

@@ -187,7 +187,6 @@ export function readOnlyTableObjToArr(obj, tableHeaders) {
     const elms = {}
     tableHeaders.forEach((item, index) => {
       let param = {}
-      console.log(192)
       param = elm[item.headerKey]
       if (!elms.tableItems) {
         elms.tableItems = []

+ 2 - 2
src/views/dataBigManage/components/efficiencyModule/index.vue

@@ -326,7 +326,7 @@ export default {
 .qualityModule {
   // .itemBox {
     box-shadow: 0px 6px 50px rgba(0, 0, 0, 0.05);
-    padding: 5px 20px;
+    padding: 10px 5px;
     border-radius: 6px;
     margin-bottom: 10px;
     .itemBox {
@@ -335,7 +335,7 @@ export default {
       margin-bottom: 10px;
       border-radius: 6px;
       padding: 8px 10px;
-      margin: 10px 10px;
+      //margin: 10px 10px;
       .empty {
         text-align: center;
         line-height: 134px;

+ 23 - 0
src/views/monthlyReport/childrenPage/editReport/components/MrTable/index.vue

@@ -343,10 +343,16 @@ export default {
       type: Array,
       required: false,
       default: () => []
+    },
+    baseDataDomKey: {
+      type: String,
+      required: false,
+      default: () => ''
     }
   },
   data() {
     this.setAnalyticFeedback = _.debounce(this.setAnalyticFeedback, 300)
+    this.pullOnlineQuestion = _.debounce(this.pullOnlineQuestion, 1000)
     return {
       analyticFeedback: '',
       expandRowKeys: [],
@@ -404,6 +410,15 @@ export default {
       return this.$store.state.monthlyReportEdit.isLoading
     }
   },
+  watch: {
+    tableData: {
+      handler(val, oldVal) {
+        this.pullOnlineQuestion()
+      },
+      deep: true,
+      immediate: true
+    }
+  },
   // watch: {
   //   tableData() {
   //     if (this.tableData.length) {
@@ -780,6 +795,14 @@ export default {
     goto(url) {
       // console.log(url)
       url && window.open(url, '_blank')
+    },
+    pullOnlineQuestion() {
+      if (this.title === '线上问题') {
+        this.$store.dispatch('monthlyReportEdit/pullOnlineQuestion', {
+          domKey: this.baseDataDomKey,
+          route: this.$route
+        })
+      }
     }
   }
 }

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

@@ -11,6 +11,7 @@
           :columns="item.tableHeaders"
           :table-data="item.tableRows"
           :dom-key="item.domKey"
+          :base-data-dom-key="baseDataDomKey"
           plus-table-data-bottom="0px"
         />
         <div v-else-if="title.search(/线上问题/) > -1" class="no-data">

+ 14 - 3
src/views/monthlyReport/childrenPage/editReport/index.vue

@@ -36,7 +36,7 @@
         >
           取消
         </el-button>
-        <el-button
+        <!-- <el-button
           v-if="pageType.search(/All/) > -1 && pageDate && pageDate.status === 20 && (roleCode === 100 || roleCode === 0)"
           slot="reference"
           type="primary"
@@ -44,7 +44,7 @@
           @click="dialogOpen('dialogViewPdf')"
         >
           PDF预览
-        </el-button>
+        </el-button> -->
         <el-button
           v-if="pageType.search(/All/) > -1 && pageDate && pageDate.status === 20 && (roleCode === 100 || roleCode === 0)"
           slot="reference"
@@ -195,7 +195,7 @@
       width="70%"
       @succes="downloadReportPdf">
       <div class="report-delete" style="text-align: initial;min-height: 30vh;max-height: 70vh;overflow-y: scroll;">
-        <!--        月报数据已检查无误,确认发布?-->
+        <!-- 月报数据已检查无误,确认发布?-->
         <div v-if="monthlyReportPrePdfView" style="" v-html="monthlyReportPrePdfView" />
       </div>
     </normal-dialog>
@@ -301,6 +301,13 @@ export default {
     }
     // 数据埋点
     this.monthlyReportBuriedPoint()
+    // 防止页面后退
+    if (this.$route.query.pageType.search(/edit/) > -1) {
+      history.pushState(null, null, document.URL)
+      window.addEventListener('popstate', function() {
+        history.pushState(null, null, document.URL)
+      })
+    }
   },
   destroyed() {
     this.indexShow = false
@@ -309,6 +316,10 @@ export default {
     if (this.$route.query.type && this.$route.query.type === 'create') {
       this.deleteReport({ isMsg: false })
     }
+    // 销毁组件时,取消浏览器前进后端拦截事件
+    window.removeEventListener('popstate', function() {
+      history.pushState(null, null, document.URL)
+    })
   },
   methods: {
     ...mapMutations('monthlyReportEdit',

+ 6 - 0
src/views/monthlyReport/index.vue

@@ -25,6 +25,7 @@
         <el-button v-if="tagData.status === 20" type="text" @click="jump('report_home_Publication', '/monthlyReport/edit', { pageType: 'readAll', reportId: reportStatus.id })"> 月报发布</el-button>
         <el-button v-if="tagData.status === 30" type="text" @click="jump('report_home_viewReport', '/monthlyReport/edit', { pageType: 'readAll', reportId: reportStatus.id })"> 查看完整报告</el-button>
         <!--    @click="downloadMonthlyReportFn"    -->
+        <a v-if="isShowPdfPushDow() && tagData.status === 20" target="blank" :href="`${projectManagementUrl}/monthlyReport/downloadMonthlyReport?id=${reportValue}&refrash=true`" :download="`${reportName}.pdf`" style="margin-left: 10px;display: inline-block"><svg-icon icon-class="monthlyReport下载" class="icon" /></a>
         <a v-if="isShowPdfDow()" target="blank" :href="`${projectManagementUrl}/monthlyReport/downloadMonthlyReport?id=${reportValue}`" :download="`${reportName}.pdf`" style="margin-left: 10px;display: inline-block"><svg-icon icon-class="monthlyReport下载" class="icon" /></a>
         <el-button v-if="tagData.status === 0" type="text" @click="sendConfirm(reportData)"> 发送确认</el-button>
       </div>
@@ -211,6 +212,11 @@ export default {
       // tagData.status === 30 && tagData.version !== 'v1' && tagData.version
       return status === 30 && version !== 'v1' && `${version}`.replace(/v/, '') > 1
     },
+    isShowPdfPushDow() {
+      const { status, version } = this.tagData
+      // tagData.status === 30 && tagData.version !== 'v1' && tagData.version
+      return status === 20 && version !== 'v1' && `${version}`.replace(/v/, '') > 1
+    },
     getReportStatus(e) {
       this.contentLoading = true
       this.monthlyReportIndex(e.id)