数据统计分析---上报隐患排名、年度隐患柱状图、四个扇形图可根据月份统计隐患数量

main
15036302109 4 months ago
parent 3c2f72b969
commit 6059f6eee0

@ -22,10 +22,10 @@ export function getDanger() {
method: 'get',
})
}
// 查询上报隐患数量
export function getDangerByDeptId() {
export function getDangerByDeptId(targetTime) {
return request({
url: '/ehs/indexStatistics/getHiddenDangerRankVoByDeptIdList',
url: '/ehs/indexStatistics/getHiddenDangerRankVoByDeptIdList?targetTime=' + targetTime,
method: 'get',
})
}
@ -47,32 +47,32 @@ return request({
})
}
// 查询隐患整改进度 环
export function getDangerStatus(data) {
export function getDangerStatus(targetTime) {
return request({
url: '/ehs/indexStatistics/getHiddenDangerStatusMapList',
url: '/ehs/indexStatistics/getHiddenDangerStatusMapList?targetTime=' + targetTime,
method: 'get',
params: data
})
}
// 查询行业领域统计 饼
export function getTrade(){
export function getTrade(targetTime){
return request({
url: '/ehs/indexStatistics/getEnterpriseMapList',
url: '/ehs/indexStatistics/getEnterpriseMapList?targetTime=' + targetTime,
method: 'get',
})
}
// 查询经济类型统计 饼
export function getEconomics(){
export function getEconomics(targetTime){
return request({
url: 'ehs/indexStatistics/geteconomicTypeMapList',
url: 'ehs/indexStatistics/geteconomicTypeMapList?targetTime=' + targetTime,
method: 'get',
})
}
// 查询企业规模统计 饼
export function getScale(){
export function getScale(targetTime){
return request({
url: '/ehs/indexStatistics/getenterpriseScaleMapList',
url: '/ehs/indexStatistics/getenterpriseScaleMapList?targetTime=' + targetTime,
method: 'get',
})
}

@ -4,6 +4,18 @@
<indexDanger ref="indexDangerRef"></indexDanger>
<div class="row">
<div class="left_top bcg">
<!-- 时间选择器 -->
<el-date-picker
v-model="queryParams.targetTime"
type="month"
placeholder="请选择月份"
value-format="yyyy-MM"
clearable>
</el-date-picker>
<!-- 查询按钮 -->
<el-button type="primary" @click="queryData"></el-button>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="行政区域统计" name="tj1">
<el-table
@ -125,7 +137,7 @@
</div>
<!-- <div class="right_top bcg" :style="$store.state.app.sidebar.opened ? 'width: 24%;': 'width: 32%;' "> -->
<div class="right_top bcg">
<h3>本月上报隐患排名</h3>
<h3>上报隐患排名</h3>
<el-table
ref="right_top"
class="custom-table"
@ -196,6 +208,7 @@ export default {
components: { indexHD, indexDanger},
data() {
return {
value1: "",//
activeName: "tj1", //tab
tableData: [], //table
tableDat_1: null,
@ -206,9 +219,70 @@ export default {
myChart4: null,
myChart5: null,
year: "2023", //
queryParams: {
targetTime: null,
},
};
},
methods: {
queryData() {
if (this.queryParams.targetTime) {
// ,,
this.getAllData(this.queryParams.targetTime);
//
this.getChartData(this.queryParams.targetTime);
} else {
this.$message.error("请选择日期!");
}
},
getAllData(targetTime) {
// TODO
getAdministeration()
.then((response) => {
if (response.code == 200) this.tableData = response.data;
})
.catch((err) => {
console.log(err);
});
// TODO
getPlace()
.then((response) => {
if (response.code == 200) this.tableDat_1 = response.data;
})
.catch((err) => {
console.log(err);
});
//
getDangerByDeptId(targetTime)
.then((response) => {
if (response.code == 200) {
response.data.map((item,index)=>{
item.index = index+1
})
this.tableData1 = response.data;
}
})
.catch((err) => {
console.error(err);
});
},
//
getChartData(targetTime) {
this.leftCenterinit(targetTime); //
this.rightBominit(targetTime); //
this.hylyinit(targetTime); //
this.jjClassInit(targetTime); //
this.scaleInit(targetTime); //
},
getDefaultTargetTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // 0+1
return `${year}-${month}`;
},
showHD(row) {
console.log(row);
this.$refs.indexHDRef.openDialog(row.deptId);
@ -216,8 +290,9 @@ export default {
handleClick(tab, event) {
console.log(tab, event);
},
async leftCenterinit() {
this.year = new Date().getFullYear();
async leftCenterinit(targetTime) {
this.year = targetTime.substring(0, 4) || new Date().getFullYear();
// this.year = new Date().getFullYear();
let res = await getDangerList(this.year);
let temp = res.data;
let legendData = [];
@ -298,8 +373,8 @@ export default {
option && this.myChart1.setOption(option);
// myChart.resize();
},
async rightBominit() {
let res = await getDangerStatus();
async rightBominit(targetTime) {
let res = await getDangerStatus(targetTime);
this.myChart2 = echarts.init(this.$refs.right_bom);
let option = {
title: { text: "隐患整改进度统计" },
@ -350,8 +425,8 @@ export default {
this.$refs.indexDangerRef.openDialog1(a.status);
});
},
async hylyinit() {
let res = await getTrade();
async hylyinit(targetTime) {
let res = await getTrade(targetTime);
this.myChart3 = echarts.init(this.$refs.hyly);
let option = {
title: { text: "行业领域统计隐患数量" },
@ -401,8 +476,8 @@ export default {
this.$refs.indexDangerRef.openDialog4(a.enterpriseType);
});
},
async jjClassInit() {
let res = await getEconomics();
async jjClassInit(targetTime) {
let res = await getEconomics(targetTime);
this.myChart4 = echarts.init(this.$refs.jjClass);
let option = {
title: { text: "经济类型统计隐患数量" },
@ -452,8 +527,8 @@ export default {
this.$refs.indexDangerRef.openDialog3(a.economicType);
});
},
async scaleInit() {
let res = await getScale();
async scaleInit(targetTime) {
let res = await getScale(targetTime);
this.myChart5 = echarts.init(this.$refs.scale);
let option = {
title: { text: "企业规模统计隐患数量" },
@ -508,46 +583,12 @@ export default {
},
created() {
//
getAdministeration()
.then((response) => {
if (response.code == 200) this.tableData = response.data;
})
.catch((err) => {
console.log(err);
});
//
getPlace()
.then((response) => {
if (response.code == 200) this.tableDat_1 = response.data;
})
.catch((err) => {
console.log(err);
});
//
getDangerByDeptId()
.then((response) => {
if (response.code == 200) {
response.data.map((item,index)=>{
item.index = index+1
})
this.tableData1 = response.data;
}
})
.catch((err) => {
console.error(err);
});
let targetTime = this.queryParams.targetTime || this.getDefaultTargetTime();
this.getAllData(targetTime);
},
mounted() {
// this.autoScroll();
this.leftCenterinit(); //
this.rightBominit(); //
this.hylyinit(); //
this.jjClassInit(); //
this.scaleInit(); //
let targetTime = this.queryParams.targetTime || this.getDefaultTargetTime();
this.getChartData(targetTime);
},
watch: {
"$store.state.app.sidebar.opened"(value) {

Loading…
Cancel
Save