wanglt 7 mesiacov pred
rodič
commit
3671f32588

+ 2 - 1
ygtx-admin/src/main/java/com/ygtx/web/controller/system/SysLoginController.java

@@ -2,6 +2,7 @@ package com.ygtx.web.controller.system;
 
 import java.util.*;
 
+import com.ygtx.system.domain.SysOperLog;
 import com.ygtx.system.domain.SysPost;
 import com.ygtx.system.service.ISysPostService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -171,7 +172,7 @@ public class SysLoginController
         LoginUser loginUser = SecurityUtils.getLoginUser();
         SysUser user = loginUser.getUser();
         int postType = postService.getHomePostType(user.getUserId());
-        List<Map<String, Object>> highUse = operLogService.selectOperLogCountByOperName(user.getUserName(),postType);
+        List<SysOperLog> highUse = operLogService.selectOperLogCountByOperName(user.getUserName(),postType);
         AjaxResult ajax = AjaxResult.success();
         ajax.put("highUse", highUse);
         return ajax;

+ 20 - 0
ygtx-system/src/main/java/com/ygtx/system/domain/SysOperLog.java

@@ -87,6 +87,10 @@ public class SysOperLog extends BaseEntity
     @Excel(name = "消耗时间", suffix = "毫秒")
     private Long costTime;
 
+    private String icon;
+
+    private String color;
+
     public Long getOperId()
     {
         return operId;
@@ -266,4 +270,20 @@ public class SysOperLog extends BaseEntity
     {
         this.costTime = costTime;
     }
+
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    public String getColor() {
+        return color;
+    }
+
+    public void setColor(String color) {
+        this.color = color;
+    }
 }

+ 1 - 1
ygtx-system/src/main/java/com/ygtx/system/mapper/SysOperLogMapper.java

@@ -53,5 +53,5 @@ public interface SysOperLogMapper
      * @param operName 操作人员名称
      * @return 结果
      */
-    public List<Map<String, Object>> selectOperLogCountByOperName(String operName);
+    public List<SysOperLog> selectOperLogCountByOperName(String operName);
 }

+ 1 - 1
ygtx-system/src/main/java/com/ygtx/system/service/ISysOperLogService.java

@@ -54,7 +54,7 @@ public interface ISysOperLogService
      * @param operName 操作人员名称
      * @return 结果
      */
-    public List<Map<String, Object>> selectOperLogCountByOperName(String operName, int postType);
+    public List<SysOperLog> selectOperLogCountByOperName(String operName, int postType);
 
     public Map<String, Object> createDataMap(String key, String value);
 }

+ 97 - 26
ygtx-system/src/main/java/com/ygtx/system/service/impl/SysOperLogServiceImpl.java

@@ -58,6 +58,89 @@ public class SysOperLogServiceImpl implements ISysOperLogService
         return operLogMapper.deleteOperLogByIds(operIds);
     }
 
+    public void createDefaultForm(List<SysOperLog> zr,List<SysOperLog> zz,List<SysOperLog> yg) {
+        // wbzr 列表转换
+        SysOperLog log1 = new SysOperLog();
+        log1.setTitle("工单管理");
+        log1.setIcon("fa fa-tasks");
+        log1.setColor("blue");
+
+        SysOperLog log2 = new SysOperLog();
+        log2.setTitle("班组管理");
+        log2.setIcon("fa fa-users");
+        log2.setColor("cyan");
+
+        SysOperLog log3 = new SysOperLog();
+        log3.setTitle("工分管理");
+        log3.setIcon("fa fa-star");
+        log3.setColor("orange");
+
+        SysOperLog log4 = new SysOperLog();
+        log4.setTitle("工时分析");
+        log4.setIcon("fa fa-clock-o");
+        log4.setColor("gray");
+
+        SysOperLog log5 = new SysOperLog();
+        log5.setTitle("通知中心");
+        log5.setIcon("fa fa-bell");
+        log5.setColor("red");
+        zr.add(log1);
+        zr.add(log2);
+        zr.add(log3);
+        zr.add(log4);
+        zr.add(log5);
+
+// zz 列表转换
+        SysOperLog log11 = new SysOperLog();
+        log11.setTitle("工单分配");
+        log11.setIcon("fa fa-tasks");
+        log11.setColor("blue");
+
+        SysOperLog log12 = new SysOperLog();
+        log12.setTitle("组员管理");
+        log12.setIcon("fa fa-user");
+        log12.setColor("cyan");
+
+        SysOperLog log13 = new SysOperLog();
+        log13.setTitle("工分管理");
+        log13.setIcon("fa fa-star");
+        log13.setColor("orange");
+
+        SysOperLog log14 = new SysOperLog();
+        log14.setTitle("超时工单");
+        log14.setIcon("fa fa-exclamation-circle");
+        log14.setColor("red");
+        zz.add(log11);
+        zz.add(log12);
+        zz.add(log13);
+        zz.add(log14);
+
+// yg 列表转换
+        SysOperLog log21 = new SysOperLog();
+        log21.setTitle("我的工单");
+        log21.setIcon("fa fa-tasks");
+        log21.setColor("blue");
+
+        SysOperLog log22 = new SysOperLog();
+        log22.setTitle("我的工分");
+        log22.setIcon("fa fa-star");
+        log22.setColor("orange");
+
+        SysOperLog log23 = new SysOperLog();
+        log23.setTitle("扣分工单");
+        log23.setIcon("fa fa-minus-circle");
+        log23.setColor("red");
+
+        SysOperLog log24 = new SysOperLog();
+        log24.setTitle("历史记录");
+        log24.setIcon("fa fa-history");
+        log24.setColor("gray");
+        yg.add(log21);
+        yg.add(log22);
+        yg.add(log23);
+        yg.add(log24);
+    }
+
     /**
      * 统计用户操作次数
      * 
@@ -65,33 +148,21 @@ public class SysOperLogServiceImpl implements ISysOperLogService
      * @return 结果
      */
     @Override
-    public List<Map<String, Object>> selectOperLogCountByOperName(String operName, int postType)
+    public List<SysOperLog> selectOperLogCountByOperName(String operName, int postType)
     {
-        List<Map<String, Object>> wbzr = new ArrayList<>();
-        wbzr.add(createMenu("工单管理", "fa fa-tasks", "blue"));
-        wbzr.add(createMenu("班组管理", "fa fa-users", "cyan"));
-        wbzr.add(createMenu("工分管理", "fa fa-star", "orange"));
-        wbzr.add(createMenu("工时分析", "fa fa-clock-o", "gray"));
-        wbzr.add(createMenu("通知中心", "fa fa-bell", "red"));
-        List<Map<String, Object>> result = operLogMapper.selectOperLogCountByOperName(operName);
+        List<SysOperLog> wbzr = new ArrayList<>();
+        List<SysOperLog> zz = new ArrayList<>();
+        List<SysOperLog> yg = new ArrayList<>();
+        createDefaultForm(wbzr,zz,yg);
+        List<SysOperLog> result = operLogMapper.selectOperLogCountByOperName(operName);
         if (!result.isEmpty()) {
             for (int i=0;i<result.size();i++) {
-                Map<String, Object> map = result.get(i);
-                map.put("color",wbzr.get(i).get("color"));
+                SysOperLog map = result.get(i);
+                map.setColor(wbzr.get(i).getColor());
             }
         }
         if (result.size()<5) {
-            List<Map<String, Object>> zz = new ArrayList<>();
-            zz.add(createMenu("工单分配", "fa fa-tasks", "blue"));
-            zz.add(createMenu("组员管理", "fa fa-user", "cyan"));
-            zz.add(createMenu("工分管理", "fa fa-star", "orange"));
-            zz.add(createMenu("超时工单", "fa fa-exclamation-circle", "red"));
-            List<Map<String, Object>> yg = new ArrayList<>();
-            yg.add(createMenu("我的工单", "fa fa-tasks", "blue"));
-            yg.add(createMenu("我的工分", "fa fa-star", "orange"));
-            yg.add(createMenu("扣分工单", "fa fa-minus-circle", "red"));
-            yg.add(createMenu("历史记录", "fa fa-history", "gray"));
-            List<Map<String, Object>> highUse = new ArrayList<>();
+            List<SysOperLog> highUse = new ArrayList<>();
             if (postType==2) {
                 highUse.addAll(wbzr);
             } else if (postType==1) {
@@ -102,13 +173,13 @@ public class SysOperLogServiceImpl implements ISysOperLogService
             if (result.isEmpty()) {
                 result.addAll(highUse);
             } else {
-                for (Map<String, Object> map : highUse) {
+                for (SysOperLog map : highUse) {
                     if (result.size()>3) {
                         break;
                     }
                     boolean isadd = true;
-                    for (Map<String, Object> map1 : result) {
-                        if (map1.get("title").equals(map.get("title"))) {
+                    for (SysOperLog map1 : result) {
+                        if (map1.getTitle().equals(map.getTitle())) {
                             isadd = false;
                             break;
                         }
@@ -122,8 +193,8 @@ public class SysOperLogServiceImpl implements ISysOperLogService
         return result;
     }
 
-    private static Map<String, Object> createMenu(String title, String icon, String color) {
-        Map<String, Object> map = new HashMap<>();
+    private static Map<String, String> createMenu(String title, String icon, String color) {
+        Map<String, String> map = new HashMap<>();
         map.put("title", title);
         map.put("icon", icon);
         map.put("color", color);

+ 3 - 3
ygtx-system/src/main/resources/mapper/system/SysOperLogMapper.xml

@@ -24,10 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="costTime"       column="cost_time"      />
 	</resultMap>
 
-	<resultMap type="java.util.HashMap" id="OperLogCountMap">
+	<resultMap type="SysOperLog" id="OperLogCountMap">
 		<result property="title" column="title" />
 		<result property="icon" column="icon" />
-		<result property="count" column="count" />
+		<result property="operUrl" column="oper_url"       />
 	</resultMap>
 
 	<sql id="selectOperLogVo">
@@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
 	<select id="selectOperLogCountByOperName" parameterType="String" resultMap="OperLogCountMap">
-		SELECT o.title, m.icon, COUNT(*) as count
+		SELECT o.title, m.icon, min(o.oper_url), COUNT(*) as count
 		FROM sys_oper_log o
 		LEFT JOIN sys_menu m ON o.title = m.menu_name
 		WHERE o.oper_name = #{operName} AND m.icon IS NOT NULL

+ 14 - 13
ygtx-ui/src/components/Dashboard/ChartsGroupOne.vue

@@ -70,27 +70,28 @@ export default {
     
     // 计算轴的最大值和间隔的新方法
     calculateAxisRange(maxValue) {
-      // 数据中的最大值除以5
-      const dividedValue = maxValue / 5;
-      
       // 预定义的数组
-      const presetValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 70, 100, 150, 200, 250, 300, 500, 700, 1000, 2000, 5000];
+      const presetValues = [1, 2, 3, 4, 5, 10, 15, 20, 25, 50, 100, 150, 200, 250, 300, 500, 1000, 2000, 5000];
       
-      // 获取第一个大于dividedValue的值
-      let selectedValue = presetValues[presetValues.length - 1]; // 默认取最大值
+      let selectedValue = maxValue/9;
+      let maxAxisValue1 = Math.floor(selectedValue) * 10;
+      let numForm = 10;
       for (let i = 0; i < presetValues.length; i++) {
-        if (presetValues[i] >= dividedValue) {
+        const numFormI = maxValue/presetValues[i];
+        if (numFormI>=1 && numFormI<=9) {
           selectedValue = presetValues[i];
+          const numFormII = Math.floor(numFormI);
+          if (numFormII<numFormI) {
+            numForm = numFormII+1;
+          }else{
+            numForm = numFormII;
+          }
+          maxAxisValue1 = selectedValue * numForm;
           break;
         }
       }
-      
-      // 乘以5作为最终的最大值
-      const maxAxisValue = selectedValue * 5;
-      
-      // 计算间隔
+      const maxAxisValue = maxAxisValue1;
       const interval = selectedValue;
-      
       return { maxAxisValue, interval };
     },
     

+ 14 - 13
ygtx-ui/src/components/Dashboard/ChartsGroupThree.vue

@@ -177,27 +177,28 @@ export default {
     
     // 计算轴的最大值和间隔的新方法
     calculateAxisRange(maxValue) {
-      // 数据中的最大值除以5
-      const dividedValue = maxValue / 5;
-      
       // 预定义的数组
-      const presetValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 70, 100, 150, 200, 250, 300, 500, 700, 1000, 2000, 5000];
+      const presetValues = [1, 2, 3, 4, 5, 10, 15, 20, 25, 50, 100, 150, 200, 250, 300, 500, 1000, 2000, 5000];
       
-      // 获取第一个大于dividedValue的值
-      let selectedValue = presetValues[presetValues.length - 1]; // 默认取最大值
+      let selectedValue = maxValue/9;
+      let maxAxisValue1 = Math.floor(selectedValue) * 10;
+      let numForm = 10;
       for (let i = 0; i < presetValues.length; i++) {
-        if (presetValues[i] >= dividedValue) {
+        const numFormI = maxValue/presetValues[i];
+        if (numFormI>=1 && numFormI<=9) {
           selectedValue = presetValues[i];
+          const numFormII = Math.floor(numFormI);
+          if (numFormII<numFormI) {
+            numForm = numFormII+1;
+          }else{
+            numForm = numFormII;
+          }
+          maxAxisValue1 = selectedValue * numForm;
           break;
         }
       }
-      
-      // 乘以5作为最终的最大值
-      const maxAxisValue = selectedValue * 5;
-      
-      // 计算间隔
+      const maxAxisValue = maxAxisValue1;
       const interval = selectedValue;
-      
       return { maxAxisValue, interval };
     },
     

+ 16 - 16
ygtx-ui/src/components/Dashboard/ChartsGroupTwo.vue

@@ -149,27 +149,28 @@ export default {
     
     // 计算轴的最大值和间隔的新方法
     calculateAxisRange(maxValue) {
-      // 数据中的最大值除以5
-      const dividedValue = maxValue / 5;
-      
       // 预定义的数组
-      const presetValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 70, 100, 150, 200, 250, 300, 500, 700, 1000, 2000, 5000];
+      const presetValues = [1, 2, 3, 4, 5, 10, 15, 20, 25, 50, 100, 150, 200, 250, 300, 500, 1000, 2000, 5000];
       
-      // 获取第一个大于dividedValue的值
-      let selectedValue = presetValues[presetValues.length - 1]; // 默认取最大值
+      let selectedValue = maxValue/9;
+      let maxAxisValue1 = Math.floor(selectedValue) * 10;
+      let numForm = 10;
       for (let i = 0; i < presetValues.length; i++) {
-        if (presetValues[i] >= dividedValue) {
+        const numFormI = maxValue/presetValues[i];
+        if (numFormI>=1 && numFormI<=9) {
           selectedValue = presetValues[i];
+          const numFormII = Math.floor(numFormI);
+          if (numFormII<numFormI) {
+            numForm = numFormII+1;
+          }else{
+            numForm = numFormII;
+          }
+          maxAxisValue1 = selectedValue * numForm;
           break;
         }
       }
-      
-      // 乘以5作为最终的最大值
-      const maxAxisValue = selectedValue * 5;
-      
-      // 计算间隔
+      const maxAxisValue = maxAxisValue1;
       const interval = selectedValue;
-      
       return { maxAxisValue, interval };
     },
     
@@ -311,7 +312,7 @@ export default {
       }
       
       // 使用新的计算方法
-      const maxValue = Math.max(...values, 5); // 至少显示到5
+      const maxValue = Math.max(...values, 2); // 至少显示到5
       const { maxAxisValue, interval } = this.calculateAxisRange(maxValue);
       
       // 超时工单情况的柱状图(柱子颜色淡红色)
@@ -366,9 +367,8 @@ export default {
           max: maxAxisValue,
           interval: interval,
           axisLabel: {
-            formatter: '{value}'
+            formatter: '{value}'
           },
-          name: '天数',
           nameLocation: 'middle',
           nameRotate: 90,
           nameGap: 40,

+ 0 - 3
ygtx-ui/src/views/index.vue

@@ -34,7 +34,6 @@ export default {
       try {
         // 调用后端接口获取首页配置
         const response = await getCurrentUserHomePage()
-        console.log(response);
         if (response.code === 200 && response.data) {
           // 使用返回数据中的homePageType值
           const homePageType = response.data.homePageType
@@ -51,8 +50,6 @@ export default {
       }
     }
 
-    console.log(homePageRouteName.value);
-
     return {
       homePageRouteName,
       currentComponent,