import Pannel from '@/components/pannel/index.vue';
import ScrollTable from '@/components/scroll-table-details/index.vue';
import { mapGetters } from 'vuex';
import { contractPaymentDueWarning } from '../../../../api/index.js';
export default {
  components: {
    ScrollTable,
    Pannel
  },
  data () {
    return {
      isLoad: false,
      headers: ['部门', '合同编码', '合同名称', '预结款日期', '结款金额'],
      data: [],
      dataName: ['deptName', 'code', 'name', 'settlementDate', 'settlementAmount']
    };
  },
  computed: {
    ...mapGetters(['year', 'deptId'])
  },
  watch: {
    year: {
      handler () {
        this.getData();
      },
      immediate: true, // 立即执行
    },
    deptId: {
      handler () {
        this.getData();
      },
      immediate: true, // 立即执行
    }
  },
  created () {
  },
  mounted () {
  },
  methods: {
    lineClick1 (val) {
      console.log(val + 222222222222)
      this.$emit('clickDetail', val, '4')
    },
    getData () {
      if (this.year, this.deptId) {
        this.isLoad = false;
        contractPaymentDueWarning(this.deptId, this.year).then(res => {
          let data = res.data;
          this.data = data;
          this.isLoad = true;
        })
      }
    },
  }
};
