Files
dvcp_v2_webapp/packages/publicity/AppContentInfo/AppContentInfo.vue

129 lines
3.9 KiB
Vue
Raw Normal View History

2021-12-18 17:16:42 +08:00
<template>
2022-03-18 13:47:30 +08:00
<ai-list v-if="!isShowDetail">
<template slot="title">
2023-06-05 16:04:14 +08:00
<ai-title :title="moduleName" :isShowBottomBorder="false" :hideLevel="user.info.areaList.length - 1" :isShowArea="true" v-model="areaId" :instance="instance" @change="onAreaChange"></ai-title>
2022-03-18 13:47:30 +08:00
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :areaId="areaId" :moduleName="moduleName" :moduleId="moduleId" :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Add v-else-if="component === 'Add'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
<Detail v-else-if="component === 'Detail'" :moduleName="moduleName" :moduleId="moduleId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Detail>
2023-02-20 10:13:27 +08:00
<Comment v-else-if="component === 'Comment'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Comment>
2021-12-18 17:16:42 +08:00
</template>
<script>
import List from './components/List'
import Add from './components/Add'
2023-02-20 10:13:27 +08:00
import Comment from './components/Comment'
2021-12-18 17:16:42 +08:00
import Detail from './components/Detail'
2022-03-18 13:47:30 +08:00
import Audit from './components/Audit'
import { mapState } from 'vuex'
2021-12-18 17:16:42 +08:00
export default {
name: 'AppContentInfo',
label: '内容发布',
props: {
instance: Function,
2022-03-18 13:47:30 +08:00
dict: Object,
permissions: Function
2021-12-18 17:16:42 +08:00
},
data () {
return {
2022-03-18 13:47:30 +08:00
areaId: '',
2021-12-18 17:16:42 +08:00
component: 'List',
params: {},
moduleId: '',
2021-12-24 20:01:48 +08:00
include: [],
2022-03-18 13:47:30 +08:00
moduleName: '',
tabs: [],
currIndex: '0',
isShowDetail: false
2021-12-18 17:16:42 +08:00
}
},
components: {
Add,
List,
2022-03-18 13:47:30 +08:00
Audit,
2023-02-20 10:13:27 +08:00
Comment,
2021-12-18 17:16:42 +08:00
Detail
},
2022-03-18 13:47:30 +08:00
computed: {
...mapState(['user'])
},
2021-12-21 15:31:49 +08:00
created () {
2021-12-18 17:16:42 +08:00
this.moduleId = this.$route.query.moduleId
2022-03-18 13:47:30 +08:00
this.areaId = this.user.info.areaId
2021-12-24 20:01:48 +08:00
this.instance.post('/app/appcontentmoduleinfo/queryDetailById?id=' + this.$route.query.moduleId).then(res => {
if (res.code === 0) {
this.moduleName = res.data.moduleName
2022-03-18 13:47:30 +08:00
this.tabs = [
{label: this.moduleName, name: 'List', comp: List, permission: ''},
2022-03-18 14:30:56 +08:00
{label: `${this.moduleName}审核`, name: 'Audit', comp: Audit, permission: 'app_appcontentinfo_examine'}
2022-03-18 13:47:30 +08:00
].filter(item => {
2022-03-18 14:30:56 +08:00
return item.name !== 'Audit' || (res.data.needExamine === '1' && item.name === 'Audit' && this.permissions(item.permission))
2022-03-18 13:47:30 +08:00
})
2021-12-24 20:01:48 +08:00
}
})
2021-12-18 17:16:42 +08:00
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
2022-03-18 13:47:30 +08:00
this.isShowDetail = true
2021-12-18 17:16:42 +08:00
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
2023-02-20 10:13:27 +08:00
this.isShowDetail = Comment
2021-12-18 17:16:42 +08:00
}
2022-03-18 13:47:30 +08:00
if (data.type === 'Audit') {
this.component = 'Audit'
2021-12-18 17:16:42 +08:00
this.params = data.params
2022-03-18 13:47:30 +08:00
this.isShowDetail = false
}
2021-12-18 17:16:42 +08:00
2022-03-18 13:47:30 +08:00
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.isShowDetail = false
2021-12-18 17:16:42 +08:00
}
2023-02-20 10:13:27 +08:00
if (data.type === 'Comment') {
this.component = 'Comment'
this.params = data.params
this.isShowDetail = true
}
2022-03-18 13:47:30 +08:00
},
onAreaChange () {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
2021-12-18 17:16:42 +08:00
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>