diff --git a/src/views/resources/api/index.js b/src/views/resources/api/index.js index 1893420..20d70be 100644 --- a/src/views/resources/api/index.js +++ b/src/views/resources/api/index.js @@ -77,3 +77,16 @@ export function resourceOverviewAnalysis (deptId, year) { params: query }) } + +// 资源一张图-左中-资源类型分析 +export function resourceTypeAnalysis (deptId, year) { + let query = { + deptId, + year + } + return request({ + url: 'api/home/xixia/resource/zylxfx', + method: 'get', + params: query + }) +} diff --git a/src/views/resources/comps/left/middle/1/index.html b/src/views/resources/comps/left/middle/1/index.html index d50f843..29b5ebd 100644 --- a/src/views/resources/comps/left/middle/1/index.html +++ b/src/views/resources/comps/left/middle/1/index.html @@ -1,10 +1,15 @@ - +
- +
\ No newline at end of file diff --git a/src/views/resources/comps/left/middle/1/index.js b/src/views/resources/comps/left/middle/1/index.js index 583a715..4cf8ff5 100644 --- a/src/views/resources/comps/left/middle/1/index.js +++ b/src/views/resources/comps/left/middle/1/index.js @@ -1,15 +1,34 @@ import Pannel from '@/components/pannel/index.vue'; import PannelTabs from '@/components/pannel-tabs/index.vue'; import Bar from '@/components/charts/bar/index.vue'; - +import { resourceTypeAnalysis } from '../../../../api/index.js' +import { mapGetters } from 'vuex'; export default { components: { Bar, PannelTabs, Pannel }, + computed: { + ...mapGetters(['year', 'deptId']) + }, + watch: { + year: { + handler () { + this.getData(); + }, + immediate: true, // 立即执行 + }, + deptId: { + handler () { + this.getData(); + }, + immediate: true, // 立即执行 + } + }, data () { return { + isLoad: false, pannelTabData: [ { id: '1', @@ -24,16 +43,31 @@ export default { name: '未利用地' } ], + data: [], tabIndex: '1' }; }, - created () { - }, - mounted () { - }, methods: { + getData () { + if (this.year, this.deptId) { + this.isLoad = false; + resourceTypeAnalysis(this.deptId, this.year).then(res => { + if (this.tabIndex == 1) { + this.data = res.data.nyd + + } else if (this.tabIndex == 2) { + this.data = res.data.jsyd + + } else if (this.tabIndex == 3) { + this.data = res.data.wlydjlm + } + this.isLoad = true; + }) + } + }, tabChange (info) { this.tabIndex = info.id + this.getData(); } } }; diff --git a/src/views/resources/comps/left/top/1/index.js b/src/views/resources/comps/left/top/1/index.js index 40718dc..9b98377 100644 --- a/src/views/resources/comps/left/top/1/index.js +++ b/src/views/resources/comps/left/top/1/index.js @@ -52,7 +52,6 @@ export default { if (this.year, this.deptId) { this.isLoad = false; resourceOverviewAnalysis(this.deptId, this.year).then(res => { - console.log(222, res); this.data[0].value = res.data.nyd this.data[1].value = res.data.jsyd this.data[2].value = res.data.wlydjlm