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

main
15036302109 4 months ago
parent 3c2f72b969
commit 6059f6eee0

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

@ -4,6 +4,18 @@
<indexDanger ref="indexDangerRef"></indexDanger> <indexDanger ref="indexDangerRef"></indexDanger>
<div class="row"> <div class="row">
<div class="left_top bcg"> <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-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="行政区域统计" name="tj1"> <el-tab-pane label="行政区域统计" name="tj1">
<el-table <el-table
@ -125,7 +137,7 @@
</div> </div>
<!-- <div class="right_top bcg" :style="$store.state.app.sidebar.opened ? 'width: 24%;': 'width: 32%;' "> --> <!-- <div class="right_top bcg" :style="$store.state.app.sidebar.opened ? 'width: 24%;': 'width: 32%;' "> -->
<div class="right_top bcg"> <div class="right_top bcg">
<h3>本月上报隐患排名</h3> <h3>上报隐患排名</h3>
<el-table <el-table
ref="right_top" ref="right_top"
class="custom-table" class="custom-table"
@ -196,6 +208,7 @@ export default {
components: { indexHD, indexDanger}, components: { indexHD, indexDanger},
data() { data() {
return { return {
value1: "",//
activeName: "tj1", //tab activeName: "tj1", //tab
tableData: [], //table tableData: [], //table
tableDat_1: null, tableDat_1: null,
@ -206,9 +219,70 @@ export default {
myChart4: null, myChart4: null,
myChart5: null, myChart5: null,
year: "2023", // year: "2023", //
queryParams: {
targetTime: null,
},
}; };
}, },
methods: { 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) { showHD(row) {
console.log(row); console.log(row);
this.$refs.indexHDRef.openDialog(row.deptId); this.$refs.indexHDRef.openDialog(row.deptId);
@ -216,8 +290,9 @@ export default {
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event); console.log(tab, event);
}, },
async leftCenterinit() { async leftCenterinit(targetTime) {
this.year = new Date().getFullYear(); this.year = targetTime.substring(0, 4) || new Date().getFullYear();
// this.year = new Date().getFullYear();
let res = await getDangerList(this.year); let res = await getDangerList(this.year);
let temp = res.data; let temp = res.data;
let legendData = []; let legendData = [];
@ -298,8 +373,8 @@ export default {
option && this.myChart1.setOption(option); option && this.myChart1.setOption(option);
// myChart.resize(); // myChart.resize();
}, },
async rightBominit() { async rightBominit(targetTime) {
let res = await getDangerStatus(); let res = await getDangerStatus(targetTime);
this.myChart2 = echarts.init(this.$refs.right_bom); this.myChart2 = echarts.init(this.$refs.right_bom);
let option = { let option = {
title: { text: "隐患整改进度统计" }, title: { text: "隐患整改进度统计" },
@ -350,8 +425,8 @@ export default {
this.$refs.indexDangerRef.openDialog1(a.status); this.$refs.indexDangerRef.openDialog1(a.status);
}); });
}, },
async hylyinit() { async hylyinit(targetTime) {
let res = await getTrade(); let res = await getTrade(targetTime);
this.myChart3 = echarts.init(this.$refs.hyly); this.myChart3 = echarts.init(this.$refs.hyly);
let option = { let option = {
title: { text: "行业领域统计隐患数量" }, title: { text: "行业领域统计隐患数量" },
@ -401,8 +476,8 @@ export default {
this.$refs.indexDangerRef.openDialog4(a.enterpriseType); this.$refs.indexDangerRef.openDialog4(a.enterpriseType);
}); });
}, },
async jjClassInit() { async jjClassInit(targetTime) {
let res = await getEconomics(); let res = await getEconomics(targetTime);
this.myChart4 = echarts.init(this.$refs.jjClass); this.myChart4 = echarts.init(this.$refs.jjClass);
let option = { let option = {
title: { text: "经济类型统计隐患数量" }, title: { text: "经济类型统计隐患数量" },
@ -452,8 +527,8 @@ export default {
this.$refs.indexDangerRef.openDialog3(a.economicType); this.$refs.indexDangerRef.openDialog3(a.economicType);
}); });
}, },
async scaleInit() { async scaleInit(targetTime) {
let res = await getScale(); let res = await getScale(targetTime);
this.myChart5 = echarts.init(this.$refs.scale); this.myChart5 = echarts.init(this.$refs.scale);
let option = { let option = {
title: { text: "企业规模统计隐患数量" }, title: { text: "企业规模统计隐患数量" },
@ -508,46 +583,12 @@ export default {
}, },
created() { created() {
// let targetTime = this.queryParams.targetTime || this.getDefaultTargetTime();
getAdministeration() this.getAllData(targetTime);
.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);
});
}, },
mounted() { mounted() {
// this.autoScroll(); let targetTime = this.queryParams.targetTime || this.getDefaultTargetTime();
this.leftCenterinit(); // this.getChartData(targetTime);
this.rightBominit(); //
this.hylyinit(); //
this.jjClassInit(); //
this.scaleInit(); //
}, },
watch: { watch: {
"$store.state.app.sidebar.opened"(value) { "$store.state.app.sidebar.opened"(value) {

Loading…
Cancel
Save