You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.7 KiB

<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" :text="bookName" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
</lx-header>
</div>
<div class="wrap" :style="{'height':mapHeight+'px'}">
<echartsLine v-if="showCharts" ref="echartsLine1" :rotate="60" :color="['#147d38','#333']" :lineDataX='monthX' :lineDataY='monthY'>
</echartsLine>
</div>
</div>
</template>
<script>
import echartsLine from "@/views/jsc/components/echartsLine.vue";
import {
getBooks
} from "@/api/book.js"
export default {
components: {
echartsLine
},
data() {
return {
bookName: '',
tableNames: '',
mapHeight: 0,
monthX: [],
monthY: [],
showCharts:false,
tableNameObjs: {
number: 'disabilities',
drug: 'medicines',
children: 'childrens',
help: 'assists',
health: 'communities',
student: 'students',
education: 'educations',
raise: 'raises',
cars: 'fuels',
address: 'starts_addresses',
starts: 'starts_subsidys',
reform:'reforms'
},
bookTypeObjs: {
number: '残疾人证统计',
drug: '免费服药统计',
children: '儿童康复统计',
help: '辅具适配统计',
health: '社区康复统计',
student: '优秀学生奖学金统计',
education: '教育专项统计',
raise: '托养统计',
cars: '燃油补贴统计',
address: '创业场地补贴统计',
starts: '创业补贴统计',
reform:'无障碍改造统计'
}
}
},
created() {
this.initHeight()
if (this.$route.path) {
let path = this.$route.path.split("_")[1]
console.log(path)
for (var k in this.bookTypeObjs) {
if (path == k) {
this.bookName = this.bookTypeObjs[k]
}
}
for (var k in this.tableNameObjs) {
if (path == k) {
this.tableNames = this.tableNameObjs[k]
this.getCharts()
}
}
}
},
methods: {
initHeight() {
let winHeight = document.body.clientHeight
this.mapHeight = winHeight - 50 - 20
},
async getCharts(){
const res = await getBooks({
table_name: this.tableNames,
})
for(var m of res){
this.monthX.push(m.month)
this.monthY.push(m.total)
}
this.showCharts = true
}
},
}
</script>
<style>
.wrap {
width: 100%;
}
</style>