From 6059f6eee032357e8a876380ba8af1aa65f203e8 Mon Sep 17 00:00:00 2001 From: 15036302109 Date: Thu, 18 Jul 2024 11:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90---=E4=B8=8A=E6=8A=A5=E9=9A=90=E6=82=A3=E6=8E=92?= =?UTF-8?q?=E5=90=8D=E3=80=81=E5=B9=B4=E5=BA=A6=E9=9A=90=E6=82=A3=E6=9F=B1?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE=E3=80=81=E5=9B=9B=E4=B8=AA=E6=89=87=E5=BD=A2?= =?UTF-8?q?=E5=9B=BE=E5=8F=AF=E6=A0=B9=E6=8D=AE=E6=9C=88=E4=BB=BD=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=9A=90=E6=82=A3=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/ehs/ehsExamples.js | 24 ++-- ruoyi-ui/src/views/ehs/ehsExamples/index.vue | 139 ++++++++++++------- 2 files changed, 102 insertions(+), 61 deletions(-) diff --git a/ruoyi-ui/src/api/ehs/ehsExamples.js b/ruoyi-ui/src/api/ehs/ehsExamples.js index cd51e7f..88203c4 100644 --- a/ruoyi-ui/src/api/ehs/ehsExamples.js +++ b/ruoyi-ui/src/api/ehs/ehsExamples.js @@ -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', }) } diff --git a/ruoyi-ui/src/views/ehs/ehsExamples/index.vue b/ruoyi-ui/src/views/ehs/ehsExamples/index.vue index fe8d08c..c4bf7d3 100644 --- a/ruoyi-ui/src/views/ehs/ehsExamples/index.vue +++ b/ruoyi-ui/src/views/ehs/ehsExamples/index.vue @@ -4,6 +4,18 @@
+ + + + + 查询 + +
-

本月上报隐患排名

+

上报隐患排名

{ + 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) {