<template>
  <div>
    <a-card title="黑名单管理">
      <a-button type="primary" slot="extra" @click="$refs.eidt.show({blacklistType})">新增黑名单</a-button>

      <a-tabs v-model="blacklistType">
        <a-tab-pane tab="身份证" key="identity">
          <IdList ref="identity" @edit="handleEdit"></IdList>
        </a-tab-pane>

        <a-tab-pane tab="手机号" key="phone">
          <PhoneList ref="phone" @edit="handleEdit"></PhoneList>
        </a-tab-pane>
      </a-tabs>
    </a-card>

    <Edit ref="eidt" @update="handleUpdate"></Edit>
  </div>
</template>

<script>
import IdList from './IdList'
import PhoneList from './PhoneList'
import Edit from './Edit'

export default {
  components: {
    Edit,
    IdList,
    PhoneList
  },
  data () {
    return {
      blacklistType: 'identity'
    }
  },
  methods: {
    handleUpdate () {
      this.$refs[this.blacklistType].getList()
    },
    handleEdit (record) {
      this.$refs.eidt.show({ blacklistType: this.blacklistType, record })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
