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

<script>
import personnelworkDetail from '@/components/personnel/personnelwork.vue';
import { createNamespacedHelpers, mapGetters } from 'vuex';
const { mapActions: mapSite } = createNamespacedHelpers('site');
const { mapActions: mapNews } = createNamespacedHelpers('policiesxinxi');

export default {
  name: 'personnel',
  props: {},
  components: {
    personnelworkDetail,
  },
  data: () => ({
    policyInfo: {},
    info: {},
  }),
  async created() {
    this.searchSite();
    this.searchInfo();
  },
  computed: {},
  methods: {
    ...mapSite(['showInfo']),
    ...mapNews({ newsList: 'query', newsInfo: '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);
      console.log(res.data);
    },
  },
};
</script>

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