<template>
  <basic-container>
    <el-tabs type="border-card" @tab-click="handleClick">
      <el-tab-pane v-if="permission.keypwd_view" label="網點鎖匙/密碼/實物交接登記表" name="keypwd">
        <div v-if="activeTab == 'keypwd'">
          <confirmed-keypwd></confirmed-keypwd>
        </div>
      </el-tab-pane>
      <el-tab-pane v-if="permission.sealhandover_view" label="業務印章交接登記表" name="sealhandover">
        <div v-if="activeTab == 'sealhandover'">
          <confirmed-sealhandover></confirmed-sealhandover>
        </div>
      </el-tab-pane>

      <el-tab-pane v-if="permission.postchange_view" label="網點出納主管及專管員崗位變更記錄表" name="postchange">
        <div v-if="activeTab == 'postchange'">
          <confirmed-postchange></confirmed-postchange>
        </div>
      </el-tab-pane>
      <el-tab-pane v-if="permission.goodsuse_view" label="網點各項憑證/實物使用及出入庫" name="goodsuse">
        <div v-if="activeTab == 'goodsuse'">
          <confirmed-goodsuse></confirmed-goodsuse>
        </div>
      </el-tab-pane>
      <el-tab-pane v-if="permission.returns_view" label="新開戶退件登記表" name="returns">
        <div v-if="activeTab == 'returns'">
          <confirmed-returns></confirmed-returns>
        </div>
      </el-tab-pane>
      <el-tab-pane v-if="permission.cardswallow_view" label="自助設備吞卡資料" name="cardswallow">
        <div v-if="activeTab == 'cardswallow'">
          <confirmed-cardswallow></confirmed-cardswallow>
        </div>
      </el-tab-pane>
    </el-tabs>
  </basic-container>
</template>

<script>
  import {mapGetters} from "vuex";
  import ConfirmedPostchange from "@/components/confirmed/confirmed-postchange";
  import ConfirmedGoodsuse from "@/components/confirmed/confirmed-goodsuse";
  import ConfirmedReturns from "../../components/confirmed/confirmed-returns";
  import ConfirmedCardswallow from "../../components/confirmed/confirmed-cardswallow";
  import ConfirmedKeypwd from "../../components/confirmed/confirmed-keypwd";
  import ConfirmedSealhandover from "../../components/confirmed/confirmed-sealhandover";

  export default {
    components: {
      ConfirmedSealhandover,
      ConfirmedKeypwd, ConfirmedCardswallow, ConfirmedReturns, ConfirmedGoodsuse, ConfirmedPostchange},
    data() {
      return {
        activeTab: "keypwd",
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.notice_add, false),
          viewBtn: this.vaildData(this.permission.notice_view, false),
          delBtn: this.vaildData(this.permission.notice_delete, false),
          editBtn: this.vaildData(this.permission.notice_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    mounted() {
      this.$nextTick(() => {
        document.getElementById("tab-keypwd").click();
      })
    },
    methods: {
      handleClick(tab, event) {
        this.activeTab = tab.name;
      }
    }
  };
</script>

<style>
</style>
