Files
dvcp_v2_webapp/project/shandong10086/apps/shandong/AppVillagersCircle/AppVillagersCircle.vue

106 lines
2.8 KiB
Vue
Raw Normal View History

2022-02-15 10:37:01 +08:00
<template>
2022-02-17 16:25:45 +08:00
<ai-list v-if="!isShowDetail">
<template slot="title">
2022-02-18 13:43:37 +08:00
<ai-title title="村民圈" isShowArea :isShowBottomBorder="false" :instance="instance" v-model="areaId" @change="changeArea"></ai-title>
2022-02-17 16:25:45 +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" :ref="tab.name" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" />
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Detail v-else-if="componentName === 'Detail'" :params="params" :instance="instance" :dict="dict" @change="onChange"></Detail>
<CommentsDetail v-else-if="componentName === 'CommentsDetail'" :areaId="areaId" :params="params" :instance="instance" :dict="dict" @change="onChange"></CommentsDetail>
2022-02-15 10:37:01 +08:00
</template>
<script>
2022-02-17 16:25:45 +08:00
import List from './components/List.vue'
import CommentsList from './components/CommentsList'
import CommentsDetail from './components/CommentsDetail'
2022-02-15 10:37:01 +08:00
import Detail from './components/Detail'
2022-02-17 16:25:45 +08:00
import { mapState } from 'vuex'
2022-02-15 10:37:01 +08:00
export default {
name: 'AppVillagersCircle',
label: '村民圈',
2022-02-17 16:25:45 +08:00
components: {
CommentsDetail,
CommentsList,
List,
Detail
},
2022-02-15 10:37:01 +08:00
props: {
instance: Function,
2022-02-17 16:25:45 +08:00
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
2022-02-17 17:39:17 +08:00
{label: '信息审核', name: 'List', comp: List, permission: ''},
{label: '评论审核', name: 'CommentsList', comp: CommentsList, permission: ''}
2022-02-17 16:25:45 +08:00
]
return tabList
}
2022-02-15 10:37:01 +08:00
},
data () {
return {
2022-02-17 16:25:45 +08:00
currIndex: '0',
componentName: '',
2022-02-15 10:37:01 +08:00
params: {},
2022-02-17 16:25:45 +08:00
areaId: '',
isShowDetail: false
2022-02-15 10:37:01 +08:00
}
},
2022-02-17 16:25:45 +08:00
created() {
this.areaId = this.user.info.areaId
2022-02-15 10:37:01 +08:00
},
methods: {
2022-02-17 16:25:45 +08:00
changeArea () {
this.$nextTick(() => {
this.$refs[this.tabs[Number(this.currIndex)].name][0].getList()
})
},
2022-02-15 10:37:01 +08:00
onChange (data) {
2022-02-17 16:25:45 +08:00
if (data.type === 'List') {
this.componentName = 'List'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'CommentsList') {
this.componentName = 'CommentsList'
this.isShowDetail = false
2022-02-15 10:37:01 +08:00
this.params = data.params
}
2022-02-17 16:25:45 +08:00
if (data.type === 'Detail') {
this.componentName = 'Detail'
this.isShowDetail = true
2022-02-15 10:37:01 +08:00
this.params = data.params
2022-02-17 16:25:45 +08:00
}
2022-02-15 10:37:01 +08:00
2022-02-17 16:25:45 +08:00
if (data.type === 'CommentsDetail') {
2022-02-18 13:49:02 +08:00
this.componentName = 'CommentsDetail'
2022-02-17 16:25:45 +08:00
this.isShowDetail = true
this.params = data.params
2022-02-15 10:37:01 +08:00
}
}
}
}
</script>
2022-02-17 16:25:45 +08:00
<style lang="scss" scoped>
2022-02-15 10:37:01 +08:00
</style>