Selaa lähdekoodia

Merge branch 'master' of http://116.63.33.55/git/read_opc

FinalYu 1 vuosi sitten
vanhempi
commit
12af39895f
37 muutettua tiedostoa jossa 291 lisäystä ja 211 poistoa
  1. 0 1
      chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/Chart.java
  2. 2 0
      chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/ChartItem.java
  3. 24 0
      chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/DataModel.java
  4. 1 1
      chaunyi_opc/opc_common/src/main/java/com/example/opc_common/util/ConstantStr.java
  5. 27 0
      chaunyi_opc/opc_common/src/main/java/com/example/opc_common/util/MathUtil.java
  6. 19 4
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ChartController.java
  7. 4 4
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataModelController.java
  8. 2 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ChartDao.java
  9. 2 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ChartService.java
  10. 29 3
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ChartServiceImpl.java
  11. 41 15
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/DataModelServiceImpl.java
  12. 2 4
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaChangeTask.java
  13. 12 13
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaExceedTask.java
  14. 9 9
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaFrequencyTask.java
  15. 12 8
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/ReportTableTask.java
  16. 11 7
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/util/OpcDaUtil.java
  17. 16 5
      chaunyi_opc/opc_da/src/main/resources/mapper/ChartDao.xml
  18. 7 3
      chaunyi_opc/opc_da/src/main/resources/mapper/DataModelDao.xml
  19. 1 1
      chaunyi_opc/opc_da/src/main/resources/static/page/index.html
  20. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.68bacd05.css
  21. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-0b1e599b.270a6a0e.css
  22. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-1c266168.183a7633.css
  23. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-635e3a0e.0770beb4.css
  24. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-7ba6392c.4c39e12c.css
  25. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.5d339b7e.js
  26. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.c60763eb.js
  27. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-0b1e599b.e6bd40cd.js
  28. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-1c266168.4f75f8f1.js
  29. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-4fbd07bc.037df53d.js
  30. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-635e3a0e.cdcefdf9.js
  31. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-7ba6392c.346a8114.js
  32. 12 7
      chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/task/ReportTableTask.java
  33. 11 7
      chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/util/OpcUaUtil.java
  34. 1 1
      chuanyi-admin/src/layout/components/Navbar.vue
  35. 1 1
      chuanyi-admin/src/views/dashboard/onlineUsers.vue
  36. 22 3
      chuanyi-admin/src/views/system/driver/index.vue
  37. 23 114
      chuanyi-admin/src/views/system/menu/index.vue

+ 0 - 1
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/Chart.java

@@ -64,5 +64,4 @@ public class Chart implements Serializable {
      * 用户组id集合
      */
     private List<UserGroup> userGroupList = new ArrayList<>();
-    ;
 }

+ 2 - 0
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/ChartItem.java

@@ -18,6 +18,8 @@ public class ChartItem implements Serializable {
      * 统计图id
      */
     private Integer chartId;
+    //虚拟字段
+    private Integer itemGroupId;
     /**
      * 数据项id
      */

+ 24 - 0
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/DataModel.java

@@ -36,6 +36,14 @@ public class DataModel implements Serializable {
      */
     private String replacingValue;
     /**
+     * 单值替换第二个
+     */
+    private String operationRuleTwo;
+    /**
+     * 替换第二个为
+     */
+    private String replacingValueTwo;
+    /**
      * 用户id
      */
     private String userId;
@@ -81,4 +89,20 @@ public class DataModel implements Serializable {
         }
         return map;
     }
+
+    public static String valueReplace(DataModel dataModel, String value) {
+        String operationRule1 = dataModel.getOperationRule();
+        if (Blank.isNotEmpty(operationRule1)) {
+            if (operationRule1.equals(value)) {
+                return dataModel.getReplacingValue();
+            }
+        }
+        String operationRuleTwo1 = dataModel.getOperationRuleTwo();
+        if (Blank.isNotEmpty(operationRuleTwo1)) {
+            if (operationRuleTwo1.equals(value)) {
+                return dataModel.getReplacingValueTwo();
+            }
+        }
+        return value;
+    }
 }

+ 1 - 1
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/util/ConstantStr.java

@@ -155,7 +155,7 @@ public class ConstantStr {
     //消息通知状态,0未读,1已读
     public static final Integer NO_READ = 0;
     public static final Integer ALREADY_READ = 1;
-    //
+    //1值替换,0四则运算
     public static final Integer MATH_OPERATION = 0;
     public static final Integer VALUE_REPLACE = 1;
 

+ 27 - 0
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/util/MathUtil.java

@@ -1,5 +1,6 @@
 package com.example.opc_common.util;
 
+import com.example.opc_common.entity.DataModel;
 import com.example.opc_common.enums.ResultEnum;
 import com.example.opc_common.exception.CustomException;
 import com.mpobjects.bdparsii.eval.Expression;
@@ -38,6 +39,32 @@ public class MathUtil {
         return new BigDecimal(0);
     }
 
+    /**
+     * 四则混合运算
+     *
+     * @param dataModel 数据模型
+     * @param value     变量值
+     * @return
+     * @throws ParseException
+     */
+    public static BigDecimal quadricOperation(DataModel dataModel, BigDecimal value) {
+        String mathParameter = dataModel.getMathParameter();
+        String operationRule = dataModel.getOperationRule();
+        if (Blank.isEmpty(mathParameter, operationRule, value)) {
+            throw new CustomException(ResultEnum.SERVER_ERROR.getRespCode(), "数学参数,表达式,数据值不能为空");
+        }
+        Scope scope = new Scope();
+        Variable a = scope.getVariable(mathParameter);
+        a.setValue(value);
+        try {
+            Expression expr = Parser.parse(operationRule, scope);
+            return expr.evaluate();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new BigDecimal(0);
+    }
+
     public static BigDecimal getAvg(BigDecimal[] arrs) {
         if (arrs == null || arrs.length == 0) {
             return new BigDecimal(0);

+ 19 - 4
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ChartController.java

@@ -70,18 +70,33 @@ public class ChartController {
     }
 
     /**
-     * 通过id获取首页统计图
+     * 通过id获取首页统计图的数据
      *
      * @param id
      * @return
      */
     @GetMapping("/getChartById")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MAINCHART, OperationEnum = OperationEnum.SELECT)
-    public Result getChartById(Integer id,String startTime,String endTime) {
-        if (Blank.isEmpty(id,startTime,endTime)) {
+    public Result getChartById(Integer id, String startTime, String endTime) {
+        if (Blank.isEmpty(id, startTime, endTime)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "统计图id不能为空");
         }
-        return chartService.getChartById(id,startTime,endTime);
+        return chartService.getChartById(id, startTime, endTime);
+    }
+
+    /**
+     * 通过id获取首页统计图详情
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getChartDetailsById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MAINCHART, OperationEnum = OperationEnum.SELECT)
+    public Result getChartDetailsById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "统计图id不能为空");
+        }
+        return chartService.getChartDetailsById(id);
     }
 
     /**

+ 4 - 4
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataModelController.java

@@ -33,8 +33,8 @@ public class DataModelController {
     @PostMapping("/addDataModel")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.ADD)
     public Result addDataModel(@RequestBody DataModel dataModel) {
-        if (Blank.isEmpty(dataModel, dataModel.getRemark(), dataModel.getOperationRule())) {
-            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空,四则混合运算表达式不能为空");
+        if (Blank.isEmpty(dataModel, dataModel.getRemark())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空不能为空");
         }
         return dataModelService.addDataModel(dataModel);
     }
@@ -48,8 +48,8 @@ public class DataModelController {
     @PostMapping("/updateDataModel")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.UPDATE)
     public Result updateDataModel(@RequestBody DataModel dataModel) {
-        if (Blank.isEmpty(dataModel, dataModel.getId(), dataModel.getRemark(), dataModel.getOperationRule())) {
-            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空,四则混合运算表达式不能为空");
+        if (Blank.isEmpty(dataModel, dataModel.getId(), dataModel.getRemark())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空不能为空");
         }
         return dataModelService.updateDataModel(dataModel);
     }

+ 2 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ChartDao.java

@@ -36,4 +36,6 @@ public interface ChartDao {
     Integer delChartById(Integer id);
 
     Integer delChartItem(Integer chartId);
+
+    List<UserGroup> getUserGroupList(Integer id);
 }

+ 2 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ChartService.java

@@ -10,6 +10,8 @@ public interface ChartService {
 
     Result getChartById(Integer id,String startTime,String endTime);
 
+    Result getChartDetailsById(Integer id);
+
     Result getAllChart(Integer page, Integer limit);
 
     Result chartAssignUserGroup(Chart chart);

+ 29 - 3
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ChartServiceImpl.java

@@ -47,8 +47,15 @@ public class ChartServiceImpl implements ChartService {
         if (chartDao.addChart(chart) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "添加统计图失败");
         }
-        chartDao.addChartItem(chart.getId(), chart.getChartItemList());
-        chartDao.addChartUserGroup(chart.getId(),chart.getUserGroupList());
+        Integer id = chart.getId();
+        List<ChartItem> chartItemList = chart.getChartItemList();
+        if (Blank.isNotEmpty(chartItemList)) {
+            chartDao.addChartItem(id, chartItemList);
+        }
+        List<UserGroup> userGroupList = chart.getUserGroupList();
+        if (Blank.isNotEmpty(userGroupList)) {
+            chartDao.addChartUserGroup(id, userGroupList);
+        }
         return Result.ok("添加统计图成功");
     }
 
@@ -57,6 +64,17 @@ public class ChartServiceImpl implements ChartService {
         if (chartDao.updateChart(chart) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "修改统计图失败");
         }
+        Integer id = chart.getId();
+        chartDao.delChartItem(id);
+        chartDao.delChartUserGroup(id);
+        List<ChartItem> chartItemList = chart.getChartItemList();
+        if (Blank.isNotEmpty(chartItemList)) {
+            chartDao.addChartItem(id, chartItemList);
+        }
+        List<UserGroup> userGroupList = chart.getUserGroupList();
+        if (Blank.isNotEmpty(userGroupList)) {
+            chartDao.addChartUserGroup(id, userGroupList);
+        }
         return Result.ok("修改统计图成功");
     }
 
@@ -169,7 +187,7 @@ public class ChartServiceImpl implements ChartService {
 
                         }
                     }
-                }else{
+                } else {
                     //如果查询出来没得数据
                     List<BigDecimal> orgValueList = new ArrayList<>();
                     List<BigDecimal> valueList = new ArrayList<>();
@@ -202,6 +220,14 @@ public class ChartServiceImpl implements ChartService {
     }
 
     @Override
+    public Result getChartDetailsById(Integer id) {
+        Chart chart = chartDao.getChartById(id);
+        chart.setChartItemList(chartDao.getChartItemList(id));
+        chart.setUserGroupList(chartDao.getUserGroupList(id));
+        return Result.ok(chart);
+    }
+
+    @Override
     public Result getAllChart(Integer page, Integer limit) {
         JSONObject jsonObject = new JSONObject();
         String userId = userUtil.getCurrentUserId();

+ 41 - 15
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/DataModelServiceImpl.java

@@ -2,8 +2,6 @@ package com.example.opc_da.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.example.opc_common.entity.DataModel;
-import com.example.opc_common.entity.Item;
-import com.example.opc_common.entity.ItemGroup;
 import com.example.opc_common.enums.ResultEnum;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
@@ -35,20 +33,34 @@ public class DataModelServiceImpl implements DataModelService {
         String userId = userUtil.getCurrentUserId();
         String remark = dataModel.getRemark();
         Integer modelType = dataModel.getModelType();
+        DataModel exitDataModel = dataModelDao.getDataModelByRemark(userId, remark);
+        if (Blank.isNotEmpty(exitDataModel)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已经存在此名称的数据模型了,请修改名称");
+        }
+        dataModel.setUserId(userId);
         if (modelType.equals(ConstantStr.VALUE_REPLACE)) {
-            if (Blank.isEmpty(dataModel.getReplacingValue())) {
-                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "选择替换类型时,替换值不能为空");
+            if (Blank.isEmpty(dataModel.getOperationRule(), dataModel.getReplacingValue())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "选择替换类型时,第一个被替换值和替换值都不能为空");
+            }
+            if (Blank.isEmpty(dataModel.getOperationRuleTwo()) && Blank.isNotEmpty(dataModel.getReplacingValueTwo())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "第二个被替换值和替换值,要么都有值,要么都没得值");
+            }
+            if (Blank.isNotEmpty(dataModel.getOperationRuleTwo()) && Blank.isEmpty(dataModel.getReplacingValueTwo())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "第二个被替换值和替换值,要么都有值,要么都没得值");
+            }
+            if (Blank.isNotEmpty(dataModel.getOperationRule()) && Blank.isNotEmpty(dataModel.getOperationRuleTwo())) {
+                if ((dataModel.getOperationRule()).equals(dataModel.getOperationRuleTwo())) {
+                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "二个被替换值和替换值不能相同");
+                }
             }
         } else {
             if (Blank.isEmpty(dataModel.getMathParameter())) {
                 return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数学参数不能为空");
             }
+            if (Blank.isEmpty(dataModel.getOperationRule())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "四则混合运算表达式不能为空");
+            }
         }
-        DataModel exitDataModel = dataModelDao.getDataModelByRemark(userId, remark);
-        if (Blank.isNotEmpty(exitDataModel)) {
-            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已经存在此名称的数据模型了,请修改名称");
-        }
-        dataModel.setUserId(userId);
         if (dataModelDao.addDataModel(dataModel) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "添加数据模型失败");
         }
@@ -61,18 +73,32 @@ public class DataModelServiceImpl implements DataModelService {
         String userId = userUtil.getCurrentUserId();
         String remark = dataModel.getRemark();
         Integer modelType = dataModel.getModelType();
+        DataModel exitDataModel = dataModelDao.getDataModelByRemarkNoId(id, userId, remark);
+        if (Blank.isNotEmpty(exitDataModel)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已经存在此名称的数据模型了,请修改名称");
+        }
         if (modelType.equals(ConstantStr.VALUE_REPLACE)) {
-            if (Blank.isEmpty(dataModel.getReplacingValue())) {
-                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "选择替换类型时,替换值不能为空");
+            if (Blank.isEmpty(dataModel.getOperationRule(), dataModel.getReplacingValue())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "选择替换类型时,第一个被替换值和替换值都不能为空");
+            }
+            if (Blank.isEmpty(dataModel.getOperationRuleTwo()) && Blank.isNotEmpty(dataModel.getReplacingValueTwo())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "第二个被替换值和替换值,要么都有值,要么都没得值");
+            }
+            if (Blank.isNotEmpty(dataModel.getOperationRuleTwo()) && Blank.isEmpty(dataModel.getReplacingValueTwo())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "第二个被替换值和替换值,要么都有值,要么都没得值");
+            }
+            if (Blank.isNotEmpty(dataModel.getOperationRule()) && Blank.isNotEmpty(dataModel.getOperationRuleTwo())) {
+                if ((dataModel.getOperationRule()).equals(dataModel.getOperationRuleTwo())) {
+                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "二个被替换值和替换值不能相同");
+                }
             }
         } else {
             if (Blank.isEmpty(dataModel.getMathParameter())) {
                 return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数学参数不能为空");
             }
-        }
-        DataModel exitDataModel = dataModelDao.getDataModelByRemarkNoId(id, userId, remark);
-        if (Blank.isNotEmpty(exitDataModel)) {
-            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已经存在此名称的数据模型了,请修改名称");
+            if (Blank.isEmpty(dataModel.getOperationRule())) {
+                return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "四则混合运算表达式不能为空");
+            }
         }
         if (dataModelDao.updateDataModel(dataModel) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "修改数据模型失败");

+ 2 - 4
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaChangeTask.java

@@ -218,11 +218,9 @@ public class OpcDaChangeTask extends TimerTask {
 
                                 } else {
                                     BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
-                                    BigDecimal dmData = Blank.isNotEmpty(dm) ?
-                                            MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
-                                            bigDecimal;
+                                    BigDecimal dmData = Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm, bigDecimal) : bigDecimal;
                                     Object oldValue = redisUtil.get(ConstantStr.VALUE + id + keyId);
-                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                             currentYmdhmss, index, currentYmdh,
                                             ConstantStr.IS_RECORD, new Date());
                                     if (Blank.isEmpty(oldValue)) {

+ 12 - 13
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaExceedTask.java

@@ -198,27 +198,26 @@ public class OpcDaExceedTask extends TimerTask {
                         if (keyId.equals(driverItem) && (index % 20 == 0)) {
                             opcAsyncTask.packageEventTable(itemList, dataSourceId, index - 1);
                         }
-                        if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)
-                                && dm.getOperationRule().equals(value.toString())) {
-                            CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(value), dm.getReplacingValue(),
+                        if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                            String valStr = value.toString();
+                            CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, valStr, DataModel.valueReplace(dm, valStr),
                                     currentYmdhmss, index, currentYmdh, ConstantStr.NOT_RECORD, new Date());
                             cursorRawDataList.add(cursorRawData);
                         } else {
                             if (javaType.toLowerCase().equals("boolean")) {
-                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(value), JSON.toJSONString(value),
+                                String varStr = value.toString();
+                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, varStr,varStr,
                                         currentYmdhmss, index, currentYmdh, ConstantStr.NOT_RECORD, new Date());
                                 cursorRawDataList.add(cursorRawData);
                             } else {
                                 try {
                                     BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
-                                    BigDecimal dmData = Blank.isNotEmpty(dm) ?
-                                            MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
-                                            bigDecimal;
+                                    BigDecimal dmData = Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm, bigDecimal) : bigDecimal;
                                     if (keyId.equals(driverItem)) {
                                         BigDecimal bigDecimal1 = new BigDecimal(modeValue);
                                         if (eventMode == ConstantStr.EVENT_MODEL_EXCEED) {
                                             if (dmData.compareTo(bigDecimal1) == 1) {
-                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                         currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                                 cursorRawDataList.add(cursorRawData);
                                             } else {
@@ -227,7 +226,7 @@ public class OpcDaExceedTask extends TimerTask {
                                             }
                                         } else if (eventMode == ConstantStr.EVENT_MODEL_LOWER) {
                                             if (dmData.compareTo(bigDecimal1) == -1) {
-                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                         currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                                 cursorRawDataList.add(cursorRawData);
                                             } else {
@@ -236,7 +235,7 @@ public class OpcDaExceedTask extends TimerTask {
                                             }
                                         } else if (eventMode == ConstantStr.EVENT_MODEL_EQUAL) {
                                             if (dmData.compareTo(bigDecimal1) == 0) {
-                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                         currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                                 cursorRawDataList.add(cursorRawData);
                                             } else {
@@ -246,7 +245,7 @@ public class OpcDaExceedTask extends TimerTask {
                                         } else if (eventMode == ConstantStr.EVENT_TRENDS_EXCEED) {
                                             if (((BigDecimal) redisUtil.get(ConstantStr.VALUE + id + keyId)).compareTo(bigDecimal1) != 1) {
                                                 if (dmData.compareTo(bigDecimal1) == 1) {
-                                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                             currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                                     cursorRawDataList.add(cursorRawData);
                                                 } else {
@@ -261,7 +260,7 @@ public class OpcDaExceedTask extends TimerTask {
                                         } else if (eventMode == ConstantStr.EVENT_TRENDS_LOWER) {
                                             if (((BigDecimal) redisUtil.get(ConstantStr.VALUE + id + keyId)).compareTo(bigDecimal1) != -1) {
                                                 if (dmData.compareTo(bigDecimal1) == -1) {
-                                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                             currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                                     cursorRawDataList.add(cursorRawData);
                                                 } else {
@@ -275,7 +274,7 @@ public class OpcDaExceedTask extends TimerTask {
                                             redisUtil.set(ConstantStr.VALUE + id + keyId, dmData, ConstantStr.TWO_HOUR);
                                         }
                                     } else {
-                                        CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(bigDecimal), JSON.toJSONString(dmData),
+                                        CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, bigDecimal.toString(), dmData.toString(),
                                                 currentYmdhmss, index, currentYmdh, ConstantStr.NOT_RECORD, new Date());
                                         cursorRawDataList.add(cursorRawData);
                                     }

+ 9 - 9
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaFrequencyTask.java

@@ -108,6 +108,7 @@ public class OpcDaFrequencyTask extends TimerTask {
         try {
             server.connect();
             server.addStateListener(connected -> {
+                log.info("--------" + connected);
                 if (!connected) {
                     Boolean flage = (Boolean) redisUtil.get(ConstantStr.ITEM_GROUP + id);
                     if (Blank.isEmpty(flage)) {
@@ -227,28 +228,27 @@ public class OpcDaFrequencyTask extends TimerTask {
                                 sqlCurrentYmdh = currentYmdh;
                             }
                         }
-                        if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)
-                                && dm.getOperationRule().equals(value.toString())) {
-                            CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, value.toString(), dm.getReplacingValue(),
+                        if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                            String valStr = val.toString();
+                            CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, valStr, DataModel.valueReplace(dm, valStr),
                                     currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                             cursorRawDataList.add(cursorRawData);
                         } else {
                             if (javaType.toLowerCase().equals("boolean")) {
-                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(value), JSON.toJSONString(value),
+                                CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, value.toString(), value.toString(),
                                         currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                 cursorRawDataList.add(cursorRawData);
                             } else {
                                 try {
                                     BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
-                                    BigDecimal dmData = Blank.isNotEmpty(dm) ?
-                                            MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) :
-                                            bigDecimal;
-                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, JSON.toJSONString(value), JSON.toJSONString(dmData),
+                                    BigDecimal dmData = Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm, bigDecimal) : bigDecimal;
+                                    CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, value.toString(), dmData.toString(),
                                             currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                     cursorRawDataList.add(cursorRawData);
                                 } catch (Exception e) {
                                     if (Blank.isNotEmpty(value)) {
-                                        CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, value.toString(), value.toString(),
+                                        String valStr = value.toString();
+                                        CursorRawData cursorRawData = new CursorRawData(id, dataSourceId, keyId, javaType, valStr, valStr,
                                                 currentYmdhmss, index, currentYmdh, ConstantStr.IS_RECORD, new Date());
                                         cursorRawDataList.add(cursorRawData);
                                     } else {

+ 12 - 8
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/ReportTableTask.java

@@ -960,14 +960,18 @@ public class ReportTableTask {
                     jsonObject.put("dataType", javaType);
                     jsonObject.put("quality", OpcDaUtil.isGood(itemMap.getQuality()));
                     jsonObject.put("dataOrgValue", value);
-                    if (javaType.toLowerCase().equals("boolean")) {
-                        jsonObject.put("dataValue", value);
-                    } else {
-                        try {
-                            BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
-                            jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
-                        } catch (Exception e) {
-                            jsonObject.put("dataValue", val.get("value"));
+                    if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                        jsonObject.put("dataValue", DataModel.valueReplace(dm, value.toString()));
+                    }else{
+                        if (javaType.toLowerCase().equals("boolean")) {
+                            jsonObject.put("dataValue", value);
+                        } else {
+                            try {
+                                BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
+                                jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
+                            } catch (Exception e) {
+                                jsonObject.put("dataValue", val.get("value"));
+                            }
                         }
                     }
                     jsonObjectList.add(jsonObject);

+ 11 - 7
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/util/OpcDaUtil.java

@@ -316,14 +316,18 @@ public class OpcDaUtil {
                             jsonObject.put("quality", isGood(itemMap.getQuality()));
 //                            jsonObject.put("eventMode", item.getEventMode());
                             jsonObject.put("dataOrgValue", value);
-                            if (javaType.toLowerCase().equals("boolean")) {
-                                jsonObject.put("dataValue", value);
+                            if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                                jsonObject.put("dataValue", DataModel.valueReplace(dm, value.toString()));
                             } else {
-                                try {
-                                    BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
-                                    jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
-                                } catch (Exception e) {
-                                    jsonObject.put("dataValue", val.get("value"));
+                                if (javaType.toLowerCase().equals("boolean")) {
+                                    jsonObject.put("dataValue", value);
+                                } else {
+                                    try {
+                                        BigDecimal bigDecimal = JSON.parseObject(value.toString(), BigDecimal.class);
+                                        jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
+                                    } catch (Exception e) {
+                                        jsonObject.put("dataValue", val.get("value"));
+                                    }
                                 }
                             }
                             jsonObject.put("operationRule", Blank.isNotEmpty(dm) ? dm.getOperationRule() : "");

+ 16 - 5
chaunyi_opc/opc_da/src/main/resources/mapper/ChartDao.xml

@@ -38,7 +38,7 @@
     </insert>
 
     <update id="updateChart">
-        update t_data_model
+        update t_chart
         set chart_type=#{chartType},
             value_type=#{valueType},
             chart_name=#{chartName},
@@ -91,10 +91,13 @@
     </select>
 
     <select id="getChartItemList" resultType="com.example.opc_common.entity.ChartItem">
-        select
-        <include refid="chartItem"/>
-        from t_chart_item
-        where chart_id = #{chartId}
+        select tci.id
+             , tci.chart_id
+             , tci.item_id
+             , ti.item_group_id
+        from t_chart_item tci
+                 left join t_item ti on tci.item_id = ti.id
+        where tci.chart_id = #{chartId}
     </select>
 
     <select id="getChartByUserGroupId" resultType="com.example.opc_common.entity.Chart">
@@ -220,4 +223,12 @@
         where tcug.chart_id = #{id}
     </select>
 
+    <select id="getUserGroupList" resultType="com.example.opc_common.entity.UserGroup">
+        select tcug.user_group_id  as id,
+               tug.user_group_name as userGroupName
+        from t_chart_user_group tcug
+                 left join t_user_group tug on tcug.user_group_id = tug.id
+        where tcug.chart_id = #{id}
+    </select>
+
 </mapper>

+ 7 - 3
chaunyi_opc/opc_da/src/main/resources/mapper/DataModelDao.xml

@@ -4,7 +4,7 @@
 
     <sql id="dataModel">
         id
-        , model_type, math_parameter, operation_rule, replacing_value, user_id, remark, create_time
+        , model_type, math_parameter, operation_rule, replacing_value, operation_rule_two, replacing_value_two, user_id, remark, user_id, remark, create_time
     </sql>
 
     <sql id="item">
@@ -13,9 +13,11 @@
     </sql>
 
     <insert id="addDataModel">
-        insert into t_data_model (model_type, math_parameter, operation_rule, replacing_value, user_id, remark,
+        insert into t_data_model (model_type, math_parameter, operation_rule, replacing_value, operation_rule_two,
+                                  replacing_value_two, user_id, remark,
                                   create_time)
-            VALUE (#{modelType},#{mathParameter}, #{operationRule},#{replacingValue}, #{userId}, #{remark}, now())
+            VALUE (#{modelType},#{mathParameter}, #{operationRule},#{replacingValue},
+            #{operationRuleTwo},#{replacingValueTwo},#{userId}, #{remark}, now())
     </insert>
 
     <update id="updateDataModel">
@@ -24,6 +26,8 @@
             math_parameter=#{mathParameter},
             operation_rule = #{operationRule},
             replacing_value = #{replacingValue},
+            operation_rule_two = #{operationRuleTwo},
+            replacing_value_two = #{replacingValueTwo},
             remark=#{remark}
         where id = #{id}
     </update>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
chaunyi_opc/opc_da/src/main/resources/static/page/index.html


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.68bacd05.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-0b1e599b.270a6a0e.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-1c266168.183a7633.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-635e3a0e.0770beb4.css


+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-849332ce.4c39e12c.css → chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-7ba6392c.4c39e12c.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.5d339b7e.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.c60763eb.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-0b1e599b.e6bd40cd.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-1c266168.4f75f8f1.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-4fbd07bc.037df53d.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-635e3a0e.cdcefdf9.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-7ba6392c.346a8114.js


+ 12 - 7
chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/task/ReportTableTask.java

@@ -6,6 +6,7 @@ import com.example.opc_common.entity.DataModel;
 import com.example.opc_common.entity.DataSource;
 import com.example.opc_common.entity.Item;
 import com.example.opc_common.util.Blank;
+import com.example.opc_common.util.ConstantStr;
 import com.example.opc_common.util.MathUtil;
 import com.example.opc_ua.util.OpcUaUtil;
 import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
@@ -37,14 +38,18 @@ public class ReportTableTask {
                 ExpandedNodeId expandedNodeId = value.getDataType().get();
                 String javaType = OpcUaUtil.getValType(dataValue);
                 jsonObject.put("dataOrgValue", value.getValue());
-                if (javaType.toLowerCase().equals("boolean")) {
-                    jsonObject.put("dataValue", value.getValue());
-                } else {
-                    try {
-                        BigDecimal bigDecimal = JSON.parseObject(value.getValue().toString(), BigDecimal.class);
-                        jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
-                    } catch (Exception e) {
+                if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                    jsonObject.put("dataValue", DataModel.valueReplace(dm, value.toString()));
+                }else{
+                    if (javaType.toLowerCase().equals("boolean")) {
                         jsonObject.put("dataValue", value.getValue());
+                    } else {
+                        try {
+                            BigDecimal bigDecimal = JSON.parseObject(value.getValue().toString(), BigDecimal.class);
+                            jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
+                        } catch (Exception e) {
+                            jsonObject.put("dataValue", value.getValue());
+                        }
                     }
                 }
                 jsonObject.put("dataType", expandedNodeId.getType().toString());

+ 11 - 7
chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/util/OpcUaUtil.java

@@ -292,14 +292,18 @@ public class OpcUaUtil {
                 jsonObject.put("dataType", javaType);
                 jsonObject.put("eventMode", mapEventMode.get(itemName));
                 jsonObject.put("dataOrgValue", value.getValue());
-                if (javaType.toLowerCase().equals("boolean")) {
-                    jsonObject.put("dataValue", value.getValue());
-                } else {
-                    try {
-                        BigDecimal bigDecimal = JSON.parseObject(value.getValue().toString(), BigDecimal.class);
-                        jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
-                    } catch (Exception e) {
+                if (Blank.isNotEmpty(dm) && dm.getModelType().equals(ConstantStr.VALUE_REPLACE)) {
+                    jsonObject.put("dataValue", DataModel.valueReplace(dm, value.toString()));
+                }else{
+                    if (javaType.toLowerCase().equals("boolean")) {
                         jsonObject.put("dataValue", value.getValue());
+                    } else {
+                        try {
+                            BigDecimal bigDecimal = JSON.parseObject(value.getValue().toString(), BigDecimal.class);
+                            jsonObject.put("dataValue", Blank.isNotEmpty(dm) ? MathUtil.quadricOperation(dm.getMathParameter(), dm.getOperationRule(), bigDecimal) : bigDecimal);
+                        } catch (Exception e) {
+                            jsonObject.put("dataValue", value.getValue());
+                        }
                     }
                 }
                 jsonObject.put("dataType", expandedNodeId.getType().toString());

+ 1 - 1
chuanyi-admin/src/layout/components/Navbar.vue

@@ -205,7 +205,7 @@ export default {
      * @returns {Promise<void>}
      */
     logout() {
-      this.$confirm('是否强制下线此用户?', '系统提示', {
+      this.$confirm('您确定要退出系统吗?', '系统提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         cancelButtonClass: 'btn_custom_cancel',

+ 1 - 1
chuanyi-admin/src/views/dashboard/onlineUsers.vue

@@ -49,7 +49,7 @@ export default {
     },
     // 清空用户登录信息
     handelClick({ userId }) {
-      this.$confirm('是否清空用户登录信息?', '系统提示', {
+      this.$confirm('是否强制下线此用户?', '系统提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         cancelButtonClass: 'btn_custom_cancel',

+ 22 - 3
chuanyi-admin/src/views/system/driver/index.vue

@@ -80,7 +80,7 @@
       append-to-body
       :close-on-click-modal="false"
     >
-      <el-form ref="driverForm" :model="driverForm" label-width="100px">
+      <el-form ref="driverForm" :model="driverForm" :rules="rules" label-width="140px">
         <el-row style="margin-bottom: 5px">
           <el-col>
             <el-form-item label="驱动:" prop="driver">
@@ -88,7 +88,7 @@
                 v-if="driverForm.id"
                 v-model="driverForm.driver"
                 placeholder="请选择驱动"
-                style="width: 360px"
+                style="width: 300px"
                 disabled
               >
                 <el-option
@@ -102,7 +102,7 @@
                 v-else
                 v-model="driverForm.driver"
                 placeholder="请选择驱动"
-                style="width: 360px"
+                style="width: 300px"
               >
                 <el-option
                   v-for="dict in driverList"
@@ -182,6 +182,25 @@ export default {
         id: null,
         driver: null,
         items: null
+      },
+      // 表单验证
+      rules: {
+        driver: [
+          {
+            required: true,
+            message: '驱动不能为空',
+            pattern: '[^ \x22]+',
+            trigger: 'change'
+          }
+        ],
+        items: [
+          {
+            required: true,
+            message: '数据项不能为空',
+            pattern: '[^ \x22]+',
+            trigger: 'blur'
+          }
+        ]
       }
     }
   },

+ 23 - 114
chuanyi-admin/src/views/system/menu/index.vue

@@ -4,31 +4,13 @@
       <el-row>
         <el-col :span="24">
           <!-- 表单查询 -->
-          <el-form
-            ref="queryForm"
-            :model="queryParams"
-            :inline="true"
-            size="small"
-          >
+          <el-form ref="queryForm" :model="queryParams" :inline="true" size="small">
             <el-form-item label="菜单名称" prop="menuName">
-              <el-input
-                v-model="queryParams.menuName"
-                placeholder="请输入菜单名称"
-                clear
-              />
+              <el-input v-model="queryParams.menuName" placeholder="请输入菜单名称" clear />
             </el-form-item>
             <el-form-item>
-              <el-button
-                type="primary"
-                icon="el-icon-search"
-                size="mini"
-                @click="handelSearch"
-              >搜索</el-button>
-              <el-button
-                icon="el-icon-refresh"
-                size="mini"
-                @click="handelReset"
-              >重置</el-button>
+              <el-button type="primary" icon="el-icon-search" size="mini" @click="handelSearch">搜索</el-button>
+              <el-button icon="el-icon-refresh" size="mini" @click="handelReset">重置</el-button>
             </el-form-item>
           </el-form>
 
@@ -51,43 +33,11 @@
             stripe
             header-row-class-name="headBackground"
           >
-            <el-table-column
-              key="menuName"
-              label="菜单名称"
-              header-align="center"
-              prop="menuName"
-              show-overflow-tooltip
-            />
-            <el-table-column
-              key="menuIcon"
-              label="菜单图标"
-              prop="menuIcon"
-              align="center"
-              show-overflow-tooltip
-            />
-            <el-table-column
-              key="menuUrl"
-              label="路由地址"
-              prop="menuUrl"
-              align="center"
-              show-overflow-tooltip
-            />
-            <el-table-column
-              key="sortNum"
-              label="排序号"
-              prop="sortNum"
-              align="center"
-              width="100"
-              show-overflow-tooltip
-            />
-            <el-table-column
-              key="hidden"
-              label="显示状态"
-              prop="hidden"
-              align="center"
-              width="100"
-              show-overflow-tooltip
-            >
+            <el-table-column key="menuName" label="菜单名称" header-align="center" prop="menuName" show-overflow-tooltip />
+            <el-table-column key="menuIcon" label="菜单图标" prop="menuIcon" align="center" show-overflow-tooltip />
+            <el-table-column key="menuUrl" label="路由地址" prop="menuUrl" align="center" show-overflow-tooltip />
+            <el-table-column key="sortNum" label="排序号" prop="sortNum" align="center" width="100" show-overflow-tooltip />
+            <el-table-column key="hidden" label="显示状态" prop="hidden" align="center" width="100" show-overflow-tooltip>
               <template slot-scope="scope">
                 {{ scope.row.hidden === 0 ? "显示" : "隐藏" }}
               </template>
@@ -121,32 +71,13 @@
                 }}
               </template>
             </el-table-column>
-            <el-table-column
-              label="操作"
-              align="center"
-              class-name="small-padding fixed-width"
-            >
+            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
               <template slot-scope="scope">
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-edit"
-                  @click="handelEdit(scope.row.id)"
-                >修改
+                <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row.id)">修改
                 </el-button>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-delete"
-                  @click="handelDel(scope.row.id)"
-                >删除
+                <el-button size="mini" type="text" icon="el-icon-delete" @click="handelDel(scope.row.id)">删除
                 </el-button>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-zoom-in"
-                  @click="handelAuth(scope.row.id)"
-                >分配权限
+                <el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handelAuth(scope.row.id)">分配权限
                 </el-button>
               </template>
             </el-table-column>
@@ -165,12 +96,7 @@
       </el-row>
 
       <!-- 弹出框 -->
-      <el-dialog
-        :title="title"
-        :visible.sync="dialogVisible"
-        width="800px"
-        :close-on-click-modal="false"
-      >
+      <el-dialog :title="title" :visible.sync="dialogVisible" width="800px" :close-on-click-modal="false">
         <el-form ref="form" :model="form" :rules="rules" label-width="90px">
           <el-row>
             <el-col :span="24">
@@ -188,39 +114,24 @@
           <el-row>
             <el-col :span="12">
               <el-form-item label="菜单图标" prop="menuIcon">
-                <el-input
-                  v-model.trim="form.menuIcon"
-                  placeholder="请输入菜单图标"
-                />
+                <el-input v-model.trim="form.menuIcon" placeholder="请输入菜单图标" />
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="菜单名称" prop="menuName">
-                <el-input
-                  v-model.trim="form.menuName"
-                  placeholder="请输入菜单名称"
-                  maxlength="10"
-                />
+                <el-input v-model.trim="form.menuName" placeholder="请输入菜单名称" maxlength="10" />
               </el-form-item>
             </el-col>
           </el-row>
           <el-row>
             <el-col :span="12">
               <el-form-item label="路由地址" prop="menuUrl">
-                <el-input
-                  v-model.trim="form.menuUrl"
-                  placeholder="请输入路由地址"
-                />
+                <el-input v-model.trim="form.menuUrl" placeholder="请输入路由地址" />
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="排序号" prop="sortNum">
-                <el-input
-                  v-model.trim="form.sortNum"
-                  placeholder="请输入排序号"
-                  :minlength="1"
-                  :maxlength="5"
-                />
+                <el-input v-model.trim="form.sortNum" placeholder="请输入排序号" :minlength="1" :maxlength="5" />
               </el-form-item>
             </el-col>
           </el-row>
@@ -240,11 +151,7 @@
           </el-row>
         </el-form>
         <span slot="footer" class="dialog-footer">
-          <el-button
-            type="primary"
-            size="mini"
-            @click="handelSubmit('form')"
-          >确定</el-button>
+          <el-button type="primary" size="mini" @click="handelSubmit('form')">确定</el-button>
           <el-button size="mini" @click="handelCancel('form')">取消</el-button>
         </span>
       </el-dialog>
@@ -336,6 +243,9 @@ export default {
             pattern: '[^ \x22]+',
             trigger: 'blur'
           }
+        ],
+        hidden: [
+          { required: true }
         ]
       },
       // 修改菜单id
@@ -500,5 +410,4 @@ export default {
 }
 </script>
 
-<style lang="scss" rel="stylesheet/scss" scoped>
-</style>
+<style lang="scss" rel="stylesheet/scss" scoped></style>

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä