103 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list v-if="!isShowDetail">
 | |
|     <template slot="title">
 | |
|       <ai-title title="居民群管理" :instance="instance" :disabledLevel="disabledLevel" isShowArea 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 :ref="tab.name" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions" :areaId="areaId"/>
 | |
|         </el-tab-pane>
 | |
|       </el-tabs>
 | |
|     </template>
 | |
|   </ai-list>
 | |
|   <Detail v-else-if="componentName === 'Detail'" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Detail>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
|   import List from './components/List.vue'
 | |
|   import Statistics from './components/Statistics'
 | |
|   import Tags from './components/Tags'
 | |
|   import Detail from './components/Detail'
 | |
|   import { mapState } from 'vuex'
 | |
| 
 | |
|   export default {
 | |
|     name: 'AppResidentGroupManage',
 | |
|     label: '居民群管理',
 | |
| 
 | |
|     components: {
 | |
|       List,
 | |
|       Tags,
 | |
|       Detail,
 | |
|       Statistics
 | |
|     },
 | |
| 
 | |
|     props: {
 | |
|       instance: Function,
 | |
|       dict: Object,
 | |
|       permissions: Function
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user']),
 | |
| 
 | |
|       tabs () {
 | |
|         const tabList = [
 | |
|           {label: '居民群列表', name: 'List', comp: List, permission: ''},
 | |
|           {label: '居民群统计', name: 'Statistics', comp: Statistics, permission: ''},
 | |
|           {label: '居民群标签', name: 'Tags', comp: Tags, permission: ''}
 | |
|         ].filter(item => {
 | |
|           return true
 | |
|         })
 | |
| 
 | |
|         return tabList
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     data () {
 | |
|       return {
 | |
|         activeName: 'JoinEvent',
 | |
|         currIndex: '0',
 | |
|         componentName: '',
 | |
|         params: {},
 | |
|         isShowDetail: false,
 | |
|         disabledLevel: 0,
 | |
|         areaId: ''
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.areaId = this.user.info.areaId
 | |
|       this.disabledLevel = this.user.info.areaList.length - 1
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       onChange (data) {
 | |
|         if (data.type === 'list') {
 | |
|           this.componentName = 'List'
 | |
|           this.isShowDetail = false
 | |
|           this.params = data.params
 | |
|         }
 | |
| 
 | |
|         if (data.type === 'detail') {
 | |
|           this.componentName = 'Detail'
 | |
|           this.isShowDetail = true
 | |
|           this.params = data.params
 | |
|         }
 | |
|       },
 | |
|       changeArea() {
 | |
|         if(this.componentName != 'Detail') {
 | |
|           var component = this.tabs[this.currIndex].name
 | |
|           this.$nextTick(() => {
 | |
|             this.$refs[component][0].getListInit()
 | |
|           })
 | |
|         }
 | |
|       },
 | |
|     },
 | |
|     
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| </style>
 |