<template> <div class="container"> <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> <el-tab-pane label="权重分配" name="permWeight"> <list-perm-weight ref="listPermWeight"/> </el-tab-pane> <el-tab-pane label="指标数量" name="targetNum"> <list-target-num ref="listTargetNum"/> </el-tab-pane> </el-tabs> </div> </template> <script> import ListPermWeight from './listPermWeight' import ListTargetNum from './listTargetNum' export default { name: 'PermManage', components: { ListPermWeight, ListTargetNum }, data() { return { activeName: 'permWeight' } }, created() { // 如果路径里带参数,自己解析deviceType参数 // if (window.location.href) { // const params = parseUrl(window.location.href) // if (params && params.deviceType) { // this.changeTab(params.deviceType) // } else { // this.caclActive() // } // } }, methods: { // 处理Tab点击事件,每次点击更新数据 handleClick(tab, event) { debugger if (tab.name === 'permWeight') { this.$refs.listPermWeight.fetchData() } else if (tab.name === 'targetNum') { this.$refs.listTargetNum.fetchData() } }, changeTab(deviceType) { if (deviceType === '1') { this.activeName = 'wellcover' } else if (deviceType === '2') { this.activeName = 'liquid' } else if (deviceType === '3') { this.activeName = 'harmful' } else if (deviceType === '4') { this.activeName = 'gas' } else if (deviceType === '5') { this.activeName = 'temp' } else if (deviceType === '6') { this.activeName = 'dig' } else if (deviceType === '7') { this.activeName = 'wellloca' } else if (deviceType === '8') { this.activeName = 'liquidgas' } else if (deviceType === '9') { this.activeName = 'kkjLocaData' } }, // 计算那个是当前第一个tab caclActive() { // if (hasPermission('/welldata/list')) { // this.activeName = 'wellcover' // } else if (hasPermission('/liquiddata/list')) { // this.activeName = 'liquid' // } else if (hasPermission('/gasdata/list')) { // this.activeName = 'gas' // } else if (hasPermission('/digdata/list')) { // this.activeName = 'dig' // } else if (hasPermission('/harmfuldata/list')) { // this.activeName = 'harmful' // } else if (hasPermission('/tempdata/list')) { // this.activeName = 'temp' // } else if (hasPermission('/welllocadata/list')) { // this.activeName = 'wellloca' // } else if (hasPermission('/liquidGasData/list')) { // this.activeName = 'liquidgas' // } } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .container{ padding: 5px; } </style>