城阳pc工作端前端代码
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.

209 lines
5.5 KiB

2 years ago
<template>
<div>
<div class="visualizing laonianren">
<div class="visualizing-item">
2 years ago
<div>
<data-title title="老年人年龄统计" />
</div>
<div id="lnrLeftChart" style="height: 400px"></div>
</div>
<div class="visualizing-item">
2 years ago
<div>
<data-title title="老年人居住情况统计" />
</div>
<div id="lnrRightChart" style="height: 400px"></div>
</div>
<div class="visualizing-item">
<div>
<data-title title="老年人享受服务情况统计" />
</div>
<div id="lnrServiceChart" style="height: 400px"></div>
</div>
2 years ago
</div>
</div>
</template>
<script>
import dataTitle from "@/views/dataBoard/renfang/visualizing/components/dataTitle.vue";
import * as echarts from "echarts";
import {color, legend,title,series} from './pie_config.js'
import { requestPost } from '@/js/dai/request';
2 years ago
function dataFormatter(arr) {
return arr.map((item) => {
return {
name: item.classification,
value: Number(item.classificationNum),
};
});
}
export default {
name: "laonianren",
props: {
title: {
type: String,
2 years ago
default: "",
},
org_id: {
type: String,
default: "",
2 years ago
},
},
components: {
dataTitle,
},
data() {
return {
lnrLeft: [],
lnrRight: [],
lnrService: [],
2 years ago
};
},
created() {
const query = this.$route.query;
this.getData();
},
activated() {},
methods: {
getData() {
const { user } = this.$store.state
console.log(user);
2 years ago
this.$http
.get("/actual/base/peopleRoomOverview/oldPeopleAgePie")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.lnrLeft = dataFormatter(res.data);
this.initLeftCharts();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/oldPeopleResidePie")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.lnrRight = dataFormatter(res.data);
this.initRightCharts();
})
.catch(() => {});
this.$http
.post(`/actual/base/peopleRoomOverview/findPeoplePie`,{ agencyId:user.agencyId,level:user.level,category:'OLD_PEOPLE_FLAG'})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
console.log(res.data,'kankan');
this.lnrService = dataFormatter(res.data);
this.initLnrServiceCharts();
})
.catch(() => {});
let url = '/actual/base/peopleRoomOverview/findPeoplePie'
let params = {
agencyId:user.agencyId,
level:user.level,
category:'OLD_PEOPLE_FLAG'
}
2 years ago
},
initLeftCharts() {
let div = document.getElementById("lnrLeftChart");
this.myChart1 = echarts.init(div);
2 years ago
const option = {
tooltip: {
trigger: "item",
},
color,
legend: legend(this.lnrLeft),
title: title(this.lnrLeft),
series: series(this.lnrLeft)
2 years ago
};
this.myChart1.setOption(option);
this.myChart1.on("click", (e) => {
2 years ago
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
2 years ago
org_id: this.org_id,
2 years ago
type_id: "aged",
type_name: "老年人",
pageType: "normal",
type: "old",
olds: e.data.name,
2 years ago
},
});
});
window.addEventListener("resize", () => this.myChart1.resize());
},
initRightCharts() {
let div = document.getElementById("lnrRightChart");
this.myChart2 = echarts.init(div);
2 years ago
const option = {
tooltip: {
trigger: "item",
2 years ago
},
color,
legend: legend(this.lnrRight),
title: title(this.lnrRight),
series: series(this.lnrRight)
2 years ago
};
this.myChart2.on("click", (e) => {
console.log('a, b::', e);
2 years ago
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
2 years ago
org_id: this.org_id,
2 years ago
type_id: "aged",
type_name: "老年人",
pageType: "normal",
type: "old",
qingk: e.data.name,
2 years ago
},
});
});
this.myChart2.setOption(option);
window.addEventListener("resize", () => this.myChart2.resize());
},
initLnrServiceCharts() {
let div = document.getElementById("lnrServiceChart");
this.myChart3 = echarts.init(div);
const option = {
tooltip: {
trigger: "item",
},
color,
legend: legend(this.lnrService),
title: title(this.lnrService),
series: series(this.lnrService)
};
this.myChart3.setOption(option);
this.myChart3.on("click", (e) => {
this.$router.push({
path: "/dataBoard/renfang/resi-class-new",
query: {
org_id: this.org_id,
type_id: "aged",
type_name: "老年人",
pageType: "normal",
type: "old",
serv_type: e.data.name,
},
});
});
window.addEventListener("resize", () => this.myChart3.resize());
},
2 years ago
},
};
</script>
<style
lang="scss"
src="@/assets/scss/dataBoard/renfang/index.scss"
scoped
></style>
<style lang="scss" scoped>
.laonianren {
padding: 140px 130px;
2 years ago
}
</style>