Merge branch 'feature_day_1110' into 'main'

照明报警管理、维护管理

See merge request likehai/ytr-god!29
This commit is contained in:
王燕 2023-11-10 17:04:41 +08:00
commit 2ffb796625
9 changed files with 1536 additions and 0 deletions

View File

@ -0,0 +1,98 @@
package com.god.web.controller.energy;
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.energy.domain.GyyqLightingAlarm;
import com.god.passenger.energy.service.IGyyqLightingAlarmService;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 照明预警管理Controller
*
* @author wangyan
* @date 2023-11-10
*/
@RestController
@RequestMapping("/lighting/alarm")
public class GyyqLightingAlarmController extends BaseController {
@Autowired
private IGyyqLightingAlarmService gyyqLightingAlarmService;
/**
* 查询照明预警管理列表
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:list')")
@GetMapping("/list")
public TableDataInfo list(GyyqLightingAlarm gyyqLightingAlarm) {
startPage();
List<GyyqLightingAlarm> list = gyyqLightingAlarmService.selectGyyqLightingAlarmList(gyyqLightingAlarm);
return getDataTable(list);
}
/**
* 导出照明预警管理列表
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:export')")
@Log(title = "照明预警管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GyyqLightingAlarm gyyqLightingAlarm) {
List<GyyqLightingAlarm> list = gyyqLightingAlarmService.selectGyyqLightingAlarmList(gyyqLightingAlarm);
ExcelUtil<GyyqLightingAlarm> util = new ExcelUtil<GyyqLightingAlarm>(GyyqLightingAlarm.class);
util.exportExcel(response, list, "照明预警管理数据");
}
/**
* 获取照明预警管理详细信息
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(gyyqLightingAlarmService.selectGyyqLightingAlarmById(id));
}
/**
* 新增照明预警管理
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:add')")
@Log(title = "照明预警管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GyyqLightingAlarm gyyqLightingAlarm) {
return toAjax(gyyqLightingAlarmService.insertGyyqLightingAlarm(gyyqLightingAlarm));
}
/**
* 修改照明预警管理
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:edit')")
@Log(title = "照明预警管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GyyqLightingAlarm gyyqLightingAlarm) {
return toAjax(gyyqLightingAlarmService.updateGyyqLightingAlarm(gyyqLightingAlarm));
}
/**
* 删除照明预警管理
*/
@PreAuthorize("@ss.hasPermi('lighting:alarm:remove')")
@Log(title = "照明预警管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(gyyqLightingAlarmService.deleteGyyqLightingAlarmByIds(ids));
}
}

View File

@ -0,0 +1,205 @@
package com.god.passenger.energy.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;
/**
* 照明预警管理对象 gyyq_lighting_alarm
*
* @author wangyan
* @date 2023-11-10
*/
public class GyyqLightingAlarm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 灯具编号 */
@Excel(name = "灯具编号")
private String lampsNumber;
/** 车间 */
@Excel(name = "车间")
private String workshop;
/** 经度 */
@Excel(name = "经度")
private String longitude;
/** 纬度 */
@Excel(name = "纬度")
private String latitude;
/** 报警时间 */
@Excel(name = "报警时间")
private String alarmTime;
/** 报警内容 */
@Excel(name = "报警内容")
private String alarmContent;
/** 是否处理 */
@Excel(name = "是否处理")
private String isDeal;
/** 处理人 */
@Excel(name = "处理人")
private String dealPerson;
/** 处理时间 */
@Excel(name = "处理时间")
private String dealTime;
/** 处理结果 */
@Excel(name = "处理结果")
private String dealResult;
/** 数据类型 */
@Excel(name = "数据类型")
private String dataType;
/** 添加人 */
@Excel(name = "添加人")
private String addPerson;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setLampsNumber(String lampsNumber)
{
this.lampsNumber = lampsNumber;
}
public String getLampsNumber()
{
return lampsNumber;
}
public void setWorkshop(String workshop)
{
this.workshop = workshop;
}
public String getWorkshop()
{
return workshop;
}
public void setLongitude(String longitude)
{
this.longitude = longitude;
}
public String getLongitude()
{
return longitude;
}
public void setLatitude(String latitude)
{
this.latitude = latitude;
}
public String getLatitude()
{
return latitude;
}
public void setAlarmTime(String alarmTime)
{
this.alarmTime = alarmTime;
}
public String getAlarmTime()
{
return alarmTime;
}
public void setAlarmContent(String alarmContent)
{
this.alarmContent = alarmContent;
}
public String getAlarmContent()
{
return alarmContent;
}
public void setIsDeal(String isDeal)
{
this.isDeal = isDeal;
}
public String getIsDeal()
{
return isDeal;
}
public void setDealPerson(String dealPerson)
{
this.dealPerson = dealPerson;
}
public String getDealPerson()
{
return dealPerson;
}
public void setDealTime(String dealTime)
{
this.dealTime = dealTime;
}
public String getDealTime()
{
return dealTime;
}
public void setDealResult(String dealResult)
{
this.dealResult = dealResult;
}
public String getDealResult()
{
return dealResult;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getDataType()
{
return dataType;
}
public void setAddPerson(String addPerson)
{
this.addPerson = addPerson;
}
public String getAddPerson()
{
return addPerson;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("lampsNumber", getLampsNumber())
.append("workshop", getWorkshop())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("alarmTime", getAlarmTime())
.append("alarmContent", getAlarmContent())
.append("isDeal", getIsDeal())
.append("dealPerson", getDealPerson())
.append("dealTime", getDealTime())
.append("dealResult", getDealResult())
.append("dataType", getDataType())
.append("addPerson", getAddPerson())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.god.passenger.energy.mapper;
import java.util.List;
import com.god.passenger.energy.domain.GyyqLightingAlarm;
/**
* 照明预警管理Mapper接口
*
* @author wangyan
* @date 2023-11-10
*/
public interface GyyqLightingAlarmMapper
{
/**
* 查询照明预警管理
*
* @param id 照明预警管理主键
* @return 照明预警管理
*/
public GyyqLightingAlarm selectGyyqLightingAlarmById(String id);
/**
* 查询照明预警管理列表
*
* @param gyyqLightingAlarm 照明预警管理
* @return 照明预警管理集合
*/
public List<GyyqLightingAlarm> selectGyyqLightingAlarmList(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 新增照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
public int insertGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 修改照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
public int updateGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 删除照明预警管理
*
* @param id 照明预警管理主键
* @return 结果
*/
public int deleteGyyqLightingAlarmById(String id);
/**
* 批量删除照明预警管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGyyqLightingAlarmByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.passenger.energy.service;
import java.util.List;
import com.god.passenger.energy.domain.GyyqLightingAlarm;
/**
* 照明预警管理Service接口
*
* @author wangyan
* @date 2023-11-10
*/
public interface IGyyqLightingAlarmService
{
/**
* 查询照明预警管理
*
* @param id 照明预警管理主键
* @return 照明预警管理
*/
public GyyqLightingAlarm selectGyyqLightingAlarmById(String id);
/**
* 查询照明预警管理列表
*
* @param gyyqLightingAlarm 照明预警管理
* @return 照明预警管理集合
*/
public List<GyyqLightingAlarm> selectGyyqLightingAlarmList(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 新增照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
public int insertGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 修改照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
public int updateGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm);
/**
* 批量删除照明预警管理
*
* @param ids 需要删除的照明预警管理主键集合
* @return 结果
*/
public int deleteGyyqLightingAlarmByIds(String[] ids);
/**
* 删除照明预警管理信息
*
* @param id 照明预警管理主键
* @return 结果
*/
public int deleteGyyqLightingAlarmById(String id);
}

View File

@ -0,0 +1,92 @@
package com.god.passenger.energy.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.energy.mapper.GyyqLightingAlarmMapper;
import com.god.passenger.energy.domain.GyyqLightingAlarm;
import com.god.passenger.energy.service.IGyyqLightingAlarmService;
/**
* 照明预警管理Service业务层处理
*
* @author wangyan
* @date 2023-11-10
*/
@Service
public class GyyqLightingAlarmServiceImpl implements IGyyqLightingAlarmService {
@Autowired
private GyyqLightingAlarmMapper gyyqLightingAlarmMapper;
/**
* 查询照明预警管理
*
* @param id 照明预警管理主键
* @return 照明预警管理
*/
@Override
public GyyqLightingAlarm selectGyyqLightingAlarmById(String id) {
return gyyqLightingAlarmMapper.selectGyyqLightingAlarmById(id);
}
/**
* 查询照明预警管理列表
*
* @param gyyqLightingAlarm 照明预警管理
* @return 照明预警管理
*/
@Override
public List<GyyqLightingAlarm> selectGyyqLightingAlarmList(GyyqLightingAlarm gyyqLightingAlarm) {
return gyyqLightingAlarmMapper.selectGyyqLightingAlarmList(gyyqLightingAlarm);
}
/**
* 新增照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
@Override
public int insertGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm) {
if (StringUtils.isBlank(gyyqLightingAlarm.getId())) {
gyyqLightingAlarm.setId(IdUtils.fastSimpleUUID());
}
return gyyqLightingAlarmMapper.insertGyyqLightingAlarm(gyyqLightingAlarm);
}
/**
* 修改照明预警管理
*
* @param gyyqLightingAlarm 照明预警管理
* @return 结果
*/
@Override
public int updateGyyqLightingAlarm(GyyqLightingAlarm gyyqLightingAlarm) {
return gyyqLightingAlarmMapper.updateGyyqLightingAlarm(gyyqLightingAlarm);
}
/**
* 批量删除照明预警管理
*
* @param ids 需要删除的照明预警管理主键
* @return 结果
*/
@Override
public int deleteGyyqLightingAlarmByIds(String[] ids) {
return gyyqLightingAlarmMapper.deleteGyyqLightingAlarmByIds(ids);
}
/**
* 删除照明预警管理信息
*
* @param id 照明预警管理主键
* @return 结果
*/
@Override
public int deleteGyyqLightingAlarmById(String id) {
return gyyqLightingAlarmMapper.deleteGyyqLightingAlarmById(id);
}
}

View File

@ -0,0 +1,113 @@
<?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.energy.mapper.GyyqLightingAlarmMapper">
<resultMap type="GyyqLightingAlarm" id="GyyqLightingAlarmResult">
<result property="id" column="id" />
<result property="lampsNumber" column="lamps_number" />
<result property="workshop" column="workshop" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="alarmTime" column="alarm_time" />
<result property="alarmContent" column="alarm_content" />
<result property="isDeal" column="is_deal" />
<result property="dealPerson" column="deal_person" />
<result property="dealTime" column="deal_time" />
<result property="dealResult" column="deal_result" />
<result property="dataType" column="data_type" />
<result property="addPerson" column="add_person" />
</resultMap>
<sql id="selectGyyqLightingAlarmVo">
select id, lamps_number, workshop, longitude, latitude, alarm_time, alarm_content, is_deal, deal_person, deal_time, deal_result, data_type, add_person from gyyq_lighting_alarm
</sql>
<select id="selectGyyqLightingAlarmList" parameterType="GyyqLightingAlarm" resultMap="GyyqLightingAlarmResult">
<include refid="selectGyyqLightingAlarmVo"/>
<where>
<if test="lampsNumber != null and lampsNumber != ''"> and lamps_number like concat('%', #{lampsNumber}, '%')</if>
<if test="workshop != null and workshop != ''"> and workshop like concat('%', #{workshop}, '%')</if>
<if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
<if test="latitude != null and latitude != ''"> and latitude = #{latitude}</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="alarmContent != null and alarmContent != ''"> and alarm_content like concat('%', #{alarmContent}, '%')</if>
<if test="isDeal != null and isDeal != ''"> and is_deal = #{isDeal}</if>
<if test="dealPerson != null and dealPerson != ''"> and deal_person like concat('%', #{dealPerson}, '%')</if>
<if test="dealTime != null and dealTime != ''"> and deal_time &gt;= #{dealTime}</if>
<if test="dealResult != null and dealResult != ''"> and deal_result like concat('%', #{dealResult}, '%')</if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%', #{dataType}, '%')</if>
<if test="addPerson != null and addPerson != ''"> and add_person like concat('%', #{addPerson}, '%')</if>
</where>
</select>
<select id="selectGyyqLightingAlarmById" parameterType="String" resultMap="GyyqLightingAlarmResult">
<include refid="selectGyyqLightingAlarmVo"/>
where id = #{id}
</select>
<insert id="insertGyyqLightingAlarm" parameterType="GyyqLightingAlarm">
insert into gyyq_lighting_alarm
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="lampsNumber != null">lamps_number,</if>
<if test="workshop != null">workshop,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="alarmTime != null">alarm_time,</if>
<if test="alarmContent != null">alarm_content,</if>
<if test="isDeal != null">is_deal,</if>
<if test="dealPerson != null">deal_person,</if>
<if test="dealTime != null">deal_time,</if>
<if test="dealResult != null">deal_result,</if>
<if test="dataType != null">data_type,</if>
<if test="addPerson != null">add_person,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="lampsNumber != null">#{lampsNumber},</if>
<if test="workshop != null">#{workshop},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="alarmTime != null">#{alarmTime},</if>
<if test="alarmContent != null">#{alarmContent},</if>
<if test="isDeal != null">#{isDeal},</if>
<if test="dealPerson != null">#{dealPerson},</if>
<if test="dealTime != null">#{dealTime},</if>
<if test="dealResult != null">#{dealResult},</if>
<if test="dataType != null">#{dataType},</if>
<if test="addPerson != null">#{addPerson},</if>
</trim>
</insert>
<update id="updateGyyqLightingAlarm" parameterType="GyyqLightingAlarm">
update gyyq_lighting_alarm
<trim prefix="SET" suffixOverrides=",">
<if test="lampsNumber != null">lamps_number = #{lampsNumber},</if>
<if test="workshop != null">workshop = #{workshop},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
<if test="alarmContent != null">alarm_content = #{alarmContent},</if>
<if test="isDeal != null">is_deal = #{isDeal},</if>
<if test="dealPerson != null">deal_person = #{dealPerson},</if>
<if test="dealTime != null">deal_time = #{dealTime},</if>
<if test="dealResult != null">deal_result = #{dealResult},</if>
<if test="dataType != null">data_type = #{dataType},</if>
<if test="addPerson != null">add_person = #{addPerson},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGyyqLightingAlarmById" parameterType="String">
delete from gyyq_lighting_alarm where id = #{id}
</delete>
<delete id="deleteGyyqLightingAlarmByIds" parameterType="String">
delete from gyyq_lighting_alarm 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 listAlarm(query) {
return request({
url: '/lighting/alarm/list',
method: 'get',
params: query
})
}
// 查询照明预警管理详细
export function getAlarm(id) {
return request({
url: '/lighting/alarm/' + id,
method: 'get'
})
}
// 新增照明预警管理
export function addAlarm(data) {
return request({
url: '/lighting/alarm',
method: 'post',
data: data
})
}
// 修改照明预警管理
export function updateAlarm(data) {
return request({
url: '/lighting/alarm',
method: 'put',
data: data
})
}
// 删除照明预警管理
export function delAlarm(id) {
return request({
url: '/lighting/alarm/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,455 @@
<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="lampsNumber">
<el-input
v-model="queryParams.lampsNumber"
placeholder="请输入灯具编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间" prop="workshop">
<el-input
v-model="queryParams.workshop"
placeholder="请输入车间"
clearable
@keyup.enter.native="handleQuery"
/>
</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="isDeal">
<el-select v-model="queryParams.isDeal" 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="dealPerson">
<el-input
v-model="queryParams.dealPerson"
placeholder="请输入处理人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="处理时间" prop="dealTime">
<el-date-picker clearable
v-model="queryParams.dealTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择处理时间">
</el-date-picker>
</el-form-item>
<el-form-item label="处理结果" prop="dealResult">
<el-input
v-model="queryParams.dealResult"
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="['lighting:alarm: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="['lighting:alarm: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="['lighting:alarm: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="['lighting:alarm:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="alarmList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="灯具编号" align="center" prop="lampsNumber" />
<el-table-column label="车间" align="center" prop="workshop" />
<el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="报警时间" align="center" prop="alarmTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="报警内容" align="center" prop="alarmContent" />
<el-table-column label="是否处理" align="center" prop="isDeal">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isDeal"/>
</template>
</el-table-column>
<el-table-column label="处理人" align="center" prop="dealPerson" />
<el-table-column label="处理时间" align="center" prop="dealTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.dealTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="处理结果" align="center" prop="dealResult" />
<!-- <el-table-column label="数据类型" align="center" prop="dataType" />-->
<el-table-column label="添加人" align="center" prop="addPerson" />
<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="['lighting:alarm:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['lighting:alarm: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="lampsNumber">
<!-- <el-input v-model="form.lampsNumber" placeholder="请输入灯具编号" />-->
<el-select v-model="form.lampsNumber" clearable placeholder="请选择" @change="getTask(form.lampsNumber)">
<el-option
v-for="item in infoList"
:key="item.lampsNumber"
:label="item.workshop +''+item.lampsNumber"
:value="item.lampsNumber">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="车间" prop="workshop">
<el-input v-model="form.workshop" placeholder="请输入车间" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item>
<el-form-item label="报警时间" prop="alarmTime">
<el-date-picker clearable
v-model="form.alarmTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择报警时间">
</el-date-picker>
</el-form-item>
<el-form-item label="报警内容" prop="alarmContent">
<el-input v-model="form.alarmContent" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="是否处理" prop="isDeal">
<el-radio-group v-model="form.isDeal">
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="处理人" prop="dealPerson">
<el-input v-model="form.dealPerson" placeholder="请输入处理人" />
</el-form-item>
<el-form-item label="处理时间" prop="dealTime">
<el-date-picker clearable
v-model="form.dealTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择处理时间">
</el-date-picker>
</el-form-item>
<el-form-item label="处理结果" prop="dealResult">
<el-input v-model="form.dealResult" 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="addPerson">
<el-input v-model="form.addPerson" 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 { listAlarm, getAlarm, delAlarm, addAlarm, updateAlarm } from "@/api/lighting/alarm";
import { listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor } from "@/api/lighting/monitor";
export default {
//
name: "Alarm",
dicts: ['sys_yes_no'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
alarmList: [],
//
title: "",
//
open: false,
//
daterangeAlarmTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
lampsNumber: null,
workshop: null,
longitude: null,
latitude: null,
alarmTime: null,
alarmContent: null,
isDeal: null,
dealPerson: null,
dealTime: null,
dealResult: null,
dataType: "报警管理",
addPerson: null
},
//
form: {},
//
rules: {
},
//
totalInfo: 0,
//
infoList: [],
loadingInfo:false,
//
queryParamsInfo: {
pageNum: 1,
pageSize: 10,
},
};
},
created() {
this.getList();
this.getBaseInfoList();
},
methods: {
/**
* 选择已有的灯具设备
* @param taskNum
*/
getTask(taskNum) {
let id = "";
this.infoList.forEach(item => {
if (item.lampsNumber === taskNum) {
id = item.id;
}
});
if (!id) return;
getMonitor(id).then(response => {
const {
// id: equipId,
latitude, lampsNumber,lampsType,longitude,workshop
} = response.data;
this.form.latitude = latitude;
this.form.lampsNumber = lampsNumber;
this.form.lampsType = lampsType;
this.form.longitude = longitude;
this.form.workshop = workshop;
});
},
/** 查询灯具设备列表 */
getBaseInfoList() {
this.loadingInfo = true;
listMonitor(this.queryParamsInfo).then(response => {
this.infoList = response.rows;
this.totalInfo = response.total;
this.loadingInfo = false;
});
},
/** 查询照明预警管理列表 */
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];
}
listAlarm(this.queryParams).then(response => {
this.alarmList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
lampsNumber: null,
workshop: null,
longitude: null,
latitude: null,
alarmTime: null,
alarmContent: null,
isDeal: null,
dealPerson: null,
dealTime: null,
dealResult: null,
dataType: null,
addPerson: 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
getAlarm(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) {
updateAlarm(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAlarm(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 delAlarm(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('lighting/alarm/export', {
...this.queryParams
}, `alarm_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,407 @@
<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="lampsNumber">
<el-input
v-model="queryParams.lampsNumber"
placeholder="请输入灯具编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间" prop="workshop">
<el-input
v-model="queryParams.workshop"
placeholder="请输入车间"
clearable
@keyup.enter.native="handleQuery"
/>
</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="dealPerson">
<el-input
v-model="queryParams.dealPerson"
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="['lighting:alarm: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="['lighting:alarm: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="['lighting:alarm: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="['lighting:alarm:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="alarmList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="灯具编号" align="center" prop="lampsNumber" />
<el-table-column label="车间" align="center" prop="workshop" />
<el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="维护时间" align="center" prop="alarmTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="维护内容" align="center" prop="alarmContent" />
<el-table-column label="维护人" align="center" prop="dealPerson" />
<el-table-column label="备注" align="center" prop="dealResult" />
<!-- <el-table-column label="数据类型" align="center" prop="dataType" />-->
<el-table-column label="添加人" align="center" prop="addPerson" />
<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="['lighting:alarm:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['lighting:alarm: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="lampsNumber">
<!-- <el-input v-model="form.lampsNumber" placeholder="请输入灯具编号" />-->
<el-select v-model="form.lampsNumber" clearable placeholder="请选择" @change="getTask(form.lampsNumber)">
<el-option
v-for="item in infoList"
:key="item.lampsNumber"
:label="item.workshop +''+item.lampsNumber"
:value="item.lampsNumber">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="车间" prop="workshop">
<el-input v-model="form.workshop" placeholder="请输入车间" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item>
<el-form-item label="维护时间" prop="alarmTime">
<el-date-picker clearable
v-model="form.alarmTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择维护时间">
</el-date-picker>
</el-form-item>
<el-form-item label="维护内容" prop="alarmContent">
<el-input v-model="form.alarmContent" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="维护人" prop="dealPerson">
<el-input v-model="form.dealPerson" placeholder="请输入维护人" />
</el-form-item>
<el-form-item label="备注" prop="dealResult">
<el-input v-model="form.dealResult" 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="addPerson">
<el-input v-model="form.addPerson" 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 { listAlarm, getAlarm, delAlarm, addAlarm, updateAlarm } from "@/api/lighting/alarm";
import { listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor } from "@/api/lighting/monitor";
export default {
//
name: "Maintenance",
dicts: ['sys_yes_no'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
alarmList: [],
//
title: "",
//
open: false,
//
daterangeAlarmTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
lampsNumber: null,
workshop: null,
longitude: null,
latitude: null,
alarmTime: null,
alarmContent: null,
isDeal: null,
dealPerson: null,
dealTime: null,
dealResult: null,
dataType: "维护管理",
addPerson: null
},
//
form: {},
//
rules: {
},
//
totalInfo: 0,
//
infoList: [],
loadingInfo:false,
//
queryParamsInfo: {
pageNum: 1,
pageSize: 10,
},
};
},
created() {
this.getList();
this.getBaseInfoList();
},
methods: {
/**
* 选择已有的灯具设备
* @param taskNum
*/
getTask(taskNum) {
let id = "";
this.infoList.forEach(item => {
if (item.lampsNumber === taskNum) {
id = item.id;
}
});
if (!id) return;
getMonitor(id).then(response => {
const {
// id: equipId,
latitude, lampsNumber,lampsType,longitude,workshop
} = response.data;
this.form.latitude = latitude;
this.form.lampsNumber = lampsNumber;
this.form.lampsType = lampsType;
this.form.longitude = longitude;
this.form.workshop = workshop;
});
},
/** 查询灯具设备列表 */
getBaseInfoList() {
this.loadingInfo = true;
listMonitor(this.queryParamsInfo).then(response => {
this.infoList = response.rows;
this.totalInfo = response.total;
this.loadingInfo = false;
});
},
/** 查询照明预警管理列表 */
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];
}
listAlarm(this.queryParams).then(response => {
this.alarmList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
lampsNumber: null,
workshop: null,
longitude: null,
latitude: null,
alarmTime: null,
alarmContent: null,
isDeal: null,
dealPerson: null,
dealTime: null,
dealResult: null,
dataType: null,
addPerson: 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
getAlarm(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) {
updateAlarm(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAlarm(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 delAlarm(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('lighting/alarm/export', {
...this.queryParams
}, `alarm_${new Date().getTime()}.xlsx`)
}
}
};
</script>