|
@@ -189,6 +189,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script type='text/javascript'>
|
|
|
+import { mapState, mapMutations, mapActions } from 'vuex'
|
|
|
import headerCom from '../../components/header'
|
|
|
import Affix from '@/components/affix/affix'
|
|
|
import Anchor from './components/anchor'
|
|
@@ -230,45 +231,9 @@ export default {
|
|
|
}
|
|
|
return pathName
|
|
|
},
|
|
|
- pageDate() {
|
|
|
- return this.$store.state.monthlyReportEdit.pageDate
|
|
|
- },
|
|
|
- tabPageData() {
|
|
|
- return this.$store.state.monthlyReportEdit.tabPageData
|
|
|
- },
|
|
|
- subTitle() {
|
|
|
- return this.$store.state.monthlyReportEdit.subTitle
|
|
|
- },
|
|
|
- tabsList() {
|
|
|
- return this.$store.state.monthlyReportEdit.tabsList
|
|
|
- },
|
|
|
- tabsActive() {
|
|
|
- return this.$store.state.monthlyReportEdit.tabsActive
|
|
|
- },
|
|
|
- treeData() {
|
|
|
- return this.$store.state.monthlyReportEdit.treeData
|
|
|
- },
|
|
|
- subTabsActive() {
|
|
|
- return this.$store.state.monthlyReportEdit.subTabsActive
|
|
|
- },
|
|
|
- domKeys() {
|
|
|
- return this.$store.state.monthlyReportEdit.domKeys
|
|
|
- },
|
|
|
- offsetList() {
|
|
|
- return this.$store.state.monthlyReportEdit.offsetList
|
|
|
- },
|
|
|
- pageType() {
|
|
|
- return this.$store.state.monthlyReportEdit.pageType
|
|
|
- },
|
|
|
- subReportInfo() {
|
|
|
- return this.$store.state.monthlyReportEdit.subReportInfo
|
|
|
- },
|
|
|
- roleCode() {
|
|
|
- return this.$store.state.monthlyReportEdit.roleCode
|
|
|
- },
|
|
|
- loading() {
|
|
|
- return this.$store.state.monthlyReportEdit.loading
|
|
|
- }
|
|
|
+ ...mapState('monthlyReportEdit',
|
|
|
+ ['pageDate', 'tabPageData', 'subTitle', 'tabsList', 'tabsActive', 'treeData', 'subTabsActive', 'domKeys', 'offsetList', 'pageType', 'subReportInfo', 'roleCode', 'loading']
|
|
|
+ )
|
|
|
},
|
|
|
watch: {
|
|
|
subTabsActive() {
|
|
@@ -276,17 +241,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.$store.commit('monthlyReportEdit/INIT_STATE_DATA')
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
+ this.INIT_STATE_DATA()
|
|
|
+ this.SET_LOADING(true)
|
|
|
this.indexShow = true
|
|
|
// 默认获取用户权限
|
|
|
- this.$store.dispatch('monthlyReportEdit/getUserPermission')
|
|
|
+ this.getUserPermission()
|
|
|
// 获取部门数据
|
|
|
- this.$store.dispatch('monthlyReportEdit/setSelectEnum')
|
|
|
+ this.setSelectEnum()
|
|
|
},
|
|
|
mounted() {
|
|
|
- // 切换页面版本
|
|
|
- // this.$store.dispatch('monthlyReportEdit/setMonthlyReportPageVersion', { self: this })
|
|
|
/*
|
|
|
* read: 查看子月报
|
|
|
* readAll:查看完整月报
|
|
@@ -294,44 +257,36 @@ export default {
|
|
|
* editAll:编辑完整月报
|
|
|
* */
|
|
|
if (this.$route.query.pageType) {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_PAGE_TYPE', this.$route.query.pageType)
|
|
|
+ this.SET_PAGE_TYPE(this.$route.query.pageType)
|
|
|
}
|
|
|
- // 获取部门数据;只有查看但业务线时,才需要单独获取部门数据
|
|
|
- // if (
|
|
|
- // this.$route.query.pageType === 'readAll' &&
|
|
|
- // this.$route.query.reportId
|
|
|
- // ) {
|
|
|
- // this.$store.dispatch(
|
|
|
- // 'monthlyReportEdit/setSelectEnum',
|
|
|
- // this.$route.query.reportId
|
|
|
- // )
|
|
|
- // }
|
|
|
// 查看
|
|
|
if (this.$route.query.pageType === 'readAll') {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_SUB_TITLE', '查看完整月报')
|
|
|
+ this.SET_SUB_TITLE('查看完整月报')
|
|
|
}
|
|
|
|
|
|
if (this.$route.query.reportId || this.$route.query.subReportId) {
|
|
|
- this.$store.dispatch('monthlyReportEdit/initPageData', {
|
|
|
+ this.initPageData({
|
|
|
id: this.$route.query.reportId,
|
|
|
subActive: this.$route.query.subActive,
|
|
|
subReportId: this.$route.query.subReportId
|
|
|
})
|
|
|
- // this.getPageData(this.$route.query.reportId)
|
|
|
}
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
- // }, 1000)
|
|
|
},
|
|
|
destroyed() {
|
|
|
this.indexShow = false
|
|
|
- this.$store.commit('monthlyReportEdit/INIT_STATE_DATA')
|
|
|
+ this.INIT_STATE_DATA()
|
|
|
// 判断当前页面是否为新建页面
|
|
|
if (this.$route.query.type && this.$route.query.type === 'create') {
|
|
|
- this.$store.dispatch('monthlyReportEdit/deleteReport', { isMsg: false })
|
|
|
+ this.deleteReport({ isMsg: false })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations('monthlyReportEdit',
|
|
|
+ ['INIT_STATE_DATA', 'SET_LOADING', 'SET_PAGE_TYPE', 'SET_SUB_TITLE']
|
|
|
+ ),
|
|
|
+ ...mapActions('monthlyReportEdit',
|
|
|
+ ['getUserPermission', 'deleteReport', 'setSelectEnum', 'initPageData', 'upDateReport', 'upDateSubReport', 'confirmReport']
|
|
|
+ ),
|
|
|
setInit() {
|
|
|
// this.$store.commit('monthlyReportEdit/INIT_EDIT_KEYS')
|
|
|
// window.addEventListener('click', () => {
|
|
@@ -412,16 +367,16 @@ export default {
|
|
|
},
|
|
|
// 月报更新
|
|
|
upDateReport(key = 'cb', confirmReportBack) {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
- this.$store.dispatch(`monthlyReportEdit/${this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'}`, () => {
|
|
|
+ this.SET_LOADING(true)
|
|
|
+ const method = this.pageType.search(/All/) > -1 ? 'upDateReport' : 'upDateSubReport'
|
|
|
+ this[method](() => {
|
|
|
confirmReportBack && confirmReportBack()
|
|
|
if (!confirmReportBack) {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
+ this.SET_LOADING(false)
|
|
|
}
|
|
|
if (key === 'cb') {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_save' })
|
|
|
this.$message.success('保存成功!')
|
|
|
- // this.$router.push({ path: '/monthlyReport/index' })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -433,7 +388,7 @@ export default {
|
|
|
id: this.$route.query.subReportId,
|
|
|
callback: () => {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_confirm' })
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
+ this.SET_LOADING(false)
|
|
|
this.$router.push({ path: '/monthlyReport/index' })
|
|
|
}
|
|
|
})
|
|
@@ -443,7 +398,7 @@ export default {
|
|
|
deleteReport(key) {
|
|
|
this.$refs['dialogDelete'].visible = false
|
|
|
if (key === '删除') {
|
|
|
- this.$store.dispatch('monthlyReportEdit/deleteReport', {
|
|
|
+ this.deleteReport({
|
|
|
key,
|
|
|
callback: () => {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_delete' })
|
|
@@ -457,12 +412,12 @@ export default {
|
|
|
// 月报发布确认
|
|
|
publishAllReport(key) {
|
|
|
this.$refs['dialogPublishAll'].visible = false
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
+ this.SET_LOADING(true)
|
|
|
this.$store.dispatch('monthlyReportEdit/publishAllReport', {
|
|
|
id: this.$route.query.reportId,
|
|
|
callback: () => {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_push' })
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
+ this.SET_LOADING(false)
|
|
|
this.$router.push({ path: '/monthlyReport/index' })
|
|
|
}
|
|
|
})
|
|
@@ -490,33 +445,21 @@ export default {
|
|
|
// this.$message('发送操作已取消!')
|
|
|
return
|
|
|
}
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
+ this.SET_LOADING(true)
|
|
|
this.$store.dispatch('monthlyReportEdit/sendReport', {
|
|
|
id: this.$route.query.reportId,
|
|
|
callback: () => {
|
|
|
setTimeout(() => {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_send' })
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
- // this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
+ this.SET_LOADING(false)
|
|
|
this.$router.push({ path: '/monthlyReport/index' })
|
|
|
}, 500)
|
|
|
}
|
|
|
})
|
|
|
- // this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
- /* this.upDateReport('nocb', () => {
|
|
|
- this.$store.dispatch('monthlyReportEdit/sendReport', {
|
|
|
- id: this.$route.query.reportId,
|
|
|
- callback: () => {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
- // this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
- this.$router.push({ path: '/monthlyReport/index' })
|
|
|
- }
|
|
|
- })
|
|
|
- }) */
|
|
|
},
|
|
|
// 月报退回
|
|
|
returnReport(command) {
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', true)
|
|
|
+ this.SET_LOADING(true)
|
|
|
let list = []
|
|
|
if (command === 'all') {
|
|
|
list = this.subReportInfo.map((elm) => {
|
|
@@ -534,7 +477,7 @@ export default {
|
|
|
},
|
|
|
callback: () => {
|
|
|
window.log({ c: 'report_edit', d: 'report_edit_return' })
|
|
|
- this.$store.commit('monthlyReportEdit/SET_LOADING', false)
|
|
|
+ this.SET_LOADING(false)
|
|
|
this.$message.success('退回成功!')
|
|
|
this.$router.push({ path: '/monthlyReport/index' })
|
|
|
}
|