master
parent
63ecb9f8a2
commit
ccb7f05960
@ -0,0 +1,17 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function pieChart(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/other/area-dengjimianji",
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function lineChart(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/other/dengjimianji",
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 查询配置 -->
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<LxHeader
|
||||
:icon="$route.meta.icon"
|
||||
:text="$route.meta.title"
|
||||
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
|
||||
>
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<DatePicker v-model="year" type="year" formatter="yyyy"></DatePicker>
|
||||
|
||||
</slot>
|
||||
|
||||
</LxHeader>
|
||||
</div>
|
||||
</div>
|
||||
<lineChart1 :year="year" id="line-chart1" width="100%" height="300px"></lineChart1>
|
||||
<pieChart :year="year" id="pie-chart" style="margin-top: 20px;" width="100%" height="300px"></pieChart>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LxHeader from '@/components/LxHeader';
|
||||
import lineChart1 from '@/views/statics/component/lineChart1.vue'
|
||||
import lineChart from '@/views/statics/component/lineChart.vue'
|
||||
import pieChart from '@/views/statics/component/pieChart.vue'
|
||||
export default {
|
||||
components: {
|
||||
lineChart,
|
||||
LxHeader,
|
||||
lineChart1,
|
||||
pieChart
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
year: new Date()
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,215 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<div :id="id" :class="className" :style="{height:height,width:width}" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { lineChart } from "@/api/statics"
|
||||
import { index } from "@/api/system/baseForm";
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/components/Charts/mixins/resize'
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
props: {
|
||||
year: Date,
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '200px'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '200px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
data: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getData().then(_ => {
|
||||
this.initChart()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
async getData () {
|
||||
const res = await lineChart({ year: this.year.getFullYear() });
|
||||
this.data = res;
|
||||
},
|
||||
initChart() {
|
||||
this.chart = echarts.init(document.getElementById(this.id))
|
||||
this.setOption()
|
||||
},
|
||||
setOption () {
|
||||
this.chart.setOption({
|
||||
backgroundColor: '#394056',
|
||||
title: {
|
||||
top: 20,
|
||||
text: '资产入账统计',
|
||||
textStyle: {
|
||||
fontWeight: 'normal',
|
||||
fontSize: 16,
|
||||
color: '#F1F1F3'
|
||||
},
|
||||
left: '1%'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
lineStyle: {
|
||||
color: '#57617B'
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
top: 20,
|
||||
icon: 'rect',
|
||||
itemWidth: 14,
|
||||
itemHeight: 5,
|
||||
itemGap: 13,
|
||||
data: ['土地数量','房产数量'],
|
||||
right: '4%',
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: '#F1F1F3'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
top: 100,
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
bottom: '2%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#57617B'
|
||||
}
|
||||
},
|
||||
data: Array.from({ length: 12 }, (val, idx) => `${idx + 1}月`),
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: 'm²',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#57617B'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 10,
|
||||
textStyle: {
|
||||
fontSize: 14
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#57617B'
|
||||
}
|
||||
}
|
||||
}],
|
||||
series: [{
|
||||
name: '土地数量',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'circle',
|
||||
symbolSize: 5,
|
||||
showSymbol: false,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
areaStyle: {
|
||||
normal: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
||||
offset: 0,
|
||||
color: 'rgba(137, 189, 27, 0.3)'
|
||||
}, {
|
||||
offset: 0.8,
|
||||
color: 'rgba(137, 189, 27, 0)'
|
||||
}], false),
|
||||
shadowColor: 'rgba(0, 0, 0, 0.1)',
|
||||
shadowBlur: 10
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(137,189,27)',
|
||||
borderColor: 'rgba(137,189,2,0.27)',
|
||||
borderWidth: 12
|
||||
|
||||
}
|
||||
},
|
||||
data: this.data.map(item => item.tudi)
|
||||
},{
|
||||
name: '房产数量',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'circle',
|
||||
symbolSize: 5,
|
||||
showSymbol: false,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
areaStyle: {
|
||||
normal: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
||||
offset: 0,
|
||||
color: 'rgba(27,189,170,0.3)'
|
||||
}, {
|
||||
offset: 0.8,
|
||||
color: 'rgba(137, 189, 27, 0)'
|
||||
}], false),
|
||||
shadowColor: 'rgba(0, 0, 0, 0.1)',
|
||||
shadowBlur: 10
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(27,159,189)',
|
||||
borderColor: 'rgba(2,189,183,0.27)',
|
||||
borderWidth: 12
|
||||
|
||||
}
|
||||
},
|
||||
data: this.data.map(item => item.fangwu)
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
year() {
|
||||
this.getData().then(_ => {
|
||||
this.initChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<div :id="id" :class="className" :style="{height:height,width:width}" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { pieChart } from "@/api/statics"
|
||||
import { index } from "@/api/system/baseForm";
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/components/Charts/mixins/resize'
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
props: {
|
||||
year: Date,
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '200px'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '200px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wxAreas: [
|
||||
"宜兴市",
|
||||
"惠山区",
|
||||
"新吴区",
|
||||
"梁溪区",
|
||||
"江阴市",
|
||||
"滨湖区",
|
||||
"锡山区",
|
||||
],
|
||||
chart: null,
|
||||
data: { houseList:[], landList:[] },
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getData().then(() => {
|
||||
this.initChart()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
async getData () {
|
||||
const res = await pieChart({ year: this.year.getFullYear() })
|
||||
console.log(res)
|
||||
this.data = res;
|
||||
},
|
||||
initChart() {
|
||||
this.chart = echarts.init(document.getElementById(this.id))
|
||||
this.setOption()
|
||||
},
|
||||
setOption () {
|
||||
this.chart.setOption({
|
||||
title: [
|
||||
{
|
||||
text: "房产资产",
|
||||
left: '20%'
|
||||
},
|
||||
{
|
||||
text: "土地资产",
|
||||
left: '70%'
|
||||
}
|
||||
],
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c}m² ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
left: 'center',
|
||||
top: 'bottom',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '房产资产',
|
||||
type: 'pie',
|
||||
radius: ['35%', '60%'],
|
||||
center: ['25%', '50%'],
|
||||
itemStyle: {
|
||||
borderRadius: 10
|
||||
},
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
data: this.data.houseList
|
||||
},
|
||||
{
|
||||
name: '土地资产',
|
||||
type: 'pie',
|
||||
radius: ['35%', '60%'],
|
||||
center: ['75%', '50%'],
|
||||
itemStyle: {
|
||||
borderRadius: 5
|
||||
},
|
||||
data: this.data.landsList
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
year () {
|
||||
this.getData().then(() => {
|
||||
this.initChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in new issue