From 13a54ebcb6412f6ed0f0311a6f003585f4e8457e Mon Sep 17 00:00:00 2001 From: LokerL Date: Fri, 1 Nov 2024 15:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=94=9F=E6=88=90-=E5=8E=82=E7=95=8C=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oil/controller/OilReportController.java | 4 +- .../project/oil/mapper/OilMonitorMapper.java | 2 +- .../oil/mapper/ThDeviceDealMapper.java | 9 +- .../impl/OilThDeviceDealServiceImpl.java | 5 +- .../mybatis/oil/OilMonitorMapper.xml | 5 + .../resources/mybatis/oil/ThDeviceDeal.xml | 41 ------- .../src/views/reportGenerate/bound/index.vue | 102 ++++++------------ 7 files changed, 43 insertions(+), 125 deletions(-) delete mode 100644 RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java index e5ca76a..dbcd15b 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilReportController.java @@ -46,11 +46,11 @@ public class OilReportController extends BaseController { // 异常设备数 int abnormalDeviceCount = getDeviceCount(deptId, year, 0); // 全年解决报警次数 -// int alarmSolveCountYear = oilThDeviceDealService.countThDeviceDealByYear(year); + int alarmSolveCountYear = oilThDeviceDealService.countThDeviceDealByYear(year); resultMap.put("deviceCount", deviceCount); resultMap.put("normalDeviceCount", normalDeviceCount); resultMap.put("abnormalDeviceCount", abnormalDeviceCount); -// resultMap.put("alarmSolveCountYear", alarmSolveCountYear); + resultMap.put("alarmSolveCountYear", alarmSolveCountYear); return AjaxResult.success(resultMap); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java index 943fbdd..0fa096c 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java @@ -114,5 +114,5 @@ public interface OilMonitorMapper { Integer querryDealTotal(@Param("reportId") Long reportId); - + Integer countThDeviceDealByYear(@Param("year") String year); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java index 73acd7c..c38a008 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceDealMapper.java @@ -3,14 +3,7 @@ package com.ruoyi.project.oil.mapper; import org.apache.ibatis.annotations.Param; -import java.util.Map; -/** - * @author Lenovo - * @description 针对表【th_device_deal】的数据库操作Mapper - * @createDate 2024-10-29 15:40:41 - * @Entity com.ruoyi.oil.domain.monitor.ThDeviceDeal - */ public interface ThDeviceDealMapper { - int countThDeviceDealByYear(@Param("year") String year); + int selectThDeviceDealByYear(@Param("year") String year); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java index 183bb5f..984031b 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceDealServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.project.oil.service.impl; +import com.ruoyi.project.oil.mapper.OilMonitorMapper; import com.ruoyi.project.oil.mapper.ThDeviceDealMapper; import com.ruoyi.project.oil.service.IOilThDeviceDealService; import org.springframework.beans.factory.annotation.Autowired; @@ -9,10 +10,10 @@ import org.springframework.stereotype.Service; public class OilThDeviceDealServiceImpl implements IOilThDeviceDealService { @Autowired - private ThDeviceDealMapper thDeviceDealMapper; + private OilMonitorMapper oilMonitorMapper; @Override public int countThDeviceDealByYear(String year) { - return thDeviceDealMapper.countThDeviceDealByYear(year); + return oilMonitorMapper.countThDeviceDealByYear(year); } } diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml index 8603449..0413d70 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml @@ -471,4 +471,9 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea + + \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml deleted file mode 100644 index 9bf1bb6..0000000 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceDeal.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-ui/src/views/reportGenerate/bound/index.vue b/ruoyi-ui/src/views/reportGenerate/bound/index.vue index 75b6f3a..358add0 100644 --- a/ruoyi-ui/src/views/reportGenerate/bound/index.vue +++ b/ruoyi-ui/src/views/reportGenerate/bound/index.vue @@ -42,7 +42,7 @@
@@ -107,59 +107,8 @@ export default { dept: null, year: "", total: 0, - tableData: [ - { - deptName: "企业1", - sn: "SN001", - position: "位置1", - month1: 1, - month2: 2, - month3: 3, - month4: 4, - month5: 5, - month6: 6, - month7: 7, - month8: 8, - month9: 9, - month10: 10, - month11: 11, - month12: 12, - }, - { - deptName: "企业2", - sn: "SN002", - position: "位置2", - month1: 1, - month2: 2, - month3: 3, - month4: 4, - month5: 5, - month6: 6, - month7: 7, - month8: 8, - month9: 9, - month10: 10, - month11: 11, - month12: 12, - }, - { - deptName: "企业3", - sn: "SN003", - position: "位置3", - month1: 1, - month2: 2, - month3: 3, - month4: 4, - month5: 5, - month6: 6, - month7: 7, - month8: 8, - month9: 9, - month10: 10, - month11: 11, - month12: 12, - }, - ], + tableData: [], + rowTagNum: 4, dashboardTag: [ { label: "设备总数", @@ -171,26 +120,26 @@ export default { key: "normalDeviceCount", icon: "el-icon-help", }, - { - label: "异常设备数", - key: "abnormalDeviceCount", - icon: "el-icon-s-help", - }, + // { + // label: "异常设备数", + // key: "abnormalDeviceCount", + // icon: "el-icon-s-help", + // }, // { // label: "正在报警设备数", // key: "alarmDeviceCount", // icon: "el-icon-message-solid", // }, - // { - // label: "全年报警次数", - // key: "alarmCountYear", - // icon: "el-icon-s-marketing", - // }, - // { - // label: "全年解决报警次数", - // key: "alarmSolveCountYear", - // icon: "el-icon-folder-checked", - // }, + { + label: "全年报警次数", + key: "alarmCountYear", + icon: "el-icon-s-marketing", + }, + { + label: "全年解决报警次数", + key: "alarmSolveCountYear", + icon: "el-icon-folder-checked", + }, // { // label: "全年未解决报警次数", // key: "alarmUnsolvedCountYear", @@ -243,7 +192,7 @@ export default { } return newArr; } - return splitArray(this.dashboardTag, 3); + return splitArray(this.dashboardTag, this.rowTagNum); }, }, methods: { @@ -272,6 +221,17 @@ export default { }).then((res) => { if (res.code === 200) { this.tableData = res.data; + console.log(this.tableData); + this.dashboardData.alarmCountYear = res.data.reduce((prev, cur) => { + for (let key in cur) { + if (key.includes("month")) { + prev += cur[key]; + } + } + return prev; + }, + 0 + ); } }); @@ -308,7 +268,7 @@ export default { display: flex; flex-direction: column; justify-content: center; - align-items: end; + align-items: flex-end; .card-content__title { font-size: 14px;