Переглянути джерело

月报设置:子月报保存

洪海涛 4 роки тому
батько
коміт
3a42bd9059

+ 2 - 2
src/api/qualityMonthlyReport/edit.js

@@ -34,9 +34,9 @@ export function updateMonthlyReport(data) {
 }
 
 // 仅更新子月报
-export function updatSettingMonthlyReport(data) {
+export function updateSubReport(data) {
   return request({
-    url: projectManagementUrl + '/monthlyReport/updatSetting',
+    url: projectManagementUrl + '/monthlyReport/subReport/update',
     method: 'post',
     data
   })

+ 39 - 14
src/store/modules/monthlyReport/edit/index.js

@@ -10,7 +10,8 @@ import {
   returnReport,
   sendSubConfirm,
   publishReport,
-  getSubReportInfo
+  getSubReportInfo,
+  updateSubReport
 } from '@/api/qualityMonthlyReport/edit'
 import { getAvaliableInfo } from '@/api/qualityMonthlyReport'
 
@@ -463,7 +464,11 @@ export default {
           }
           console.log(elm.reportName)
           // 如果是
-          if (elm.status === 30) {
+          if (elm.status === 10) {
+            state.subTitle = `确认月报|${elm.reportName}`
+          } else if (elm.status === 20) {
+            state.subTitle = `发布月报|${elm.reportName}`
+          } else if (elm.status === 30) {
             state.subTitle = `查看|${elm.reportName}`
           } else {
             state.subTitle = `${elm.statueStr}|${elm.reportName}`
@@ -570,8 +575,28 @@ export default {
         }, 700)
       }
     },
+    // 子月报更新
+    async upDateSubReport({ state }, callback) {
+      const params = _.cloneDeep(state.pageDate)
+      params.reportCatalog = {
+        children: _.cloneDeep(state.tabPageData.children),
+        content: [],
+        depth: 0,
+        fromUser: false,
+        hiddenAncestor: null,
+        isVisible: true,
+        subTitles: null,
+        title: params.reportName,
+        type: 'Tag'
+      }
+      params.reportCatalog = reportDataBack(params.reportCatalog)
+      const res = await updateSubReport(params)
+      if (res.code === 200) {
+        callback()
+      }
+    },
     // 月报更新
-    async upDateReport({ commit, state }, cb) {
+    async upDateReport({ dispatch, state }, callback) {
       const params = _.cloneDeep(state.pageDate)
       const tabPageData = _.cloneDeep(state.tabPageData)
       const tabsActive = setTabActive('tab_', state.tabsActive)
@@ -588,7 +613,7 @@ export default {
       // 转换数据结构
       const res = await updateMonthlyReport(params)
       if (res.code === 200) {
-        cb()
+        callback()
       }
     },
     // 获取部门数据
@@ -601,49 +626,49 @@ export default {
       }
     },
     // 删除月报
-    async deleteReport({ commit, state, context }, { key, cb }) {
+    async deleteReport({ commit, state, context }, { key, callback }) {
       const res = await delMonthlyReport(state.pageDate.id)
       if (res.code === 200) {
         message.success('删除成功!')
-        cb()
+        callback()
       }
     },
     // 月报发送
-    async sendReport({ commit, state, context }, { id, cb }) {
+    async sendReport({ commit, state, context }, { id, callback }) {
       const res = await sendConfirm({
         id
       })
       if (res.code === 200) {
         message.success('发送成功!')
-        cb()
+        callback()
       }
     },
     // 月报发布
-    async publishAllReport({ commit, state, context }, { id, cb }) {
+    async publishAllReport({ commit, state, context }, { id, callback }) {
       const res = await publishReport({
         id
       })
       if (res.code === 200) {
         message.success('发布成功!')
-        cb()
+        callback()
       }
     },
     // 月报确认
     async confirmReport({ state }, {
-      id, cb
+      id, callback
     }) {
       const res = await sendSubConfirm({
         subReportId: id
       })
       if (res.code === 200) {
-        cb()
+        callback()
       }
     },
     // 月报回退
-    async returnReport({ commit, state, context }, { data, cb }) {
+    async returnReport({ commit, state, context }, { data, callback }) {
       const res = await returnReport(data)
       if (res.code === 200) {
-        cb()
+        callback()
       }
     },
     // 获取用户月报操作区域权限

+ 8 - 8
src/views/monthlyReport/childrenPage/editReport/index.vue

@@ -16,7 +16,7 @@
           v-if="pageDate && pageDate.status < 20 && (roleCode === 100 || roleCode === 50 || roleCode === 0)"
           type="primary"
           size="small"
-          @click="upDateReport"
+          @click="upDateReport('cb')"
           >保存
         </el-button>
         <el-button
@@ -24,7 +24,7 @@
           type="primary"
           size="small"
           @click="confirmReport"
-          >确认
+          >月报确认
         </el-button>
         <el-button
           v-if="pageDate && pageDate.status < 10 && (roleCode === 100 || roleCode === 0)"
@@ -363,7 +363,7 @@ export default {
     },
     // 月报更新
     upDateReport(key = 'cb') {
-      this.$store.dispatch('monthlyReportEdit/upDateReport', () => {
+      this.$store.dispatch(`monthlyReportEdit/${this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'}`, () => {
         if (key === 'cb') {
           this.$router.push({ path: '/monthlyReport/index' })
         }
@@ -374,7 +374,7 @@ export default {
       this.upDateReport('nocb')
       this.$store.dispatch('monthlyReportEdit/confirmReport', {
         id: this.$route.query.subReportId,
-        cb: () => {
+        callback: () => {
           this.$router.push({ path: '/monthlyReport/index' })
         }
       })
@@ -384,7 +384,7 @@ export default {
       if (key === '删除') {
         this.$store.dispatch('monthlyReportEdit/deleteReport', {
           key,
-          cb: () => {
+          callback: () => {
             this.$router.push({ path: '/monthlyReport/index' })
           }
         })
@@ -395,7 +395,7 @@ export default {
     publishAllReport(key) {
       this.$store.dispatch('monthlyReportEdit/publishAllReport', {
         id: this.$route.query.reportId,
-        cb: () => {
+        callback: () => {
           this.$router.push({ path: '/monthlyReport/index' })
         }
       })
@@ -419,7 +419,7 @@ export default {
       this.upDateReport('nocb')
       this.$store.dispatch('monthlyReportEdit/sendReport', {
         id: this.$route.query.reportId,
-        cb: () => {
+        callback: () => {
           this.$router.push({ path: '/monthlyReport/index' })
         }
       })
@@ -441,7 +441,7 @@ export default {
         data: {
           subReportIds: list
         },
-        cb: () => {
+        callback: () => {
           this.$message.success('退回成功!')
           this.$router.push({ path: '/monthlyReport/index' })
         }