88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list class="AppDeviceConfig">
 | |
|     <template slot="title">
 | |
|       <ai-title title="设备配置" :isShowBottomBorder="false" :fullname.sync="areaName" 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" :permissions="permissions"/>
 | |
|         </el-tab-pane>
 | |
|       </el-tabs>
 | |
|     </template>
 | |
|   </ai-list>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
|   import eyeList from './components/eyeList.vue'
 | |
|   import videoList from './components/videoList.vue'
 | |
|   import { mapState } from 'vuex'
 | |
| 
 | |
|   export default {
 | |
|     name: 'AppDeviceConfig',
 | |
|     label: '设备配置',
 | |
| 
 | |
|     components: {
 | |
|       eyeList,
 | |
|       videoList,
 | |
|     },
 | |
| 
 | |
|     props: {
 | |
|       instance: Function,
 | |
|       dict: Object,
 | |
|       permissions: Function
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user']),
 | |
| 
 | |
|       tabs () {
 | |
|         const tabList = [
 | |
|           {label: '千里眼', name: 'eyeList', comp: eyeList, permission: ''},
 | |
|           {label: '视联网', name: 'videoList', comp: videoList, permission: ''}
 | |
|         ]
 | |
| 
 | |
|         return tabList
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     data () {
 | |
|       return {
 | |
|         currIndex: '0',
 | |
|         component: 'eyeList',
 | |
|         params: {},
 | |
|         areaId: '',
 | |
|         areaName: ''
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.areaId = this.user.info.areaId
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       onChange (data) {
 | |
|         this.component = data.type
 | |
|         this.params = data.params
 | |
| 
 | |
|         this.$nextTick(() => {
 | |
|           if (data.isRefresh) {
 | |
|             this.$refs.component.getList()
 | |
|           }
 | |
|         })
 | |
|         
 | |
|       },
 | |
| 
 | |
|       onAreaChange () {
 | |
|         this.$refs[this.currIndex][0].changeArea()
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
|   .AppDeviceConfig {
 | |
|     height: 100%;
 | |
|   }
 | |
| </style>
 |