import Pannel from '@/components/pannel/index.vue';
import ScrollTable from '@/components/scroll-table-details/index.vue';
import { resourceDisposalWarning } from '../../../../api/index.js';
import { mapGetters } from 'vuex';
export default {
  components: {
    ScrollTable,
    Pannel
  },
  computed: {
    ...mapGetters(['year', 'deptId'])
  },
  watch: {
    year: {
      handler () {
        this.getData();
      },
      immediate: true, // 立即执行
    },
    deptId: {
      handler () {
        this.getData();
      },
      immediate: true, // 立即执行
    }
  },
  data () {
    return {
      isLoad: false,
      headers: ['部门', '资产名称', '资产类别', '申请日期', '处置类型'],
      data: [
        ['部门', '资产名称', '资产类别', '申请日期', '处置类型']
      ],
      dataName: ['bookName', 'assetName', 'assetType', 'applyAt', 'assetStatus']
    };
  },
  methods: {
    lineClick1 (val) {
      console.log(val)
      this.$emit('clickDetail', val, '1')
    },
    getData () {
      if (this.year, this.deptId) {
        this.isLoad = false;
        resourceDisposalWarning(this.deptId, this.year).then(res => {
          let data = res.rows;
          this.data = data;
          this.isLoad = true;
        })
      }
    }
  }
};
