lin.liu преди 3 седмици
родител
ревизия
1e1f3b8fe2
променени са 29 файла, в които са добавени 1808 реда и са изтрити 110 реда
  1. 19 7
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/controller/DangerCategoryController.java
  2. 10 0
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/controller/GridCategoryController.java
  3. 17 5
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/domain/vo/GridInfoVO.java
  4. 3 6
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/entity/request/gridinfo/ReqCreateGridInfo.java
  5. 3 6
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/entity/request/gridinfo/ReqModifyGridInfo.java
  6. 25 6
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/mapper/impl/DangerCategoryMapperImpl.java
  7. 25 6
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/mapper/impl/GridCategoryMapperImpl.java
  8. 32 8
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/DangerCategoryService.java
  9. 42 8
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/GridCategoryService.java
  10. 116 15
      secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/GridInfoService.java
  11. 5 0
      secure-producting-common/src/main/java/com/customs/cq/datacenter/common/constant/CacheNames.java
  12. 11 5
      secure-producting-common/src/main/java/com/customs/cq/datacenter/common/core/domain/entity/SysDept.java
  13. 1 1
      secure-producting-common/src/main/java/com/customs/cq/datacenter/common/enums/DataBaseType.java
  14. 4 0
      secure-producting-common/src/main/java/com/customs/cq/datacenter/common/enums/EResultCode.java
  15. 1 1
      secure-producting-common/src/main/java/com/customs/cq/datacenter/common/helper/DataBaseHelper.java
  16. 3 2
      secure-producting-host/src/test/java/com/customs/cq/datacenter/host/H4ATest.java
  17. 13 0
      secure-producting-system/src/main/java/com/customs/cq/datacenter/system/service/ISysDeptService.java
  18. 43 3
      secure-producting-system/src/main/java/com/customs/cq/datacenter/system/service/impl/SysDeptServiceImpl.java
  19. 44 0
      secure-producting-vue/src/api/danger/DangerCategory.js
  20. 44 0
      secure-producting-vue/src/api/grid/GridCategory.js
  21. 36 0
      secure-producting-vue/src/api/grid/GridIndex.js
  22. 27 0
      secure-producting-vue/src/router/index.js
  23. 353 0
      secure-producting-vue/src/views/danger/DangerCategory.vue
  24. 353 0
      secure-producting-vue/src/views/grid/GridCategory.vue
  25. 546 0
      secure-producting-vue/src/views/grid/GridIndex.vue
  26. 7 11
      secure-producting-vue/src/views/policy/category.vue
  27. 22 17
      secure-producting-vue/src/views/policy/index.vue
  28. 1 1
      secure-producting-vue/src/views/system/user/index.vue
  29. 2 2
      sql/init.sql

+ 19 - 7
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/controller/DangerCategoryController.java

@@ -22,21 +22,23 @@
 */
 package com.customs.cq.datacenter.business.controller;
 
+import com.customs.cq.datacenter.business.domain.vo.DangerCategoryVO;
+import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqCreateDangerCategory;
+import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqModifyDangerCategory;
+import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
+import com.customs.cq.datacenter.business.service.DangerCategoryService;
 import com.customs.cq.datacenter.common.ExecutedResult;
 import com.customs.cq.datacenter.common.PagerResult;
+import com.customs.cq.datacenter.common.core.controller.BasicController;
+import com.customs.cq.datacenter.common.model.NameValueDto;
+import com.customs.cq.datacenter.common.model.ReqListId;
 import com.customs.cq.datacenter.common.utils.ParameterUtil;
 import com.customs.cq.datacenter.common.validator.ParameterValidateResult;
 import com.customs.cq.datacenter.common.validator.ParameterValidator;
-import com.customs.cq.datacenter.common.core.controller.BasicController;
-import com.customs.cq.datacenter.common.model.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+
 import java.util.List;
-import com.customs.cq.datacenter.business.service.DangerCategoryService;
-import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqCreateDangerCategory;
-import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqModifyDangerCategory;
-import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
-import com.customs.cq.datacenter.business.domain.vo.DangerCategoryVO;
 
 /**
  * 1040.隐患类别
@@ -125,4 +127,14 @@ public class DangerCategoryController extends BasicController {
     public ExecutedResult<PagerResult<DangerCategoryVO>> search(@RequestBody SearchDangerCategory request) {
         return this.service.search(request);
     }
+
+    /**
+     * 获取所有隐患类别下拉选项
+     *
+     * @author lin.liu
+     */
+    @GetMapping(value = "listAll")
+    public ExecutedResult<List<NameValueDto>> listAllSelect() {
+        return success(this.service.listAllSelect());
+    }
 }

+ 10 - 0
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/controller/GridCategoryController.java

@@ -125,4 +125,14 @@ public class GridCategoryController extends BasicController {
     public ExecutedResult<PagerResult<GridCategoryVO>> search(@RequestBody SearchGridCategory request) {
         return this.service.search(request);
     }
+
+    /**
+     * 获取所有网格类别下拉选项
+     *
+     * @author lin.liu
+     */
+    @GetMapping(value = "listAll")
+    public ExecutedResult<List<NameValueDto>> listAllSelect() {
+        return success(this.service.listAllSelect());
+    }
 }

+ 17 - 5
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/domain/vo/GridInfoVO.java

@@ -22,14 +22,14 @@
 */
 package com.customs.cq.datacenter.business.domain.vo;
 
-import lombok.Data;
-
+import com.customs.cq.datacenter.business.domain.GridInfoPO;
+import com.customs.cq.datacenter.common.core.vo.BasicVO;
 import com.customs.cq.datacenter.common.utils.LocalDateTimeUtil;
 import com.customs.cq.datacenter.common.utils.NumericUtil;
-import java.util.Objects;
+import lombok.Data;
 
-import com.customs.cq.datacenter.common.core.vo.BasicVO;
-import com.customs.cq.datacenter.business.domain.GridInfoPO;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * 网格信息
@@ -54,4 +54,16 @@ public class GridInfoVO extends GridInfoPO implements BasicVO {
         }
         return LocalDateTimeUtil.toFormatFullString(this.getUpdateTime());
     }
+    /**
+     * 网格类型-展示
+     */
+    private String gridCategoryTxt;
+    /**
+     * 隐患分类-展示
+     */
+    private String dangerCategoryTxt;
+    /**
+     * 部门列表
+     */
+    private List<Long> listDepartment;
 }

+ 3 - 6
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/entity/request/gridinfo/ReqCreateGridInfo.java

@@ -24,6 +24,7 @@ package com.customs.cq.datacenter.business.entity.request.gridinfo;
 
 import lombok.Data;
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * 网格信息
@@ -37,13 +38,9 @@ public class ReqCreateGridInfo {
 	 */
 	private String gridName;
 	/**
-	 * 所属部门
+	 * 部门列表
 	 */
-	private String department;
-	/**
-	 * 部门名称
-	 */
-	private String departmentName;
+	private List<Long> listDepartment;
 	/**
 	 * 网格类型
 	 */

+ 3 - 6
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/entity/request/gridinfo/ReqModifyGridInfo.java

@@ -24,6 +24,7 @@ package com.customs.cq.datacenter.business.entity.request.gridinfo;
 
 import lombok.Data;
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * 网格信息
@@ -41,13 +42,9 @@ public class ReqModifyGridInfo {
 	 */
 	private String gridName;
 	/**
-	 * 所属部门
+	 * 部门列表
 	 */
-	private String department;
-	/**
-	 * 部门名称
-	 */
-	private String departmentName;
+	private List<Long> listDepartment;
 	/**
 	 * 网格类型
 	 */

+ 25 - 6
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/mapper/impl/DangerCategoryMapperImpl.java

@@ -3,17 +3,22 @@ package com.customs.cq.datacenter.business.mapper.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.customs.cq.datacenter.business.domain.DangerCategoryPO;
+import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
+import com.customs.cq.datacenter.business.mapper.DangerCategoryMapper;
+import com.customs.cq.datacenter.common.core.mapper.BasicMapper;
 import com.customs.cq.datacenter.common.enums.EOrderBy;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
-import com.customs.cq.datacenter.common.utils.ListUtil;
-import com.customs.cq.datacenter.common.utils.NumericUtil;
-import com.customs.cq.datacenter.common.core.mapper.BasicMapper;
+import com.customs.cq.datacenter.common.model.NameValueDto;
 import com.customs.cq.datacenter.common.model.OrderByDTO;
 import com.customs.cq.datacenter.common.model.SearchBasicDTO;
+import com.customs.cq.datacenter.common.utils.ListUtil;
+import com.customs.cq.datacenter.common.utils.NumericUtil;
 import org.springframework.stereotype.Repository;
-import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
-import com.customs.cq.datacenter.business.domain.DangerCategoryPO;
-import com.customs.cq.datacenter.business.mapper.DangerCategoryMapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 隐患类别
@@ -97,4 +102,18 @@ public class DangerCategoryMapperImpl extends BasicMapper<DangerCategoryPO> {
         }
         return mapper.selectPage(new Page<>(search.getPage(), search.getLimit()), queryWrapper);
     }
+
+    public List<NameValueDto> listAllSelect() {
+        List<String> listColumn = new ArrayList<>();
+        listColumn.add("id");
+        listColumn.add("category_name");
+
+        LambdaQueryWrapper<DangerCategoryPO> queryWrapper = this.getQuery();
+        queryWrapper.select(DangerCategoryPO.class, c -> listColumn.contains(c.getColumn()));
+        queryWrapper.eq(DangerCategoryPO::getIsDelete, EYesOrNo.NO.getValue());
+        return mapper.selectList(queryWrapper)
+                .stream()
+                .map(c -> new NameValueDto(c.getCategoryName(), c.getId().toString()))
+                .collect(Collectors.toList());
+    }
 }

+ 25 - 6
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/mapper/impl/GridCategoryMapperImpl.java

@@ -3,17 +3,22 @@ package com.customs.cq.datacenter.business.mapper.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.customs.cq.datacenter.business.domain.GridCategoryPO;
+import com.customs.cq.datacenter.business.entity.search.SearchGridCategory;
+import com.customs.cq.datacenter.business.mapper.GridCategoryMapper;
+import com.customs.cq.datacenter.common.core.mapper.BasicMapper;
 import com.customs.cq.datacenter.common.enums.EOrderBy;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
-import com.customs.cq.datacenter.common.utils.ListUtil;
-import com.customs.cq.datacenter.common.utils.NumericUtil;
-import com.customs.cq.datacenter.common.core.mapper.BasicMapper;
+import com.customs.cq.datacenter.common.model.NameValueDto;
 import com.customs.cq.datacenter.common.model.OrderByDTO;
 import com.customs.cq.datacenter.common.model.SearchBasicDTO;
+import com.customs.cq.datacenter.common.utils.ListUtil;
+import com.customs.cq.datacenter.common.utils.NumericUtil;
 import org.springframework.stereotype.Repository;
-import com.customs.cq.datacenter.business.entity.search.SearchGridCategory;
-import com.customs.cq.datacenter.business.domain.GridCategoryPO;
-import com.customs.cq.datacenter.business.mapper.GridCategoryMapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 网格类别
@@ -97,4 +102,18 @@ public class GridCategoryMapperImpl extends BasicMapper<GridCategoryPO> {
         }
         return mapper.selectPage(new Page<>(search.getPage(), search.getLimit()), queryWrapper);
     }
+
+    public List<NameValueDto> listAllSelect() {
+        List<String> listColumn = new ArrayList<>();
+        listColumn.add("id");
+        listColumn.add("category_name");
+
+        LambdaQueryWrapper<GridCategoryPO> queryWrapper = this.getQuery();
+        queryWrapper.select(GridCategoryPO.class, c -> listColumn.contains(c.getColumn()));
+        queryWrapper.eq(GridCategoryPO::getIsDelete, EYesOrNo.NO.getValue());
+        return mapper.selectList(queryWrapper)
+                .stream()
+                .map(c -> new NameValueDto(c.getCategoryName(), c.getId().toString()))
+                .collect(Collectors.toList());
+    }
 }

+ 32 - 8
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/DangerCategoryService.java

@@ -23,22 +23,27 @@
 package com.customs.cq.datacenter.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.customs.cq.datacenter.common.*;
+import com.customs.cq.datacenter.business.domain.DangerCategoryPO;
+import com.customs.cq.datacenter.business.domain.vo.DangerCategoryVO;
+import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqCreateDangerCategory;
+import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqModifyDangerCategory;
+import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
+import com.customs.cq.datacenter.business.mapper.impl.DangerCategoryMapperImpl;
+import com.customs.cq.datacenter.common.ExecutedResult;
+import com.customs.cq.datacenter.common.PagerResult;
+import com.customs.cq.datacenter.common.core.domain.model.LoginUser;
+import com.customs.cq.datacenter.common.core.service.BasicService;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
+import com.customs.cq.datacenter.common.helper.LoginHelper;
+import com.customs.cq.datacenter.common.model.NameValueDto;
 import com.customs.cq.datacenter.common.model.Tuple;
 import com.customs.cq.datacenter.common.utils.*;
-import com.customs.cq.datacenter.common.core.service.BasicService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-import com.customs.cq.datacenter.business.mapper.impl.DangerCategoryMapperImpl;
-import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqCreateDangerCategory;
-import com.customs.cq.datacenter.business.entity.request.dangercategory.ReqModifyDangerCategory;
-import com.customs.cq.datacenter.business.entity.search.SearchDangerCategory;
-import com.customs.cq.datacenter.business.domain.DangerCategoryPO;
-import com.customs.cq.datacenter.business.domain.vo.DangerCategoryVO;
 
 /**
  * 隐患类别
@@ -61,6 +66,12 @@ public class DangerCategoryService extends BasicService {
         item.setCreateTime(LocalDateTimeUtil.nowTimeStamp());
         // 是否删除(逻辑删除)初始值
         item.setIsDelete(EYesOrNo.NO.getValue());
+        // 创建人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setCreateBy(loginUser.getUserId().toString());
+            item.setCreateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.insert(item);
         if (result != 1) {
@@ -77,6 +88,12 @@ public class DangerCategoryService extends BasicService {
         }
         // 转换po
         DangerCategoryPO item = CopierUtil.mapTo(request, DangerCategoryPO.class);
+        // 更新人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setUpdateBy(loginUser.getUserId().toString());
+            item.setUpdateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.updateById(item);
         if (result != 1) {
@@ -209,4 +226,11 @@ public class DangerCategoryService extends BasicService {
         }
         return ExecutedResult.success(exists);
     }
+
+    /**
+     * 获取所有隐患类别下拉选项
+     */
+    public List<NameValueDto> listAllSelect() {
+        return dao.listAllSelect();
+    }
 }

+ 42 - 8
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/GridCategoryService.java

@@ -23,22 +23,29 @@
 package com.customs.cq.datacenter.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.customs.cq.datacenter.common.*;
+import com.customs.cq.datacenter.business.domain.GridCategoryPO;
+import com.customs.cq.datacenter.business.domain.vo.GridCategoryVO;
+import com.customs.cq.datacenter.business.entity.request.gridcategory.ReqCreateGridCategory;
+import com.customs.cq.datacenter.business.entity.request.gridcategory.ReqModifyGridCategory;
+import com.customs.cq.datacenter.business.entity.search.SearchGridCategory;
+import com.customs.cq.datacenter.business.mapper.impl.GridCategoryMapperImpl;
+import com.customs.cq.datacenter.common.ExecutedResult;
+import com.customs.cq.datacenter.common.PagerResult;
+import com.customs.cq.datacenter.common.core.domain.model.LoginUser;
+import com.customs.cq.datacenter.common.core.service.BasicService;
+import com.customs.cq.datacenter.common.enums.EResultCode;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
+import com.customs.cq.datacenter.common.exception.ServiceException;
+import com.customs.cq.datacenter.common.helper.LoginHelper;
+import com.customs.cq.datacenter.common.model.NameValueDto;
 import com.customs.cq.datacenter.common.model.Tuple;
 import com.customs.cq.datacenter.common.utils.*;
-import com.customs.cq.datacenter.common.core.service.BasicService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-import com.customs.cq.datacenter.business.mapper.impl.GridCategoryMapperImpl;
-import com.customs.cq.datacenter.business.entity.request.gridcategory.ReqCreateGridCategory;
-import com.customs.cq.datacenter.business.entity.request.gridcategory.ReqModifyGridCategory;
-import com.customs.cq.datacenter.business.entity.search.SearchGridCategory;
-import com.customs.cq.datacenter.business.domain.GridCategoryPO;
-import com.customs.cq.datacenter.business.domain.vo.GridCategoryVO;
 
 /**
  * 网格类别
@@ -61,6 +68,12 @@ public class GridCategoryService extends BasicService {
         item.setCreateTime(LocalDateTimeUtil.nowTimeStamp());
         // 是否删除(逻辑删除)初始值
         item.setIsDelete(EYesOrNo.NO.getValue());
+        // 创建人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setCreateBy(loginUser.getUserId().toString());
+            item.setCreateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.insert(item);
         if (result != 1) {
@@ -77,6 +90,12 @@ public class GridCategoryService extends BasicService {
         }
         // 转换po
         GridCategoryPO item = CopierUtil.mapTo(request, GridCategoryPO.class);
+        // 更新人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setUpdateBy(loginUser.getUserId().toString());
+            item.setUpdateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.updateById(item);
         if (result != 1) {
@@ -209,4 +228,19 @@ public class GridCategoryService extends BasicService {
         }
         return ExecutedResult.success(exists);
     }
+
+    protected GridCategoryPO check4IdExt(Long id) {
+        GridCategoryPO exists = dao.selectById(id);
+        if (Objects.isNull(exists)) {
+            throw new ServiceException("[网格类别]不存在:" + id, EResultCode.NOT_FOUND.getCode());
+        }
+        return exists;
+    }
+
+    /**
+     * 获取所有网格类别下拉选项
+     */
+    public List<NameValueDto> listAllSelect() {
+        return dao.listAllSelect();
+    }
 }

+ 116 - 15
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/GridInfoService.java

@@ -23,22 +23,34 @@
 package com.customs.cq.datacenter.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.customs.cq.datacenter.common.*;
+import com.customs.cq.datacenter.business.domain.DangerCategoryPO;
+import com.customs.cq.datacenter.business.domain.GridCategoryPO;
+import com.customs.cq.datacenter.business.domain.GridInfoPO;
+import com.customs.cq.datacenter.business.domain.vo.GridInfoVO;
+import com.customs.cq.datacenter.business.entity.request.gridinfo.ReqCreateGridInfo;
+import com.customs.cq.datacenter.business.entity.request.gridinfo.ReqModifyGridInfo;
+import com.customs.cq.datacenter.business.entity.search.SearchGridInfo;
+import com.customs.cq.datacenter.business.mapper.impl.DangerCategoryMapperImpl;
+import com.customs.cq.datacenter.business.mapper.impl.GridCategoryMapperImpl;
+import com.customs.cq.datacenter.business.mapper.impl.GridInfoMapperImpl;
+import com.customs.cq.datacenter.common.ExecutedResult;
+import com.customs.cq.datacenter.common.PagerResult;
+import com.customs.cq.datacenter.common.core.domain.entity.SysDept;
+import com.customs.cq.datacenter.common.core.domain.model.LoginUser;
+import com.customs.cq.datacenter.common.core.service.BasicService;
+import com.customs.cq.datacenter.common.enums.EState;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
+import com.customs.cq.datacenter.common.helper.LoginHelper;
+import com.customs.cq.datacenter.common.model.NameValueDto;
 import com.customs.cq.datacenter.common.model.Tuple;
 import com.customs.cq.datacenter.common.utils.*;
-import com.customs.cq.datacenter.common.core.service.BasicService;
+import com.customs.cq.datacenter.system.service.ISysDeptService;
+import com.customs.cq.datacenter.system.service.impl.SysDeptServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import com.customs.cq.datacenter.business.mapper.impl.GridInfoMapperImpl;
-import com.customs.cq.datacenter.business.entity.request.gridinfo.ReqCreateGridInfo;
-import com.customs.cq.datacenter.business.entity.request.gridinfo.ReqModifyGridInfo;
-import com.customs.cq.datacenter.business.entity.search.SearchGridInfo;
-import com.customs.cq.datacenter.business.domain.GridInfoPO;
-import com.customs.cq.datacenter.business.domain.vo.GridInfoVO;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 网格信息
@@ -49,18 +61,47 @@ import com.customs.cq.datacenter.business.domain.vo.GridInfoVO;
 public class GridInfoService extends BasicService {
     @Autowired
     private GridInfoMapperImpl dao;
+    @Autowired
+    private GridCategoryMapperImpl gridCategoryMapper;
+    @Autowired
+    private DangerCategoryMapperImpl dangerCategoryMapper;
+
+
+    @Autowired
+    private GridCategoryService gridCategoryService;
+    @Autowired
+    private DangerCategoryService dangerCategoryService;
+
+    @Autowired
+    private ISysDeptService deptService;
 
     public ExecutedResult<Long> create(ReqCreateGridInfo request) {
+        // 查找部门
+        List<SysDept> listDept = deptService.getList(request.getListDepartment());
+        listDept.sort(Comparator.comparing(SysDept::getLevel));
+
         // 转换po
         GridInfoPO item = CopierUtil.mapTo(request, GridInfoPO.class);
         // 设置主键
         item.setId(SnowFlakeUtil.getId());
+        item.setDepartment("");
+        item.setDepartmentName("");
+        if (ListUtil.isNotNullOrEmpty(listDept)) {
+            item.setDepartment("#" + StringUtil.join(listDept.stream().map(c -> c.getDeptId().toString()).collect(Collectors.toList()), "#,#") + "#");
+            item.setDepartmentName("#" + StringUtil.join(listDept.stream().map(SysDept::getDeptName).collect(Collectors.toList()), "#,#") + "#");
+        }
         // 设置状态
-        //item.setStatus(EState.NORMAL.getValue());
+        item.setStatus(EState.NORMAL.getValue());
         // 设置记录创建时间
         item.setCreateTime(LocalDateTimeUtil.nowTimeStamp());
         // 是否删除(逻辑删除)初始值
         item.setIsDelete(EYesOrNo.NO.getValue());
+        // 创建人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setCreateBy(loginUser.getUserId().toString());
+            item.setCreateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.insert(item);
         if (result != 1) {
@@ -70,6 +111,10 @@ public class GridInfoService extends BasicService {
     }
 
     public ExecutedResult<String> modify(ReqModifyGridInfo request) {
+        // 查找部门
+        List<SysDept> listDept = deptService.getList(request.getListDepartment());
+        listDept.sort(Comparator.comparing(SysDept::getLevel));
+
         // 验证记录是否存在
         ExecutedResult<GridInfoPO> checkExists = this.check4Id(request.getId());
         if (checkExists.isFailed()) {
@@ -77,6 +122,18 @@ public class GridInfoService extends BasicService {
         }
         // 转换po
         GridInfoPO item = CopierUtil.mapTo(request, GridInfoPO.class);
+        item.setDepartment("");
+        item.setDepartmentName("");
+        if (ListUtil.isNotNullOrEmpty(listDept)) {
+            item.setDepartment("#" + StringUtil.join(listDept.stream().map(c -> c.getDeptId().toString()).collect(Collectors.toList()), "#,#") + "#");
+            item.setDepartmentName("#" + StringUtil.join(listDept.stream().map(SysDept::getDeptName).collect(Collectors.toList()), "#,#") + "#");
+        }
+        // 更新人信息
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        if (Objects.nonNull(loginUser)) {
+            item.setUpdateBy(loginUser.getUserId().toString());
+            item.setUpdateByName(loginUser.getUsername());
+        }
 
         int result = this.dao.updateById(item);
         if (result != 1) {
@@ -91,6 +148,17 @@ public class GridInfoService extends BasicService {
         GridInfoPO find = dao.selectById(id);
         if (null != find) {
             result = CopierUtil.mapTo(find, GridInfoVO.class);
+            result.setGridCategoryTxt("");
+            result.setDangerCategoryTxt("");
+            GridCategoryPO gridCategory = gridCategoryMapper.selectById(find.getGridCategory());
+            if (Objects.nonNull(gridCategory)) {
+                result.setGridCategoryTxt(gridCategory.getCategoryName());
+            }
+            DangerCategoryPO dangerCategory = dangerCategoryMapper.selectById(find.getGridCategory());
+            if (Objects.nonNull(dangerCategory)) {
+                result.setDangerCategoryTxt(dangerCategory.getCategoryName());
+            }
+            result.setListDepartment(StringUtil.splitLongList(find.getDepartment().replaceAll("#,#", ",").replaceAll("#", "")));
         }
         return ExecutedResult.success(result);
     }
@@ -176,7 +244,24 @@ public class GridInfoService extends BasicService {
 
         List<GridInfoPO> list = this.dao.selectBatchIds(listId);
         if (ListUtil.isNotNullOrEmpty(list)) {
-            result = CopierUtil.mapTo(list, GridInfoVO.class);
+            List<NameValueDto> listGridCategory = gridCategoryService.listAllSelect();
+            Map<String, NameValueDto> mapGridCategory = listGridCategory.stream().collect(Collectors.toMap(NameValueDto::getValue, c -> c));
+            List<NameValueDto> listDangerCategory = dangerCategoryService.listAllSelect();
+            Map<String, NameValueDto> mapDangerCategory = listDangerCategory.stream().collect(Collectors.toMap(NameValueDto::getValue, c -> c));
+            for (GridInfoPO item : list) {
+                // 转换vo
+                GridInfoVO vo = CopierUtil.mapTo(item, GridInfoVO.class);
+                vo.setGridCategoryTxt("");
+                vo.setDangerCategoryTxt("");
+                if (mapGridCategory.containsKey(item.getGridCategory() + "")) {
+                    vo.setGridCategoryTxt(mapGridCategory.get(item.getGridCategory() + "").getName());
+                }
+                if (mapDangerCategory.containsKey(item.getDangerCategory() + "")) {
+                    vo.setDangerCategoryTxt(mapDangerCategory.get(item.getDangerCategory() + "").getName());
+                }
+                vo.setListDepartment(StringUtil.splitLongList(item.getDepartment().replaceAll("#,#", ",").replaceAll("#", "")));
+                result.add(vo);
+            }
         }
         return ExecutedResult.success(result);
     }
@@ -195,8 +280,24 @@ public class GridInfoService extends BasicService {
         List<GridInfoVO> listVo = new ArrayList<>();
         List<GridInfoPO> list = pageList.getRecords();
         if (ListUtil.isNotNullOrEmpty(list)) {
-            // 转换vo
-            listVo = CopierUtil.mapTo(list, GridInfoVO.class);
+            List<NameValueDto> listGridCategory = gridCategoryService.listAllSelect();
+            Map<String, NameValueDto> mapGridCategory = listGridCategory.stream().collect(Collectors.toMap(NameValueDto::getValue, c -> c));
+            List<NameValueDto> listDangerCategory = dangerCategoryService.listAllSelect();
+            Map<String, NameValueDto> mapDangerCategory = listDangerCategory.stream().collect(Collectors.toMap(NameValueDto::getValue, c -> c));
+            for (GridInfoPO item : list) {
+                // 转换vo
+                GridInfoVO vo = CopierUtil.mapTo(item, GridInfoVO.class);
+                vo.setGridCategoryTxt("");
+                vo.setDangerCategoryTxt("");
+                if (mapGridCategory.containsKey(item.getGridCategory() + "")) {
+                    vo.setGridCategoryTxt(mapGridCategory.get(item.getGridCategory() + "").getName());
+                }
+                if (mapDangerCategory.containsKey(item.getDangerCategory() + "")) {
+                    vo.setDangerCategoryTxt(mapDangerCategory.get(item.getDangerCategory() + "").getName());
+                }
+                vo.setListDepartment(StringUtil.splitLongList(item.getDepartment().replaceAll("#,#", ",").replaceAll("#", "")));
+                listVo.add(vo);
+            }
         }
         PagerResult<GridInfoVO> result = new PagerResult<>(pageList.getSize(), pageList.getCurrent(), pageList.getTotal(), listVo);
         return ExecutedResult.success(result);

+ 5 - 0
secure-producting-common/src/main/java/com/customs/cq/datacenter/common/constant/CacheNames.java

@@ -55,4 +55,9 @@ public interface CacheNames {
      */
     String ONLINE_TOKEN = "online_tokens";
 
+
+    /**
+     * 部门
+     */
+    String SYS_DEPT_PARENT = "sys_dept_parent#30d";
 }

+ 11 - 5
secure-producting-common/src/main/java/com/customs/cq/datacenter/common/core/domain/entity/SysDept.java

@@ -17,7 +17,6 @@ import javax.validation.constraints.Size;
  *
  * @author Lion
  */
-
 @Data
 @EqualsAndHashCode(callSuper = true)
 @TableName("sys_dept")
@@ -37,6 +36,16 @@ public class SysDept extends TreeEntity<SysDept> {
     @Size(min = 0, max = 30, message = "部门名称长度不能超过{max}个字符")
     private String deptName;
 
+    /**
+     * 祖级列表
+     */
+    private String ancestors;
+
+    /**
+     * 层级
+     */
+    private Integer level;
+
     /**
      * 显示顺序
      */
@@ -66,14 +75,11 @@ public class SysDept extends TreeEntity<SysDept> {
      */
     private String status;
 
-    /**
-     * 祖级列表
-     */
-    private String ancestors;
     /**
      * h4a guid
      */
     private String guid;
+
     /**
      * h4a父级guid
      */

+ 1 - 1
secure-producting-common/src/main/java/com/customs/cq/datacenter/common/enums/DataBaseType.java

@@ -36,7 +36,7 @@ public enum DataBaseType {
     /**
      * DM
      */
-    DM("DM8");
+    DM("DM DBMS");
 
     private final String type;
 

+ 4 - 0
secure-producting-common/src/main/java/com/customs/cq/datacenter/common/enums/EResultCode.java

@@ -38,6 +38,10 @@ public enum EResultCode implements IErrorCode {
      * 没有相关权限=403,
      **/
     FORBIDDEN(403, "没有相关权限"),
+    /**
+     * 资源不存在=404,
+     **/
+    NOT_FOUND(404, "资源不存在"),
     /**
      * 签名验证失败=407,
      */

+ 1 - 1
secure-producting-common/src/main/java/com/customs/cq/datacenter/common/helper/DataBaseHelper.java

@@ -62,7 +62,7 @@ public class DataBaseHelper {
         } else if (dataBasyType == DataBaseType.POSTGRE_SQL) {
             // (select position(',100,' in ',0,100,101,')) <> 0
             return "(select position('," + var + ",' in ','||" + var2 + "||',')) <> 0";
-        } else if (dataBasyType == DataBaseType.ORACLE) {
+        } else if (dataBasyType == DataBaseType.ORACLE || dataBasyType == DataBaseType.DM) {
             // instr(',0,100,101,' , ',100,') <> 0
             return "instr(','||" + var2 + "||',' , '," + var + ",') <> 0";
         }

+ 3 - 2
secure-producting-host/src/test/java/com/customs/cq/datacenter/host/H4ATest.java

@@ -15,7 +15,6 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.time.LocalDateTime;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -35,12 +34,12 @@ public class H4ATest {
         Map<String, List<OrganizationChildren>> map4Parent = Arrays.stream(list).collect(Collectors.groupingBy(OrganizationChildren::getParent_guid));
 
         LocalDateTime now = LocalDateTime.now();
-        List<SysDept> listNew = new ArrayList<>();
 
         String rootGuid = "94480300-fca2-4268-86c2-4c13963bf4cb";
         SysDept root = new SysDept();
         root.setDeptId(StringUtil.guidToId(rootGuid));
         root.setParentId(0L);
+        root.setLevel(0);
         root.setAncestors("");
         root.setOrderNum(0);
         root.setDeptName("海关总署");
@@ -70,6 +69,7 @@ public class H4ATest {
                 item.setDeptName(org.getObj_name());
             }
             item.setParentId(0L);
+            item.setLevel(1);
             item.setAncestors(item.getAllPathName().replaceAll("\\\\", "/").replace("/" + item.getDeptName(), ""));
             item.setOrderNum(0);
             item.setLeader("");
@@ -105,6 +105,7 @@ public class H4ATest {
                     item.setDeptName(org.getObj_name());
                 }
                 item.setParentId(0L);
+                item.setLevel(dep.getLevel() + 1);
                 item.setAncestors(item.getAllPathName().replaceAll("\\\\", "/").replace(item.getDeptName(), ""));
                 item.setOrderNum(0);
                 item.setLeader("");

+ 13 - 0
secure-producting-system/src/main/java/com/customs/cq/datacenter/system/service/ISysDeptService.java

@@ -113,4 +113,17 @@ public interface ISysDeptService {
      * @return 结果
      */
     int deleteDeptById(Long deptId);
+
+    /**
+     * 获取指定部门以及所有父级部门
+     * @param deptId 部门id
+     * @param includeSelf 是否返回自身
+     */
+    List<SysDept> getDeptAndParent(Long deptId, Boolean includeSelf);
+
+    /**
+     * 批量获取部门
+     * @param listDept 部门id列表
+     */
+    public List<SysDept> getList(List<Long> listDept);
 }

+ 43 - 3
secure-producting-system/src/main/java/com/customs/cq/datacenter/system/service/impl/SysDeptServiceImpl.java

@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.customs.cq.datacenter.common.enums.EYesOrNo;
+import com.customs.cq.datacenter.common.utils.StringUtil;
 import com.customs.cq.datacenter.system.mapper.SysDeptMapper;
 import com.customs.cq.datacenter.common.constant.CacheNames;
 import com.customs.cq.datacenter.common.constant.UserConstants;
@@ -29,9 +30,8 @@ import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 部门管理 服务实现
@@ -305,4 +305,44 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
         return baseMapper.deleteById(deptId);
     }
 
+    /**
+     * 获取指定部门以及所有父级部门
+     * @param deptId 部门id
+     * @param includeSelf 是否返回自身
+     */
+    @Cacheable(cacheNames = CacheNames.SYS_DEPT_PARENT, key = "#deptId")
+    @Override
+    public List<SysDept> getDeptAndParent(Long deptId, Boolean includeSelf) {
+        List<SysDept> result = new ArrayList<>();
+        SysDept dept = baseMapper.selectById(deptId);
+        if (Objects.isNull(dept)) {
+            return result;
+        }
+        if (includeSelf) {
+            result.add(dept);
+        }
+        List<SysDept> list = baseMapper.selectList();
+        Map<String, SysDept> map = list.stream().
+                collect(Collectors.toMap(SysDept::getGuid, c -> c));
+        this.fillParent(dept, map, result);
+
+        result.sort(Comparator.comparing(SysDept::getDeptId).reversed());
+        return result;
+    }
+
+    private void fillParent(SysDept dept, Map<String, SysDept> map, List<SysDept> list) {
+        if (StringUtil.isNotNullOrEmpty(dept.getGuid()) && map.containsKey(dept.getParentGuid())) {
+            SysDept child = map.get(dept.getParentGuid());
+            list.add(child);
+            this.fillParent(child, map, list);
+        }
+    }
+
+    /**
+     * 批量获取部门
+     * @param listDept 部门id列表
+     */
+    public List<SysDept> getList(List<Long> listDept) {
+        return baseMapper.selectBatchIds(listDept);
+    }
 }

+ 44 - 0
secure-producting-vue/src/api/danger/DangerCategory.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询[隐患分类]
+export function search(data) {
+  return request({
+    url: '/dangerCategory/search',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取[隐患分类]
+export function detail(id) {
+  return request({
+    url: '/dangerCategory/get/' + id,
+    method: 'get'
+  })
+}
+
+// 创建[隐患分类]
+export function create(data) {
+  return request({
+    url: '/dangerCategory/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 编辑[隐患分类]
+export function modify(data) {
+  return request({
+    url: '/dangerCategory/modify',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取所有隐患分类下拉选项
+export function listAllDangerCategory() {
+  return request({
+    url: '/dangerCategory/listAll',
+    method: 'get'
+  })
+}

+ 44 - 0
secure-producting-vue/src/api/grid/GridCategory.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询[网格类型]
+export function search(data) {
+  return request({
+    url: '/gridCategory/search',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取[网格类型]
+export function detail(id) {
+  return request({
+    url: '/gridCategory/get/' + id,
+    method: 'get'
+  })
+}
+
+// 创建[网格类型]
+export function create(data) {
+  return request({
+    url: '/gridCategory/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 编辑[网格类型]
+export function modify(data) {
+  return request({
+    url: '/gridCategory/modify',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取所有网格类型下拉选项
+export function listAllGridCategory() {
+  return request({
+    url: '/gridCategory/listAll',
+    method: 'get'
+  })
+}

+ 36 - 0
secure-producting-vue/src/api/grid/GridIndex.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 查询[网格信息]
+export function search(data) {
+  return request({
+    url: '/gridInfo/search',
+    method: 'post',
+    data: data
+  })
+}
+
+// 获取[网格信息]
+export function detail(id) {
+  return request({
+    url: '/gridInfo/get/' + id,
+    method: 'get'
+  })
+}
+
+// 创建[网格信息]
+export function create(data) {
+  return request({
+    url: '/gridInfo/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 编辑[网格信息]
+export function modify(data) {
+  return request({
+    url: '/gridInfo/modify',
+    method: 'post',
+    data: data
+  })
+}

+ 27 - 0
secure-producting-vue/src/router/index.js

@@ -192,6 +192,33 @@ export const dynamicRoutes = [
       }
     ]
   },
+  // 安全生产网格管理
+  {
+    path: '/grid',
+    component: Layout,
+    hidden: true,
+    permissions: ['grid:index:list'],
+    children: [
+      {
+        path: 'category',
+        component: () => import('@/views/grid/GridCategory'),
+        name: 'GridCategory',
+        meta: { title: '网格类型', activeMenu: '/grid/category' }
+      },
+      {
+        path: 'dangerCategory',
+        component: () => import('@/views/danger/DangerCategory'),
+        name: 'DangerCategory',
+        meta: { title: '隐患分类', activeMenu: '/grid/dangerCategory' }
+      },
+      {
+        path: 'index',
+        component: () => import('@/views/grid/GridIndex'),
+        name: 'GridIndex',
+        meta: { title: '网格管理', activeMenu: '/grid/index' }
+      }
+    ]
+  },
   {
     path: '/policy',
     component: Layout,

+ 353 - 0
secure-producting-vue/src/views/danger/DangerCategory.vue

@@ -0,0 +1,353 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="关键字" prop="keywords">
+        <el-input
+          v-model="queryParams.keywords"
+          placeholder="请输入关键字"
+          clearable
+          style="width: 200px"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建时间">
+        <el-date-picker
+          v-model="dateRangeCreateTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[
+            new Date(2000, 1, 1, 0, 0, 0),
+            new Date(2000, 1, 1, 23, 59, 59),
+          ]"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="Plus"
+          @click="handleAdd"
+          >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="Edit"
+          :disabled="single"
+          @click="handleUpdate"
+          >修改</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table
+      :data="dataList"
+      @selection-change="handleSelectionChange"
+      @row-dblclick="handleDetail"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="主键" align="center" prop="id" />
+      <el-table-column label="分类名称" align="center" prop="categoryName" />
+      <el-table-column label="创建时间" align="center" prop="createTimeView" />
+      <el-table-column label="最后更新时间" align="center" prop="updateTimeView" />
+      <el-table-column
+        label="操作"
+        align="center"
+        width="150"
+        fixed="right"
+        class-name="small-padding fixed-width"
+      >
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="handleDetail(scope.row)"
+            >详情</el-button>
+          <el-button
+            link
+            type="primary"
+            icon="Edit"
+            @click="handleUpdate(scope.row)"
+            >修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.page"
+      v-model:limit="queryParams.limit"
+      @pagination="getList"
+    />
+
+  <!-- 添加对话框 -->
+  <el-dialog
+    :title="title"
+    v-model="dialogOpenCreate"
+    width="750px"
+    append-to-body
+  >
+    <el-form
+      ref="formCrateRef"
+      :model="formCreate"
+      :rules="rulesCreate"
+      label-width="135px"
+    >
+      <el-form-item label="分类名称" prop="categoryName">
+        <el-input v-model="formCreate.categoryName" placeholder="请输入分类名称" />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input v-model="formCreate.description" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入描述" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button
+          :loading="createLoading"
+          type="primary"
+          @click="submitCreate"
+          >确 定</el-button>
+        <el-button @click="cancelCreate">取 消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+
+  <!-- 修改对话框 -->
+  <el-dialog
+    :title="title"
+    v-model="dialogOpenModify"
+    width="750px"
+    append-to-body
+  >
+    <el-form
+      :disabled="isDetail"
+      ref="formModifyRef"
+      :model="formModify"
+      :rules="rulesModify"
+      label-width="135px"
+    >
+      <el-form-item label="分类名称" prop="categoryName">
+        <el-input v-model="formModify.id" type="hidden" />
+        <el-input v-model="formModify.categoryName" placeholder="请输入分类名称" />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input v-model="formModify.description" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入描述" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button
+          v-if="isDetail === false"
+          :loading="modifyLoading"
+          type="primary"
+          @click="submitModify"
+          >确 定</el-button>
+        <el-button @click="cancelModify">{{cancelModifyTxt}}</el-button>
+        <el-button type="primary" v-if="isDetail" @click="changeModify">编 辑</el-button>
+      </div>
+    </template>
+  </el-dialog>
+  </div>
+</template>
+
+<script setup name="DangerCategory">
+import {
+  create, detail, modify, search
+} from "@/api/danger/DangerCategory";
+
+const { proxy } = getCurrentInstance();
+
+const dataList = ref([]);
+
+const createLoading = ref(false);
+const dialogOpenCreate = ref(false);
+
+const modifyLoading = ref(false);
+const dialogOpenModify = ref(false);
+
+const total = ref(0);
+const dateRangeCreateTime = ref([]);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const title = ref("");
+const cancelModifyTxt = ref("取 消");
+const isDetail = ref(false);
+
+const queryParams = ref({
+  page: 1,
+  limit: 10,
+  createTimeRange: "",
+  keywords: undefined,
+  listStatus: undefined,
+  createTime: undefined,
+});
+
+const formCreate = ref({});
+const rulesCreate = ref({
+  categoryName: [
+    { required: true, message: "分类名称不能为空", trigger: "blur" },
+    { max: 100, message: '分类名称字符长度不能超过100', trigger: 'blur' }
+  ],
+  description: [{ max: 200, message: '分类描述字符长度不能超过200', trigger: 'blur' }],
+});
+
+const formModify = ref({});
+const rulesModify = ref({
+  categoryName: [
+    { required: true, message: "分类名称不能为空", trigger: "blur" },
+    { max: 100, message: '分类名称字符长度不能超过1200', trigger: 'blur' }
+  ],
+  description: [{ max: 200, message: '分类描述字符长度不能超过500', trigger: 'blur' }],
+});
+
+
+
+/** 查询列表 */
+function getList() {
+  if (
+    dateRangeCreateTime &&
+    dateRangeCreateTime.value &&
+    dateRangeCreateTime.value[0]
+  ) {
+    queryParams.value.createTimeRange = dateRangeCreateTime.value.join(" ~ ");
+  }
+  search(queryParams.value).then((response) => {
+    dataList.value = response.data.list;
+    total.value = response.data.total;
+  })
+};
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.page = 1;
+  getList();
+}
+/** 重置按钮操作 */
+function resetQuery() {
+  dateRangeCreateTime.value = [];
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+/** 选择条数  */
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+/** 取消新增按钮 */
+function cancelCreate() {
+  dialogOpenCreate.value = false;
+  resetCreate();
+}
+/** 新增表单重置 */
+function resetCreate() {
+  formCreate.value = {
+    categoryName: undefined,
+    description: undefined,
+  };
+  proxy.resetForm("formCrateRef");
+}
+/** 新增按钮 */
+function handleAdd() {
+  resetCreate();
+  dialogOpenCreate.value = true;
+  title.value = "添加隐患分类";
+}
+/** 新增提交 */
+function submitCreate() {
+  proxy.$refs["formCrateRef"].validate((valid) => {
+    if (valid) {
+      createLoading.value = true;
+
+      create(formCreate.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("新增成功");
+          dialogOpenCreate.value = false;
+          getList();
+        })
+        .finally(() => {
+          createLoading.value = false;
+        });
+    }
+  });
+}
+/** 取消编辑按钮 */
+function cancelModify() {
+  dialogOpenModify.value = false;
+  resetModify();
+}
+/** 编辑表单重置 */
+function resetModify() {
+  formModify.value = {
+    id: undefined,
+    categoryName: undefined,
+    description: undefined,
+  };
+  proxy.resetForm("formModifyRef");
+}
+/** 详情按钮 */
+function handleDetail(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = true;
+    modifyLoading.value = false;
+    formModify.value = response.data;
+    dialogOpenModify.value = true;
+    title.value = "隐患分类";
+    cancelModifyTxt.value = '关 闭';
+  });
+}
+/** 详情编辑 */
+function changeModify() {
+  isDetail.value = false;
+  title.value = "修改隐患分类";
+}
+/** 修改按钮 */
+function handleUpdate(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = false;
+    modifyLoading.value = false;
+    formModify.value = response.data;
+    dialogOpenModify.value = true;
+    title.value = "修改隐患分类";
+    cancelModifyTxt.value = '取 消';
+  });
+}
+/** 修改提交 */
+function submitModify() {
+  proxy.$refs["formModifyRef"].validate((valid) => {
+    if (valid) {
+      modifyLoading.value = true;
+
+      modify(formModify.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("修改成功");
+          dialogOpenModify.value = false;
+          getList();
+        })
+        .finally(() => {
+          modifyLoading.value = false;
+        });
+    }
+  });
+}
+
+// 调用列表查询
+getList();
+</script>

+ 353 - 0
secure-producting-vue/src/views/grid/GridCategory.vue

@@ -0,0 +1,353 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="关键字" prop="keywords">
+        <el-input
+          v-model="queryParams.keywords"
+          placeholder="请输入"
+          clearable
+          style="width: 200px"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建时间">
+        <el-date-picker
+          v-model="dateRangeCreateTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[
+            new Date(2000, 1, 1, 0, 0, 0),
+            new Date(2000, 1, 1, 23, 59, 59),
+          ]"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="Plus"
+          @click="handleAdd"
+          >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="Edit"
+          :disabled="single"
+          @click="handleUpdate"
+          >修改</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table
+      :data="dataList"
+      @selection-change="handleSelectionChange"
+      @row-dblclick="handleDetail"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="主键" align="center" prop="id" />
+      <el-table-column label="类型名称" align="center" prop="categoryName" />
+      <el-table-column label="创建时间" align="center" prop="createTimeView" />
+      <el-table-column label="最后更新时间" align="center" prop="updateTimeView" />
+      <el-table-column
+        label="操作"
+        align="center"
+        width="150"
+        fixed="right"
+        class-name="small-padding fixed-width"
+      >
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="handleDetail(scope.row)"
+            >详情</el-button>
+          <el-button
+            link
+            type="primary"
+            icon="Edit"
+            @click="handleUpdate(scope.row)"
+            >修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.page"
+      v-model:limit="queryParams.limit"
+      @pagination="getList"
+    />
+
+  <!-- 添加对话框 -->
+  <el-dialog
+    :title="title"
+    v-model="dialogOpenCreate"
+    width="750px"
+    append-to-body
+  >
+    <el-form
+      ref="formCrateRef"
+      :model="formCreate"
+      :rules="rulesCreate"
+      label-width="135px"
+    >
+      <el-form-item label="类型名称" prop="categoryName">
+        <el-input v-model="formCreate.categoryName" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input v-model="formCreate.description" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button
+          :loading="createLoading"
+          type="primary"
+          @click="submitCreate"
+          >确 定</el-button>
+        <el-button @click="cancelCreate">取 消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+
+  <!-- 修改对话框 -->
+  <el-dialog
+    :title="title"
+    v-model="dialogOpenModify"
+    width="750px"
+    append-to-body
+  >
+    <el-form
+      :disabled="isDetail"
+      ref="formModifyRef"
+      :model="formModify"
+      :rules="rulesModify"
+      label-width="135px"
+    >
+      <el-form-item label="类型名称" prop="categoryName">
+        <el-input v-model="formModify.id" type="hidden" />
+        <el-input v-model="formModify.categoryName" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input v-model="formModify.description" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button
+          v-if="isDetail === false"
+          :loading="modifyLoading"
+          type="primary"
+          @click="submitModify"
+          >确 定</el-button>
+        <el-button @click="cancelModify">{{cancelModifyTxt}}</el-button>
+        <el-button type="primary" v-if="isDetail" @click="changeModify">编 辑</el-button>
+      </div>
+    </template>
+  </el-dialog>
+  </div>
+</template>
+
+<script setup name="GridCategory">
+import {
+  create, detail, modify, search
+} from "@/api/grid/GridCategory";
+
+const { proxy } = getCurrentInstance();
+
+const dataList = ref([]);
+
+const createLoading = ref(false);
+const dialogOpenCreate = ref(false);
+
+const modifyLoading = ref(false);
+const dialogOpenModify = ref(false);
+
+const total = ref(0);
+const dateRangeCreateTime = ref([]);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const title = ref("");
+const cancelModifyTxt = ref("取 消");
+const isDetail = ref(false);
+
+const queryParams = ref({
+  page: 1,
+  limit: 10,
+  createTimeRange: "",
+  keywords: undefined,
+  listStatus: undefined,
+  createTime: undefined,
+});
+
+const formCreate = ref({});
+const rulesCreate = ref({
+  categoryName: [
+    { required: true, message: "类型名称不能为空", trigger: "blur" },
+    { max: 100, message: '类型名称字符长度不能超过100', trigger: 'blur' }
+  ],
+  description: [{ max: 200, message: '描述字符长度不能超过200', trigger: 'blur' }],
+});
+
+const formModify = ref({});
+const rulesModify = ref({
+  categoryName: [
+    { required: true, message: "类型名称不能为空", trigger: "blur" },
+    { max: 100, message: '类型名称字符长度不能超过100', trigger: 'blur' }
+  ],
+  description: [{ max: 200, message: '描述字符长度不能超过200', trigger: 'blur' }],
+});
+
+
+
+/** 查询列表 */
+function getList() {
+  if (
+    dateRangeCreateTime &&
+    dateRangeCreateTime.value &&
+    dateRangeCreateTime.value[0]
+  ) {
+    queryParams.value.createTimeRange = dateRangeCreateTime.value.join(" ~ ");
+  }
+  search(queryParams.value).then((response) => {
+    dataList.value = response.data.list;
+    total.value = response.data.total;
+  })
+};
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.page = 1;
+  getList();
+}
+/** 重置按钮操作 */
+function resetQuery() {
+  dateRangeCreateTime.value = [];
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+/** 选择条数  */
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+/** 取消新增按钮 */
+function cancelCreate() {
+  dialogOpenCreate.value = false;
+  resetCreate();
+}
+/** 新增表单重置 */
+function resetCreate() {
+  formCreate.value = {
+    categoryName: undefined,
+    description: undefined,
+  };
+  proxy.resetForm("formCrateRef");
+}
+/** 新增按钮 */
+function handleAdd() {
+  resetCreate();
+  dialogOpenCreate.value = true;
+  title.value = "添加网格类型";
+}
+/** 新增提交 */
+function submitCreate() {
+  proxy.$refs["formCrateRef"].validate((valid) => {
+    if (valid) {
+      createLoading.value = true;
+
+      create(formCreate.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("新增成功");
+          dialogOpenCreate.value = false;
+          getList();
+        })
+        .finally(() => {
+          createLoading.value = false;
+        });
+    }
+  });
+}
+/** 取消编辑按钮 */
+function cancelModify() {
+  dialogOpenModify.value = false;
+  resetModify();
+}
+/** 编辑表单重置 */
+function resetModify() {
+  formModify.value = {
+    id: undefined,
+    categoryName: undefined,
+    description: undefined,
+  };
+  proxy.resetForm("formModifyRef");
+}
+/** 详情按钮 */
+function handleDetail(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = true;
+    modifyLoading.value = false;
+    formModify.value = response.data;
+    dialogOpenModify.value = true;
+    title.value = "网格类型";
+    cancelModifyTxt.value = '关 闭';
+  });
+}
+/** 详情编辑 */
+function changeModify() {
+  isDetail.value = false;
+  title.value = "修改网格类型";
+}
+/** 修改按钮 */
+function handleUpdate(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = false;
+    modifyLoading.value = false;
+    formModify.value = response.data;
+    dialogOpenModify.value = true;
+    title.value = "修改网格类型";
+    cancelModifyTxt.value = '取 消';
+  });
+}
+/** 修改提交 */
+function submitModify() {
+  proxy.$refs["formModifyRef"].validate((valid) => {
+    if (valid) {
+      modifyLoading.value = true;
+
+      modify(formModify.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("修改成功");
+          dialogOpenModify.value = false;
+          getList();
+        })
+        .finally(() => {
+          modifyLoading.value = false;
+        });
+    }
+  });
+}
+
+// 调用列表查询
+getList();
+</script>

+ 546 - 0
secure-producting-vue/src/views/grid/GridIndex.vue

@@ -0,0 +1,546 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="关键字" prop="keywords">
+        <el-input
+          v-model="queryParams.keywords"
+          placeholder="请输入关键字"
+          clearable
+          style="width: 200px"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="所属部门" prop="department">
+        <el-tree-select
+          v-model="queryParams.department"
+          :data="deptOptions"
+          :props="{ value: 'id', label: 'label', children: 'children' }"
+          value-key="id"
+          placeholder="请选择所属部门"
+          check-strictly
+        />
+      </el-form-item>
+      <el-form-item label="网格类型" prop="listGridCategory">
+        <el-select
+          v-model="queryParams.listGridCategory"
+          multiple
+          collapse-tags
+          collapse-tags-tooltip
+          placeholder="请选择"
+          style="width: 240px"
+        >
+          <el-option
+            v-for="item in gridCategoryList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="隐患分类" prop="listDangerCategory">
+        <el-select
+          v-model="queryParams.listDangerCategory"
+          multiple
+          collapse-tags
+          collapse-tags-tooltip
+          placeholder="请选择"
+          style="width: 240px"
+        >
+          <el-option
+            v-for="item in dangerCategoryList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="创建时间">
+        <el-date-picker
+          v-model="dateRangeCreateTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[
+            new Date(2000, 1, 1, 0, 0, 0),
+            new Date(2000, 1, 1, 23, 59, 59),
+          ]"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="search" @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="Plus"
+          @click="handleAdd"
+          >新增</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="Edit"
+          :disabled="single"
+          @click="handleUpdate"
+          >修改</el-button
+        >
+      </el-col>
+    </el-row>
+
+    <el-table
+      :data="dataList"
+      @selection-change="handleSelectionChange"
+      @row-dblclick="handleDetail"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="网格名称" align="center" prop="gridName" />
+      <el-table-column label="所属部门" align="center" prop="departmentName" />
+      <el-table-column label="网格类型" align="center" prop="gridCategoryTxt" />
+      <el-table-column label="隐患分类" align="center" prop="dangerCategoryTxt" />
+      <el-table-column label="创建时间" align="center" prop="createTimeView" />
+      <el-table-column label="数据创建人" align="center" prop="createByName" />
+      <el-table-column label="操作" align="center" width="150" fixed="right" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="handleDetail(scope.row)"
+          >详情</el-button>
+          <el-button
+            link
+            type="primary"
+            icon="Edit"
+            @click="handleUpdate(scope.row)"
+          >修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.page"
+      v-model:limit="queryParams.limit"
+      @pagination="getList"
+    />
+
+    <!-- 添加对话框 -->
+    <el-dialog
+      :title="title"
+      v-model="dialogOpenCreate"
+      width="750px"
+      append-to-body
+    >
+      <el-form
+        ref="formCrateRef"
+        :model="formCreate"
+        :rules="rulesCreate"
+        label-width="85px"
+      >
+        <el-form-item label="网格名称" prop="gridName">
+          <el-input v-model="formCreate.gridName" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="所属部门" prop="listDepartment">
+          <el-cascader
+            v-model="formCreate.listDepartment"
+            :options="deptOptions"
+            :props="{checkStrictly:true,value:'id'}"
+          />
+        </el-form-item>
+        <el-form-item label="网格类型" prop="gridCategory">
+          <el-select
+            v-model="formCreate.gridCategory"
+            placeholder="请选择"
+            style="width: 240px"
+          >
+            <el-option
+              v-for="item in gridCategoryList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="隐患分类" prop="dangerCategory">
+          <el-select
+            v-model="formCreate.dangerCategory"
+            placeholder="请选择"
+            style="width: 240px"
+          >
+            <el-option
+              v-for="item in dangerCategoryList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="网格员职责" prop="gridPersonDuty">
+          <el-input v-model="formCreate.gridPersonDuty" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button
+            :loading="createLoading"
+            type="primary"
+            @click="submitCreate"
+            >确 定</el-button>
+          <el-button @click="cancelCreate">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+    <!-- 修改对话框 -->
+    <el-dialog
+      :title="title"
+      v-model="dialogOpenModify"
+      width="750px"
+      append-to-body
+    >
+      <el-form
+        :disabled="isDetail"
+        ref="formModifyRef"
+        :model="formModify"
+        :rules="rulesModify"
+        label-width="85px"
+      >
+        <el-form-item label="网格名称" prop="gridName">
+          <el-input v-model="formModify.gridName" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="所属部门" prop="listDepartment">
+          <el-cascader
+            v-model="formModify.listDepartment"
+            :options="deptOptions"
+            :props="{checkStrictly:true,value:'id'}"
+          />
+        </el-form-item>
+        <el-form-item label="网格类型" prop="gridCategory">
+          <el-select
+            v-model="formModify.gridCategory"
+            placeholder="请选择"
+            style="width: 240px"
+          >
+            <el-option
+              v-for="item in gridCategoryList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="隐患分类" prop="dangerCategory">
+          <el-select
+            v-model="formModify.dangerCategory"
+            placeholder="请选择"
+            style="width: 240px"
+          >
+            <el-option
+              v-for="item in dangerCategoryList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-switch v-model="formModify.status" :active-value="1" :inactive-value="0" />
+        </el-form-item>
+        <el-form-item label="网格员职责" prop="gridPersonDuty">
+          <el-input v-model="formModify.gridPersonDuty" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button
+            v-if="isDetail === false"
+            :loading="modifyLoading"
+            type="primary"
+            @click="submitModify"
+            >确 定</el-button
+          >
+          <el-button @click="cancelModify">{{ cancelModifyTxt }}</el-button>
+          <el-button type="primary" v-if="isDetail" @click="changeModify">编 辑</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="GridIndex">
+import { listAllGridCategory } from "@/api/grid/GridCategory";
+import { listAllDangerCategory } from "@/api/danger/DangerCategory";
+import { detail, modify, create, search } from "@/api/grid/GridIndex";
+import { deptTreeSelect } from "@/api/system/user";
+
+const { proxy } = getCurrentInstance();
+
+const deptOptions = ref(undefined);
+const gridCategoryList = ref([]);
+const dangerCategoryList = ref([]);
+const dataList = ref([]);
+
+const createLoading = ref(false);
+const dialogOpenCreate = ref(false);
+
+const modifyLoading = ref(false);
+const dialogOpenModify = ref(false);
+
+const total = ref(0);
+const dateRangeCreateTime = ref([]);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const title = ref("");
+const cancelModifyTxt = ref("取 消");
+const isDetail = ref(false);
+
+const queryParams = ref({
+  page: 1,
+  limit: 10,
+  createTimeRange: "",
+  keywords: undefined,
+  listStatus: undefined,
+  createTime: undefined,
+  listGridCategory: [],
+  listDangerCategory: [],
+});
+
+const formCreate = ref({});
+const rulesCreate = ref({
+  gridName: [
+    { required: true, message: "网格名称不能为空", trigger: "blur" },
+    { max: 50, message: "网格名称字符长度不能超过50", trigger: "blur" },
+  ],
+  department: [
+    { required: true, message: "所属部门不能为空", trigger: "blur" },
+    { max: 50, message: "所属部门字符长度不能超过50", trigger: "blur" },
+  ],
+  departmentName: [
+    { required: true, message: "部门名称不能为空", trigger: "blur" },
+    { max: 200, message: "部门名称字符长度不能超过200", trigger: "blur" },
+  ],
+  gridCategory: [{ required: true, message: "网格类型不能为空", trigger: "blur" }],
+  dangerCategory: [{ required: true, message: "隐患分类不能为空", trigger: "blur" }],
+  gridPersonDuty: [{ max: 500, message: "网格员职责字符长度不能超过500", trigger: "blur" }],
+});
+
+const formModify = ref({});
+const rulesModify = ref({
+  gridName: [
+    { required: true, message: "网格名称不能为空", trigger: "blur" },
+    { max: 50, message: "网格名称字符长度不能超过50", trigger: "blur" },
+  ],
+  department: [
+    { required: true, message: "所属部门不能为空", trigger: "blur" },
+    { max: 50, message: "所属部门字符长度不能超过50", trigger: "blur" },
+  ],
+  departmentName: [
+    { required: true, message: "部门名称不能为空", trigger: "blur" },
+    { max: 200, message: "部门名称字符长度不能超过200", trigger: "blur" },
+  ],
+  gridCategory: [{ required: true, message: "网格类型不能为空", trigger: "blur" }],
+  dangerCategory: [{ required: true, message: "隐患分类不能为空", trigger: "blur" }],
+  gridPersonDuty: [{ max: 500, message: "网格员职责字符长度不能超过500", trigger: "blur" }],
+  status: [{ required: true, message: "状态", trigger: "blur" }],
+});
+
+
+
+/** 查询列表 */
+function getList() {
+  if (
+    dateRangeCreateTime &&
+    dateRangeCreateTime.value &&
+    dateRangeCreateTime.value[0]
+  ) {
+    queryParams.value.createTimeRange = dateRangeCreateTime.value.join(" ~ ");
+  }
+  search(queryParams.value).then((response) => {
+    for(let i=0; i<response.data.list.length; i++) {
+      let item = response.data.list[i];
+      item.departmentName = item.departmentName.replaceAll('#,#', '/').replaceAll('#', '');
+    }
+    dataList.value = response.data.list;
+    total.value = response.data.total;
+  });
+}
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.page = 1;
+  getList();
+}
+/** 重置按钮操作 */
+function resetQuery() {
+  dateRangeCreateTime.value = [];
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+/** 选择条数  */
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+
+
+/** 取消新增按钮 */
+function cancelCreate() {
+  dialogOpenCreate.value = false;
+  resetCreate();
+}
+/** 新增表单重置 */
+function resetCreate() {
+  formCreate.value = {
+    gridName: undefined,
+    listDepartment: undefined,
+    gridCategory: undefined,
+    dangerCategory: undefined,
+    gridPersonDuty: undefined,
+  };
+  proxy.resetForm("formCrateRef");
+}
+/** 新增按钮 */
+function handleAdd() {
+  resetCreate();
+  dialogOpenCreate.value = true;
+  title.value = "网格信息添加";
+}
+/** 新增提交 */
+function submitCreate() {
+  proxy.$refs["formCrateRef"].validate((valid) => {
+    if (valid) {
+      createLoading.value = true;
+
+      create(formCreate.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("新增成功");
+          dialogOpenCreate.value = false;
+          getList();
+        })
+        .finally(() => {
+          createLoading.value = false;
+        });
+    }
+  });
+}
+
+
+/** 取消编辑按钮 */
+function cancelModify() {
+  dialogOpenModify.value = false;
+  resetModify();
+}
+/** 编辑表单重置 */
+function resetModify() {
+  formModify.value = {
+    id: undefined,
+    gridName: undefined,
+    listDepartment: undefined,
+    gridCategory: undefined,
+    dangerCategory: undefined,
+    gridPersonDuty: undefined,
+    status: undefined,
+  };
+  proxy.resetForm("formModifyRef");
+}
+/** 详情按钮 */
+function handleDetail(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = true;
+    modifyLoading.value = false;
+
+    formModify.value = response.data;
+
+    dialogOpenModify.value = true;
+    title.value = "网格信息";
+    cancelModifyTxt.value = "关 闭";
+  });
+}
+/** 详情编辑 */
+function changeModify() {
+  isDetail.value = false;
+  title.value = "修改网格信息";
+}
+/** 修改按钮 */
+function handleUpdate(row) {
+  modifyLoading.value = true;
+  resetModify();
+  const id = row.id || ids.value[0];
+  detail(id).then((response) => {
+    isDetail.value = false;
+    modifyLoading.value = false;
+
+    formModify.value = response.data;
+
+    dialogOpenModify.value = true;
+    title.value = "修改网格信息";
+    cancelModifyTxt.value = "取 消";
+  });
+}
+/** 修改提交 */
+function submitModify() {
+  proxy.$refs["formModifyRef"].validate((valid) => {
+    if (valid) {
+      modifyLoading.value = true;
+
+      modify(formModify.value)
+        .then((response) => {
+          proxy.$modal.msgSuccess("修改成功");
+          dialogOpenModify.value = false;
+          getList();
+        })
+        .finally(() => {
+          modifyLoading.value = false;
+        });
+    }
+  });
+}
+
+
+
+/** 查询部门下拉树结构 */
+function getDeptTree() {
+  deptTreeSelect().then(response => {
+    deptOptions.value = response.data;
+  });
+};
+/** 初始化网格类型下拉框数据 */
+function initListGridCategory() {
+  listAllGridCategory().then((response) => {
+    gridCategoryList.value = response.data;
+  });
+}
+/** 初始化隐患分类下拉框数据 */
+function initListDangerCategory() {
+  listAllDangerCategory().then((response) => {
+    dangerCategoryList.value = response.data;
+  });
+}
+
+
+
+// 调用初始化部门下拉框数据
+getDeptTree();
+// 调用初始化网格类型下拉框数据
+initListGridCategory();
+// 调用初始化隐患分类下拉框数据
+initListDangerCategory();
+// 调用列表查询
+getList();
+</script>

+ 7 - 11
secure-producting-vue/src/views/policy/category.vue

@@ -4,7 +4,7 @@
       <el-form-item label="关键字" prop="keywords">
         <el-input
           v-model="queryParams.keywords"
-          placeholder="请输入关键字"
+          placeholder="请输入"
           clearable
           style="width: 200px"
           @keyup.enter="handleQuery"
@@ -53,7 +53,6 @@
     </el-row>
 
     <el-table
-      v-listLoading="listLoading"
       :data="dataList"
       @selection-change="handleSelectionChange"
       @row-dblclick="handleDetail"
@@ -110,16 +109,16 @@
       label-width="135px"
     >
       <el-form-item label="分类名称" prop="categoryName">
-        <el-input v-model="formCreate.categoryName" placeholder="请输入分类名称" />
+        <el-input v-model="formCreate.categoryName" placeholder="请输入" />
       </el-form-item>
       <el-form-item label="描述" prop="remark">
-        <el-input v-model="formCreate.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入描述" />
+        <el-input v-model="formCreate.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
       </el-form-item>
     </el-form>
     <template #footer>
       <div class="dialog-footer">
         <el-button
-          :listLoading="createLoading"
+          :loading="createLoading"
           type="primary"
           @click="submitCreate"
           >确 定</el-button>
@@ -144,17 +143,17 @@
     >
       <el-form-item label="分类名称" prop="categoryName">
         <el-input v-model="formModify.id" type="hidden" />
-        <el-input v-model="formModify.categoryName" placeholder="请输入分类名称" />
+        <el-input v-model="formModify.categoryName" placeholder="请输入" />
       </el-form-item>
       <el-form-item label="描述" prop="remark">
-        <el-input v-model="formModify.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入描述" />
+        <el-input v-model="formModify.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请输入" />
       </el-form-item>
     </el-form>
     <template #footer>
       <div class="dialog-footer">
         <el-button
           v-if="isDetail === false"
-          :listLoading="modifyLoading"
+          :loading="modifyLoading"
           type="primary"
           @click="submitModify"
           >确 定</el-button>
@@ -174,7 +173,6 @@ import {
 const { proxy } = getCurrentInstance();
 
 const dataList = ref([]);
-const listLoading = ref(false);
 
 const createLoading = ref(false);
 const dialogOpenCreate = ref(false);
@@ -222,7 +220,6 @@ const rulesModify = ref({
 
 /** 查询列表 */
 function getList() {
-  listLoading.value = true;
   if (
     dateRangeCreateTime &&
     dateRangeCreateTime.value &&
@@ -233,7 +230,6 @@ function getList() {
   search(queryParams.value).then((response) => {
     dataList.value = response.data.list;
     total.value = response.data.total;
-    listLoading.value = false;
   })
 };
 /** 搜索按钮操作 */

+ 22 - 17
secure-producting-vue/src/views/policy/index.vue

@@ -74,7 +74,6 @@
     </el-row>
 
     <el-table
-      v-listLoading="listLoading"
       :data="dataList"
       @selection-change="handleSelectionChange"
       @row-dblclick="handleDetail"
@@ -82,9 +81,9 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="标题" align="center" prop="title" />
       <el-table-column label="分类" align="center" prop="categoryName" />
-      <el-table-column label="政策文件" align="left" prop="filePath">
+      <el-table-column label="政策文件" width="800" align="left" prop="filePath">
         <template #default="scope">
-          {{scope.row.filePath.substring(scope.row.filePath.lastIndexOf('/') + 1)}}
+          <span style="width:500px;display:inline-flex;">{{scope.row.filePath.substring(scope.row.filePath.lastIndexOf('/') + 1)}}</span>
           <el-button @click="downloadFile(scope.row.title, scope.row.filePath)">
             下载
           </el-button>
@@ -150,7 +149,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="标题" prop="title">
-          <el-input v-model="formCreate.title" placeholder="请输入标题" />
+          <el-input v-model="formCreate.title" placeholder="请输入" />
         </el-form-item>
         <el-form-item label="政策文件" prop="">
           <el-upload
@@ -184,7 +183,7 @@
       <template #footer>
         <div class="dialog-footer">
           <el-button
-            :listLoading="createLoading"
+            :loading="createLoading"
             type="primary"
             @click="submitCreate"
             >确 定</el-button
@@ -223,7 +222,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="标题" prop="title">
-          <el-input v-model="formModify.title" placeholder="请输入标题" />
+          <el-input v-model="formModify.title" placeholder="请输入" />
         </el-form-item>
         <el-form-item label="政策文件" prop="">
           <el-upload
@@ -258,7 +257,7 @@
         <div class="dialog-footer">
           <el-button
             v-if="isDetail === false"
-            :listLoading="modifyLoading"
+            :loading="modifyLoading"
             type="primary"
             @click="submitModify"
             >确 定</el-button
@@ -277,7 +276,7 @@
       v-model="dialogOpenViewPdf"
       width="75%"
       append-to-body
-      close-on-click-modal="true"
+      :close-on-click-modal="autoClose"
     >
       <div style="width:100%;height:100%;">
         <img :src="imgUrl" style="width:100%;height:100%;" alt="" />
@@ -314,13 +313,13 @@ const allowedFileTypes = ref([
   'application/x-gzip'
 ]);
 const dialogOpenViewPdf  = ref(false);
+const autoClose = ref(true);
 const imgUrl = ref('');
 
 
 
 const categoryList = ref([]);
 const dataList = ref([]);
-const listLoading = ref(false);
 
 const createLoading = ref(false);
 const dialogOpenCreate = ref(false);
@@ -353,18 +352,26 @@ const queryParams = ref({
 
 const formCreate = ref({});
 const rulesCreate = ref({
-  infoName: [
-    { required: true, message: "分类名称不能为空", trigger: "blur" },
-    { max: 20, message: "描述字符长度不能超过500", trigger: "blur" },
+  title: [
+    { required: true, message: "政策法规标题不能为空", trigger: "blur" },
+    { max: 100, message: "描述字符长度不能超过100", trigger: "blur" },
+  ],
+  filePath: [
+    { required: true, message: "政策文件路径不能为空", trigger: "blur" },
+    { max: 200, message: "政策文件路径字符长度不能超过200", trigger: "blur" },
   ],
   remark: [{ max: 500, message: "描述字符长度不能超过500", trigger: "blur" }],
 });
 
 const formModify = ref({});
 const rulesModify = ref({
-  infoName: [
-    { required: true, message: "分类名称不能为空", trigger: "blur" },
-    { max: 20, message: "描述字符长度不能超过500", trigger: "blur" },
+  title: [
+    { required: true, message: "政策法规标题不能为空", trigger: "blur" },
+    { max: 100, message: "描述字符长度不能超过100", trigger: "blur" },
+  ],
+  filePath: [
+    { required: true, message: "政策文件路径不能为空", trigger: "blur" },
+    { max: 200, message: "政策文件路径字符长度不能超过200", trigger: "blur" },
   ],
   remark: [{ max: 500, message: "描述字符长度不能超过500", trigger: "blur" }],
 });
@@ -373,7 +380,6 @@ const rulesModify = ref({
 
 /** 查询列表 */
 function getList() {
-  listLoading.value = true;
   if (
     dateRangeCreateTime &&
     dateRangeCreateTime.value &&
@@ -391,7 +397,6 @@ function getList() {
     }
     dataList.value = response.data.list;
     total.value = response.data.total;
-    listLoading.value = false;
   });
 }
 /** 搜索按钮操作 */

+ 1 - 1
secure-producting-vue/src/views/system/user/index.vue

@@ -21,7 +21,7 @@
                   ref="deptTreeRef"
                   node-key="id"
                   highlight-current
-                  default-expand-all
+                  :default-expand-all="false"
                   @node-click="handleNodeClick"
                />
             </div>

+ 2 - 2
sql/init.sql

@@ -824,8 +824,8 @@ COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."ID" IS '主键';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."CATEGORY_ID" IS '所属分类';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."CATEGORY_NAME" IS '所属分类名称';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."TITLE" IS '标题';
-COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."FILE_PATH" IS '政策文件转pdf路径';
-COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."FILE_PDF_PATH" IS '';
+COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."FILE_PATH" IS '政策文件路径';
+COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."FILE_PDF_PATH" IS '政策文件转pdf路径';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."REMARK" IS '备注';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."CREATE_TIME" IS '数据创建时间';
 COMMENT ON COLUMN "SECURE_PRODUCTING"."SP_POLICY_PUBLISH"."UPDATE_TIME" IS '最后更新时间';