洪海涛 4 жил өмнө
parent
commit
8787eb3a32

+ 21 - 34
src/views/monthlyReport/v2/childrenPage/editReport/components/core.vue

@@ -91,8 +91,7 @@
         <el-tabs
           v-model="activeName"
           :class="{'isBar':baseData.children.filter(elm => elm.title.search(/服务端|客户端/) < 0).length}"
-          @tab-click="handleClick"
-        >
+          @tab-click="handleClick">
           <el-tab-pane
             v-for="(item, index) in baseData.children"
             :key="item.domKey"
@@ -126,6 +125,7 @@
                 :base-data="item"
               />
             </span>
+
           </el-tab-pane>
         </el-tabs>
       </div>
@@ -144,8 +144,6 @@
 
 <script>
 import _ from 'lodash'
-import { mapState, mapMutations } from 'vuex'
-
 import headTitle from '@/components/headTitle'
 import contentDom from './content'
 import SubTitle from './SubTitle'
@@ -153,7 +151,7 @@ import PushAndBanck from './PushAndBanck'
 import OnlineQuestion from './OnlineQuestion'
 import Refresh from './Refresh'
 import { toChinesNum } from '@/utils'
-import markingIssues from '@/views/monthlyReport/v2/childrenPage/editReport/components/markingIssues'
+import markingIssues from '@/views/monthlyReport/v1/childrenPage/editReport/components/markingIssues'
 
 export default {
   name: 'Core',
@@ -200,27 +198,22 @@ export default {
       }
       return `${this.baseData.domIndexKey + 1}、`
     },
-    ...mapState('monthlyReportEdit', ['tabsActive', 'pageType', 'pageDate'])
-    // tabsActive() {
-    //   return this.$store.state.monthlyReportEdit.tabsActive
-    // },
-    // pageType() {
-    //   return this.$store.state.monthlyReportEdit.pageType
-    // },
-    // pageDate() {
-    //   return this.$store.state.monthlyReportEdit.pageDate
-    // }
+    tabsActive() {
+      return this.$store.state.monthlyReportEditV2.tabsActive
+    },
+    pageType() {
+      return this.$store.state.monthlyReportEditV2.pageType
+    },
+    pageDate() {
+      return this.$store.state.monthlyReportEditV2.pageDate
+    }
   },
   watch: {
     activeName(val, old) {
-      this.SUB_TABS_ACTIVE({
+      this.$store.commit('monthlyReportEditV2/SUB_TABS_ACTIVE', {
         key: val,
         oldKey: old
       })
-      // this.$store.commit('monthlyReportEdit/SUB_TABS_ACTIVE', {
-      //   key: val,
-      //   oldKey: old
-      // })
     },
     'baseData.content': {
       handler() {
@@ -231,13 +224,14 @@ export default {
     }
   },
   mounted() {
+    console.log(212)
     if (
       this.baseData &&
       this.baseData.children &&
       this.baseData.children.length &&
       this.baseData.children[0].type === 'Tag'
     ) {
-      // this.$store.commit('monthlyReportEdit/SUB_TABS_ACTIVE', this.baseData.children[0].domKey, this.activeName)
+      // this.$store.commit('monthlyReportEditV2/SUB_TABS_ACTIVE', this.baseData.children[0].domKey, this.activeName)
       this.$nextTick(() => {
         this.activeName = this.baseData.children[0].domKey
       })
@@ -246,7 +240,6 @@ export default {
     this.pushAndBanckheadle()
   },
   methods: {
-    ...mapMutations('monthlyReportEdit', ['GET_ALL_OFFSETTOP', 'INIT_EDIT_KEYS', 'SET_HEADER_TITLE', 'SUB_TABS_ACTIVE']),
     // 发布&回滚 标题设置
     pushAndBanckheadle() {
       const [elm] = this.baseData.content
@@ -269,17 +262,15 @@ export default {
       this.loading = true
       // console.log(tab, event)
       this.$nextTick(() => {
-        this.GET_ALL_OFFSETTOP()
-        // this.$store.commit('monthlyReportEdit/GET_ALL_OFFSETTOP')
-        this.INIT_EDIT_KEYS()
-        // this.$store.commit('monthlyReportEdit/INIT_EDIT_KEYS')
+        this.$store.commit('monthlyReportEditV2/GET_ALL_OFFSETTOP')
+        this.$store.commit('monthlyReportEditV2/INIT_EDIT_KEYS')
       })
       setTimeout(() => {
         this.domKey = new Date().getTime()
         this.loading = false
       }, 650)
       // const { name } = tab
-      // this.$store.commit('monthlyReportEdit/SUB_TABS_ACTIVE', this.baseData.children[0].domKey, this.activeName)
+      // this.$store.commit('monthlyReportEditV2/SUB_TABS_ACTIVE', this.baseData.children[0].domKey, this.activeName)
     },
     setHeader() {
       let title = `${this.baseData.title}`
@@ -289,14 +280,10 @@ export default {
       // }
       if (title.search(/\{param\}/) > -1) {
         this.headerTitle = this.generalDelayTitle(title)
-        this.SET_HEADER_TITLE({
+        this.$store.commit('monthlyReportEditV2/SET_HEADER_TITLE', {
           domKey: this.baseData.domKey,
           headerTitle: `${this.headerTitle}`
         })
-        // this.$store.commit('monthlyReportEdit/SET_HEADER_TITLE', {
-        //   domKey: this.baseData.domKey,
-        //   headerTitle: `${this.headerTitle}`
-        // })
         return
       }
       // 得到3的,得到23的
@@ -326,11 +313,11 @@ export default {
       if (newTitle.search(/提测打回|发版撤回|延期|增发/g) > -1) {
         newTitle = newTitle.replace(
           '{param}',
-          `<hhtem class="${test1 > 0 ? 'red' : ''}">${test1}</hhtem>`
+          `<hhtem class='${test1 > 0 ? 'red' : ''}'>${test1}</hhtem>`
         )
         newTitle = newTitle.replace(
           '{param}',
-          `<hhtem class="${test2 > 0 ? 'red' : ''}">${test2}</hhtem>`
+          `<hhtem class='${test2 > 0 ? 'red' : ''}'>${test2}</hhtem>`
         )
       } else {
         newTitle = newTitle.replace('{param}', `<hhtem>${test1}</hhtem>`)

+ 72 - 122
src/views/monthlyReport/v2/childrenPage/editReport/index.vue

@@ -4,7 +4,7 @@
     ref="pageWrapper"
     v-loading="loading"
     class="page-wrapper"
-    @click.stop="$store.commit('monthlyReportEditV2/INIT_EDIT_KEYS')"
+    @click.stop="$store.commit('monthlyReportEdit/INIT_EDIT_KEYS')"
   >
     <headerCom :key="subTitle" title="月报" :sub-title="subTitle" :address="address">
       <template v-if="pageDate" slot="content">
@@ -55,7 +55,7 @@
           >
             回退
           </el-button>
-          <el-dropdown v-else @command="returnReportFn">
+          <el-dropdown v-else @command="returnReport">
             <el-button size="small"> 回退<i class="el-icon-arrow-down el-icon--right" /> </el-button>
             <el-dropdown-menu slot="dropdown">
               <el-dropdown-item command="all">全部</el-dropdown-item>
@@ -167,7 +167,7 @@
       :show-dialog="false"
       :title="'邮件预览'"
       width="70%"
-      @succes="publishAllReportFn">
+      @succes="publishAllReport">
       <div class="report-delete" style="text-align: initial;min-height: 30vh;max-height: 70vh;overflow-y: scroll;">
         <!--        月报数据已检查无误,确认发布?-->
         <div v-if="monthlyReportPreView" style="" v-html="monthlyReportPreView.content" />
@@ -188,8 +188,7 @@
   </div>
 </template>
 
-<script type='text/javascript'>
-import { mapState, mapActions, mapMutations } from 'vuex'
+<script type="text/javascript">
 import headerCom from '../../components/header'
 import Affix from '@/components/affix/affix'
 import Anchor from './components/anchor'
@@ -231,8 +230,45 @@ export default {
       }
       return pathName
     },
-    // 使用对象展开运算符将 getter 混入 computed 对象中
-    ...mapState('monthlyReportEditV2', ['pageDate', 'tabPageData', 'subTitle', 'tabsList', 'tabsActive', 'treeData', 'subTabsActive', 'domKeys', 'offsetList', 'pageType', 'subReportInfo', 'roleCode', 'loading'])
+    pageDate() {
+      return this.$store.state.monthlyReportEditV2.pageDate
+    },
+    tabPageData() {
+      return this.$store.state.monthlyReportEditV2.tabPageData
+    },
+    subTitle() {
+      return this.$store.state.monthlyReportEditV2.subTitle
+    },
+    tabsList() {
+      return this.$store.state.monthlyReportEditV2.tabsList
+    },
+    tabsActive() {
+      return this.$store.state.monthlyReportEditV2.tabsActive
+    },
+    treeData() {
+      return this.$store.state.monthlyReportEditV2.treeData
+    },
+    subTabsActive() {
+      return this.$store.state.monthlyReportEditV2.subTabsActive
+    },
+    domKeys() {
+      return this.$store.state.monthlyReportEditV2.domKeys
+    },
+    offsetList() {
+      return this.$store.state.monthlyReportEditV2.offsetList
+    },
+    pageType() {
+      return this.$store.state.monthlyReportEditV2.pageType
+    },
+    subReportInfo() {
+      return this.$store.state.monthlyReportEditV2.subReportInfo
+    },
+    roleCode() {
+      return this.$store.state.monthlyReportEditV2.roleCode
+    },
+    loading() {
+      return this.$store.state.monthlyReportEditV2.loading
+    }
   },
   watch: {
     subTabsActive() {
@@ -240,17 +276,13 @@ export default {
     }
   },
   created() {
-    this.INIT_STATE_DATA()
-    // this.$store.commit('monthlyReportEditV2/INIT_STATE_DATA')
-    this.SET_LOADING(true)
-    // this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
+    this.$store.commit('monthlyReportEditV2/INIT_STATE_DATA')
+    this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
     this.indexShow = true
     // 默认获取用户权限
-    this.getUserPermission()
-    // this.$store.dispatch('monthlyReportEditV2/getUserPermission')
+    this.$store.dispatch('monthlyReportEditV2/getUserPermission')
     // 获取部门数据
-    this.setSelectEnum()
-    // this.$store.dispatch('monthlyReportEditV2/setSelectEnum')
+    this.$store.dispatch('monthlyReportEditV2/setSelectEnum')
   },
   mounted() {
     /*
@@ -260,8 +292,7 @@ export default {
      * editAll:编辑完整月报
      * */
     if (this.$route.query.pageType) {
-      this.SET_PAGE_TYPE(this.$route.query.pageType)
-      // this.$store.commit('monthlyReportEditV2/SET_PAGE_TYPE', this.$route.query.pageType)
+      this.$store.commit('monthlyReportEditV2/SET_PAGE_TYPE', this.$route.query.pageType)
     }
     // 获取部门数据;只有查看但业务线时,才需要单独获取部门数据
     // if (
@@ -275,21 +306,15 @@ export default {
     // }
     // 查看
     if (this.$route.query.pageType === 'readAll') {
-      this.SET_SUB_TITLE('查看完整月报')
-      // this.$store.commit('monthlyReportEditV2/SET_SUB_TITLE', '查看完整月报')
+      this.$store.commit('monthlyReportEditV2/SET_SUB_TITLE', '查看完整月报')
     }
 
     if (this.$route.query.reportId || this.$route.query.subReportId) {
-      this.initPageData({
+      this.$store.dispatch('monthlyReportEditV2/initPageData', {
         id: this.$route.query.reportId,
         subActive: this.$route.query.subActive,
         subReportId: this.$route.query.subReportId
       })
-      // this.$store.dispatch('monthlyReportEditV2/initPageData', {
-      //   id: this.$route.query.reportId,
-      //   subActive: this.$route.query.subActive,
-      //   subReportId: this.$route.query.subReportId
-      // })
       // this.getPageData(this.$route.query.reportId)
     }
     // setTimeout(() => {
@@ -298,17 +323,13 @@ export default {
   },
   destroyed() {
     this.indexShow = false
-    this.INIT_STATE_DATA()
-    // this.$store.commit('monthlyReportEditV2/INIT_STATE_DATA')
+    this.$store.commit('monthlyReportEditV2/INIT_STATE_DATA')
     // 判断当前页面是否为新建页面
     if (this.$route.query.type && this.$route.query.type === 'create') {
-      this.deleteReport({ isMsg: false })
-      // this.$store.dispatch('monthlyReportEditV2/deleteReport', { isMsg: false })
+      this.$store.dispatch('monthlyReportEditV2/deleteReport', { isMsg: false })
     }
   },
   methods: {
-    ...mapMutations('monthlyReportEditV2', ['INIT_STATE_DATA', 'SET_LOADING', 'SET_PAGE_TYPE', 'SET_SUB_TITLE', 'INIT_EDIT_KEYS']),
-    ...mapActions('monthlyReportEditV2', ['getUserPermission', 'setSelectEnum', 'initPageData', 'deleteReport', 'upDateReport', 'upDateSubReport', 'confirmReport', 'publishAllReport', 'tabActiveChange', 'sendReport', 'returnReport']),
     setInit() {
       // this.$store.commit('monthlyReportEditV2/INIT_EDIT_KEYS')
       // window.addEventListener('click', () => {
@@ -389,14 +410,11 @@ export default {
     },
     // 月报更新
     upDateReport(key = 'cb', confirmReportBack) {
-      this.SET_LOADING(true)
-      // this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
-      const method = this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'
-      this[method](() => {
+      this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
+      this.$store.dispatch(`monthlyReportEditV2/${this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'}`, () => {
         confirmReportBack && confirmReportBack()
         if (!confirmReportBack) {
-          this.SET_LOADING(false)
-          // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
+          this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
         }
         if (key === 'cb') {
           window.log({ c: 'report_edit', d: 'report_edit_save' })
@@ -404,98 +422,56 @@ export default {
           // this.$router.push({ path: '/monthlyReport/index' })
         }
       })
-      // this.$store.dispatch(`monthlyReportEditV2/${this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'}`, () => {
-      //   confirmReportBack && confirmReportBack()
-      //   if (!confirmReportBack) {
-      //     this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-      //   }
-      //   if (key === 'cb') {
-      //     window.log({ c: 'report_edit', d: 'report_edit_save' })
-      //     this.$message.success('保存成功!')
-      //     // this.$router.push({ path: '/monthlyReport/index' })
-      //   }
-      // })
     },
     // 月报确认
     confirmReport() {
       this.$refs['dialogConfirm'].visible = false
       this.upDateReport('nocb', () => {
-        this.confirmReport({
+        this.$store.dispatch('monthlyReportEditV2/confirmReport', {
           id: this.$route.query.subReportId,
           callback: () => {
             window.log({ c: 'report_edit', d: 'report_edit_confirm' })
-            this.SET_LOADING(false)
-            // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
+            this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
             this.$router.push({ path: '/monthlyReport/index' })
           }
         })
-        // this.$store.dispatch('monthlyReportEditV2/confirmReport', {
-        //   id: this.$route.query.subReportId,
-        //   callback: () => {
-        //     window.log({ c: 'report_edit', d: 'report_edit_confirm' })
-        //     this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-        //     this.$router.push({ path: '/monthlyReport/index' })
-        //   }
-        // })
       })
     },
     // 删除月报
     deleteReport(key) {
       this.$refs['dialogDelete'].visible = false
       if (key === '删除') {
-        this.deleteReport({
+        this.$store.dispatch('monthlyReportEditV2/deleteReport', {
           key,
           callback: () => {
             window.log({ c: 'report_edit', d: 'report_edit_delete' })
             this.$router.push({ path: '/monthlyReport/index' })
           }
         })
-        // this.$store.dispatch('monthlyReportEditV2/deleteReport', {
-        //   key,
-        //   callback: () => {
-        //     window.log({ c: 'report_edit', d: 'report_edit_delete' })
-        //     this.$router.push({ path: '/monthlyReport/index' })
-        //   }
-        // })
       } else {
         // this.$message('删除操作已取消!')
       }
     },
     // 月报发布确认
-    publishAllReportFn(key) {
+    publishAllReport(key) {
       this.$refs['dialogPublishAll'].visible = false
-      this.SET_LOADING(true)
-      // this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
-      this.publishAllReport({
+      this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
+      this.$store.dispatch('monthlyReportEditV2/publishAllReport', {
         id: this.$route.query.reportId,
         callback: () => {
           window.log({ c: 'report_edit', d: 'report_edit_push' })
-          this.SET_LOADING(false)
-          // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
+          this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
           this.$router.push({ path: '/monthlyReport/index' })
         }
       })
-      // this.$store.dispatch('monthlyReportEditV2/publishAllReport', {
-      //   id: this.$route.query.reportId,
-      //   callback: () => {
-      //     window.log({ c: 'report_edit', d: 'report_edit_push' })
-      //     this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-      //     this.$router.push({ path: '/monthlyReport/index' })
-      //   }
-      // })
     },
     tabClick(tab, event) {
       this.bodyLoading = true
-      this.tabActiveChange({
+      this.$store.dispatch('monthlyReportEditV2/tabActiveChange', {
         ...this.$route.query,
         id: this.$route.query.reportId,
         tabsActive: tab.name
       })
-      // this.$store.dispatch('monthlyReportEditV2/tabActiveChange', {
-      //   ...this.$route.query,
-      //   id: this.$route.query.reportId,
-      //   tabsActive: tab.name
-      // })
       setTimeout(() => {
         this.bodyLoading = false
       }, 700)
@@ -512,21 +488,8 @@ export default {
         // this.$message('发送操作已取消!')
         return
       }
-      this.SET_LOADING(true)
-      // this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
-      this.sendReport({
-        id: this.$route.query.reportId,
-        callback: () => {
-          setTimeout(() => {
-            window.log({ c: 'report_edit', d: 'report_edit_send' })
-            this.SET_LOADING(false)
-            // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-            // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-            this.$router.push({ path: '/monthlyReport/index' })
-          }, 500)
-        }
-      })
-      /* this.$store.dispatch('monthlyReportEditV2/sendReport', {
+      this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
+      this.$store.dispatch('monthlyReportEditV2/sendReport', {
         id: this.$route.query.reportId,
         callback: () => {
           setTimeout(() => {
@@ -536,23 +499,22 @@ export default {
             this.$router.push({ path: '/monthlyReport/index' })
           }, 500)
         }
-      })*/
+      })
       // this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
       /* this.upDateReport('nocb', () => {
         this.$store.dispatch('monthlyReportEditV2/sendReport', {
           id: this.$route.query.reportId,
           callback: () => {
             this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
-            // this.$store.commit('monthlyReportEdit/SET_LOADING', false)
+            // this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
             this.$router.push({ path: '/monthlyReport/index' })
           }
         })
       }) */
     },
     // 月报退回
-    returnReportFn(command) {
-      this.SET_LOADING(true)
-      // this.$store.commit('monthlyReportEdit/SET_LOADING', true)
+    returnReport(command) {
+      this.$store.commit('monthlyReportEditV2/SET_LOADING', true)
       let list = []
       if (command === 'all') {
         list = this.subReportInfo.map((elm) => {
@@ -564,29 +526,17 @@ export default {
       if (command === 'only' && this.$route.query.subReportId) {
         list = [Number.parseInt(this.$route.query.subReportId)]
       }
-      this.returnReport({
+      this.$store.dispatch('monthlyReportEditV2/returnReport', {
         data: {
           subReportIds: list
         },
         callback: () => {
           window.log({ c: 'report_edit', d: 'report_edit_return' })
-          this.SET_LOADING(false)
-          // this.$store.commit('monthlyReportEdit/SET_LOADING', false)
+          this.$store.commit('monthlyReportEditV2/SET_LOADING', false)
           this.$message.success('退回成功!')
           this.$router.push({ path: '/monthlyReport/index' })
         }
       })
-      /* this.$store.dispatch('monthlyReportEdit/returnReport', {
-        data: {
-          subReportIds: list
-        },
-        callback: () => {
-          window.log({ c: 'report_edit', d: 'report_edit_return' })
-          this.$store.commit('monthlyReportEdit/SET_LOADING', false)
-          this.$message.success('退回成功!')
-          this.$router.push({ path: '/monthlyReport/index' })
-        }
-      })*/
     },
     // 月报预览
     async setMonthlyReportPreView() {
@@ -598,7 +548,7 @@ export default {
   }
 }
 </script>
-<style scoped lang='less'>
+<style scoped lang="less">
 @import '../../style';
 // setscroll
 .set_scroll {