行政执法台账:化学品,工贸,烟花爆竹,打非治违,非煤矿山增删改查,导入导出功能完成

main
15036302109 12 months ago
parent 87485a3434
commit 4bc61f05c7

@ -0,0 +1,158 @@
package com.ruoyi.web.controller.ehs;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.ExcelExp;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.ExcelExportUtil;
import com.ruoyi.ehsLawEnforce.domain.LawEnforceImportTemplate;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ehsLawEnforce.domain.EhsLawEnforcement;
import com.ruoyi.ehsLawEnforce.service.IEhsLawEnforcementService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-13
*/
@Api(tags = "行政执法台账管理")
@RestController
@RequestMapping("/ehs/ehsLawEnforce")
public class EhsLawEnforcementController extends BaseController {
@Autowired
private IEhsLawEnforcementService ehsLawEnforcementService;
@Autowired
private ISysDictTypeService dictTypeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:list')")
@GetMapping("/list")
public TableDataInfo list(EhsLawEnforcement ehsLawEnforcement) {
startPage();
List<EhsLawEnforcement> list = ehsLawEnforcementService.selectEhsLawEnforcementList(ehsLawEnforcement);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:export')")
@Log(title = "行政执法台账", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsLawEnforcement ehsLawEnforcement) {
List<EhsLawEnforcement> list = ehsLawEnforcementService.selectEhsLawEnforcementList(ehsLawEnforcement);
ExcelUtil<EhsLawEnforcement> util = new ExcelUtil<EhsLawEnforcement>(EhsLawEnforcement.class);
util.exportExcel(response, list, "行政执法台账数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ehsLawEnforcementService.selectEhsLawEnforcementById(id));
}
/**
*
*/
@ApiOperation("新增行政执法台账")
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:add')")
@Log(title = "行政执法台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsLawEnforcement ehsLawEnforcement) {
return toAjax(ehsLawEnforcementService.save(ehsLawEnforcement));
}
/**
*
*/
@ApiOperation("修改行政执法台账")
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:edit')")
@Log(title = "行政执法台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsLawEnforcement ehsLawEnforcement) {
return toAjax(ehsLawEnforcementService.updateById(ehsLawEnforcement));
}
/**
*
*/
@ApiOperation("删除行政执法台账")
@PreAuthorize("@ss.hasPermi('ehs:ehsLawEnforce:remove')")
@Log(title = "行政执法台账", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(ehsLawEnforcementService.removeByIds(Arrays.asList(ids)));
}
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsLawEnforcement> teamWorkerList = new ArrayList<>();
// 获取企业类别字典数据
List<SysDictData> enterpriseTypeData = dictTypeService.selectDictDataByType("enterprise_type");
String[] header =
{"单位名称#",
"地址#",
"负责人#",
"联系电话#",
"存在隐患#",
"是否是重大隐患(Y是,N否)#",
"整改措施#",
"整改责任人#",
"企业类别(输入1,2,3..参考企业类别信息sheet)#",
"企业人数#",
"是否建立双预防(Y是,N否)#",
"时间(格式为2023-12-12)#",
"其他#",
"备注#"};
ExcelExp e1 = new ExcelExp("行政公文台账信息", header, teamWorkerList, EhsLawEnforcement.class);
header = new String[]{"行业值#dictValue", "行业名称#dictLabel"};
ExcelExp e2 = new ExcelExp("企业类别信息", header, enterpriseTypeData, SysDictData.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
mysheet.add(e2);
ExcelExportUtil.exportManySheetExcel("行政公文台账信息批量导入模板", mysheet, response);
}
//批量导入 params是classFirst的值
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport, Long params) throws Exception {
ExcelUtil<LawEnforceImportTemplate> util = new ExcelUtil<>(LawEnforceImportTemplate.class);
List<LawEnforceImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsLawEnforcementService.importData(list, updateSupport, params);
return AjaxResult.success(message);
}
}

@ -0,0 +1,122 @@
package com.ruoyi.ehsLawEnforce.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* ehs_law_enforcement
*
* @author ruoyi
* @date 2023-12-13
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_law_enforcement")
public class EhsLawEnforcement extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
@Excel(name = "单位名称")
private String enterpriseName;
/**
*
*/
@Excel(name = "地址")
private String location;
/**
*
*/
@Excel(name = "负责人")
private String responsiblePerson;
/**
*
*/
@Excel(name = "联系电话")
private String phone;
/**
*
*/
@Excel(name = "存在隐患")
private String risk;
/**
*
*/
@Excel(name = "是否重大隐患")
private String isLargeRisk;
/**
*
*/
@Excel(name = "整改措施")
private String rectificationMeasure;
/**
*
*/
@Excel(name = "整改责任人")
private String rectificationPeople;
/**
*
*/
@Excel(name = "企业类别")
private Integer enterpriseCategory;
/**
*
*/
@Excel(name = "企业人数")
private Long employeeNum;
/**
*
*/
@Excel(name = "是否建立双预防")
private String isEstablishPrevention;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date time;
/**
*
*/
@Excel(name = "其他")
private String other;
/**
*
*/
@Excel(name = "类别")
private Long classFirst;
}

@ -0,0 +1,40 @@
package com.ruoyi.ehsLawEnforce.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class LawEnforceImportTemplate {
@Excel(name = "单位名称", type = Excel.Type.ALL)
private String enterpriseName;
@Excel(name = "地址", type = Excel.Type.ALL)
private String location;
@Excel(name = "负责人", type = Excel.Type.ALL)
private String responsiblePerson;
@Excel(name = "联系电话", type = Excel.Type.ALL)
private String phone;
@Excel(name = "存在隐患", type = Excel.Type.ALL)
private String risk;
@Excel(name = "是否是重大隐患(Y是,N否)", type = Excel.Type.ALL)
private String isLargeRisk;
@Excel(name = "整改措施", type = Excel.Type.ALL)
private String rectificationMeasure;
@Excel(name = "整改责任人", type = Excel.Type.ALL)
private String rectificationPeople;
@Excel(name = "企业类别(输入1,2,3..参考企业类别信息sheet)", type = Excel.Type.ALL)
private Integer enterpriseCategory;
@Excel(name = "企业人数", type = Excel.Type.ALL)
private Long employeeNum;
@Excel(name = "是否建立双预防(Y是,N否)", type = Excel.Type.ALL)
private String isEstablishPrevention;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "时间(格式为2023-12-12)", width = 30, dateFormat = "yyyy-MM-dd", type = Excel.Type.ALL)
private Date time;
@Excel(name = "其他", type = Excel.Type.ALL)
private String other;
@Excel(name = "备注", type = Excel.Type.ALL)
private String remark;
}

@ -0,0 +1,30 @@
package com.ruoyi.ehsLawEnforce.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsLawEnforce.domain.EhsLawEnforcement;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-13
*/
public interface EhsLawEnforcementMapper extends BaseMapper<EhsLawEnforcement> {
/**
*
*
* @param id
* @return
*/
public EhsLawEnforcement selectEhsLawEnforcementById(Long id);
/**
*
*
* @param ehsLawEnforcement
* @return
*/
public List<EhsLawEnforcement> selectEhsLawEnforcementList(EhsLawEnforcement ehsLawEnforcement);
}

@ -0,0 +1,42 @@
package com.ruoyi.ehsLawEnforce.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsLawEnforce.domain.EhsLawEnforcement;
import com.ruoyi.ehsLawEnforce.domain.LawEnforceImportTemplate;
/**
* Service
*
* @author ruoyi
* @date 2023-12-13
*/
public interface IEhsLawEnforcementService extends IService<EhsLawEnforcement> {
/**
*
*
* @param id
* @return
*/
public EhsLawEnforcement selectEhsLawEnforcementById(Long id);
/**
*
*
* @param ehsLawEnforcement
* @return
*/
public List<EhsLawEnforcement> selectEhsLawEnforcementList(EhsLawEnforcement ehsLawEnforcement);
/**
*
*
* @param list
* @param updateSupport
* @param params classFirst
* @return
*/
public String importData(List<LawEnforceImportTemplate> list, Boolean updateSupport, Long params) throws Exception;
}

@ -0,0 +1,131 @@
package com.ruoyi.ehsLawEnforce.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.ehsLawEnforce.domain.LawEnforceImportTemplate;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import com.ruoyi.ehsLawEnforce.mapper.EhsLawEnforcementMapper;
import com.ruoyi.ehsLawEnforce.domain.EhsLawEnforcement;
import com.ruoyi.ehsLawEnforce.service.IEhsLawEnforcementService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-13
*/
@Service
public class EhsLawEnforcementServiceImpl extends ServiceImpl<EhsLawEnforcementMapper, EhsLawEnforcement> implements IEhsLawEnforcementService {
@Autowired
private EhsLawEnforcementMapper ehsLawEnforcementMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsLawEnforcement selectEhsLawEnforcementById(Long id) {
return ehsLawEnforcementMapper.selectEhsLawEnforcementById(id);
}
/**
*
*
* @param ehsLawEnforcement
* @return
*/
@Override
public List<EhsLawEnforcement> selectEhsLawEnforcementList(EhsLawEnforcement ehsLawEnforcement) {
return ehsLawEnforcementMapper.selectEhsLawEnforcementList(ehsLawEnforcement);
}
/**
*
*
* @param list
* @param updateSupport
* @param params classFirst
* @return
*/
@Override
public String importData(List<LawEnforceImportTemplate> list, Boolean updateSupport, Long params) throws Exception {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new Exception("导入行政执法台账数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (LawEnforceImportTemplate lawEnforceImportTemplate : list) {
EhsLawEnforcement temp = new EhsLawEnforcement();
/**
* ,id,idString,uuid
* id,,id
*/
// temp.setId(IdUtils.fastSimpleUUID());
temp.setEnterpriseName(lawEnforceImportTemplate.getEnterpriseName());// 单位名称
temp.setLocation(lawEnforceImportTemplate.getLocation());// 地址
temp.setResponsiblePerson(lawEnforceImportTemplate.getResponsiblePerson());// 负责人
temp.setPhone(lawEnforceImportTemplate.getPhone());// 联系电话
temp.setRisk(lawEnforceImportTemplate.getRisk());// 存在隐患
temp.setIsLargeRisk(lawEnforceImportTemplate.getIsLargeRisk().toUpperCase());// 是否重大隐患
temp.setRectificationMeasure(lawEnforceImportTemplate.getRectificationMeasure());// 整改措施
temp.setRectificationPeople(lawEnforceImportTemplate.getRectificationPeople());// 整改责任人
temp.setEnterpriseCategory(lawEnforceImportTemplate.getEnterpriseCategory());// 企业类别
temp.setEmployeeNum(lawEnforceImportTemplate.getEmployeeNum());// 企业人数
temp.setIsEstablishPrevention(lawEnforceImportTemplate.getIsEstablishPrevention().toUpperCase());// 是否建立双预防
temp.setTime(lawEnforceImportTemplate.getTime());// 时间
temp.setRemark(lawEnforceImportTemplate.getRemark());// 备注
temp.setOther(lawEnforceImportTemplate.getOther());// 其他
temp.setClassFirst(params);// 类别
try {
//插入数据
this.save(temp);
successNum++;
successMsg.append("<br />" + successNum + "、" + temp.getEnterpriseName() + "行政执法台账信息导入成功");
} catch (Exception e) {
e.printStackTrace();
log.error(e.getLocalizedMessage());
failureNum++;
successMsg.append("<br /><font color='red'>" + failureNum + "、" + temp.getEnterpriseName() + "行政执法台账信息导入异常,请联系管理员!</font>");
continue;
}
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsLawEnforcement> buildQueryWrapper(EhsLawEnforcement query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsLawEnforcement> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(query.getEnterpriseName()), EhsLawEnforcement::getEnterpriseName, query.getEnterpriseName());
lqw.like(StringUtils.isNotBlank(query.getLocation()), EhsLawEnforcement::getLocation, query.getLocation());
lqw.like(StringUtils.isNotBlank(query.getResponsiblePerson()), EhsLawEnforcement::getResponsiblePerson, query.getResponsiblePerson());
lqw.eq(StringUtils.isNotBlank(query.getPhone()), EhsLawEnforcement::getPhone, query.getPhone());
lqw.eq(StringUtils.isNotBlank(query.getRisk()), EhsLawEnforcement::getRisk, query.getRisk());
lqw.eq(StringUtils.isNotBlank(query.getIsLargeRisk()), EhsLawEnforcement::getIsLargeRisk, query.getIsLargeRisk());
lqw.eq(StringUtils.isNotBlank(query.getRectificationMeasure()), EhsLawEnforcement::getRectificationMeasure, query.getRectificationMeasure());
lqw.eq(StringUtils.isNotBlank(query.getRectificationPeople()), EhsLawEnforcement::getRectificationPeople, query.getRectificationPeople());
lqw.eq(query.getEnterpriseCategory() != null, EhsLawEnforcement::getEnterpriseCategory, query.getEnterpriseCategory());
lqw.eq(query.getEmployeeNum() != null, EhsLawEnforcement::getEmployeeNum, query.getEmployeeNum());
lqw.eq(StringUtils.isNotBlank(query.getIsEstablishPrevention()), EhsLawEnforcement::getIsEstablishPrevention, query.getIsEstablishPrevention());
lqw.eq(query.getTime() != null, EhsLawEnforcement::getTime, query.getTime());
lqw.eq(StringUtils.isNotBlank(query.getOther()), EhsLawEnforcement::getOther, query.getOther());
lqw.eq(query.getClassFirst() != null, EhsLawEnforcement::getClassFirst, query.getClassFirst());
lqw.orderByDesc(EhsLawEnforcement::getCreateTime);
return lqw;
}
}

@ -0,0 +1,65 @@
<?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.ehsLawEnforce.mapper.EhsLawEnforcementMapper">
<resultMap type="EhsLawEnforcement" id="EhsLawEnforcementResult">
<result property="id" column="id" />
<result property="enterpriseName" column="enterprise_name" />
<result property="location" column="location" />
<result property="responsiblePerson" column="responsible_person" />
<result property="phone" column="phone" />
<result property="risk" column="risk" />
<result property="isLargeRisk" column="is_large_risk" />
<result property="rectificationMeasure" column="rectification_measure" />
<result property="rectificationPeople" column="rectification_people" />
<result property="enterpriseCategory" column="enterprise_category" />
<result property="employeeNum" column="employee_num" />
<result property="isEstablishPrevention" column="is_establish_prevention" />
<result property="time" column="time" />
<result property="other" column="other" />
<result property="classFirst" column="class_first" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deptId" column="dept_id" />
<result property="createUserId" column="create_user_id" />
<result property="updateUserId" column="update_user_id" />
</resultMap>
<sql id="selectEhsLawEnforcementVo">
select id, enterprise_name, location, responsible_person, phone, risk, is_large_risk, rectification_measure, rectification_people, enterprise_category, employee_num, is_establish_prevention, time, other, class_first, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_law_enforcement
</sql>
<select id="selectEhsLawEnforcementList" parameterType="EhsLawEnforcement" resultMap="EhsLawEnforcementResult">
<include refid="selectEhsLawEnforcementVo"/>
<where>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="location != null and location != ''"> and location like concat('%', #{location}, '%')</if>
<if test="responsiblePerson != null and responsiblePerson != ''"> and responsible_person like concat('%', #{responsiblePerson}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="risk != null and risk != ''"> and risk = #{risk}</if>
<if test="isLargeRisk != null and isLargeRisk != ''"> and is_large_risk = #{isLargeRisk}</if>
<if test="rectificationMeasure != null and rectificationMeasure != ''"> and rectification_measure = #{rectificationMeasure}</if>
<if test="rectificationPeople != null and rectificationPeople != ''"> and rectification_people like concat('%',#{rectificationPeople}, '%')</if>
<if test="enterpriseCategory != null "> and enterprise_category = #{enterpriseCategory}</if>
<if test="employeeNum != null "> and employee_num = #{employeeNum}</if>
<if test="isEstablishPrevention != null and isEstablishPrevention != ''"> and is_establish_prevention = #{isEstablishPrevention}</if>
<if test="time != null "> and time = #{time}</if>
<if test="other != null and other != ''"> and other = #{other}</if>
<if test="classFirst != null "> and class_first = #{classFirst}</if>
</where>
</select>
<select id="selectEhsLawEnforcementById" parameterType="Long" resultMap="EhsLawEnforcementResult">
<include refid="selectEhsLawEnforcementVo"/>
where id = #{id}
</select>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询行政执法台账列表
export function listEhsLawEnforce(query) {
return request({
url: '/ehs/ehsLawEnforce/list',
method: 'get',
params: query
})
}
// 查询行政执法台账详细
export function getEhsLawEnforce(id) {
return request({
url: '/ehs/ehsLawEnforce/' + id,
method: 'get'
})
}
// 新增行政执法台账
export function addEhsLawEnforce(data) {
return request({
url: '/ehs/ehsLawEnforce',
method: 'post',
data: data
})
}
// 修改行政执法台账
export function updateEhsLawEnforce(data) {
return request({
url: '/ehs/ehsLawEnforce',
method: 'put',
data: data
})
}
// 删除行政执法台账
export function delEhsLawEnforce(id) {
return request({
url: '/ehs/ehsLawEnforce/' + id,
method: 'delete'
})
}

@ -0,0 +1,502 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="单位名称" prop="enterpriseName">
<el-input
v-model="queryParams.enterpriseName"
placeholder="请输入单位名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="地址" prop="location">
<el-input
v-model="queryParams.location"
placeholder="请输入地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="负责人" prop="responsiblePerson">
<el-input
v-model="queryParams.responsiblePerson"
placeholder="请输入负责人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入联系电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="存在隐患" prop="risk">
<el-input
v-model="queryParams.risk"
placeholder="请输入存在隐患"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否重大隐患" prop="isLargeRisk">
<el-select v-model="queryParams.isLargeRisk" placeholder="请选择是否重大隐患" clearable>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="整改措施" prop="rectificationMeasure">
<el-input
v-model="queryParams.rectificationMeasure"
placeholder="请输入整改措施"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="整改责任人" prop="rectificationPeople">
<el-input
v-model="queryParams.rectificationPeople"
placeholder="请输入整改责任人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="企业类别" prop="enterpriseCategory">
<el-select v-model="queryParams.enterpriseCategory" placeholder="请选择企业类别" clearable>
<el-option
v-for="dict in dict.type.enterprise_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否建立双预防" prop="isEstablishPrevention">
<el-select v-model="queryParams.isEstablishPrevention" placeholder="请选择是否建立双预防" clearable>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="时间" prop="time">
<el-date-picker clearable
v-model="queryParams.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>-->
<el-form-item>
<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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ehs:ehsLawEnforce:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ehs:ehsLawEnforce:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ehs:ehsLawEnforce:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ehs:ehsLawEnforce:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>批量导入</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ehsLawEnforceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="单位名称" align="center" prop="enterpriseName" />
<el-table-column label="地址" align="center" prop="location" />
<el-table-column label="负责人" align="center" prop="responsiblePerson" />
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="存在隐患" align="center" prop="risk" />
<el-table-column label="是否重大隐患" align="center" prop="isLargeRisk">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isLargeRisk"/>
</template>
</el-table-column>
<el-table-column label="整改措施" align="center" prop="rectificationMeasure" />
<el-table-column label="整改责任人" align="center" prop="rectificationPeople" />
<el-table-column label="企业类别" align="center" prop="enterpriseCategory">
<template slot-scope="scope">
<dict-tag :options="dict.type.enterprise_type" :value="scope.row.enterpriseCategory"/>
</template>
</el-table-column>
<el-table-column label="企业人数" align="center" prop="employeeNum" />
<el-table-column label="是否建立双预防" align="center" prop="isEstablishPrevention">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isEstablishPrevention"/>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="time" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="其他" align="center" prop="other" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ehs:ehsLawEnforce:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ehs:ehsLawEnforce:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改行政执法台账对话框 -->
<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-item label="单位名称" prop="enterpriseName">
<el-input v-model="form.enterpriseName" placeholder="请输入单位名称" />
</el-form-item>
<el-form-item label="地址" prop="location">
<el-input v-model="form.location" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="负责人" prop="responsiblePerson">
<el-input v-model="form.responsiblePerson" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="存在隐患" prop="risk">
<el-input v-model="form.risk" placeholder="请输入存在隐患" />
</el-form-item>
<el-form-item label="是否重大隐患" prop="isLargeRisk">
<el-select v-model="form.isLargeRisk" placeholder="请选择是否重大隐患">
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="整改措施" prop="rectificationMeasure">
<el-input v-model="form.rectificationMeasure" placeholder="请输入整改措施" />
</el-form-item>
<el-form-item label="整改责任人" prop="rectificationPeople">
<el-input v-model="form.rectificationPeople" placeholder="请输入整改责任人" />
</el-form-item>
<el-form-item label="企业类别" prop="enterpriseCategory">
<el-select v-model="form.enterpriseCategory" placeholder="请选择企业类别">
<el-option
v-for="dict in dict.type.enterprise_type"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="企业人数" prop="employeeNum">
<el-input v-model="form.employeeNum" placeholder="请输入企业人数" />
</el-form-item>
<el-form-item label="是否建立双预防" prop="isEstablishPrevention">
<el-select v-model="form.isEstablishPrevention" placeholder="请选择是否建立双预防">
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" prop="time">
<el-date-picker clearable
v-model="form.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="其他" prop="other">
<el-input v-model="form.other" placeholder="请输入其他" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehs/ehsLawEnforce/importTemplate"
temName="行政执法台账导入模板"
></importUpload>
</div>
</template>
<script>
import { listEhsLawEnforce, getEhsLawEnforce, delEhsLawEnforce, addEhsLawEnforce, updateEhsLawEnforce } from "@/api/ehs/ehsLawEnforce";
import importUpload from "@/components/upload/upload";
export default {
name: "EhsLawEnforce",
dicts: ['sys_yes_no', 'enterprise_type'],
components: {
importUpload,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
lawEnforceClass: 0,
//
ehsLawEnforceList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
enterpriseName: null,
location: null,
responsiblePerson: null,
phone: null,
risk: null,
isLargeRisk: null,
rectificationMeasure: null,
rectificationPeople: null,
enterpriseCategory: null,
employeeNum: null,
isEstablishPrevention: null,
time: null,
other: null,
classFirst: null,
classFirst:this.$route.query.classFirst,
},
//
form: {
classFirst:this.$route.query.classFirst,
},
//
rules: {
}
};
},
created() {
this.lawEnforceClass = this.$route.query.classFirst;
this.getList();
},
methods: {
/** 查询行政执法台账列表 */
getList() {
this.loading = true;
listEhsLawEnforce(this.queryParams).then(response => {
this.ehsLawEnforceList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
enterpriseName: null,
location: null,
responsiblePerson: null,
phone: null,
risk: null,
isLargeRisk: null,
rectificationMeasure: null,
rectificationPeople: null,
enterpriseCategory: null,
employeeNum: null,
isEstablishPrevention: null,
time: null,
other: null,
classFirst: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deptId: null,
createUserId: null,
updateUserId: null,
classFirst:this.$route.query.classFirst,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加行政执法台账";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEhsLawEnforce(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改行政执法台账";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEhsLawEnforce(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsLawEnforce(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除行政执法台账编号为"' + ids + '"的数据项?').then(function() {
return delEhsLawEnforce(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsLawEnforce/export', {
...this.queryParams
}, `ehsLawEnforce_${new Date().getTime()}.xlsx`)
},
/** 批量导入 */
handleImport() {
console.log(this.$refs.uploadRef.upload);
this.$refs.uploadRef.upload.open = true;
this.$refs.uploadRef.upload.title = "行政执法台账导入";
this.$refs.uploadRef.upload.params = this.$route.query.classFirst;
this.$refs.uploadRef.upload.url =
process.env.VUE_APP_BASE_API + "/ehs/ehsLawEnforce/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
}
};
</script>

@ -150,7 +150,6 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 采集器编号 -->
<el-drawer <el-drawer
title="人员信息管理" title="人员信息管理"
:visible.sync="drawer1" :visible.sync="drawer1"

Loading…
Cancel
Save