洪海涛 4 роки тому
батько
коміт
5e9eefa183

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

@@ -253,3 +253,14 @@ export function getHistoryDetail(params) {
     params
   })
 }
+
+// 月报历史记录详情
+export function getAnalyticFeedback(data) {
+  return request({
+    url: projectManagementUrl + '/monthlyReport/getAnalyticFeedback',
+    // url: 'http://127.0.0.1:4523/mock/368525/monthlyReport/getHistoryDetail',
+    method: 'post',
+    timeout: '100000',
+    data
+  })
+}

+ 68 - 31
src/views/monthlyReport/childrenPage/editReport/components/MrTable/index.vue

@@ -305,7 +305,7 @@ import markingIssues from '../markingIssues'
 import CascaderSingle from '../CascaderSingle'
 import CascaderSingleInfo from '../CascaderSingleInfo'
 import searchPeople from '@/components/select/searchPeople' // 人员select
-import { updateAnalyticFeedback, getDeptCharge } from '@/api/qualityMonthlyReport/edit'
+import { updateAnalyticFeedback, getDeptCharge, getAnalyticFeedback } from '@/api/qualityMonthlyReport/edit'
 import { reportDataBack } from '@/store/modules/monthlyReport/utils'
 // import { getDeptByKeyWord } from '@/api/qualityMonthlyReport'
 
@@ -443,13 +443,14 @@ export default {
   //   }
   // },
   mounted() {
+    console.log(this.subReportInfo)
     this.$nextTick(() => {
-      this.setExpandRowKeys()
+      this.setAnalyticFeedbackTitle()
       this.init()
     })
     setTimeout(() => {
       if (!this.analyticFeedback) {
-        this.setAnalyticFeedback()
+        this.setAnalyticFeedbackTitle()
       }
     }, 3000)
   },
@@ -671,40 +672,73 @@ export default {
         return [0, 0]
       }
     },
+    getTableObjAndVersion() {
+      const tabPageData = reportDataBack(_.cloneDeep(this.tabPageData))
+      let version = ''
+      let obj = null
+      const run = (arr) => {
+        arr.forEach((elm) => {
+          console.log(elm, '分析反馈')
+          if (elm.domKey === this.domKey) {
+            if (!version) {
+              version = elm.domKey
+            }
+            obj = _.cloneDeep(elm)
+          }
+          if (elm.content.length) {
+            elm.content.forEach((item) => {
+              if (item.domKey === this.domKey) {
+                // console.log(elm)
+                obj = _.cloneDeep(elm)
+              }
+            })
+          }
+          if (elm.children.length) {
+            run(elm.children)
+          }
+        })
+      }
+      run(tabPageData.children)
+      return { obj, version }
+    },
+    // 更新分析反馈信息title
+    async setAnalyticFeedbackTitle() {
+      const { obj } = this.getTableObjAndVersion()
+      let subReportId = ''
+      // 根据找到的业务线名称查询业务线ID
+      this.subReportInfo && this.subReportInfo.length && this.subReportInfo.forEach(elm => {
+        if (elm.reportName === obj.title) {
+          subReportId = elm.id
+        }
+      })
+      const res = await getAnalyticFeedback({
+        subReportId
+      })
+      if (res.code === 200) {
+        this.analyticFeedback = res.data
+        if (this.analyticFeedback.search(/yellow/) > -1) {
+          this.analyticFeedback = this.analyticFeedback.replace(
+            /yellow/g,
+            '#FAAD14'
+          )
+        }
+        if (this.analyticFeedback.search(/green/) > -1) {
+          this.analyticFeedback = this.analyticFeedback.replace(
+            /green/g,
+            '#7ED321'
+          )
+        }
+      }
+    },
     // 查看页面数据分析
     setAnalyticFeedback(key = '', feedbackCharge = '') {
-      let version = this.version + ''
       if (
         // this.pageType.search(/edit/) < 0 &&
         // this.pageDate.status > 10 &&
         // this.tabsActive.indexOf('本月重点问题') > -1
         this.isExpand
       ) {
-        const tabPageData = reportDataBack(_.cloneDeep(this.tabPageData))
-        let obj = null
-        const run = (arr) => {
-          arr.forEach((elm) => {
-            console.log(elm, '分析反馈')
-            if (elm.domKey === this.domKey) {
-              if (!version) {
-                version = elm.domKey
-              }
-              obj = _.cloneDeep(elm)
-            }
-            if (elm.content.length) {
-              elm.content.forEach((item) => {
-                if (item.domKey === this.domKey) {
-                  // console.log(elm)
-                  obj = _.cloneDeep(elm)
-                }
-              })
-            }
-            if (elm.children.length) {
-              run(elm.children)
-            }
-          })
-        }
-        run(tabPageData.children)
+        const { obj, version } = this.getTableObjAndVersion()
         const params = {
           reportId: this.$route.query.reportId,
           subReportName: this.subReportName,
@@ -715,14 +749,17 @@ export default {
         }
         if (this.$route.query.pageType === 'readAll' && obj) {
           params.subReportName = `${obj.title}`
+          // 获取查看完整月报状态下的子月报ID的version
+          params.version = version || ''
+        } else {
+          // 获取查看单个子月报状态下的子月报ID的version
+          params.version = this.version || ''
         }
-        // console.log(params)
         // 提交数据
         if (obj && obj.content[0].tableRows.length) {
           if (key && key === 'feedbackType') {
             params[key] = 'feedback_commit'
           }
-          params.version = version || ''
           updateAnalyticFeedback(params).then((res) => {
             if (res.code === 200) {
               this.analyticFeedback = res.data

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

@@ -85,7 +85,6 @@
         </el-button>
       </template>
     </headerCom>
-    version: {{ version }}
     <div class="content-wrapper">
       <el-tabs v-if="pageType.search(/All/) > -1" :value="tabsActive" @tab-click="tabClick">
         <el-tab-pane v-for="item in tabsList" :key="item.name" :label="item.label" :name="item.name" />