<template>
  <div id="unit">
    <view-form :fields="fields" :data="form"> </view-form>
  </div>
</template>

<script>
const _ = require('lodash');
import viewForm from './util/view-form.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('company_information');
export default {
  name: 'unit',
  props: {},
  components: { viewForm },
  data: function () {
    return {
      form: {},
      fields: [
        {
          label: '申请单位名称',
          model: 'company',
        },
        {
          label: '申请单位所属市县(区)',
          model: 'belong_city',
        },
        {
          label: '申请单位详细地址',
          model: 'belong_city_detailed',
        },
        // {
        //   label: '保安服务许可证号',
        //   model: 'company_xkzpzwh',
        // },
        {
          label: '学校或职业培训机构的批准机关',
          model: 'approval_office',
        },
        {
          label: '批准文号',
          model: 'approval_num',
        },
      ],
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    ...mapActions(['fetch']),
    async init() {
      const res = await this.fetch({ company_id: this.id });
      if (this.$checkRes(res)) {
        if (res.data) this.$set(this, 'form', res.data);
      }
    },
  },
  computed: {
    id() {
      return this.$route.query.id;
    },
  },
};
</script>

<style lang="less" scoped></style>
