Commit 9ba4f77d authored by 王晓倩's avatar 王晓倩

安全承诺公告

parent 414d3f77
package com.zehong.web.controller.safetyManagement;
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.TSafetyCommitmentAnnouncement;
import com.zehong.system.service.ITSafetyCommitmentAnnouncementService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 安全承诺公告Controller
*
* @author zehong
* @date 2022-12-21
*/
@RestController
@RequestMapping("/safetyManagement/announcement")
public class TSafetyCommitmentAnnouncementController extends BaseController
{
@Autowired
private ITSafetyCommitmentAnnouncementService tSafetyCommitmentAnnouncementService;
/**
* 查询安全承诺公告列表
*/
@PreAuthorize("@ss.hasPermi('system:announcement:list')")
@GetMapping("/list")
public TableDataInfo list(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
startPage();
List<TSafetyCommitmentAnnouncement> list = tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
return getDataTable(list);
}
/**
* 导出安全承诺公告列表
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:export')")
@Log(title = "安全承诺公告", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
List<TSafetyCommitmentAnnouncement> list = tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
ExcelUtil<TSafetyCommitmentAnnouncement> util = new ExcelUtil<TSafetyCommitmentAnnouncement>(TSafetyCommitmentAnnouncement.class);
return util.exportExcel(list, "安全承诺公告数据");
}
/**
* 获取安全承诺公告详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementById(id));
}
/**
* 新增安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:add')")
@Log(title = "安全承诺公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return toAjax(tSafetyCommitmentAnnouncementService.insertTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement));
}
/**
* 修改安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:edit')")
@Log(title = "安全承诺公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return toAjax(tSafetyCommitmentAnnouncementService.updateTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement));
}
/**
* 删除安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:remove')")
@Log(title = "安全承诺公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tSafetyCommitmentAnnouncementService.deleteTSafetyCommitmentAnnouncementByIds(ids));
}
}
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
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_safety_commitment_announcement
*
* @author zehong
* @date 2022-12-21
*/
@Data
public class TSafetyCommitmentAnnouncement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 安全承诺公告id */
private Long id;
/** 生产装置 */
@Excel(name = "生产装置")
private Long productionUnit;
/** 运行装置 */
@Excel(name = "运行装置")
private Long runningDevice;
/** 停产装置 */
@Excel(name = "停产装置")
private Long shutdownDevice;
/** 检修装置 */
@Excel(name = "检修装置")
private Long maintenanceDevice;
/** 动火作业 */
@Excel(name = "动火作业")
private Long hotWork;
/** 特殊动火作业 */
@Excel(name = "特殊动火作业")
private Long specialHotWork;
/** 一级动火作业 */
@Excel(name = "一级动火作业")
private Long classOneHotWork;
/** 二级动火作业 */
@Excel(name = "二级动火作业")
private Long classTwoHotWork;
/** 是否受限空间作业(0是,1否) */
@Excel(name = "是否受限空间作业", readConverterExp = "0=是,1否")
private String isConfinedSpace;
/** 是否试生产(0是,1否) */
@Excel(name = "是否试生产", readConverterExp = "0=是,1否")
private String isTrialProduction;
/** 罐装、仓库等重大危险源是否处于安全状态(0是,1否) */
@Excel(name = "罐装、仓库等重大危险源是否处于安全状态", readConverterExp = "0=是,1否")
private String isSecurityStatus;
/** 风险等级 */
@Excel(name = "风险等级")
private String assessmentLevel;
/** 主要负责人 */
@Excel(name = "主要负责人")
private String keyPerson;
/** 承诺公告 */
@Excel(name = "承诺公告")
private String announcement;
private String status;
/** 承诺日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "承诺日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date commitmentDate;
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
/**
* 安全承诺公告Mapper接口
*
* @author zehong
* @date 2022-12-21
*/
public interface TSafetyCommitmentAnnouncementMapper
{
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id);
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告集合
*/
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 删除安全承诺公告
*
* @param id 安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementById(Long id);
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
/**
* 安全承诺公告Service接口
*
* @author zehong
* @date 2022-12-21
*/
public interface ITSafetyCommitmentAnnouncementService
{
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id);
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告集合
*/
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids);
/**
* 删除安全承诺公告信息
*
* @param id 安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementById(Long id);
}
package com.zehong.system.service.impl;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSafetyCommitmentAnnouncementMapper;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
import com.zehong.system.service.ITSafetyCommitmentAnnouncementService;
/**
* 安全承诺公告Service业务层处理
*
* @author zehong
* @date 2022-12-21
*/
@Service
public class TSafetyCommitmentAnnouncementServiceImpl implements ITSafetyCommitmentAnnouncementService
{
@Autowired
private TSafetyCommitmentAnnouncementMapper tSafetyCommitmentAnnouncementMapper;
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
@Override
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id)
{
return tSafetyCommitmentAnnouncementMapper.selectTSafetyCommitmentAnnouncementById(id);
}
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告
*/
@Override
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
}
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
@Override
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.insertTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement);
}
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
@Override
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.updateTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement);
}
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的安全承诺公告ID
* @return 结果
*/
@Override
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids)
{
return tSafetyCommitmentAnnouncementMapper.deleteTSafetyCommitmentAnnouncementByIds(ids);
}
/**
* 删除安全承诺公告信息
*
* @param id 安全承诺公告ID
* @return 结果
*/
@Override
public int deleteTSafetyCommitmentAnnouncementById(Long id)
{
return tSafetyCommitmentAnnouncementMapper.deleteTSafetyCommitmentAnnouncementById(id);
}
}
<?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.TSafetyCommitmentAnnouncementMapper">
<resultMap type="TSafetyCommitmentAnnouncement" id="TSafetyCommitmentAnnouncementResult">
<result property="id" column="id" />
<result property="productionUnit" column="production_unit" />
<result property="runningDevice" column="running_device" />
<result property="shutdownDevice" column="shutdown_device" />
<result property="maintenanceDevice" column="maintenance_device" />
<result property="hotWork" column="hot_work" />
<result property="specialHotWork" column="special_hot_work" />
<result property="classOneHotWork" column="class_one_hot_work" />
<result property="classTwoHotWork" column="class_two_hot_work" />
<result property="isConfinedSpace" column="is_confined_space" />
<result property="isTrialProduction" column="is_trial_production" />
<result property="isSecurityStatus" column="is_security_status" />
<result property="assessmentLevel" column="assessment_level" />
<result property="keyPerson" column="key_person" />
<result property="announcement" column="announcement" />
<result property="commitmentDate" column="commitment_date" />
<result property="status" column="status" />
</resultMap>
<sql id="selectTSafetyCommitmentAnnouncementVo">
select id, production_unit, running_device, shutdown_device, maintenance_device, hot_work, special_hot_work, class_one_hot_work, class_two_hot_work, is_confined_space, is_trial_production, is_security_status, assessment_level, key_person, announcement, commitment_date, status from t_safety_commitment_announcement
</sql>
<select id="selectTSafetyCommitmentAnnouncementList" parameterType="TSafetyCommitmentAnnouncement" resultMap="TSafetyCommitmentAnnouncementResult">
<include refid="selectTSafetyCommitmentAnnouncementVo"/>
<where>
<if test="productionUnit != null "> and production_unit = #{productionUnit}</if>
<if test="runningDevice != null "> and running_device = #{runningDevice}</if>
<if test="shutdownDevice != null "> and shutdown_device = #{shutdownDevice}</if>
<if test="maintenanceDevice != null "> and maintenance_device = #{maintenanceDevice}</if>
<if test="hotWork != null "> and hot_work = #{hotWork}</if>
<if test="specialHotWork != null "> and special_hot_work = #{specialHotWork}</if>
<if test="classOneHotWork != null "> and class_one_hot_work = #{classOneHotWork}</if>
<if test="classTwoHotWork != null "> and class_two_hot_work = #{classTwoHotWork}</if>
<if test="isConfinedSpace != null and isConfinedSpace != ''"> and is_confined_space = #{isConfinedSpace}</if>
<if test="isTrialProduction != null and isTrialProduction != ''"> and is_trial_production = #{isTrialProduction}</if>
<if test="isSecurityStatus != null and isSecurityStatus != ''"> and is_security_status = #{isSecurityStatus}</if>
<if test="assessmentLevel != null and assessmentLevel != ''"> and assessment_level = #{assessmentLevel}</if>
<if test="keyPerson != null and keyPerson != ''"> and key_person = #{keyPerson}</if>
<if test="announcement != null and announcement != ''"> and announcement = #{announcement}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND commitment_date &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND commitment_date &lt;= #{params.endTime}
</if>
</where>
order by commitment_date desc
</select>
<select id="selectTSafetyCommitmentAnnouncementById" parameterType="Long" resultMap="TSafetyCommitmentAnnouncementResult">
<include refid="selectTSafetyCommitmentAnnouncementVo"/>
where id = #{id}
</select>
<insert id="insertTSafetyCommitmentAnnouncement" parameterType="TSafetyCommitmentAnnouncement">
insert into t_safety_commitment_announcement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="productionUnit != null">production_unit,</if>
<if test="runningDevice != null">running_device,</if>
<if test="shutdownDevice != null">shutdown_device,</if>
<if test="maintenanceDevice != null">maintenance_device,</if>
<if test="hotWork != null">hot_work,</if>
<if test="specialHotWork != null">special_hot_work,</if>
<if test="classOneHotWork != null">class_one_hot_work,</if>
<if test="classTwoHotWork != null">class_two_hot_work,</if>
<if test="isConfinedSpace != null">is_confined_space,</if>
<if test="isTrialProduction != null">is_trial_production,</if>
<if test="isSecurityStatus != null">is_security_status,</if>
<if test="assessmentLevel != null">assessment_level,</if>
<if test="keyPerson != null">key_person,</if>
<if test="announcement != null">announcement,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="productionUnit != null">#{productionUnit},</if>
<if test="runningDevice != null">#{runningDevice},</if>
<if test="shutdownDevice != null">#{shutdownDevice},</if>
<if test="maintenanceDevice != null">#{maintenanceDevice},</if>
<if test="hotWork != null">#{hotWork},</if>
<if test="specialHotWork != null">#{specialHotWork},</if>
<if test="classOneHotWork != null">#{classOneHotWork},</if>
<if test="classTwoHotWork != null">#{classTwoHotWork},</if>
<if test="isConfinedSpace != null">#{isConfinedSpace},</if>
<if test="isTrialProduction != null">#{isTrialProduction},</if>
<if test="isSecurityStatus != null">#{isSecurityStatus},</if>
<if test="assessmentLevel != null">#{assessmentLevel},</if>
<if test="keyPerson != null">#{keyPerson},</if>
<if test="announcement != null">#{announcement},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateTSafetyCommitmentAnnouncement" parameterType="TSafetyCommitmentAnnouncement">
update t_safety_commitment_announcement
<trim prefix="SET" suffixOverrides=",">
<if test="productionUnit != null">production_unit = #{productionUnit},</if>
<if test="runningDevice != null">running_device = #{runningDevice},</if>
<if test="shutdownDevice != null">shutdown_device = #{shutdownDevice},</if>
<if test="maintenanceDevice != null">maintenance_device = #{maintenanceDevice},</if>
<if test="hotWork != null">hot_work = #{hotWork},</if>
<if test="specialHotWork != null">special_hot_work = #{specialHotWork},</if>
<if test="classOneHotWork != null">class_one_hot_work = #{classOneHotWork},</if>
<if test="classTwoHotWork != null">class_two_hot_work = #{classTwoHotWork},</if>
<if test="isConfinedSpace != null">is_confined_space = #{isConfinedSpace},</if>
<if test="isTrialProduction != null">is_trial_production = #{isTrialProduction},</if>
<if test="isSecurityStatus != null">is_security_status = #{isSecurityStatus},</if>
<if test="assessmentLevel != null">assessment_level = #{assessmentLevel},</if>
<if test="keyPerson != null">key_person = #{keyPerson},</if>
<if test="announcement != null">announcement = #{announcement},</if>
<if test="status != null">status = #{status},</if>
<if test="commitmentDate != null">commitment_date = #{commitmentDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTSafetyCommitmentAnnouncementById" parameterType="Long">
delete from t_safety_commitment_announcement where id = #{id}
</delete>
<delete id="deleteTSafetyCommitmentAnnouncementByIds" parameterType="String">
delete from t_safety_commitment_announcement where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询安全承诺公告列表
export function listAnnouncement(query) {
return request({
url: '/safetyManagement/announcement/list',
method: 'get',
params: query
})
}
// 查询安全承诺公告详细
export function getAnnouncement(id) {
return request({
url: '/safetyManagement/announcement/' + id,
method: 'get'
})
}
// 新增安全承诺公告
export function addAnnouncement(data) {
return request({
url: '/safetyManagement/announcement',
method: 'post',
data: data
})
}
// 修改安全承诺公告
export function updateAnnouncement(data) {
return request({
url: '/safetyManagement/announcement',
method: 'put',
data: data
})
}
// 删除安全承诺公告
export function delAnnouncement(id) {
return request({
url: '/safetyManagement/announcement/' + id,
method: 'delete'
})
}
// 导出安全承诺公告
export function exportAnnouncement(query) {
return request({
url: '/safetyManagement/announcement/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="assessmentLevel">
<el-select v-model="queryParams.assessmentLevel" placeholder="请选择风险等级" style="width: 100%">
<el-option
v-for="dict in levelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="承诺时间" prop="commitmentDate">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd HH:mm:ss"
size="small"
style="width: 220px"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
:default-time="['00:00:00', '23:59:59']"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button style="width: 75px"
type="primary"
plain
size="mini"
@click="handleAdd"
>承诺</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="announcementList">
<el-table-column label="序号" align="center" type="index" width="100"/>
<el-table-column label="风险等级" align="center" prop="assessmentLevel" :formatter="levelFormate"/>
<el-table-column label="承诺人" align="center" prop="keyPerson" />
<el-table-column label="承诺时间" align="center" prop="commitmentDate" width="180" />
<el-table-column label="承诺状态" align="center" prop="status" >
<template slot-scope="scope">
<span v-if="scope.row.status == '0'">已承诺</span>
</template>
</el-table-column>
<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="handleDetail(scope.row)"
>安全承诺报告</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" center :visible.sync="open" width="1200px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-row>
<el-col :span="24">
<span style="font-weight: bold">企业状态</span>
<el-divider></el-divider>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="生产装置" prop="productionUnit">
<el-input v-show="!operate" v-model="form.productionUnit" placeholder="" disabled/>
<span v-show="operate">{{form.productionUnit}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="运行装置" prop="runningDevice">
<el-input-number v-show="!operate" :min="0" v-model="form.runningDevice" placeholder="请输入运行装置数量" @change="unitSum"/>
<span v-show="operate">{{form.runningDevice}}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="停产装置" prop="shutdownDevice">
<el-input-number v-show="!operate" :min="0" v-model="form.shutdownDevice" placeholder="请输入停产装置数量" @change="unitSum"/>
<span v-show="operate">{{form.shutdownDevice}}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检修装置" prop="maintenanceDevice">
<el-input-number v-show="!operate" :min="0" v-model="form.maintenanceDevice" placeholder="请输入检修装置数量" @change="unitSum"/>
<span v-show="operate">{{form.maintenanceDevice}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="动火作业" prop="hotWork">
<el-input v-show="!operate" v-model="form.hotWork" placeholder="" disabled/>
<span v-show="operate">{{form.hotWork}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="特殊动火作业" prop="specialHotWork">
<el-input-number v-show="!operate" :min="0" v-model="form.specialHotWork" placeholder="请输入特殊动火作业数量" @change="workSum"/>
<span v-show="operate">{{form.specialHotWork}}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="一级动火作业" prop="classOneHotWork">
<el-input-number v-show="!operate" :min="0" v-model="form.classOneHotWork" placeholder="请输入一级动火作业数量" @change="workSum"/>
<span v-show="operate">{{form.classOneHotWork}}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="二级动火作业" prop="classTwoHotWork">
<el-input-number v-show="!operate" :min="0" v-model="form.classTwoHotWork" placeholder="请输入二级动火作业数量" @change="workSum"/>
<span v-show="operate">{{form.classTwoHotWork}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="风险等级" prop="assessmentLevel">
<el-select v-show="!operate" v-model="form.assessmentLevel" placeholder="请选择风险等级" style="width: 100%">
<el-option v-show="!operate"
v-for="dict in levelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
<span v-show="operate">{{form.assessmentLevel}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="进入受限空间作业" prop="isConfinedSpace">
<el-select v-show="!operate" v-model="form.isConfinedSpace" placeholder="是否进入受限空间作业" style="width: 100%">
<el-option
v-for="dict in options"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<span v-show="operate" v-if="form.isConfinedSpace == '0'"></span>
<span v-show="operate" v-if="form.isConfinedSpace == '1'"></span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否处于试生产" prop="isTrialProduction">
<el-select v-show="!operate" v-model="form.isTrialProduction" placeholder="是否处于试生产" style="width: 100%">
<el-option
v-for="dict in options"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<span v-show="operate" v-if="form.isTrialProduction == '0'"></span>
<span v-show="operate" v-if="form.isTrialProduction == '1'"></span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="罐装、仓库等重大危险源是否处于安全状态">
<el-select v-show="!operate" v-model="form.isSecurityStatus" placeholder="是否处于安全状态" style="width: 100%">
<el-option
v-for="dict in options"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<span v-show="operate" v-if="form.isSecurityStatus == '0'"></span>
<span v-show="operate" v-if="form.isSecurityStatus == '1'"></span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<span style="font-weight: bold">企业承诺</span>
<el-divider></el-divider>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="主要负责人" prop="keyPerson">
<el-input v-show="!operate" v-model="form.keyPerson" placeholder="请输入主要负责人" />
<span v-show="operate">{{form.keyPerson}}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="承诺日期" prop="commitmentDate">
<el-date-picker clearable size="small" disabled v-show="!operate"
v-model="commitmentDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择承诺日期">
</el-date-picker>
<span v-show="operate">{{parseTime(form.commitmentDate, '{y}-{m}-{d}')}}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="承诺公告" prop="announcement">
<el-input v-show="!operate" v-model="form.announcement" type="textarea" placeholder="请输入内容" />
<span v-show="operate">{{form.announcement}}</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-show="!operate" type="primary" @click="submitForm">确 定</el-button>
<el-button v-show="!operate" @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAnnouncement, getAnnouncement, delAnnouncement, addAnnouncement, updateAnnouncement, exportAnnouncement } from "@/api/safetyManagement/announcement";
export default {
name: "Announcement",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 日期范围(默认当日0点到当前时间)
// dateRange: [new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0,0,0), new Date()],
dateRange: [],
levelOptions: [],
options: [{
value:"0",
label:"是"
},{
value:"1",
label:"否"
}],
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 安全承诺公告表格数据
announcementList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
//详情控制
operate: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
assessmentLevel: null
},
// 表单参数
form: {},
commitmentDate: new Date(),
// 表单校验
rules: {
keyPerson: [
{ required: true, message: "主要负责人不能为空", trigger: "blur" }
],
announcement: [
{ required: true, message: "承诺公告不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getDicts("assessment_level").then(response => {
this.levelOptions = response.data;
});
},
methods: {
/** 查询安全承诺公告列表 */
getList() {
this.loading = true;
// let params,
// begin = this.dateRange[0],
// end = this.dateRange[1];
// // params = [begin.getFullYear()+'-'+begin.getMonth()+'-'+begin.getDate()+' '+end.getHours()+':'+end.getMinutes()+':'+end.getSeconds(),
// // end.getFullYear()+'-'+end.getMonth()+'-'+end.getDate()+' '+end.getHours()+':'+end.getMinutes()+':'+end.getSeconds()];
// params = [begin.toLocaleString(), end.toLocaleString()];
// console.log(begin, end);
// console.log("params", params);
// listAnnouncement(this.addDateRange(this.queryParams, params)).then(response => {
listAnnouncement(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
console.log("response.rows",response.rows);
this.announcementList = response.rows;
this.total = response.total;
this.loading = false;
});
},
levelFormate(row){
console.log("this.levelOptions",this.levelOptions);
return this.levelOptions.find(item => item.dictValue == row.assessmentLevel).dictLabel;
},
unitSum(){
if(isNaN(this.form.runningDevice)){
this.form.runningDevice = 0;
}
if(isNaN(this.form.shutdownDevice)){
this.form.shutdownDevice = 0;
}
if(isNaN(this.form.maintenanceDevice)){
this.form.maintenanceDevice = 0;
}
this.form.productionUnit = this.form.runningDevice + this.form.shutdownDevice + this.form.maintenanceDevice;
},
workSum(){
if(isNaN(this.form.specialHotWork)){
this.form.specialHotWork = 0;
}
if(isNaN(this.form.classOneHotWork)){
this.form.classOneHotWork = 0;
}
if(isNaN(this.form.classTwoHotWork)){
this.form.classTwoHotWork = 0;
}
this.form.hotWork = this.form.specialHotWork + this.form.classOneHotWork + this.form.classTwoHotWork;
},
// 取消按钮
cancel() {
this.open = false;
this.operate = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
productionUnit: null,
runningDevice: null,
shutdownDevice: null,
maintenanceDevice: null,
hotWork: null,
specialHotWork: null,
classOneHotWork: null,
classTwoHotWork: null,
isConfinedSpace: null,
isTrialProduction: null,
isSecurityStatus: null,
assessmentLevel: null,
keyPerson: null,
announcement: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
// this.dateRange = [new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0,0,0), new Date()];
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
let params,
begin = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0,0,0),
end = new Date();
params = [begin.toLocaleString(), end.toLocaleString()];
console.log(begin, end);
console.log("params", params);
listAnnouncement(this.addDateRange(this.queryParams, params)).then(response => {
let list = response.rows;
if(list.length == 0) {
this.reset();
this.open = true;
this.title = "安全承诺公告";
}else{
this.msgError("今日已录入安全承诺");
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
addAnnouncement(this.form).then(response => {
this.msgSuccess("提交成功");
this.open = false;
this.getList();
});
}
});
},
handleDetail(row) {
getAnnouncement(row.id).then(response => {
if(response.code == 200) {
this.form = response.data;
this.open = true;
this.operate = true;
this.title = "安全承诺公告报告";
}else{
this.msgSuccess("查看失败");
}
});
},
}
};
</script>
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