95 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list v-if="!isShowDetail">
 | |
|     <template slot="title">
 | |
|       <ai-title title="居民管理" :isShowBottomBorder="false"></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="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>
 | |
|   <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: 'AppResidentManage',
 | |
|     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
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       if (this.$route.query.id) {
 | |
|         this.componentName = this.$route.query?.type
 | |
|         this.params = {id: this.$route.query?.id}
 | |
|         this.isShowDetail = true
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     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
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| </style>
 |