import BlockValue from '@/components/value/index.vue'; import data from './data.js'; import { debtAnalysis } from '../../../api/index.js' import { mapGetters } from 'vuex'; export default { components: { BlockValue }, computed: { ...mapGetters(['year', 'deptId']) }, watch: { year: { handler () { this.getData(); }, immediate: true, // 立即执行 }, deptId: { handler () { this.getData(); }, immediate: true, // 立即执行 } }, data () { return { data }; }, created () { }, mounted () { }, methods: { getData () { if (this.year, this.deptId) { this.isLoad = false; debtAnalysis(this.deptId, this.year, this.type).then(res => { this.data[0][0].value = res.data.dqjk this.data[0][1].value = res.data.yfk this.data[0][2].value = res.data.yfgz this.data[1][0].value = res.data.yflwf this.data[1][1].value = res.data.cqjkjyfk this.data[1][2].value = res.data.ysyyzj this.data[1][3].value = res.data.zxyfk this.isLoad = true; }) } } } };