<template>
  <div id="personnel">
    <personnelexpert-detail :info="info" :policyInfo="policyInfo"></personnelexpert-detail>
  </div>
</template>

<script>
import personnelexpertDetail from '@/components/personnel/personnelexpert.vue';
import { createNamespacedHelpers, mapGetters } from 'vuex';
const { mapActions: mapSite } = createNamespacedHelpers('site');
const { mapActions: mapNews } = createNamespacedHelpers('policieszhuanjia');
const { mapActions: mapColumn } = createNamespacedHelpers('policiesColumn');

export default {
  name: 'personnel',
  props: {},
  components: {
    personnelexpertDetail,
  },
  data: () => ({
    info: {},
    policyInfo: {},
  }),
  async created() {
    this.searchSite();
    this.searchInfo();
  },
  computed: {},
  methods: {
    ...mapSite(['showInfo']),
    ...mapNews({ newsList: 'query', newsInfo: 'fetch' }),
    ...mapColumn({ columnList: 'query', columnInfo: 'fetch' }),
    // 查询站点信息
    async searchSite() {
      let res = await this.showInfo();
      let object = JSON.parse(JSON.stringify(res.data));
      if (object) {
        this.$set(this, `info`, res.data);
      } else {
        this.$message.error(res.errmsg ? res.errmsg : 'error');
      }
    },
    async searchInfo() {
      let detailId = this.$route.query.id;
      const res = await this.newsInfo(detailId);
      this.$set(this, `policyInfo`, res.data);
    },
  },
};
</script>

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