<template>
  <div id="edit">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-button type="primary" size="mini" @click="back()">返回</el-button>
        </el-col>
        <el-col :span="24" class="two">
          <el-tabs v-model="active" type="card">
            <el-tab-pane label="保安员基本信息" name="first">
              <basic-data @basicBtn="basicBtn"></basic-data>
            </el-tab-pane>
            <el-tab-pane label="其他信息" name="second">
              <other-data :basic_id="basic_id"></other-data>
            </el-tab-pane>
          </el-tabs>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import basicData from '../../security/baybm/addParts/basic-1.vue';
import otherData from '../../security/baybm/addParts/other-1.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'edit',
  props: {},
  components: {
    basicData,
    otherData,
  },
  data: function () {
    return {
      active: 'first',
      basic_id: '',
    };
  },
  created() {},
  methods: {
    // 信息创建成功，保存基本信息
    basicBtn(data) {
      this.$set(this, `basic_id`, data.id);
    },
    // 返回
    back() {
      this.$router.push({ path: '/adminPolice/information/bayxxwh' });
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .one {
    text-align: right;
    margin: 10px 0;
  }
}
</style>
