Commit 72ac26fc authored by zhangjianqian's avatar zhangjianqian

应急处置功能

parent 37139dcb
...@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问 // 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage").anonymous() .antMatchers("/login", "/captchaImage","/common/upload").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/*.html", "/*.html",
......
package com.zehong.system.controller;
import java.util.List;
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 com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TEventInfo;
import com.zehong.system.service.ITEventInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 事件处置Controller
*
* @author zehong
* @date 2022-02-11
*/
@RestController
@RequestMapping("/system/eventInfo")
public class TEventInfoController extends BaseController
{
@Autowired
private ITEventInfoService tEventInfoService;
/**
* 查询事件处置列表
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TEventInfo tEventInfo)
{
startPage();
List<TEventInfo> list = tEventInfoService.selectTEventInfoList(tEventInfo);
return getDataTable(list);
}
/**
* 导出事件处置列表
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:export')")
@Log(title = "事件处置", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TEventInfo tEventInfo)
{
List<TEventInfo> list = tEventInfoService.selectTEventInfoList(tEventInfo);
ExcelUtil<TEventInfo> util = new ExcelUtil<TEventInfo>(TEventInfo.class);
return util.exportExcel(list, "事件处置数据");
}
/**
* 获取事件处置详细信息
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:query')")
@GetMapping(value = "/{eventId}")
public AjaxResult getInfo(@PathVariable("eventId") Long eventId)
{
return AjaxResult.success(tEventInfoService.selectTEventInfoById(eventId));
}
/**
* 新增事件处置
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:add')")
@Log(title = "事件处置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TEventInfo tEventInfo)
{
return toAjax(tEventInfoService.insertTEventInfo(tEventInfo));
}
/**
* 修改事件处置
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:edit')")
@Log(title = "事件处置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TEventInfo tEventInfo)
{
return toAjax(tEventInfoService.updateTEventInfo(tEventInfo));
}
/**
* 删除事件处置
*/
@PreAuthorize("@ss.hasPermi('system:eventInfo:remove')")
@Log(title = "事件处置", businessType = BusinessType.DELETE)
@DeleteMapping("/{eventIds}")
public AjaxResult remove(@PathVariable Long[] eventIds)
{
return toAjax(tEventInfoService.deleteTEventInfoByIds(eventIds));
}
}
package com.zehong.system.controller;
import java.util.List;
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 com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TPlanInfo;
import com.zehong.system.service.ITPlanInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 应急预案Controller
*
* @author zehong
* @date 2022-02-11
*/
@RestController
@RequestMapping("/system/planInfo")
public class TPlanInfoController extends BaseController
{
@Autowired
private ITPlanInfoService tPlanInfoService;
/**
* 查询应急预案列表
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:list')")
@GetMapping("/list")
public TableDataInfo list(TPlanInfo tPlanInfo)
{
startPage();
List<TPlanInfo> list = tPlanInfoService.selectTPlanInfoList(tPlanInfo);
return getDataTable(list);
}
/**
* 导出应急预案列表
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:export')")
@Log(title = "应急预案", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TPlanInfo tPlanInfo)
{
List<TPlanInfo> list = tPlanInfoService.selectTPlanInfoList(tPlanInfo);
ExcelUtil<TPlanInfo> util = new ExcelUtil<TPlanInfo>(TPlanInfo.class);
return util.exportExcel(list, "应急预案数据");
}
/**
* 获取应急预案详细信息
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") Long planId)
{
return AjaxResult.success(tPlanInfoService.selectTPlanInfoById(planId));
}
/**
* 新增应急预案
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:add')")
@Log(title = "应急预案", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TPlanInfo tPlanInfo)
{
return toAjax(tPlanInfoService.insertTPlanInfo(tPlanInfo));
}
/**
* 修改应急预案
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:edit')")
@Log(title = "应急预案", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TPlanInfo tPlanInfo)
{
return toAjax(tPlanInfoService.updateTPlanInfo(tPlanInfo));
}
/**
* 删除应急预案
*/
@PreAuthorize("@ss.hasPermi('system:planInfo:remove')")
@Log(title = "应急预案", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable Long[] planIds)
{
return toAjax(tPlanInfoService.deleteTPlanInfoByIds(planIds));
}
@GetMapping("/getEnterpris")
public AjaxResult getEnterpris()
{
return AjaxResult.success(tPlanInfoService.selectEnterprise());
}
}
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 事件处置对象 t_event_info
*
* @author zehong
* @date 2022-02-11
*/
public class TEventInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 事件id */
private Long eventId;
/** 事件名称 */
@Excel(name = "事件名称")
private String eventTitle;
/** 事件类型:1.泄漏 2.火灾 3.爆炸 */
@Excel(name = "事件类型:1.泄漏 2.火灾 3.爆炸")
private String eventType;
/** 事件等级 */
@Excel(name = "事件等级")
private String eventLevel;
/** 事件地点 */
@Excel(name = "事件地点")
private String eventLocation;
/** 报案时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报案时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date reportTime;
/** 报案人 */
@Excel(name = "报案人")
private String reportPerson;
/** 事件处置信息 */
@Excel(name = "事件处置信息")
private String eventDeal;
/** 事件评估信息 */
@Excel(name = "事件评估信息")
private String eventAssessment;
/** 所属企业 */
@Excel(name = "所属企业")
private String beyondEnterpriseId;
/** 所属企业名称 */
private String beyondEnterpriseName;
/** 图片路径 */
@Excel(name = "图片路径")
private String iconUrl;
/** 是否删除(0正常,1删除) */
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setEventId(Long eventId)
{
this.eventId = eventId;
}
public Long getEventId()
{
return eventId;
}
public void setEventTitle(String eventTitle)
{
this.eventTitle = eventTitle;
}
public String getEventTitle()
{
return eventTitle;
}
public void setEventType(String eventType)
{
this.eventType = eventType;
}
public String getEventType()
{
return eventType;
}
public void setEventLevel(String eventLevel)
{
this.eventLevel = eventLevel;
}
public String getEventLevel()
{
return eventLevel;
}
public void setEventLocation(String eventLocation)
{
this.eventLocation = eventLocation;
}
public String getEventLocation()
{
return eventLocation;
}
public void setReportTime(Date reportTime)
{
this.reportTime = reportTime;
}
public Date getReportTime()
{
return reportTime;
}
public void setReportPerson(String reportPerson)
{
this.reportPerson = reportPerson;
}
public String getReportPerson()
{
return reportPerson;
}
public void setEventDeal(String eventDeal)
{
this.eventDeal = eventDeal;
}
public String getEventDeal()
{
return eventDeal;
}
public void setEventAssessment(String eventAssessment)
{
this.eventAssessment = eventAssessment;
}
public String getEventAssessment()
{
return eventAssessment;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public String getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public String getIconUrl()
{
return iconUrl;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("eventId", getEventId())
.append("eventTitle", getEventTitle())
.append("eventType", getEventType())
.append("eventLevel", getEventLevel())
.append("eventLocation", getEventLocation())
.append("reportTime", getReportTime())
.append("reportPerson", getReportPerson())
.append("eventDeal", getEventDeal())
.append("eventAssessment", getEventAssessment())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("iconUrl", getIconUrl())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 应急预案对象 t_plan_info
*
* @author zehong
* @date 2022-02-11
*/
public class TPlanInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 预案id */
private Long planId;
/** 预案标题 */
@Excel(name = "预案标题")
private String planTitle;
/** 预案类型 */
@Excel(name = "预案类型")
private String planType;
/** 预案等级 */
@Excel(name = "预案等级")
private String planLevel;
/** 所属企业 */
private String beyondEnterpriseId;
/** 所属企业名称 */
@Excel(name = "所属企业名称")
private String beyondEnterpriseName;
/** 应急方案 */
@Excel(name = "应急方案")
private String planContents;
/** 应急设备及车辆 */
@Excel(name = "应急设备及车辆")
private String planEquipment;
/** 图片路径 */
private String iconUrl;
/** 是否删除(0正常,1删除) */
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setPlanTitle(String planTitle)
{
this.planTitle = planTitle;
}
public String getPlanTitle()
{
return planTitle;
}
public void setPlanType(String planType)
{
this.planType = planType;
}
public String getPlanType()
{
return planType;
}
public void setPlanLevel(String planLevel)
{
this.planLevel = planLevel;
}
public String getPlanLevel()
{
return planLevel;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public String getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setPlanContents(String planContents)
{
this.planContents = planContents;
}
public String getPlanContents()
{
return planContents;
}
public void setPlanEquipment(String planEquipment)
{
this.planEquipment = planEquipment;
}
public String getPlanEquipment()
{
return planEquipment;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public String getIconUrl()
{
return iconUrl;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("planId", getPlanId())
.append("planTitle", getPlanTitle())
.append("planType", getPlanType())
.append("planLevel", getPlanLevel())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("planContents", getPlanContents())
.append("planEquipment", getPlanEquipment())
.append("iconUrl", getIconUrl())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TEventInfo;
/**
* 事件处置Mapper接口
*
* @author zehong
* @date 2022-02-11
*/
public interface TEventInfoMapper
{
/**
* 查询事件处置
*
* @param eventId 事件处置ID
* @return 事件处置
*/
public TEventInfo selectTEventInfoById(Long eventId);
/**
* 查询事件处置列表
*
* @param tEventInfo 事件处置
* @return 事件处置集合
*/
public List<TEventInfo> selectTEventInfoList(TEventInfo tEventInfo);
/**
* 新增事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
public int insertTEventInfo(TEventInfo tEventInfo);
/**
* 修改事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
public int updateTEventInfo(TEventInfo tEventInfo);
/**
* 删除事件处置
*
* @param eventId 事件处置ID
* @return 结果
*/
public int deleteTEventInfoById(Long eventId);
/**
* 批量删除事件处置
*
* @param eventIds 需要删除的数据ID
* @return 结果
*/
public int deleteTEventInfoByIds(Long[] eventIds);
}
package com.zehong.system.mapper;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TPlanInfo;
/**
* 应急预案Mapper接口
*
* @author zehong
* @date 2022-02-11
*/
public interface TPlanInfoMapper
{
/**
* 查询应急预案
*
* @param planId 应急预案ID
* @return 应急预案
*/
public TPlanInfo selectTPlanInfoById(Long planId);
/**
* 查询应急预案列表
*
* @param tPlanInfo 应急预案
* @return 应急预案集合
*/
public List<TPlanInfo> selectTPlanInfoList(TPlanInfo tPlanInfo);
/**
* 新增应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
public int insertTPlanInfo(TPlanInfo tPlanInfo);
/**
* 修改应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
public int updateTPlanInfo(TPlanInfo tPlanInfo);
/**
* 删除应急预案
*
* @param planId 应急预案ID
* @return 结果
*/
public int deleteTPlanInfoById(Long planId);
/**
* 批量删除应急预案
*
* @param planIds 需要删除的数据ID
* @return 结果
*/
public int deleteTPlanInfoByIds(Long[] planIds);
/**
* 公司列表
*/
public List<Map<String,Object>> selectEnterprise();
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TEventInfo;
/**
* 事件处置Service接口
*
* @author zehong
* @date 2022-02-11
*/
public interface ITEventInfoService
{
/**
* 查询事件处置
*
* @param eventId 事件处置ID
* @return 事件处置
*/
public TEventInfo selectTEventInfoById(Long eventId);
/**
* 查询事件处置列表
*
* @param tEventInfo 事件处置
* @return 事件处置集合
*/
public List<TEventInfo> selectTEventInfoList(TEventInfo tEventInfo);
/**
* 新增事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
public int insertTEventInfo(TEventInfo tEventInfo);
/**
* 修改事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
public int updateTEventInfo(TEventInfo tEventInfo);
/**
* 批量删除事件处置
*
* @param eventIds 需要删除的事件处置ID
* @return 结果
*/
public int deleteTEventInfoByIds(Long[] eventIds);
/**
* 删除事件处置信息
*
* @param eventId 事件处置ID
* @return 结果
*/
public int deleteTEventInfoById(Long eventId);
}
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TPlanInfo;
/**
* 应急预案Service接口
*
* @author zehong
* @date 2022-02-11
*/
public interface ITPlanInfoService
{
/**
* 查询应急预案
*
* @param planId 应急预案ID
* @return 应急预案
*/
public TPlanInfo selectTPlanInfoById(Long planId);
/**
* 查询应急预案列表
*
* @param tPlanInfo 应急预案
* @return 应急预案集合
*/
public List<TPlanInfo> selectTPlanInfoList(TPlanInfo tPlanInfo);
/**
* 新增应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
public int insertTPlanInfo(TPlanInfo tPlanInfo);
/**
* 修改应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
public int updateTPlanInfo(TPlanInfo tPlanInfo);
/**
* 批量删除应急预案
*
* @param planIds 需要删除的应急预案ID
* @return 结果
*/
public int deleteTPlanInfoByIds(Long[] planIds);
/**
* 删除应急预案信息
*
* @param planId 应急预案ID
* @return 结果
*/
public int deleteTPlanInfoById(Long planId);
public List<Map<String,Object>> selectEnterprise();
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TEventInfoMapper;
import com.zehong.system.domain.TEventInfo;
import com.zehong.system.service.ITEventInfoService;
/**
* 事件处置Service业务层处理
*
* @author zehong
* @date 2022-02-11
*/
@Service
public class TEventInfoServiceImpl implements ITEventInfoService
{
@Autowired
private TEventInfoMapper tEventInfoMapper;
/**
* 查询事件处置
*
* @param eventId 事件处置ID
* @return 事件处置
*/
@Override
public TEventInfo selectTEventInfoById(Long eventId)
{
return tEventInfoMapper.selectTEventInfoById(eventId);
}
/**
* 查询事件处置列表
*
* @param tEventInfo 事件处置
* @return 事件处置
*/
@Override
public List<TEventInfo> selectTEventInfoList(TEventInfo tEventInfo)
{
return tEventInfoMapper.selectTEventInfoList(tEventInfo);
}
/**
* 新增事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
@Override
public int insertTEventInfo(TEventInfo tEventInfo)
{
tEventInfo.setCreateTime(DateUtils.getNowDate());
return tEventInfoMapper.insertTEventInfo(tEventInfo);
}
/**
* 修改事件处置
*
* @param tEventInfo 事件处置
* @return 结果
*/
@Override
public int updateTEventInfo(TEventInfo tEventInfo)
{
tEventInfo.setUpdateTime(DateUtils.getNowDate());
return tEventInfoMapper.updateTEventInfo(tEventInfo);
}
/**
* 批量删除事件处置
*
* @param eventIds 需要删除的事件处置ID
* @return 结果
*/
@Override
public int deleteTEventInfoByIds(Long[] eventIds)
{
return tEventInfoMapper.deleteTEventInfoByIds(eventIds);
}
/**
* 删除事件处置信息
*
* @param eventId 事件处置ID
* @return 结果
*/
@Override
public int deleteTEventInfoById(Long eventId)
{
return tEventInfoMapper.deleteTEventInfoById(eventId);
}
}
package com.zehong.system.service.impl;
import java.util.List;
import java.util.Map;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TPlanInfoMapper;
import com.zehong.system.domain.TPlanInfo;
import com.zehong.system.service.ITPlanInfoService;
/**
* 应急预案Service业务层处理
*
* @author zehong
* @date 2022-02-11
*/
@Service
public class TPlanInfoServiceImpl implements ITPlanInfoService
{
@Autowired
private TPlanInfoMapper tPlanInfoMapper;
/**
* 查询应急预案
*
* @param planId 应急预案ID
* @return 应急预案
*/
@Override
public TPlanInfo selectTPlanInfoById(Long planId)
{
return tPlanInfoMapper.selectTPlanInfoById(planId);
}
/**
* 查询应急预案列表
*
* @param tPlanInfo 应急预案
* @return 应急预案
*/
@Override
public List<TPlanInfo> selectTPlanInfoList(TPlanInfo tPlanInfo)
{
return tPlanInfoMapper.selectTPlanInfoList(tPlanInfo);
}
/**
* 新增应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
@Override
public int insertTPlanInfo(TPlanInfo tPlanInfo)
{
tPlanInfo.setCreateTime(DateUtils.getNowDate());
return tPlanInfoMapper.insertTPlanInfo(tPlanInfo);
}
/**
* 修改应急预案
*
* @param tPlanInfo 应急预案
* @return 结果
*/
@Override
public int updateTPlanInfo(TPlanInfo tPlanInfo)
{
tPlanInfo.setUpdateTime(DateUtils.getNowDate());
return tPlanInfoMapper.updateTPlanInfo(tPlanInfo);
}
/**
* 批量删除应急预案
*
* @param planIds 需要删除的应急预案ID
* @return 结果
*/
@Override
public int deleteTPlanInfoByIds(Long[] planIds)
{
return tPlanInfoMapper.deleteTPlanInfoByIds(planIds);
}
/**
* 删除应急预案信息
*
* @param planId 应急预案ID
* @return 结果
*/
@Override
public int deleteTPlanInfoById(Long planId)
{
return tPlanInfoMapper.deleteTPlanInfoById(planId);
}
@Override
public List<Map<String,Object>> selectEnterprise(){
return tPlanInfoMapper.selectEnterprise();
}
}
<?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.zehong.system.mapper.TEventInfoMapper">
<resultMap type="TEventInfo" id="TEventInfoResult">
<result property="eventId" column="event_id" />
<result property="eventTitle" column="event_title" />
<result property="eventType" column="event_type" />
<result property="eventLevel" column="event_level" />
<result property="eventLocation" column="event_location" />
<result property="reportTime" column="report_time" />
<result property="reportPerson" column="report_person" />
<result property="eventDeal" column="event_deal" />
<result property="eventAssessment" column="event_assessment" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="iconUrl" column="icon_url" />
<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="isDel" column="is_del" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTEventInfoVo">
select event_id, event_title, event_type, event_level, event_location, report_time, report_person, event_deal, event_assessment, beyond_enterprise_id, beyond_enterprise_name, icon_url, create_by, create_time, update_by, update_time, is_del, remarks from t_event_info
</sql>
<select id="selectTEventInfoList" parameterType="TEventInfo" resultMap="TEventInfoResult">
<include refid="selectTEventInfoVo"/>
<where>
<if test="eventTitle != null and eventTitle != ''"> and event_title like concat('%', #{eventTitle}, '%')</if>
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
<if test="eventLevel != null and eventLevel != ''"> and event_level = #{eventLevel}</if>
<if test="reportPerson != null and reportPerson != ''"> and report_person like concat('%', #{reportPerson}, '%')</if>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != ''"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
</where>
</select>
<select id="selectTEventInfoById" parameterType="Long" resultMap="TEventInfoResult">
<include refid="selectTEventInfoVo"/>
where event_id = #{eventId}
</select>
<insert id="insertTEventInfo" parameterType="TEventInfo" useGeneratedKeys="true" keyProperty="eventId">
insert into t_event_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="eventTitle != null">event_title,</if>
<if test="eventType != null">event_type,</if>
<if test="eventLevel != null">event_level,</if>
<if test="eventLocation != null">event_location,</if>
<if test="reportTime != null">report_time,</if>
<if test="reportPerson != null">report_person,</if>
<if test="eventDeal != null">event_deal,</if>
<if test="eventAssessment != null">event_assessment,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="iconUrl != null">icon_url,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eventTitle != null">#{eventTitle},</if>
<if test="eventType != null">#{eventType},</if>
<if test="eventLevel != null">#{eventLevel},</if>
<if test="eventLocation != null">#{eventLocation},</if>
<if test="reportTime != null">#{reportTime},</if>
<if test="reportPerson != null">#{reportPerson},</if>
<if test="eventDeal != null">#{eventDeal},</if>
<if test="eventAssessment != null">#{eventAssessment},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="iconUrl != null">#{iconUrl},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTEventInfo" parameterType="TEventInfo">
update t_event_info
<trim prefix="SET" suffixOverrides=",">
<if test="eventTitle != null">event_title = #{eventTitle},</if>
<if test="eventType != null">event_type = #{eventType},</if>
<if test="eventLevel != null">event_level = #{eventLevel},</if>
<if test="eventLocation != null">event_location = #{eventLocation},</if>
<if test="reportTime != null">report_time = #{reportTime},</if>
<if test="reportPerson != null">report_person = #{reportPerson},</if>
<if test="eventDeal != null">event_deal = #{eventDeal},</if>
<if test="eventAssessment != null">event_assessment = #{eventAssessment},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="iconUrl != null">icon_url = #{iconUrl},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where event_id = #{eventId}
</update>
<delete id="deleteTEventInfoById" parameterType="Long">
delete from t_event_info where event_id = #{eventId}
</delete>
<delete id="deleteTEventInfoByIds" parameterType="String">
delete from t_event_info where event_id in
<foreach item="eventId" collection="array" open="(" separator="," close=")">
#{eventId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.zehong.system.mapper.TPlanInfoMapper">
<resultMap type="TPlanInfo" id="TPlanInfoResult">
<result property="planId" column="plan_id" />
<result property="planTitle" column="plan_title" />
<result property="planType" column="plan_type" />
<result property="planLevel" column="plan_level" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="planContents" column="plan_contents" />
<result property="planEquipment" column="plan_equipment" />
<result property="iconUrl" column="icon_url" />
<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="isDel" column="is_del" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTPlanInfoVo">
select plan_id, plan_title, plan_type, plan_level, beyond_enterprise_id, beyond_enterprise_name, plan_contents, plan_equipment, icon_url, create_by, create_time, update_by, update_time, is_del, remarks from t_plan_info
</sql>
<select id="selectTPlanInfoList" parameterType="TPlanInfo" resultMap="TPlanInfoResult">
<include refid="selectTPlanInfoVo"/>
<where>
<if test="planTitle != null and planTitle != ''"> and plan_title = #{planTitle}</if>
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if>
<if test="planLevel != null and planLevel != ''"> and plan_level = #{planLevel}</if>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != ''"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
</where>
</select>
<select id="selectTPlanInfoById" parameterType="Long" resultMap="TPlanInfoResult">
<include refid="selectTPlanInfoVo"/>
where plan_id = #{planId}
</select>
<insert id="insertTPlanInfo" parameterType="TPlanInfo" useGeneratedKeys="true" keyProperty="planId">
insert into t_plan_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planTitle != null">plan_title,</if>
<if test="planType != null">plan_type,</if>
<if test="planLevel != null">plan_level,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="planContents != null">plan_contents,</if>
<if test="planEquipment != null">plan_equipment,</if>
<if test="iconUrl != null">icon_url,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planTitle != null">#{planTitle},</if>
<if test="planType != null">#{planType},</if>
<if test="planLevel != null">#{planLevel},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="planContents != null">#{planContents},</if>
<if test="planEquipment != null">#{planEquipment},</if>
<if test="iconUrl != null">#{iconUrl},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTPlanInfo" parameterType="TPlanInfo">
update t_plan_info
<trim prefix="SET" suffixOverrides=",">
<if test="planTitle != null">plan_title = #{planTitle},</if>
<if test="planType != null">plan_type = #{planType},</if>
<if test="planLevel != null">plan_level = #{planLevel},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="planContents != null">plan_contents = #{planContents},</if>
<if test="planEquipment != null">plan_equipment = #{planEquipment},</if>
<if test="iconUrl != null">icon_url = #{iconUrl},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where plan_id = #{planId}
</update>
<delete id="deleteTPlanInfoById" parameterType="Long">
delete from t_plan_info where plan_id = #{planId}
</delete>
<delete id="deleteTPlanInfoByIds" parameterType="String">
delete from t_plan_info where plan_id in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
<select id="selectEnterprise" resultType="java.util.HashMap">
SELECT enterprise_id as enterpriseId,enterprise_name as enterpriseName FROM t_enterprise_info
WHERE is_del = 0
</select>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询事件处置列表
export function listEventInfo(query) {
return request({
url: '/system/eventInfo/list',
method: 'get',
params: query
})
}
// 公司列表
export function enterpriseList() {
return request({
url: '/system/planInfo/getEnterpris',
method: 'get'
})
}
// 查询事件处置详细
export function getEventInfo(eventId) {
return request({
url: '/system/eventInfo/' + eventId,
method: 'get'
})
}
// 新增事件处置
export function addEventInfo(data) {
return request({
url: '/system/eventInfo',
method: 'post',
data: data
})
}
// 修改事件处置
export function updateEventInfo(data) {
return request({
url: '/system/eventInfo',
method: 'put',
data: data
})
}
// 删除事件处置
export function delEventInfo(eventId) {
return request({
url: '/system/eventInfo/' + eventId,
method: 'delete'
})
}
// 导出事件处置
export function exportEventInfo(query) {
return request({
url: '/system/eventInfo/export',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询应急预案列表
export function listPlanInfo(query) {
return request({
url: '/system/planInfo/list',
method: 'get',
params: query
})
}
// 查询应急预案详细
export function getPlanInfo(planId) {
return request({
url: '/system/planInfo/' + planId,
method: 'get'
})
}
// 公司列表
export function enterpriseList() {
return request({
url: '/system/planInfo/getEnterpris',
method: 'get'
})
}
// 新增应急预案
export function addPlanInfo(data) {
return request({
url: '/system/planInfo',
method: 'post',
data: data
})
}
// 修改应急预案
export function updatePlanInfo(data) {
return request({
url: '/system/planInfo',
method: 'put',
data: data
})
}
// 删除应急预案
export function delPlanInfo(planId) {
return request({
url: '/system/planInfo/' + planId,
method: 'delete'
})
}
// 导出应急预案
export function exportPlanInfo(query) {
return request({
url: '/system/planInfo/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="事件名称" prop="eventTitle">
<el-input
v-model="queryParams.eventTitle"
placeholder="请输入事件名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="事件类型" prop="eventType">
<el-select v-model="queryParams.eventType" placeholder="请选择事件类型" clearable size="small">
<el-option
v-for="dict in eventTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="事件等级" prop="eventLevel">
<el-select v-model="queryParams.eventLevel" placeholder="请选择事件等级" clearable size="small">
<el-option
v-for="dict in eventLevelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="报案人" prop="reportPerson">
<el-input
v-model="queryParams.reportPerson"
placeholder="请输入报案人"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属企业" prop="beyondEnterpriseId">
<el-select v-model="queryParams.beyondEnterpriseId" placeholder="请选择预案等级" clearable size="small">
<el-option
v-for = "dict in enterpriseList"
:key = "dict.enterpriseId"
:label = "dict.enterpriseName"
:value = "dict.enterpriseId"
/>
</el-select>
</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="['system:eventInfo: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="['system:eventInfo: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="['system:eventInfo:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:eventInfo:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="eventInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="事件id" align="center" prop="eventId" />
<el-table-column label="事件名称" align="center" prop="eventTitle" />
<el-table-column label="事件类型" align="center" prop="eventType" :formatter="eventTypeFormat" />
<el-table-column label="事件等级" align="center" prop="eventLevel" :formatter="eventLevelFormat" />
<el-table-column label="事件地点" align="center" prop="eventLocation" />
<el-table-column label="报案时间" align="center" prop="reportTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.reportTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="报案人" align="center" prop="reportPerson" />
<el-table-column label="事件处置信息" align="center" prop="eventDeal" />
<el-table-column label="事件评估信息" align="center" prop="eventAssessment" />
<el-table-column label="所属企业" align="center" prop="beyondEnterpriseId" />
<el-table-column label="备注" align="center" prop="remarks" />
<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="['system:eventInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:eventInfo: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="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<div class="division">
<div style="width: 50%">
<el-form-item label="事件名称" prop="eventTitle">
<el-input v-model="form.eventTitle" placeholder="请输入事件名称" />
</el-form-item>
<el-form-item label="事件类型" prop="eventType">
<el-select v-model="form.eventType" placeholder="请选择事件类型">
<el-option
v-for="dict in eventTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="事件等级" prop="eventLevel">
<el-select v-model="form.eventLevel" placeholder="请选择事件等级">
<el-option
v-for="dict in eventLevelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="事件地点" prop="eventLocation">
<el-input v-model="form.eventLocation" placeholder="请输入事件地点" />
</el-form-item>
<el-form-item label="图片上传" prop="iconUrl">
<el-upload
:action="uploadImgUrl"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-success ="uploadsuccess"
:on-remove="handleRemove"
:file-list="fileList">
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<!--<el-input v-model="form.iconUrl" type="textarea" placeholder="请输入内容" />-->
</el-form-item>
</div>
<div style="width: 50%">
<el-form-item label="所属企业" prop="beyondEnterpriseId">
<el-select v-model="form.beyondEnterpriseId" placeholder="请选择预案等级" @change="qiyechang">
<el-option
v-for = "dict in enterpriseList"
:key = "dict.enterpriseId"
:label = "dict.enterpriseName"
:value = "dict.enterpriseId"
/>
</el-select>
<!--<el-input v-model="form.beyondEnterpriseId" placeholder="请输入所属企业" />-->
</el-form-item>
<el-form-item label="报案人" prop="reportPerson">
<el-input v-model="form.reportPerson" placeholder="请输入报案人" />
</el-form-item>
<el-form-item label="报案时间" prop="reportTime">
<el-date-picker clearable size="small"
v-model="form.reportTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择报案时间">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</div>
</div>
<el-form-item label="事件处置信息" prop="eventDeal">
<el-input v-model="form.eventDeal" type="textarea" placeholder="请输入事件处置信息" />
</el-form-item>
<el-form-item label="事件评估信息" prop="eventAssessment">
<el-input v-model="form.eventAssessment" type="textarea" placeholder="请输入事件评估信息" />
</el-form-item>
<!--<el-form-item label="所属企业名称" prop="beyondEnterpriseName">-->
<!--<el-input v-model="form.beyondEnterpriseName" 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>
</div>
</template>
<script>
import { listEventInfo, getEventInfo, delEventInfo, addEventInfo, updateEventInfo, exportEventInfo ,enterpriseList} from "@/api/system/eventInfo";
export default {
name: "EventInfo",
components: {
},
data() {
return {
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 事件处置表格数据
eventInfoList: [],
enterpriseList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dialogImageUrl: '',
dialogVisible: false,
fileList:[],
// 事件类型:1.泄漏 2.火灾 3.爆炸字典
eventTypeOptions: [],
// 事件等级字典
eventLevelOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
eventTitle: null,
eventType: null,
eventLevel: null,
reportPerson: null,
beyondEnterpriseId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
eventTitle: [
{ required: true, message: "事件名称不能为空", trigger: "blur" }
],
eventType: [
{ required: true, message: "事件类型不能为空", trigger: "blur" }
],
eventLevel: [
{ required: true, message: "事件等级不能为空", trigger: "blur" }
],
beyondEnterpriseId: [
{ required: true, message: "所属企业不能为空", trigger: "blur" }
],
reportPerson: [
{ required: true, message: "报案人不能为空", trigger: "blur" }
],
reportTime: [
{ required: true, message: "报案时间不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
this.getEnterpriseList();
this.getDicts("t_yuan_type").then(response => {
this.eventTypeOptions = response.data;
});
this.getDicts("t_plan_level").then(response => {
this.eventLevelOptions = response.data;
});
},
methods: {
/** 查询事件处置列表 */
getList() {
this.loading = true;
listEventInfo(this.queryParams).then(response => {
this.eventInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//公司列表
getEnterpriseList() {
console.log(this.uploadImgUrl)
enterpriseList(this.queryParams).then(response => {
this.enterpriseList = response.data;
});
},
//上传
handleRemove(file, fileList) {
//console.log(file, fileList);
document.getElementsByClassName("el-upload")[0].style.display=""
},
uploadsuccess(response){
this.form.iconUrl=response.url;
console.log(document.getElementsByClassName("el-upload")[0])
this.$nextTick(()=>{
document.getElementsByClassName("el-upload")[0].style.display="none"
})
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
qiyechang(value){
let obj = {};
obj = this.enterpriseList.find((item)=>{
return item.enterpriseId === value;
});
this.form.beyondEnterpriseName = obj.enterpriseName;
},
// 事件类型:1.泄漏 2.火灾 3.爆炸字典翻译
eventTypeFormat(row, column) {
return this.selectDictLabel(this.eventTypeOptions, row.eventType);
},
// 事件等级字典翻译
eventLevelFormat(row, column) {
return this.selectDictLabel(this.eventLevelOptions, row.eventLevel);
},
// 取消按钮
cancel() {
this.fileList = [];
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
eventId: null,
eventTitle: null,
eventType: null,
eventLevel: null,
eventLocation: null,
reportTime: null,
reportPerson: null,
eventDeal: null,
eventAssessment: null,
beyondEnterpriseId: null,
beyondEnterpriseName: null,
iconUrl: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
isDel: null,
remarks: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.eventId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.fileList = [];
this.reset();
this.open = true;
this.title = "添加事件处置";
this.$nextTick(()=>{
document.getElementsByClassName("el-upload")[0].style.display=""
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.fileList = [];
this.reset();
const eventId = row.eventId || this.ids
getEventInfo(eventId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改事件处置";
if(row.iconUrl!=null){
this.fileList = [{name: 'file', url: row.iconUrl}];
this.$nextTick(()=>{
document.getElementsByClassName("el-upload")[0].style.display="none"
})
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.eventId != null) {
updateEventInfo(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEventInfo(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const eventIds = row.eventId || this.ids;
this.$confirm('是否确认删除事件处置编号为"' + eventIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delEventInfo(eventIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有事件处置数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportEventInfo(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
<style>
.division{
display:flex;
flex-direction:row;
justify-content:flex-start;
}
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="预案标题" prop="planTitle">
<el-input
v-model="queryParams.planTitle"
placeholder="请输入预案标题"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预案类型" prop="planType">
<el-select v-model="queryParams.planType" placeholder="请选择预案类型" clearable size="small">
<el-option
v-for = "dict in planTypeList"
:key = "dict.dictValue"
:label = "dict.dictLabel"
:value = "dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="预案等级" prop="planLevel">
<el-select v-model="queryParams.planLevel" placeholder="请选择预案等级" clearable size="small">
<el-option
v-for = "dict in planLevelList"
:key = "dict.dictValue"
:label = "dict.dictLabel"
:value = "dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="所属企业" prop="beyondEnterpriseId">
<el-select v-model="queryParams.beyondEnterpriseId" placeholder="请选择预案等级" clearable size="small">
<el-option
v-for = "dict in enterpriseList"
:key = "dict.enterpriseId"
:label = "dict.enterpriseName"
:value = "dict.enterpriseId"
/>
</el-select>
</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="['system:planInfo: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="['system:planInfo: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="['system:planInfo:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:planInfo:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="planInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="预案id" align="center" prop="planId" />-->
<el-table-column label="预案标题" align="center" prop="planTitle" />
<el-table-column label="预案类型" align="center" prop="planType" :formatter="planTypeFormat"/>
<el-table-column label="预案等级" align="center" prop="planLevel" :formatter="planLevelFormat"/>
<el-table-column label="所属企业名称" align="center" prop="beyondEnterpriseName" />
<el-table-column label="应急方案" align="center" prop="planContents" />
<el-table-column label="应急设备及车辆" align="center" prop="planEquipment" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remarks" />
<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="['system:planInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:planInfo: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="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<div class="division">
<div style="width: 50%;">
<el-form-item label="预案标题" prop="planTitle">
<el-input v-model="form.planTitle" placeholder="请输入预案标题" />
</el-form-item>
<el-form-item label="预案类型" prop="planType">
<el-select v-model="form.planType" placeholder="请选择预案类型">
<el-option
v-for = "dict in planTypeList"
:key = "dict.dictValue"
:label = "dict.dictLabel"
:value = "dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="预案等级" prop="planLevel">
<el-select v-model="form.planLevel" placeholder="请选择预案等级">
<el-option
v-for = "dict in planLevelList"
:key = "dict.dictValue"
:label = "dict.dictLabel"
:value = "dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="预案图片" prop="iconUrl">
<el-upload
:action="uploadImgUrl"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-success ="uploadsuccess"
:on-remove="handleRemove"
:file-list="fileList">
<i class="el-icon-plus"></i>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form-item>
<el-form-item label="应急方案" prop="planContents">
<el-upload
class="upload-demo"
:action="uploadImgUrl"
:on-success="uploadsuccess2"
:on-remove="handleRemove2"
:file-list="fileList2"
list-type="text">
<el-button size="small" id = "uploadfang" type="primary">点击上传</el-button>
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
</el-upload>
</el-form-item>
</div>
<div style="width: 50%;">
<el-form-item label="所属企业" prop="beyondEnterpriseId">
<el-select v-model="form.beyondEnterpriseId" placeholder="请选择预案等级" @change="qiyechang">
<el-option
v-for = "dict in enterpriseList"
:key = "dict.enterpriseId"
:label = "dict.enterpriseName"
:value = "dict.enterpriseId"
/>
</el-select>
</el-form-item>
<el-form-item label="应急设备车辆" prop="planEquipment">
<el-input v-model="form.planEquipment" placeholder="请输入应急设备及车辆" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</div>
</div>
<!--<el-form-item label="所属企业名称" prop="beyondEnterpriseName">-->
<!--<el-input v-model="form.beyondEnterpriseName" 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>
</div>
</template>
<script>
import { listPlanInfo, getPlanInfo, delPlanInfo, addPlanInfo, updatePlanInfo, exportPlanInfo,enterpriseList } from "@/api/system/planInfo";
export default {
name: "PlanInfo",
components: {
},
data() {
return {
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 应急预案表格数据
planInfoList: [],
planTypeList:[],
planLevelList:[],
enterpriseList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dialogImageUrl: '',
dialogVisible: false,
fileList:[],
fileList2:[],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
planTitle: null,
planType: null,
planLevel: null,
beyondEnterpriseId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
planTitle: [
{ required: true, message: "标题不能为空", trigger: "blur" }
],
beyondEnterpriseId: [
{ required: true, message: "所属企业不能为空", trigger: "blur" }
],
planType: [
{ required: true, message: "预案类型不能为空", trigger: "blur" }
],
planLevel: [
{ required: true, message: "预案等级不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
this.getEnterpriseList()
this.getDicts("t_yuan_type").then(response =>{
this.planTypeList = response.data;
})
this.getDicts("t_plan_level").then(response =>{
this.planLevelList = response.data;
})
},
methods: {
/** 查询应急预案列表 */
getList() {
this.loading = true;
listPlanInfo(this.queryParams).then(response => {
this.planInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//公司列表
getEnterpriseList() {
enterpriseList(this.queryParams).then(response => {
this.enterpriseList = response.data;
});
},
qiyechang(value){
let obj = {};
obj = this.enterpriseList.find((item)=>{
return item.enterpriseId === value;
});
this.form.beyondEnterpriseName = obj.enterpriseName;
},
//上传图片
uploadsuccess(response){
this.form.iconUrl=response.url;
//console.log(document.getElementsByClassName("el-upload--picture-card"))
document.getElementsByClassName("el-upload--picture-card")[0].style.display="none";
},
handleRemove(file, fileList) {
document.getElementsByClassName("el-upload--picture-card")[0].style.display="";
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//上传方案
handleRemove2(file, fileList) {
document.getElementById("uploadfang").style.display="";
},
uploadsuccess2(response){
this.form.planContents=response.url;
document.getElementById("uploadfang").style.display="none";
},
// 取消按钮
cancel() {
this.fileList = [];
this.fileList2 = [];
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
planId: null,
planTitle: null,
planType: null,
planLevel: null,
beyondEnterpriseId: null,
beyondEnterpriseName: null,
planContents: null,
planEquipment: null,
iconUrl: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
isDel: null,
remarks: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.fileList = [];
this.fileList2 = [];
this.reset();
this.open = true;
this.title = "添加应急预案";
document.getElementsByClassName("el-upload--picture-card")[0].style.display="";
document.getElementById("uploadfang").style.display="";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.fileList = [];
this.fileList2 = [];
this.reset();
const planId = row.planId || this.ids
getPlanInfo(planId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改应急预案";
if(row.iconUrl!=null||row.iconUrl==""){
this.fileList = [{name: 'file', url: row.iconUrl}];
this.$nextTick(()=>{
document.getElementsByClassName("el-upload--picture-card")[0].style.display="none"
})
}
if(row.planContents!=null||row.planContents==""){
this.fileList2 = [{name: 'file2', url: row.planContents}];
this.$nextTick(()=>{
document.getElementById("uploadfang").style.display="none"
})
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
updatePlanInfo(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
this.fileList = [];
});
} else {
addPlanInfo(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
this.fileList = [];
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planIds = row.planId || this.ids;
this.$confirm('是否确认删除应急预案编号为"' + planIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delPlanInfo(planIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
// 事件类型:1.泄漏 2.火灾 3.爆炸字典翻译
planTypeFormat(row, column) {
return this.selectDictLabel(this.planTypeList, row.planType);
},
// 事件等级字典翻译
planLevelFormat(row, column) {
return this.selectDictLabel(this.planLevelList, row.planLevel);
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有应急预案数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportPlanInfo(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
<style>
.division{
display:flex;
flex-direction:row;
justify-content:flex-start;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment