生产监测预警信息

This commit is contained in:
wangyan21 2023-10-18 14:48:05 +08:00
parent e8a7409773
commit 573997abfd
10 changed files with 1137 additions and 2 deletions

View File

@ -0,0 +1,98 @@
package com.god.web.controller.passenger;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.god.passenger.domain.ZhcjProductionWarning;
import com.god.passenger.service.IZhcjProductionWarningService;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 生产监测预警信息Controller
*
* @author wangyan21
* @date 2023-10-18
*/
@RestController
@RequestMapping("/produce/warning")
public class ZhcjProductionWarningController extends BaseController {
@Autowired
private IZhcjProductionWarningService zhcjProductionWarningService;
/**
* 查询生产监测预警信息列表
*/
@PreAuthorize("@ss.hasPermi('produce:warning:list')")
@GetMapping("/list")
public TableDataInfo list(ZhcjProductionWarning zhcjProductionWarning) {
startPage();
List<ZhcjProductionWarning> list = zhcjProductionWarningService.selectZhcjProductionWarningList(zhcjProductionWarning);
return getDataTable(list);
}
/**
* 导出生产监测预警信息列表
*/
@PreAuthorize("@ss.hasPermi('produce:warning:export')")
@Log(title = "生产监测预警信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZhcjProductionWarning zhcjProductionWarning) {
List<ZhcjProductionWarning> list = zhcjProductionWarningService.selectZhcjProductionWarningList(zhcjProductionWarning);
ExcelUtil<ZhcjProductionWarning> util = new ExcelUtil<ZhcjProductionWarning>(ZhcjProductionWarning.class);
util.exportExcel(response, list, "生产监测预警信息数据");
}
/**
* 获取生产监测预警信息详细信息
*/
@PreAuthorize("@ss.hasPermi('produce:warning:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(zhcjProductionWarningService.selectZhcjProductionWarningById(id));
}
/**
* 新增生产监测预警信息
*/
@PreAuthorize("@ss.hasPermi('produce:warning:add')")
@Log(title = "生产监测预警信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZhcjProductionWarning zhcjProductionWarning) {
return toAjax(zhcjProductionWarningService.insertZhcjProductionWarning(zhcjProductionWarning));
}
/**
* 修改生产监测预警信息
*/
@PreAuthorize("@ss.hasPermi('produce:warning:edit')")
@Log(title = "生产监测预警信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZhcjProductionWarning zhcjProductionWarning) {
return toAjax(zhcjProductionWarningService.updateZhcjProductionWarning(zhcjProductionWarning));
}
/**
* 删除生产监测预警信息
*/
@PreAuthorize("@ss.hasPermi('produce:warning:remove')")
@Log(title = "生产监测预警信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(zhcjProductionWarningService.deleteZhcjProductionWarningByIds(ids));
}
}

View File

@ -0,0 +1,206 @@
package com.god.passenger.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 生产监测预警信息对象 zhcj_production_warning
*
* @author wangyan21
* @date 2023-10-18
*/
public class ZhcjProductionWarning extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 区域 */
@Excel(name = "区域")
private String areaInfo;
/** 时间 */
@Excel(name = "时间")
private String alarmTime;
/** 预警类型 */
@Excel(name = "预警类型")
private String alarmType;
/** 预警信息 */
@Excel(name = "预警信息")
private String alarmInfo;
/** 位置 */
@Excel(name = "位置")
private String address;
/** 抓拍图片 */
@Excel(name = "抓拍图片")
private String photoInfo;
/** 视频地址 */
@Excel(name = "视频地址")
private String videoUrl;
/** 数据类型 */
@Excel(name = "数据类型")
private String dataType;
/** 负责人 */
@Excel(name = "负责人")
private String chargePerson;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 呼叫频道 */
@Excel(name = "呼叫频道")
private String callChannel;
/** 事件状态 */
@Excel(name = "事件状态")
private String eventStatus;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setAreaInfo(String areaInfo)
{
this.areaInfo = areaInfo;
}
public String getAreaInfo()
{
return areaInfo;
}
public void setAlarmTime(String alarmTime)
{
this.alarmTime = alarmTime;
}
public String getAlarmTime()
{
return alarmTime;
}
public void setAlarmType(String alarmType)
{
this.alarmType = alarmType;
}
public String getAlarmType()
{
return alarmType;
}
public void setAlarmInfo(String alarmInfo)
{
this.alarmInfo = alarmInfo;
}
public String getAlarmInfo()
{
return alarmInfo;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setPhotoInfo(String photoInfo)
{
this.photoInfo = photoInfo;
}
public String getPhotoInfo()
{
return photoInfo;
}
public void setVideoUrl(String videoUrl)
{
this.videoUrl = videoUrl;
}
public String getVideoUrl()
{
return videoUrl;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getDataType()
{
return dataType;
}
public void setChargePerson(String chargePerson)
{
this.chargePerson = chargePerson;
}
public String getChargePerson()
{
return chargePerson;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setCallChannel(String callChannel)
{
this.callChannel = callChannel;
}
public String getCallChannel()
{
return callChannel;
}
public void setEventStatus(String eventStatus)
{
this.eventStatus = eventStatus;
}
public String getEventStatus()
{
return eventStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("areaInfo", getAreaInfo())
.append("alarmTime", getAlarmTime())
.append("alarmType", getAlarmType())
.append("alarmInfo", getAlarmInfo())
.append("address", getAddress())
.append("photoInfo", getPhotoInfo())
.append("videoUrl", getVideoUrl())
.append("dataType", getDataType())
.append("remark", getRemark())
.append("chargePerson", getChargePerson())
.append("phone", getPhone())
.append("callChannel", getCallChannel())
.append("eventStatus", getEventStatus())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.god.passenger.mapper;
import java.util.List;
import com.god.passenger.domain.ZhcjProductionWarning;
/**
* 生产监测预警信息Mapper接口
*
* @author wangyan21
* @date 2023-10-18
*/
public interface ZhcjProductionWarningMapper {
/**
* 查询生产监测预警信息
*
* @param id 生产监测预警信息主键
* @return 生产监测预警信息
*/
public ZhcjProductionWarning selectZhcjProductionWarningById(String id);
/**
* 查询生产监测预警信息列表
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 生产监测预警信息集合
*/
public List<ZhcjProductionWarning> selectZhcjProductionWarningList(ZhcjProductionWarning zhcjProductionWarning);
/**
* 新增生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
public int insertZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning);
/**
* 修改生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
public int updateZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning);
/**
* 删除生产监测预警信息
*
* @param id 生产监测预警信息主键
* @return 结果
*/
public int deleteZhcjProductionWarningById(String id);
/**
* 批量删除生产监测预警信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZhcjProductionWarningByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.passenger.service;
import java.util.List;
import com.god.passenger.domain.ZhcjProductionWarning;
/**
* 生产监测预警信息Service接口
*
* @author wangyan21
* @date 2023-10-18
*/
public interface IZhcjProductionWarningService {
/**
* 查询生产监测预警信息
*
* @param id 生产监测预警信息主键
* @return 生产监测预警信息
*/
public ZhcjProductionWarning selectZhcjProductionWarningById(String id);
/**
* 查询生产监测预警信息列表
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 生产监测预警信息集合
*/
public List<ZhcjProductionWarning> selectZhcjProductionWarningList(ZhcjProductionWarning zhcjProductionWarning);
/**
* 新增生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
public int insertZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning);
/**
* 修改生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
public int updateZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning);
/**
* 批量删除生产监测预警信息
*
* @param ids 需要删除的生产监测预警信息主键集合
* @return 结果
*/
public int deleteZhcjProductionWarningByIds(String[] ids);
/**
* 删除生产监测预警信息信息
*
* @param id 生产监测预警信息主键
* @return 结果
*/
public int deleteZhcjProductionWarningById(String id);
}

View File

@ -0,0 +1,99 @@
package com.god.passenger.service.impl;
import java.util.List;
import com.god.common.utils.StringUtils;
import com.god.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.god.passenger.mapper.ZhcjProductionWarningMapper;
import com.god.passenger.domain.ZhcjProductionWarning;
import com.god.passenger.service.IZhcjProductionWarningService;
/**
* 生产监测预警信息Service业务层处理
*
* @author wangyan21
* @date 2023-10-18
*/
@Service
public class ZhcjProductionWarningServiceImpl implements IZhcjProductionWarningService {
@Autowired
private ZhcjProductionWarningMapper zhcjProductionWarningMapper;
/**
* 查询生产监测预警信息
*
* @param id 生产监测预警信息主键
* @return 生产监测预警信息
*/
@Override
public ZhcjProductionWarning selectZhcjProductionWarningById(String id) {
return zhcjProductionWarningMapper.selectZhcjProductionWarningById(id);
}
/**
* 查询生产监测预警信息列表
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 生产监测预警信息
*/
@Override
public List<ZhcjProductionWarning> selectZhcjProductionWarningList(ZhcjProductionWarning zhcjProductionWarning) {
return zhcjProductionWarningMapper.selectZhcjProductionWarningList(zhcjProductionWarning);
}
/**
* 新增生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
@Override
public int insertZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning) {
if (StringUtils.isBlank(zhcjProductionWarning.getId())) {
zhcjProductionWarning.setId(IdUtils.fastSimpleUUID());
}
if (StringUtils.isBlank(zhcjProductionWarning.getVideoUrl()) && StringUtils.isNotEmpty(zhcjProductionWarning.getPhotoInfo())) {
zhcjProductionWarning.setVideoUrl(zhcjProductionWarning.getPhotoInfo());
}
return zhcjProductionWarningMapper.insertZhcjProductionWarning(zhcjProductionWarning);
}
/**
* 修改生产监测预警信息
*
* @param zhcjProductionWarning 生产监测预警信息
* @return 结果
*/
@Override
public int updateZhcjProductionWarning(ZhcjProductionWarning zhcjProductionWarning) {
//如果视频地址是空且photo的地址不是空把photo的地址设为视频的地址
if (StringUtils.isBlank(zhcjProductionWarning.getVideoUrl()) && StringUtils.isNotEmpty(zhcjProductionWarning.getPhotoInfo())) {
zhcjProductionWarning.setVideoUrl(zhcjProductionWarning.getPhotoInfo());
}
return zhcjProductionWarningMapper.updateZhcjProductionWarning(zhcjProductionWarning);
}
/**
* 批量删除生产监测预警信息
*
* @param ids 需要删除的生产监测预警信息主键
* @return 结果
*/
@Override
public int deleteZhcjProductionWarningByIds(String[] ids) {
return zhcjProductionWarningMapper.deleteZhcjProductionWarningByIds(ids);
}
/**
* 删除生产监测预警信息信息
*
* @param id 生产监测预警信息主键
* @return 结果
*/
@Override
public int deleteZhcjProductionWarningById(String id) {
return zhcjProductionWarningMapper.deleteZhcjProductionWarningById(id);
}
}

View File

@ -0,0 +1,117 @@
<?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.god.passenger.mapper.ZhcjProductionWarningMapper">
<resultMap type="ZhcjProductionWarning" id="ZhcjProductionWarningResult">
<result property="id" column="id" />
<result property="areaInfo" column="area_info" />
<result property="alarmTime" column="alarm_time" />
<result property="alarmType" column="alarm_type" />
<result property="alarmInfo" column="alarm_info" />
<result property="address" column="address" />
<result property="photoInfo" column="photo_info" />
<result property="videoUrl" column="video_url" />
<result property="dataType" column="data_type" />
<result property="remark" column="remark" />
<result property="chargePerson" column="charge_person" />
<result property="phone" column="phone" />
<result property="callChannel" column="call_channel" />
<result property="eventStatus" column="event_status" />
</resultMap>
<sql id="selectZhcjProductionWarningVo">
select id, area_info, alarm_time, alarm_type, alarm_info, address, photo_info, video_url, data_type, remark, charge_person, phone, call_channel, event_status from zhcj_production_warning
</sql>
<select id="selectZhcjProductionWarningList" parameterType="ZhcjProductionWarning" resultMap="ZhcjProductionWarningResult">
<include refid="selectZhcjProductionWarningVo"/>
<where>
<if test="areaInfo != null and areaInfo != ''"> and area_info like concat('%', #{areaInfo}, '%')</if>
<if test="params.beginAlarmTime != null and params.beginAlarmTime != '' and params.endAlarmTime != null and params.endAlarmTime != ''"> and alarm_time between #{params.beginAlarmTime} and #{params.endAlarmTime}</if>
<if test="alarmType != null and alarmType != ''"> and alarm_type like concat('%', #{alarmType}, '%')</if>
<if test="alarmInfo != null and alarmInfo != ''"> and alarm_info like concat('%', #{alarmInfo}, '%')</if>
<if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
<if test="photoInfo != null and photoInfo != ''"> and photo_info like concat('%', #{photoInfo}, '%')</if>
<if test="videoUrl != null and videoUrl != ''"> and video_url like concat('%', #{videoUrl}, '%')</if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%', #{dataType}, '%')</if>
<if test="chargePerson != null and chargePerson != ''"> and charge_person like concat('%', #{chargePerson}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="callChannel != null and callChannel != ''"> and call_channel like concat('%', #{callChannel}, '%')</if>
<if test="eventStatus != null and eventStatus != ''"> and event_status like concat('%', #{eventStatus}, '%')</if>
</where>
</select>
<select id="selectZhcjProductionWarningById" parameterType="String" resultMap="ZhcjProductionWarningResult">
<include refid="selectZhcjProductionWarningVo"/>
where id = #{id}
</select>
<insert id="insertZhcjProductionWarning" parameterType="ZhcjProductionWarning">
insert into zhcj_production_warning
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="areaInfo != null">area_info,</if>
<if test="alarmTime != null">alarm_time,</if>
<if test="alarmType != null">alarm_type,</if>
<if test="alarmInfo != null">alarm_info,</if>
<if test="address != null">address,</if>
<if test="photoInfo != null">photo_info,</if>
<if test="videoUrl != null">video_url,</if>
<if test="dataType != null">data_type,</if>
<if test="remark != null">remark,</if>
<if test="chargePerson != null">charge_person,</if>
<if test="phone != null">phone,</if>
<if test="callChannel != null">call_channel,</if>
<if test="eventStatus != null">event_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="areaInfo != null">#{areaInfo},</if>
<if test="alarmTime != null">#{alarmTime},</if>
<if test="alarmType != null">#{alarmType},</if>
<if test="alarmInfo != null">#{alarmInfo},</if>
<if test="address != null">#{address},</if>
<if test="photoInfo != null">#{photoInfo},</if>
<if test="videoUrl != null">#{videoUrl},</if>
<if test="dataType != null">#{dataType},</if>
<if test="remark != null">#{remark},</if>
<if test="chargePerson != null">#{chargePerson},</if>
<if test="phone != null">#{phone},</if>
<if test="callChannel != null">#{callChannel},</if>
<if test="eventStatus != null">#{eventStatus},</if>
</trim>
</insert>
<update id="updateZhcjProductionWarning" parameterType="ZhcjProductionWarning">
update zhcj_production_warning
<trim prefix="SET" suffixOverrides=",">
<if test="areaInfo != null">area_info = #{areaInfo},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
<if test="alarmType != null">alarm_type = #{alarmType},</if>
<if test="alarmInfo != null">alarm_info = #{alarmInfo},</if>
<if test="address != null">address = #{address},</if>
<if test="photoInfo != null">photo_info = #{photoInfo},</if>
<if test="videoUrl != null">video_url = #{videoUrl},</if>
<if test="dataType != null">data_type = #{dataType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="chargePerson != null">charge_person = #{chargePerson},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="callChannel != null">call_channel = #{callChannel},</if>
<if test="eventStatus != null">event_status = #{eventStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZhcjProductionWarningById" parameterType="String">
delete from zhcj_production_warning where id = #{id}
</delete>
<delete id="deleteZhcjProductionWarningByIds" parameterType="String">
delete from zhcj_production_warning where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询生产监测预警信息列表
export function listWarning(query) {
return request({
url: '/produce/warning/list',
method: 'get',
params: query
})
}
// 查询生产监测预警信息详细
export function getWarning(id) {
return request({
url: '/produce/warning/' + id,
method: 'get'
})
}
// 新增生产监测预警信息
export function addWarning(data) {
return request({
url: '/produce/warning',
method: 'post',
data: data
})
}
// 修改生产监测预警信息
export function updateWarning(data) {
return request({
url: '/produce/warning',
method: 'put',
data: data
})
}
// 删除生产监测预警信息
export function delWarning(id) {
return request({
url: '/produce/warning/' + id,
method: 'delete'
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

View File

@ -1,7 +1,7 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">智慧车间安防监控和管理系统</h3>
<!-- <h3 class="title">智慧车间安防监控和管理系统</h3>-->
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
@ -161,7 +161,7 @@ export default {
justify-content: center;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
background-image: url("../assets/images/login.png");
background-size: cover;
}
.title {
@ -175,6 +175,7 @@ export default {
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
margin-left: 50%;
.el-input {
height: 38px;
input {

View File

@ -0,0 +1,448 @@
<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="areaInfo">
<el-select v-model="queryParams.areaInfo" placeholder="请选择区域" clearable>
<el-option
v-for="dict in dict.type.zhcj_warn_area"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="时间">
<el-date-picker
v-model="daterangeAlarmTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="预警类型" prop="alarmType">
<el-select v-model="queryParams.alarmType" placeholder="请选择预警类型" clearable>
<el-option
v-for="dict in dict.type.zhcj_warn_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="预警信息" prop="alarmInfo">
<el-input
v-model="queryParams.alarmInfo"
placeholder="请输入预警信息"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="位置" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入位置"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="视频地址" prop="videoUrl">-->
<!-- <el-input-->
<!-- v-model="queryParams.videoUrl"-->
<!-- placeholder="请输入视频地址"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="数据类型" prop="dataType">-->
<!-- <el-input-->
<!-- v-model="queryParams.dataType"-->
<!-- placeholder="请输入数据类型"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="负责人" prop="chargePerson">-->
<!-- <el-input-->
<!-- v-model="queryParams.chargePerson"-->
<!-- 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="callChannel">-->
<!-- <el-input-->
<!-- v-model="queryParams.callChannel"-->
<!-- placeholder="请输入呼叫频道"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="事件状态" prop="eventStatus">-->
<!-- <el-input-->
<!-- v-model="queryParams.eventStatus"-->
<!-- placeholder="请输入事件状态"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </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="['produce:warning: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="['produce:warning: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="['produce:warning: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="['produce:warning:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="warningList" @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="areaInfo">
<template slot-scope="scope">
<dict-tag :options="dict.type.zhcj_warn_area" :value="scope.row.areaInfo"/>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="alarmTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="预警类型" align="center" prop="alarmType">
<template slot-scope="scope">
<dict-tag :options="dict.type.zhcj_warn_type" :value="scope.row.alarmType"/>
</template>
</el-table-column>
<el-table-column label="预警信息" align="center" prop="alarmInfo" :show-overflow-tooltip="true"/>
<el-table-column label="位置" align="center" prop="address" :show-overflow-tooltip="true"/>
<el-table-column label="抓拍图片" align="center" prop="photoInfo" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.photoInfo" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="视频地址" align="center" prop="videoUrl" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="数据类型" align="center" prop="dataType" />-->
<!-- <el-table-column label="备注" align="center" prop="remark" />-->
<!-- <el-table-column label="负责人" align="center" prop="chargePerson" />-->
<!-- <el-table-column label="联系电话" align="center" prop="phone" />-->
<!-- <el-table-column label="呼叫频道" align="center" prop="callChannel" />-->
<!-- <el-table-column label="事件状态" align="center" prop="eventStatus" />-->
<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="['produce:warning:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['produce:warning: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="areaInfo">
<el-select v-model="form.areaInfo" placeholder="请选择区域">
<el-option
v-for="dict in dict.type.zhcj_warn_area"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" prop="alarmTime">
<el-date-picker clearable
v-model="form.alarmTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="预警类型" prop="alarmType">
<el-select v-model="form.alarmType" placeholder="请选择预警类型">
<el-option
v-for="dict in dict.type.zhcj_warn_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="预警信息" prop="alarmInfo">
<el-input v-model="form.alarmInfo" placeholder="请输入预警信息" />
</el-form-item>
<el-form-item label="位置" prop="address">
<el-input v-model="form.address" placeholder="请输入位置" />
</el-form-item>
<el-form-item label="抓拍图片" prop="photoInfo">
<image-upload v-model="form.photoInfo"/>
</el-form-item>
<el-form-item label="视频地址" prop="videoUrl">
<el-input v-model="form.videoUrl" placeholder="请输入视频地址" />
</el-form-item>
<!-- <el-form-item label="数据类型" prop="dataType">-->
<!-- <el-input v-model="form.dataType" placeholder="请输入数据类型" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="备注" prop="remark">-->
<!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="负责人" prop="chargePerson">-->
<!-- <el-input v-model="form.chargePerson" 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="callChannel">-->
<!-- <el-input v-model="form.callChannel" placeholder="请输入呼叫频道" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="事件状态" prop="eventStatus">-->
<!-- <el-input v-model="form.eventStatus" 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 { listWarning, getWarning, delWarning, addWarning, updateWarning } from "@/api/passenger/warning";
export default {
name: "Warning",
dicts: ['zhcj_warn_area', 'zhcj_warn_type'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
warningList: [],
//
title: "",
//
open: false,
//
daterangeAlarmTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
areaInfo: null,
alarmTime: null,
alarmType: null,
alarmInfo: null,
address: null,
photoInfo: null,
videoUrl: null,
dataType: "监测预警",
chargePerson: null,
phone: null,
callChannel: null,
eventStatus: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询生产监测预警信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeAlarmTime && '' != this.daterangeAlarmTime) {
this.queryParams.params["beginAlarmTime"] = this.daterangeAlarmTime[0];
this.queryParams.params["endAlarmTime"] = this.daterangeAlarmTime[1];
}
listWarning(this.queryParams).then(response => {
this.warningList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
areaInfo: null,
alarmTime: null,
alarmType: null,
alarmInfo: null,
address: null,
photoInfo: null,
videoUrl: null,
dataType: null,
remark: null,
chargePerson: null,
phone: null,
callChannel: null,
eventStatus: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeAlarmTime = [];
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 = "添加生产监测预警信息";
this.form.dataType = "监测预警";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWarning(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) {
updateWarning(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWarning(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 delWarning(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('produce/warning/export', {
...this.queryParams
}, `warning_${new Date().getTime()}.xlsx`)
}
}
};
</script>