村民圈

This commit is contained in:
yanran200730
2022-02-17 16:25:45 +08:00
parent 512e30a84b
commit c80ef26ad5
5 changed files with 329 additions and 73 deletions

View File

@@ -1,66 +1,105 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="村民圈" :isShowBottomBorder="false" :instance="instance" v-model="areaId" @change="changeArea"></ai-title>
</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>
</template>
<script>
import List from './components/List'
import List from './components/List.vue'
import CommentsList from './components/CommentsList'
import CommentsDetail from './components/CommentsDetail'
import Detail from './components/Detail'
import { mapState } from 'vuex'
export default {
name: 'AppVillagersCircle',
label: '村民圈',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
CommentsDetail,
CommentsList,
List,
Detail
},
mounted () {
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
{label: '村民圈列表', name: 'List', comp: List, permission: ''},
{label: '评论列表', name: 'CommentsList', comp: CommentsList, permission: ''}
]
return tabList
}
},
data () {
return {
currIndex: '0',
componentName: '',
params: {},
areaId: '',
isShowDetail: false
}
},
created() {
this.areaId = this.user.info.areaId
},
methods: {
changeArea () {
this.$nextTick(() => {
this.$refs[this.tabs[Number(this.currIndex)].name][0].getList()
})
},
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
if (data.type === 'List') {
this.componentName = 'List'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'CommentsList') {
this.componentName = 'CommentsList'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
if (data.type === 'Detail') {
this.componentName = 'Detail'
this.isShowDetail = true
this.params = data.params
}
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
if (data.type === 'CommentsDetail') {
this.componentName = 'Statistics'
this.isShowDetail = true
this.params = data.params
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
<style lang="scss" scoped>
</style>