Files
dvcp_v2_webapp/project/pingchang/apps/AppCommunityManagement/AppCommunityManagement.vue
yanran200730 3279bdb348 返乡登记
2022-12-06 14:08:40 +08:00

101 lines
2.3 KiB
Vue

<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="社区管理" :isShowArea="(currIndex == 0)" :isShowBottomBorder="false" v-model="areaId" :instance="instance" @change="onAreaChange"></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="String(i)" 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="component === 'Detail'" :params="params" :instance="instance" :dict="dict" @change="onChange"></Detail>
</template>
<script>
import List from './components/List.vue'
import Statistics from './components/Statistics'
import Detail from './components/Detail'
import { mapState } from 'vuex'
export default {
name: 'AppCommunityManagement',
label: '社区管理',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
isShowDetail: false,
currIndex: 0,
areaId: ''
}
},
components: {
Detail,
List,
Statistics
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
{label: '社区管理', name: 'List', comp: List },
{label: '管理统计', name: 'Statistics', comp: Statistics }
]
return tabList
}
},
created () {
this.areaId = this.user.info.areaId
},
methods: {
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
this.isShowDetail = true
}
if (data.type === 'Statistics') {
this.component = 'Statistics'
this.params = data.params
this.isShowDetail = false
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.isShowDetail = false
}
},
onAreaChange () {
this.$refs[this.currIndex][0].changeArea()
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>