统计分析

main
13233904609 11 months ago
parent 21baf76da2
commit a26f614db2

@ -0,0 +1,178 @@
package com.ruoyi.web.controller.ehs;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
import com.ruoyi.ehsIndexStatistics.service.EhsIndexStatisticsService;
import com.ruoyi.ehsIndexStatistics.vo.*;
import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
* @author:
* @date: 20231212 11:10
*/
@Api(tags = "首页统计分析接口")
@RestController
@RequestMapping("/ehs/indexStatistics")
public class EhsIndexStatisticsController extends BaseController {
@Autowired
private EhsIndexStatisticsService ehsIndexStatisticsService;
/**
*
*/
@GetMapping("/getEhsIndexStatistics")
public AjaxResult getEhsIndexStatistics()
{
EhsIndexStatistics ehsIndexStatistics = ehsIndexStatisticsService.getEhsIndexStatistics();
return AjaxResult.success(ehsIndexStatistics);
}
/**
* --
*/
@GetMapping("/getSuperviseAndHandle")
public AjaxResult getSuperviseAndHandle()
{
EhsIndexStatistics ehsIndexStatistics = ehsIndexStatisticsService.getSuperviseAndHandle();
return AjaxResult.success(ehsIndexStatistics);
}
/**
* ----
*/
@GetMapping("/getEhsIndexStatisticsList")
public AjaxResult getEhsIndexStatisticsList()
{
List<EhsIndexStatistics> list = ehsIndexStatisticsService.getEhsIndexStatisticsList();
return AjaxResult.success(list);
}
/**
*
*/
@GetMapping("/detailslist")
public TableDataInfo detailslist(HiddenDangerVo vo)
{
startPage();
List<HiddenDangerVo> list = ehsIndexStatisticsService.getHiddenDangerVoList(vo);
return getDataTable(list);
}
/**
* ---
*/
@ApiOperation("隐患情况---按行政区域统计")
@GetMapping("/getHiddenDangerSituationList")
public AjaxResult getHiddenDangerSituationList()
{
List<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationList();
return AjaxResult.success(list);
}
/**
* ---
*/
@ApiOperation("按地址统计")
@GetMapping("/getHiddenDangerSituationByEnterpriseNameList")
public AjaxResult getHiddenDangerSituationByEnterpriseNameList()
{
List<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("上报隐患排名")
@GetMapping("/getHiddenDangerRankVoList")
public AjaxResult getHiddenDangerRankVoList()
{
List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("行业领域统计数量")
@GetMapping("/getEnterpriseMapList")
public AjaxResult getEnterpriseMapList()
{
List<Map<String,Object>> list = ehsIndexStatisticsService.getEnterpriseMapList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("经济类型统计数量")
@GetMapping("/geteconomicTypeMapList")
public AjaxResult geteconomicTypeMapList()
{
List<Map<String,Object>> list = ehsIndexStatisticsService.geteconomicTypeMapList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("企业规模统计数量")
@GetMapping("/getenterpriseScaleMapList")
public AjaxResult getenterpriseScaleMapList()
{
List<Map<String,Object>> list = ehsIndexStatisticsService.getenterpriseScaleMapList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("隐患类型分析统计")
@GetMapping("/getHiddenDangerTypeMapList")
public AjaxResult getHiddenDangerTypeMapList()
{
List<Map<String,Object>> list = ehsIndexStatisticsService.getHiddenDangerTypeMapList();
return AjaxResult.success(list);
}
/**
*
*/
@ApiOperation("隐患数据统计分析")
@GetMapping("/getHiddenDangerDataMapList")
public AjaxResult getHiddenDangerDataMapList(String year)
{
JSONArray row = new JSONArray();
List<Map<String,Object>> list = ehsIndexStatisticsService.getHiddenDangerDataMapList(year);
if(StringUtils.isNotEmpty(list)){
LinkedHashMap<Object, List<Map<String, Object>>> nameList = list.stream().collect(Collectors.groupingBy(e -> e.get("name"), LinkedHashMap::new, Collectors.toList()));
if(StringUtils.isNotEmpty(nameList)){
for (Object key : nameList.keySet()) {
JSONObject obj = new JSONObject();
System.out.println("map.get(" + key + ") = " + nameList.get(key));
obj.put("name",key);
List<Object> dataList = nameList.get(key).stream().map(e -> e.get("dataNum")).collect(Collectors.toList());
obj.put("data",dataList);
row.add(obj);
}
}
}
return AjaxResult.success(row);
}
}

@ -8,7 +8,11 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
/** /**
@ -188,4 +192,38 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant()); return Date.from(zdt.toInstant());
} }
/**
* ()
*
* @param startTime
* @param endTime
* @returnYYYY-MM
*/
public static List<String> getMonthBetweenDate(String startTime, String endTime){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
// 声明保存日期集合
List<String> list = new ArrayList<String>();
try {
// 转化成日期类型
Date startDate = sdf.parse(startTime);
Date endDate = sdf.parse(endTime);
//用Calendar 进行日期比较判断
Calendar calendar = Calendar.getInstance();
while (startDate.getTime()<=endDate.getTime()){
// 把日期添加到集合
list.add(sdf.format(startDate));
// 设置日期
calendar.setTime(startDate);
//把日期增加一天
calendar.add(Calendar.MONTH, 1);
// 获取增加后的日期
startDate=calendar.getTime();
}
} catch (ParseException e) {
e.printStackTrace();
}
return list;
}
} }

@ -0,0 +1,28 @@
package com.ruoyi.ehsIndexStatistics.mapper;
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EhsIndexStatisticsMapper {
EhsIndexStatistics getEhsIndexStatistics(@Param("deptId") Long deptId);
EhsIndexStatistics getSuperviseAndHandle(@Param("deptId") Long deptId);
List<EhsIndexStatistics> getEhsIndexStatisticsList(@Param("deptId") Long deptId);
List<HiddenDangerVo> getHiddenDangerVoList(@Param("vo") HiddenDangerVo vo);
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList();
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList();
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<Map<String,Object>> getEnterpriseMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> geteconomicTypeMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> getenterpriseScaleMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> getHiddenDangerTypeMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> getHiddenDangerDataMapList(@Param("yearStr") String yearStr,@Param("deptId") Long deptId);
}

@ -0,0 +1,38 @@
package com.ruoyi.ehsIndexStatistics.service;
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EhsIndexStatisticsService {
EhsIndexStatistics getEhsIndexStatistics();
EhsIndexStatistics getSuperviseAndHandle();
List<EhsIndexStatistics> getEhsIndexStatisticsList();
List<HiddenDangerVo> getHiddenDangerVoList(HiddenDangerVo vo);
/**
*
*/
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList();
/**
*
*/
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList();
/**
*
*/
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<Map<String,Object>> getEnterpriseMapList();
List<Map<String,Object>> geteconomicTypeMapList();
List<Map<String,Object>> getenterpriseScaleMapList();
List<Map<String,Object>> getHiddenDangerTypeMapList();
List<Map<String,Object>> getHiddenDangerDataMapList(String yearStr);
}

@ -0,0 +1,172 @@
package com.ruoyi.ehsIndexStatistics.service.impl;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ehsDocument.mapper.EhsDocumentMapper;
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
import com.ruoyi.ehsIndexStatistics.mapper.EhsIndexStatisticsMapper;
import com.ruoyi.ehsIndexStatistics.service.EhsIndexStatisticsService;
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
* @author:
* @date: 20231212 15:06
*/
@Service
public class EhsIndexStatisticsServiceImpl implements EhsIndexStatisticsService {
@Autowired
private EhsIndexStatisticsMapper mapper;
@Override
public EhsIndexStatistics getEhsIndexStatistics() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getEhsIndexStatistics(deptId);
}
@Override
public EhsIndexStatistics getSuperviseAndHandle() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getSuperviseAndHandle(deptId);
}
@Override
public List<EhsIndexStatistics> getEhsIndexStatisticsList() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getEhsIndexStatisticsList(deptId);
}
@Override
public List<HiddenDangerVo> getHiddenDangerVoList(HiddenDangerVo vo) {
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
vo.setDeptId(currentUser.getDept().getDeptId().longValue());
}
return mapper.getHiddenDangerVoList(vo);
}
@Override
public List<HiddenDangerStatisticsVo> getHiddenDangerSituationList() {
return mapper.getHiddenDangerSituationList();
}
@Override
public List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList() {
return mapper.getHiddenDangerSituationByEnterpriseNameList();
}
@Override
public List<HiddenDangerRankVo> getHiddenDangerRankVoList() {
return mapper.getHiddenDangerRankVoList();
}
@Override
public List<Map<String,Object>> getEnterpriseMapList() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getEnterpriseMapList(deptId);
}
@Override
public List<Map<String,Object>> geteconomicTypeMapList() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.geteconomicTypeMapList(deptId);
}
@Override
public List<Map<String,Object>> getenterpriseScaleMapList() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getenterpriseScaleMapList(deptId);
}
@Override
public List<Map<String,Object>> getHiddenDangerTypeMapList() {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getHiddenDangerTypeMapList(deptId);
}
@Override
public List<Map<String,Object>> getHiddenDangerDataMapList(String yearStr) {
Long deptId = null;
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
deptParentId.longValue() != 0) {
deptId = currentUser.getDept().getDeptId().longValue();
}
return mapper.getHiddenDangerDataMapList(yearStr,deptId);
}
}

@ -0,0 +1,56 @@
package com.ruoyi.ehsIndexStatistics.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*
* @author:
* @date: 20231212 13:22
*/
@Data
public class EhsIndexStatistics {
/**
*
*/
private String name;
/**
*
*/
private Integer unitNum;
/**
*
*/
private Integer hiddenDangerNum;
/**
*
*/
private Integer haveRectifiedNum;
/**
*
*/
private Integer notRectifiedNum;
/**
*
*/
private Integer exceedNotRectifiedNum;
/**
*
*/
private BigDecimal rectifyMoneySum;
/**
*
*/
private String rectifyRate;
}

@ -0,0 +1,23 @@
package com.ruoyi.ehsIndexStatistics.vo;
import lombok.Data;
/**
*
*
* @author:
* @date: 20231215 9:08
*/
@Data
public class HiddenDangerRankVo {
/**
*
*/
private String areaName;
/**
* --
*/
private Integer reportHiddenNum;
}

@ -0,0 +1,64 @@
package com.ruoyi.ehsIndexStatistics.vo;
import lombok.Data;
/**
*
*
* @author:
* @date: 20231215 9:01
*/
@Data
public class HiddenDangerStatisticsVo {
/**
*
*/
private String name;
/**
* --
*/
private Integer thisUnitNum;
/**
* --
*/
private Integer totalUnitNum;
/**
* --
*/
private Integer thisReportNum;
/**
* --
*/
private Integer totalReportNum;
/**
* --
*/
private Integer thisHaveNum;
/**
* --
*/
private Integer totalHaveNum;
/**
* --
*/
private Integer thisNotNum;
/**
* --
*/
private Integer totalNotNum;
/**
* --
*/
private String thisRate;
/**
* --
*/
private String totalRate;
}

@ -0,0 +1,65 @@
package com.ruoyi.ehsIndexStatistics.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
*
* @author:
* @date: 20231214 17:03
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
public class HiddenDangerVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String hiddenDangerDesc;
/**
*
*/
private String enterpriseName;
/**
*
*/
private String hiddenDangerType;
/**
*
*/
private String hiddenDangerGrade;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date checkTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date rectifyTermTime;
/**
*
*/
private String principalName;
/**
*
*/
private String status;
}

@ -0,0 +1,294 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ehsIndexStatistics.mapper.EhsIndexStatisticsMapper">
<select id="getEhsIndexStatistics" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
SELECT
count(distinct enterprise_name) unitNum,
count( 1 ) hiddenDangerNum,
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
sum( CASE WHEN STATUS != 10 AND rectify_term_time &lt; NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
sum( rectify_money ) rectifyMoneySum,
CONCAT(round(
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ),
2
)*100,'%') rectifyRate
FROM
`ehs_hidden_danger`
<where>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
</select>
<select id="getSuperviseAndHandle" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
SELECT
count( 1 ) hiddenDangerNum,
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
sum( CASE WHEN STATUS != 10 AND rectify_term_time &lt; NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
sum( rectify_money ) rectifyMoneySum,
CONCAT(round(
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ),
2
)*100,'%') rectifyRate
FROM
`ehs_hidden_danger`
<where>
is_supervise = 1
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
</select>
<select id="getEhsIndexStatisticsList" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
SELECT
r.hidden_danger_grade,
d.dict_label name,
sum( CASE WHEN r.hidden_danger_id is not null THEN 1 ELSE 0 END ) hiddenDangerNum,
sum( CASE WHEN r.STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
sum( CASE WHEN r.STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
sum( CASE WHEN r.STATUS != 10 AND r.rectify_term_time &lt; NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
ifnull(sum( r.rectify_money ),0) rectifyMoneySum,
CONCAT(ifnull(round(
sum( CASE WHEN r.STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN r.STATUS != 10 THEN 1 ELSE 0 END ),
2
)* 100,0),'%') rectifyRate
FROM
sys_dict_data d
LEFT JOIN ehs_hidden_danger r ON r.hidden_danger_grade = d.dict_value
<where>
d.dict_type = 'hidden_danger_grade'
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
GROUP BY
r.hidden_danger_grade
</select>
<select id="getHiddenDangerVoList" parameterType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo" resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo">
SELECT
*
FROM
ehs_hidden_danger
<where>
<if test="vo.deptId != null and vo.deptId != ''">and dept_id = #{vo.deptId}</if>
<if test="vo.enterpriseName != null and vo.enterpriseName != ''">and enterprise_name like CONCAT('%',#{vo.enterpriseName},'%')</if>
<if test="vo.hiddenDangerGrade != null and vo.hiddenDangerGrade != ''">and hidden_danger_grade = #{vo.hiddenDangerGrade}</if>
<if test="vo.status != null and vo.status != ''">and status = #{vo.status}</if>
<if test="vo.params.qxStartTime != null and vo.params.qxStartTime != ''">and rectify_term_time >= #{vo.params.qxStartTime}</if>
<if test="vo.params.qxEndTime != null and vo.params.qxEndTime != ''">and rectify_term_time &lt; #{vo.params.qxEndTime}</if>
<if test="vo.params.pcStartTime != null and vo.params.pcStartTime != ''">and check_time >= #{vo.params.pcStartTime}</if>
<if test="vo.params.pcEndTime != null and vo.params.pcEndTime != ''">and check_time &lt; #{vo.params.pcEndTime}</if>
<if test="vo.params.wcStartTime != null and vo.params.wcStartTime != ''">and rectify_time >= #{vo.params.wcStartTime}</if>
<if test="vo.params.wcEndTime != null and vo.params.wcEndTime != ''">and rectify_time &lt; #{vo.params.wcEndTime}</if>
</where>
</select>
<select id="getHiddenDangerSituationList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
SELECT
d.dict_label 'name',
(select count(1) from ehs_enterprise e where e.area_id = d.dict_value and e.create_time>= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' )) thisUnitNum,
(select count(1) from ehs_enterprise e where e.area_id = d.dict_value) totalUnitNum,
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'totalReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END ) 'thisHaveNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END ) 'totalHaveNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status != 10 THEN 1 ELSE 0 END ) 'thisNotNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status != 10 THEN 1 ELSE 0 END ) 'totalNotNum',
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ),0)*100,2),'%') 'thisRate',
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ),0)*100,2),'%') 'totalRate'
FROM
sys_dict_data d
LEFT JOIN ehs_hidden_danger r ON r.area_id = d.dict_value
WHERE
d.dict_type = 'area_id'
GROUP BY
r.area_id
</select>
<select id="getHiddenDangerSituationByEnterpriseNameList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
SELECT
r.enterprise_name 'name',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'totalReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END ) 'thisHaveNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END ) 'totalHaveNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status != 10 THEN 1 ELSE 0 END ) 'thisNotNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status != 10 THEN 1 ELSE 0 END ) 'totalNotNum',
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ),0)*100,2),'%') 'thisRate',
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ),0)*100,2),'%') 'totalRate'
FROM
ehs_hidden_danger r
GROUP BY
r.enterprise_name
</select>
<select id="getHiddenDangerRankVoList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo">
SELECT
s.*
FROM
(
SELECT
d.dict_label 'areaName',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'reportHiddenNum'
FROM
sys_dict_data d
LEFT JOIN ehs_hidden_danger r ON r.area_id = d.dict_value
WHERE
d.dict_type = 'area_id'
GROUP BY
r.area_id
) s
ORDER BY
s.reportHiddenNum DESC
</select>
<select id="getEnterpriseMapList"
resultType="map">
SELECT
ifnull(d.dict_label,'未知') 'name',
count( 1 ) 'value'
FROM
ehs_enterprise e
LEFT JOIN sys_dict_data d ON e.enterprise_type = d.dict_value
AND d.dict_type = 'enterprise_type'
<where>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
GROUP BY
e.enterprise_type
</select>
<select id="geteconomicTypeMapList"
resultType="map">
SELECT
ifnull(d.dict_label,'未知') 'name',
count( 1 ) 'value'
FROM
ehs_enterprise e
LEFT JOIN sys_dict_data d ON e.economic_type = d.dict_value
AND d.dict_type = 'economic_type'
<where>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
GROUP BY
e.economic_type
</select>
<select id="getenterpriseScaleMapList"
resultType="map">
SELECT
ifnull(d.dict_label,'未知') 'name',
count( 1 ) 'value'
FROM
ehs_enterprise e
LEFT JOIN sys_dict_data d ON e.enterprise_scale = d.dict_value
AND d.dict_type = 'enterprise_scale'
<where>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
GROUP BY
e.enterprise_scale
</select>
<select id="getHiddenDangerTypeMapList"
resultType="map">
SELECT
ifnull(d.dict_label,'未知') 'name',
count( 1 ) 'value'
FROM
ehs_hidden_danger e
LEFT JOIN sys_dict_data d ON e.hidden_danger_type = d.dict_value
AND d.dict_type = 'hidden_danger_type'
<where>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
</where>
GROUP BY
e.hidden_danger_type
</select>
<select id="getHiddenDangerDataMapList"
resultType="map">
SELECT
g.date_time 'dayStr',
g.dict_label 'name',
CAST(ifnull( h.value, 0 ) AS CHAR) 'dataNum'
FROM
(
SELECT
s.date_time,
d.dict_code,
d.dict_label,
d.dict_value
FROM
(
SELECT
DATE_FORMAT( date_add( CONCAT( #{yearStr}, '-01-01' ), INTERVAL ROW MONTH ), '%Y-%m' ) date_time
FROM
(
SELECT
@ROW := @ROW + 1 AS ROW
FROM
(
SELECT
0 UNION ALL
SELECT
1 UNION ALL
SELECT
2 UNION ALL
SELECT
3 UNION ALL
SELECT
4 UNION ALL
SELECT
5 UNION ALL
SELECT
6 UNION ALL
SELECT
7 UNION ALL
SELECT
8 UNION ALL
SELECT
9
) t,
(
SELECT
0 UNION ALL
SELECT
1 UNION ALL
SELECT
2 UNION ALL
SELECT
3 UNION ALL
SELECT
4 UNION ALL
SELECT
5 UNION ALL
SELECT
6 UNION ALL
SELECT
7 UNION ALL
SELECT
8 UNION ALL
SELECT
9
) t2,
( SELECT @ROW :=- 1 ) r
) se
WHERE
DATE_FORMAT( date_add( CONCAT( #{yearStr}, '-01-01' ), INTERVAL ROW MONTH ), '%Y-%m' ) &lt;= DATE_FORMAT( CONCAT( #{yearStr}, '-12-01' ), '%Y-%m' )) s,
sys_dict_data d
WHERE
d.dict_type = 'hidden_danger_grade'
) g
LEFT JOIN (
SELECT
DATE_FORMAT( r.check_time, '%Y-%m' ) date_time,
r.hidden_danger_grade,
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'value'
FROM
ehs_hidden_danger r
<where>
<if test="deptId != null and deptId != ''">and r.dept_id = #{deptId}</if>
</where>
GROUP BY
r.hidden_danger_grade,
DATE_FORMAT( r.check_time, '%Y-%m' )) h ON g.date_time = h.date_time
AND g.dict_value = h.hidden_danger_grade
ORDER BY
g.date_time,
g.dict_value
</select>
</mapper>

@ -1,6 +1,13 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="公文名称" prop="docName"> <el-form-item label="公文名称" prop="docName">
<el-input <el-input
v-model="queryParams.docName" v-model="queryParams.docName"
@ -10,7 +17,11 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="公文类型" prop="docType"> <el-form-item label="公文类型" prop="docType">
<el-select v-model="queryParams.docType" placeholder="请选择公文类型" clearable> <el-select
v-model="queryParams.docType"
placeholder="请选择公文类型"
clearable
>
<el-option <el-option
v-for="dict in dict.type.doc_type" v-for="dict in dict.type.doc_type"
:key="dict.value" :key="dict.value"
@ -20,8 +31,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -34,7 +53,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['ehs:ehsDocument:add']" v-hasPermi="['ehs:ehsDocument:add']"
>公文登记 >公文登记
</el-button> </el-button>
</el-col> </el-col>
@ -47,7 +66,7 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['ehs:ehsDocument:edit']" v-hasPermi="['ehs:ehsDocument:edit']"
>修改 >修改
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -59,7 +78,7 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['ehs:ehsDocument:remove']" v-hasPermi="['ehs:ehsDocument:remove']"
>删除 >删除
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -70,36 +89,52 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['ehs:ehsDocument:export']" v-hasPermi="['ehs:ehsDocument:export']"
>导出 >导出
</el-button> </el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="ehsDocumentList" @selection-change="handleSelectionChange"> <el-table
<el-table-column type="selection" width="55" align="center"/> v-loading="loading"
:data="ehsDocumentList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />--> <!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ Number(scope.$index) + 1 }}</span> <span>{{ Number(scope.$index) + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="公文名称" align="center" prop="docName"/> <el-table-column label="公文名称" align="center" prop="docName" />
<el-table-column label="公文字号" align="center" prop="docFont"/> <el-table-column label="公文字号" align="center" prop="docFont" />
<el-table-column label="拟稿部门" align="center" prop="draftDept"/> <el-table-column label="拟稿部门" align="center" prop="draftDept" />
<el-table-column label="公文类型" align="center" prop="docType"> <el-table-column label="公文类型" align="center" prop="docType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.doc_type" :value="scope.row.docType"/> <dict-tag :options="dict.type.doc_type" :value="scope.row.docType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="公文编号" align="center" prop="docNumber"/> <el-table-column label="公文编号" align="center" prop="docNumber" />
<el-table-column label="收文日期" align="center" prop="receiveTime" width="180"> <el-table-column
label="收文日期"
align="center"
prop="receiveTime"
width="180"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.receiveTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.receiveTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark" />
<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"> <template slot-scope="scope">
<!-- <el-button <!-- <el-button
size="mini" size="mini"
@ -108,33 +143,34 @@
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['ehs:ehsDocument:edit']" v-hasPermi="['ehs:ehsDocument:edit']"
>修改</el-button>--> >修改</el-button>-->
<el-button v-show="scope.row.status==1" <el-button
type="primary" v-show="scope.row.status == 1"
plain type="primary"
size="mini" plain
@click="handleLend(scope.row)" size="mini"
>借出 @click="handleLend(scope.row)"
>借出
</el-button> </el-button>
<el-button v-show="scope.row.status==0" <el-button
type="primary" v-show="scope.row.status == 0"
plain type="primary"
size="mini" plain
@click="returnDoc(scope.row)" size="mini"
>归还 @click="returnDoc(scope.row)"
>归还
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
@click="transferRecord(scope.row)" @click="transferRecord(scope.row)"
>流转记录 >流转记录
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -145,10 +181,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="公文名称" prop="docName"> <el-form-item label="公文名称" prop="docName">
<el-input v-model="form.docName" placeholder="请输入公文名称"/> <el-input v-model="form.docName" placeholder="请输入公文名称" />
</el-form-item> </el-form-item>
<el-form-item label="公文字号" prop="docFont"> <el-form-item label="公文字号" prop="docFont">
<el-input v-model="form.docFont" placeholder="请输入公文字号"/> <el-input v-model="form.docFont" placeholder="请输入公文字号" />
</el-form-item> </el-form-item>
<!--<el-form-item label="拟稿部门" prop="draftDept"> <!--<el-form-item label="拟稿部门" prop="draftDept">
<el-input v-model="form.draftDept" placeholder="请输入拟稿部门" /> <el-input v-model="form.draftDept" placeholder="请输入拟稿部门" />
@ -179,19 +215,24 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="公文编号" prop="docNumber"> <el-form-item label="公文编号" prop="docNumber">
<el-input v-model="form.docNumber" placeholder="请输入公文编号"/> <el-input v-model="form.docNumber" placeholder="请输入公文编号" />
</el-form-item> </el-form-item>
<el-form-item label="收文日期" prop="receiveTime"> <el-form-item label="收文日期" prop="receiveTime">
<el-date-picker clearable <el-date-picker
v-model="form.receiveTime" clearable
type="date" v-model="form.receiveTime"
value-format="yyyy-MM-dd" type="date"
placeholder="请选择收文日期" value-format="yyyy-MM-dd"
placeholder="请选择收文日期"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -200,51 +241,76 @@
</div> </div>
</el-dialog> </el-dialog>
<!--流转记录会话框--> <!--流转记录会话框-->
<el-dialog :title="title1" :visible.sync="open1" width="600px" append-to-body> <el-dialog
:title="title1"
:visible.sync="open1"
width="600px"
append-to-body
>
<el-table v-loading="loading" :data="ehsDocTransferList"> <el-table v-loading="loading" :data="ehsDocTransferList">
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ Number(scope.$index) + 1 }}</span> <span>{{ Number(scope.$index) + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流转人" align="center" prop="transferName"/> <el-table-column label="流转人" align="center" prop="transferName" />
<el-table-column label="流转时间" align="center" prop="transferTime" width="180"> <el-table-column
label="流转时间"
align="center"
prop="transferTime"
width="180"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.transferTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{
parseTime(scope.row.transferTime, "{y}-{m}-{d} {h}:{i}:{s}")
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流转状态" align="center" prop="docTransferStatus"> <el-table-column
label="流转状态"
align="center"
prop="docTransferStatus"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.docTransferStatus == '0'"></span> <span v-if="scope.row.docTransferStatus == '0'"></span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog>
<!--公文借出会话框--> <!--公文借出会话框-->
<el-dialog :title="title2" :visible.sync="open2" width="600px" append-to-body> <el-dialog
:title="title2"
<el-form :disabled="true" ref="form" :model="form" :rules="rules" label-width="80px"> :visible.sync="open2"
width="600px"
append-to-body
>
<el-form
:disabled="true"
ref="form"
:model="form"
:rules="rules"
label-width="80px"
>
<el-form-item label="公文名称" prop="documentName"> <el-form-item label="公文名称" prop="documentName">
<el-input v-model="form.documentName" placeholder="请输入公文名称"/> <el-input v-model="form.documentName" placeholder="请输入公文名称" />
</el-form-item> </el-form-item>
<el-form label-width="80px" :model="form"> <el-form label-width="80px" :model="form">
<el-form-item label="流转人" prop="transferName"> <el-form-item label="流转人" prop="transferName">
<el-input v-model="form.transferName" placeholder="请输入流转人"/> <el-input v-model="form.transferName" placeholder="请输入流转人" />
</el-form-item> </el-form-item>
<el-form-item label="流转时间" prop="transferTime"> <el-form-item label="流转时间" prop="transferTime">
<el-date-picker clearable <el-date-picker
v-model="form.transferTime" clearable
type="datetime" v-model="form.transferTime"
value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
placeholder="请选择流转时间" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择流转时间"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -257,7 +323,6 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -269,15 +334,20 @@ import {
updateEhsDocument, updateEhsDocument,
getAllDraftDept, getAllDraftDept,
getDocTransferById, getDocTransferById,
getEhsDocumentById getEhsDocumentById,
} from '@/api/ehs/ehsDocument' } from "@/api/ehs/ehsDocument";
import { addEhsDocTransfer, listEhsDocTransfer, lendEhsDoc, returnEhsDoc } from '@/api/ehs/ehsDocTransfer' import {
import { parseTime } from '../../../utils/ruoyi' addEhsDocTransfer,
import dict from '@/utils/dict' listEhsDocTransfer,
lendEhsDoc,
returnEhsDoc,
} from "@/api/ehs/ehsDocTransfer";
import { parseTime } from "../../../utils/ruoyi";
import dict from "@/utils/dict";
export default { export default {
name: 'EhsDocument', name: "EhsDocument",
dicts: ['doc_type', 'doc_transfer_status'], dicts: ["doc_type", "doc_transfer_status"],
data() { data() {
return { return {
// //
@ -299,9 +369,9 @@ export default {
// //
ehsDocTransferList: [], ehsDocTransferList: [],
// //
title: '', title: "",
title1: '', title1: "",
title2: '', title2: "",
// //
open: false, open: false,
open1: false, open1: false,
@ -311,45 +381,45 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
docName: null, docName: null,
docType: null docType: null,
}, },
// //
form: {}, form: {},
// //
rules: {} rules: {},
} };
}, },
created() { created() {
this.getList() this.getList();
// 稿 // 稿
this.getAllDraftDept() this.getAllDraftDept();
}, },
methods: { methods: {
dict, dict,
parseTime, parseTime,
/** 查询公文管理列表 */ /** 查询公文管理列表 */
getList() { getList() {
this.loading = true this.loading = true;
listEhsDocument(this.queryParams).then(response => { listEhsDocument(this.queryParams).then((response) => {
this.ehsDocumentList = response.rows this.ehsDocumentList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false this.loading = false;
}) });
}, },
/** 获取拟稿部门下拉列表 */ /** 获取拟稿部门下拉列表 */
getAllDraftDept() { getAllDraftDept() {
getAllDraftDept().then((res) => { getAllDraftDept().then((res) => {
console.log(res) console.log(res);
this.ngbmInfo = res.data this.ngbmInfo = res.data;
}) });
}, },
// //
cancel() { cancel() {
this.open = false this.open = false;
this.open1 = false this.open1 = false;
this.open2 = false this.open2 = false;
this.reset() this.reset();
}, },
// //
reset() { reset() {
@ -368,124 +438,130 @@ export default {
remark: null, remark: null,
deptId: null, deptId: null,
createUserId: null, createUserId: null,
updateUserId: null updateUserId: null,
} };
this.resetForm('form') this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm("queryForm");
this.handleQuery() this.handleQuery();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset();
this.open = true this.open = true;
this.title = '公文登记' this.title = "公文登记";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getEhsDocument(id).then(response => { getEhsDocument(id).then((response) => {
this.form = response.data this.form = response.data;
this.open = true this.open = true;
this.title = '修改公文' this.title = "修改公文";
}) });
}, },
/** 借出按钮操作 */ /** 借出按钮操作 */
handleLend(row) { handleLend(row) {
this.reset() this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getEhsDocumentById(id).then(response => { getEhsDocumentById(id).then((response) => {
this.form = response.data this.form = response.data;
this.open2 = true this.open2 = true;
this.title2 = '借出信息' this.title2 = "借出信息";
}) });
}, },
/** 归还操作 */ /** 归还操作 */
returnDoc(row) { returnDoc(row) {
const id = row.id || this.ids; const id = row.id || this.ids;
returnEhsDoc(id).then(response => { returnEhsDoc(id).then((response) => {
this.$modal.msgSuccess('归还成功') this.$modal.msgSuccess("归还成功");
this.getList() this.getList();
}) });
}, },
/** 流转记录按钮操作 */ /** 流转记录按钮操作 */
transferRecord(row) { transferRecord(row) {
this.reset() this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
/** 查询公文流转记录 */ /** 查询公文流转记录 */
getDocTransferById(id).then(response => { getDocTransferById(id).then((response) => {
this.open1 = true this.open1 = true;
this.loading = true this.loading = true;
this.title1 = '流转记录' this.title1 = "流转记录";
this.ehsDocTransferList = response.rows this.ehsDocTransferList = response.rows;
//this.total1 = response.total; //this.total1 = response.total;
this.loading = false this.loading = false;
}) });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateEhsDocument(this.form).then(response => { updateEhsDocument(this.form).then((response) => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess("修改成功");
this.open = false this.open = false;
this.getList() this.getList();
}) });
} else { } else {
addEhsDocument(this.form).then(response => { addEhsDocument(this.form).then((response) => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess("新增成功");
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
} }
}) });
}, },
/** 提交借出信息 */ /** 提交借出信息 */
submitLendForm() { submitLendForm() {
this.$refs['form'].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
lendEhsDoc(this.form).then(response => { lendEhsDoc(this.form).then((response) => {
this.$modal.msgSuccess('借出成功') this.$modal.msgSuccess("借出成功");
this.open2 = false this.open2 = false;
this.getList() this.getList();
}) });
} }
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除公文管理编号为"' + ids + '"的数据项?').then(function() { this.$modal
return delEhsDocument(ids) .confirm('是否确认删除公文管理编号为"' + ids + '"的数据项?')
}).then(() => { .then(function () {
this.getList() return delEhsDocument(ids);
this.$modal.msgSuccess('删除成功') })
}).catch(() => { .then(() => {
}) this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('ehs/ehsDocument/export', { this.download(
...this.queryParams "ehs/ehsDocument/export",
}, `ehsDocument_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
} `ehsDocument_${new Date().getTime()}.xlsx`
);
},
},
};
</script> </script>

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@ export default {
components: { iFrame }, components: { iFrame },
data() { data() {
return { return {
url: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html" url: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html",
}; };
}, },
}; };

Loading…
Cancel
Save