<template>
  <section class="gmList">
    <ai-list class="AppGridMember">
      <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" lazy :instance="instance"
                       :dict="dict" :permissions="permissions" v-on="$listeners"/>
          </el-tab-pane>
        </el-tabs>
      </template>
    </ai-list>
  </section>
</template>

<script>
import List from "./list";
import ApplyList from "./ApplyList";

export default {
  name: "gmList",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function
  },
  computed: {
    tabs() {
      return [
        {label: '网格员信息', name: 'List', comp: List, permission: ''},
        {label: '申报信息', name: 'ApplyList', comp: ApplyList, permission: 'app_appgirdmemberapply_detail'}
      ].filter(item => {
        return item.name !== 'ApplyList' || this.permissions(item.permission)
      })
    }
  },
  data() {
    return {
      currIndex: '0',
    }
  },
  methods: {},
  created() {
  }
}
</script>

<style lang="scss" scoped>
.gmList {
  height: 100%;
}
</style>
