@@ -77,3 +77,16 @@ export function resourceOverviewAnalysis (deptId, year) { | |||||
params: query | params: query | ||||
}) | }) | ||||
} | } | ||||
// 资源一张图-左中-资源类型分析 | |||||
export function resourceTypeAnalysis (deptId, year) { | |||||
let query = { | |||||
deptId, | |||||
year | |||||
} | |||||
return request({ | |||||
url: 'api/home/xixia/resource/zylxfx', | |||||
method: 'get', | |||||
params: query | |||||
}) | |||||
} |
@@ -1,10 +1,15 @@ | |||||
<Pannel title="资源类型分析" height="340"> | |||||
<Pannel title="资源类型分析" height="340" | |||||
v-loading="!isLoad" | |||||
element-loading-text="拼命加载中" | |||||
element-loading-spinner="el-icon-loading" | |||||
element-loading-background="rgba(0, 0, 0, 0.1)" | |||||
> | |||||
<div class="full"> | <div class="full"> | ||||
<div class="top"> | <div class="top"> | ||||
<PannelTabs @change="tabChange" :data="pannelTabData"></PannelTabs> | <PannelTabs @change="tabChange" :data="pannelTabData"></PannelTabs> | ||||
</div> | </div> | ||||
<div class="buttom"> | <div class="buttom"> | ||||
<Bar :color="['rgba(134, 91, 252, 1)', 'rgba(49, 129, 246, 1)']"></Bar> | |||||
<Bar v-if="isLoad" :data="data" :color="['rgba(134, 91, 252, 1)', 'rgba(49, 129, 246, 1)']"></Bar> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</Pannel> | </Pannel> |
@@ -1,15 +1,34 @@ | |||||
import Pannel from '@/components/pannel/index.vue'; | import Pannel from '@/components/pannel/index.vue'; | ||||
import PannelTabs from '@/components/pannel-tabs/index.vue'; | import PannelTabs from '@/components/pannel-tabs/index.vue'; | ||||
import Bar from '@/components/charts/bar/index.vue'; | import Bar from '@/components/charts/bar/index.vue'; | ||||
import { resourceTypeAnalysis } from '../../../../api/index.js' | |||||
import { mapGetters } from 'vuex'; | |||||
export default { | export default { | ||||
components: { | components: { | ||||
Bar, | Bar, | ||||
PannelTabs, | PannelTabs, | ||||
Pannel | Pannel | ||||
}, | }, | ||||
computed: { | |||||
...mapGetters(['year', 'deptId']) | |||||
}, | |||||
watch: { | |||||
year: { | |||||
handler () { | |||||
this.getData(); | |||||
}, | |||||
immediate: true, // 立即执行 | |||||
}, | |||||
deptId: { | |||||
handler () { | |||||
this.getData(); | |||||
}, | |||||
immediate: true, // 立即执行 | |||||
} | |||||
}, | |||||
data () { | data () { | ||||
return { | return { | ||||
isLoad: false, | |||||
pannelTabData: [ | pannelTabData: [ | ||||
{ | { | ||||
id: '1', | id: '1', | ||||
@@ -24,16 +43,31 @@ export default { | |||||
name: '未利用地' | name: '未利用地' | ||||
} | } | ||||
], | ], | ||||
data: [], | |||||
tabIndex: '1' | tabIndex: '1' | ||||
}; | }; | ||||
}, | }, | ||||
created () { | |||||
}, | |||||
mounted () { | |||||
}, | |||||
methods: { | 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) { | tabChange (info) { | ||||
this.tabIndex = info.id | this.tabIndex = info.id | ||||
this.getData(); | |||||
} | } | ||||
} | } | ||||
}; | }; |
@@ -52,7 +52,6 @@ export default { | |||||
if (this.year, this.deptId) { | if (this.year, this.deptId) { | ||||
this.isLoad = false; | this.isLoad = false; | ||||
resourceOverviewAnalysis(this.deptId, this.year).then(res => { | resourceOverviewAnalysis(this.deptId, this.year).then(res => { | ||||
console.log(222, res); | |||||
this.data[0].value = res.data.nyd | this.data[0].value = res.data.nyd | ||||
this.data[1].value = res.data.jsyd | this.data[1].value = res.data.jsyd | ||||
this.data[2].value = res.data.wlydjlm | this.data[2].value = res.data.wlydjlm | ||||