累计跟新
parent
73d299576f
commit
162cded138
@ -0,0 +1,154 @@
|
||||
package com.ruoyi.web.controller.ehs;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
|
||||
import com.ruoyi.ehsNoticeMessage.service.IEhsNoticeMessageService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ehsMyMessage.domain.EhsMyMessage;
|
||||
import com.ruoyi.ehsMyMessage.service.IEhsMyMessageService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 我的的消息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-01-16
|
||||
*/
|
||||
@Api(tags="我的的消息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ehsMyMessage/ehsMyMessage")
|
||||
public class EhsMyMessageController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEhsMyMessageService ehsMyMessageService;
|
||||
@Autowired
|
||||
private IEhsNoticeMessageService ehsNoticeMessageService;
|
||||
/**
|
||||
* 查询我的的消息列表
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EhsMyMessage ehsMyMessage)
|
||||
{
|
||||
startPage();
|
||||
List<EhsMyMessage> list = ehsMyMessageService.selectEhsMyMessageList(ehsMyMessage);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出我的的消息列表
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:export')")
|
||||
@Log(title = "我的的消息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EhsMyMessage ehsMyMessage)
|
||||
{
|
||||
List<EhsMyMessage> list = ehsMyMessageService.selectEhsMyMessageList(ehsMyMessage);
|
||||
ExcelUtil<EhsMyMessage> util = new ExcelUtil<EhsMyMessage>(EhsMyMessage.class);
|
||||
util.exportExcel(response, list, "我的的消息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的的消息详细信息
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:query')")
|
||||
@GetMapping(value = "/{myMessageId}")
|
||||
public AjaxResult getInfo(@PathVariable("myMessageId") Long myMessageId)
|
||||
{
|
||||
return success(ehsMyMessageService.selectEhsMyMessageByMyMessageId(myMessageId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增我的的消息
|
||||
*/
|
||||
@ApiOperation("新增我的的消息")
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:add')")
|
||||
@Log(title = "我的的消息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EhsMyMessage ehsMyMessage)
|
||||
{
|
||||
return toAjax(ehsMyMessageService.save(ehsMyMessage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的的消息
|
||||
*/
|
||||
@ApiOperation("修改我的的消息")
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:edit')")
|
||||
@Log(title = "我的的消息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EhsMyMessage ehsMyMessage)
|
||||
{
|
||||
return toAjax(ehsMyMessageService.updateById(ehsMyMessage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的的消息
|
||||
*/
|
||||
@ApiOperation("删除我的的消息")
|
||||
//@PreAuthorize("@ss.hasPermi('ehsMyMessage:ehsMyMessage:remove')")
|
||||
@Log(title = "我的的消息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{myMessageIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] myMessageIds)
|
||||
{
|
||||
return toAjax(ehsMyMessageService.removeByIds(Arrays.asList(myMessageIds)));
|
||||
}
|
||||
@GetMapping("/getUnread")
|
||||
public AjaxResult getUnread()
|
||||
{
|
||||
AjaxResult ajr = new AjaxResult();
|
||||
EhsMyMessage ehsMyMessage = new EhsMyMessage();
|
||||
ehsMyMessage.setMyMessageType("0");
|
||||
ehsMyMessage.setMyUserId(SecurityUtils.getUserId());
|
||||
EhsMyMessage msg = ehsMyMessageService.selectEhsMyMessageByMyMessageMax(ehsMyMessage);
|
||||
if(msg.getMyMessageState().equals("N"))
|
||||
ajr.put("msgHD","1");
|
||||
else
|
||||
ajr.put("msgHD","0");
|
||||
//分析是否有本人的未读消息通知
|
||||
//消息通知的每一记录,我的消息都应该有一条记录,如果没有,说明未读,并向我的消息插入一条记录,并设置为未读
|
||||
//消息通知模块点击阅读按钮后,需要同时修改我的消息的已读标志
|
||||
//统计我的消息类型=1的所有未读数量。
|
||||
EhsMyMessage myMsg = new EhsMyMessage();
|
||||
myMsg.setNoticeDeptId(SecurityUtils.getDeptId());
|
||||
myMsg.setNoticeStatus("1");
|
||||
myMsg.setNoticeMesgType(1L);
|
||||
myMsg.setMyMessageType("1");
|
||||
myMsg.setMyUserId(SecurityUtils.getUserId());
|
||||
List<EhsMyMessage> list = ehsMyMessageService.selectUnReadNotice(myMsg);
|
||||
if(!list.isEmpty()){
|
||||
for(EhsMyMessage emsg :list){
|
||||
EhsMyMessage msgNew = new EhsMyMessage();
|
||||
msgNew.setMyMessageKey(emsg.getMyMessageId().toString());
|
||||
ehsMyMessageService.saveMyMessage(msgNew);
|
||||
}
|
||||
}
|
||||
EhsMyMessage msgQuery = new EhsMyMessage();
|
||||
msgQuery.setMyMessageType("1");
|
||||
msgQuery.setMyMessageState("N");
|
||||
msgQuery.setMyUserId(SecurityUtils.getUserId());
|
||||
Long msgCount = ehsMyMessageService.msgCount(msgQuery);
|
||||
ajr.put("msg",msgCount.toString());
|
||||
return ajr;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.ruoyi.ehsMyMessage.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 我的的消息对象 ehs_my_message
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-01-16
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("ehs_my_message")
|
||||
public class EhsMyMessage extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(type= IdType.AUTO)
|
||||
private Long myMessageId;
|
||||
|
||||
/** 关键字 */
|
||||
@Excel(name = "关键字")
|
||||
private String myMessageKey;
|
||||
|
||||
/** 消息类型 */
|
||||
@Excel(name = "消息类型")
|
||||
private String myMessageType;
|
||||
|
||||
/** 消息内容 */
|
||||
@Excel(name = "消息内容")
|
||||
private String myMessageDesc;
|
||||
|
||||
/** 是否已读 */
|
||||
@Excel(name = "是否已读")
|
||||
private String myMessageState;
|
||||
|
||||
/** 消息所有者 */
|
||||
@Excel(name = "消息所有者")
|
||||
private Long myUserId;
|
||||
|
||||
/** 消息通知状态 */
|
||||
private String noticeStatus;
|
||||
/** 消息通知类型 */
|
||||
private Long noticeMesgType;
|
||||
/** 消息通知部门id */
|
||||
private Long noticeDeptId;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.ehsMyMessage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.ehsMyMessage.domain.EhsMyMessage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 我的的消息Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-01-16
|
||||
*/
|
||||
public interface EhsMyMessageMapper extends BaseMapper<EhsMyMessage> {
|
||||
/**
|
||||
* 查询我的的消息
|
||||
*
|
||||
* @param myMessageId 我的的消息主键
|
||||
* @return 我的的消息
|
||||
*/
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageId(Long myMessageId);
|
||||
|
||||
/**
|
||||
* 查询我的的消息列表
|
||||
*
|
||||
* @param ehsMyMessage 我的的消息
|
||||
* @return 我的的消息集合
|
||||
*/
|
||||
public List<EhsMyMessage> selectEhsMyMessageList(EhsMyMessage ehsMyMessage);
|
||||
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageMax(EhsMyMessage ehsMyMessage);
|
||||
|
||||
public List<EhsMyMessage> selectUnReadNotice(EhsMyMessage ehsMyMessage);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.ehsMyMessage.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.ehsMyMessage.domain.EhsMyMessage;
|
||||
|
||||
/**
|
||||
* 我的的消息Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-01-16
|
||||
*/
|
||||
public interface IEhsMyMessageService extends IService<EhsMyMessage> {
|
||||
|
||||
/**
|
||||
* 查询我的的消息
|
||||
*
|
||||
* @param myMessageId 我的的消息主键
|
||||
* @return 我的的消息
|
||||
*/
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageId(Long myMessageId);
|
||||
|
||||
/**
|
||||
* 查询我的的消息列表
|
||||
*
|
||||
* @param ehsMyMessage 我的的消息
|
||||
* @return 我的的消息集合
|
||||
*/
|
||||
public List<EhsMyMessage> selectEhsMyMessageList(EhsMyMessage ehsMyMessage);
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageMax(EhsMyMessage ehsMyMessage);
|
||||
public Long msgCount(EhsMyMessage query);
|
||||
public List<EhsMyMessage> selectUnReadNotice(EhsMyMessage ehsMyMessage);
|
||||
public boolean saveMyMessage(EhsMyMessage msgNew);
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package com.ruoyi.ehsMyMessage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.ruoyi.ehsMyMessage.mapper.EhsMyMessageMapper;
|
||||
import com.ruoyi.ehsMyMessage.domain.EhsMyMessage;
|
||||
import com.ruoyi.ehsMyMessage.service.IEhsMyMessageService;
|
||||
|
||||
/**
|
||||
* 我的的消息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-01-16
|
||||
*/
|
||||
@Service
|
||||
public class EhsMyMessageServiceImpl extends ServiceImpl<EhsMyMessageMapper, EhsMyMessage> implements IEhsMyMessageService {
|
||||
|
||||
@Autowired
|
||||
private EhsMyMessageMapper ehsMyMessageMapper;
|
||||
|
||||
/**
|
||||
* 查询我的的消息
|
||||
*
|
||||
* @param myMessageId 我的的消息主键
|
||||
* @return 我的的消息
|
||||
*/
|
||||
@Override
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageId(Long myMessageId)
|
||||
{
|
||||
return ehsMyMessageMapper.selectEhsMyMessageByMyMessageId(myMessageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的的消息列表
|
||||
*
|
||||
* @param ehsMyMessage 我的的消息
|
||||
* @return 我的的消息
|
||||
*/
|
||||
@Override
|
||||
public List<EhsMyMessage> selectEhsMyMessageList(EhsMyMessage ehsMyMessage)
|
||||
{
|
||||
return ehsMyMessageMapper.selectEhsMyMessageList(ehsMyMessage);
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<EhsMyMessage> buildQueryWrapper(EhsMyMessage query) {
|
||||
Map<String, Object> params = query.getParams();
|
||||
LambdaQueryWrapper<EhsMyMessage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(query.getMyMessageKey()), EhsMyMessage::getMyMessageKey, query.getMyMessageKey());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getMyMessageType()), EhsMyMessage::getMyMessageType, query.getMyMessageType());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getMyMessageDesc()), EhsMyMessage::getMyMessageDesc, query.getMyMessageDesc());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getMyMessageState()), EhsMyMessage::getMyMessageState, query.getMyMessageState());
|
||||
lqw.eq(query.getMyUserId() != null, EhsMyMessage::getMyUserId, query.getMyUserId());
|
||||
lqw.orderByDesc(EhsMyMessage::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
public EhsMyMessage selectEhsMyMessageByMyMessageMax(EhsMyMessage ehsMyMessage){
|
||||
return ehsMyMessageMapper.selectEhsMyMessageByMyMessageMax(ehsMyMessage);
|
||||
}
|
||||
@Override
|
||||
public Long msgCount(EhsMyMessage query){
|
||||
return ehsMyMessageMapper.selectCount(buildQueryWrapper(query));
|
||||
}
|
||||
|
||||
public List<EhsMyMessage> selectUnReadNotice(EhsMyMessage ehsMyMessage){
|
||||
return ehsMyMessageMapper.selectUnReadNotice(ehsMyMessage);
|
||||
}
|
||||
public boolean saveMyMessage(EhsMyMessage msgNew){
|
||||
msgNew.setMyUserId(SecurityUtils.getUserId());
|
||||
msgNew.setMyMessageType("1");
|
||||
msgNew.setMyMessageDesc("您有新的消息通知未阅读,请及及时处理!");
|
||||
msgNew.setMyMessageState("N");
|
||||
return saveOrUpdate(msgNew);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ehsMyMessage.mapper.EhsMyMessageMapper">
|
||||
|
||||
<resultMap type="EhsMyMessage" id="EhsMyMessageResult">
|
||||
<result property="myMessageId" column="my_message_id" />
|
||||
<result property="myMessageKey" column="my_message_key" />
|
||||
<result property="myMessageType" column="my_message_type" />
|
||||
<result property="myMessageDesc" column="my_message_desc" />
|
||||
<result property="myMessageState" column="my_message_state" />
|
||||
<result property="myUserId" column="my_user_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="createUserId" column="create_user_id" />
|
||||
<result property="updateUserId" column="update_user_id" />
|
||||
<result property="noticeStatus" column="notice_status" />
|
||||
<result property="noticeMesgType" column="notice_mesg_type" />
|
||||
<result property="noticeDeptId" column="notice_dept_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEhsMyMessageVo">
|
||||
select my_message_id, my_message_key, my_message_type, my_message_desc,
|
||||
my_message_state, my_user_id, create_by, create_time, update_by, update_time, remark, dept_id,
|
||||
create_user_id, update_user_id from ehs_my_message
|
||||
</sql>
|
||||
|
||||
<select id="selectEhsMyMessageList" parameterType="EhsMyMessage" resultMap="EhsMyMessageResult">
|
||||
<include refid="selectEhsMyMessageVo"/>
|
||||
<where>
|
||||
<if test="myMessageKey != null and myMessageKey != ''"> and my_message_key = #{myMessageKey}</if>
|
||||
<if test="myMessageType != null and myMessageType != ''"> and my_message_type = #{myMessageType}</if>
|
||||
<if test="myMessageDesc != null and myMessageDesc != ''"> and my_message_desc = #{myMessageDesc}</if>
|
||||
<if test="myMessageState != null and myMessageState != ''"> and my_message_state = #{myMessageState}</if>
|
||||
<if test="myUserId != null "> and my_user_id = #{myUserId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEhsMyMessageByMyMessageId" parameterType="Long" resultMap="EhsMyMessageResult">
|
||||
<include refid="selectEhsMyMessageVo"/>
|
||||
where my_message_id = #{myMessageId}
|
||||
</select>
|
||||
|
||||
<select id="selectEhsMyMessageByMyMessageMax" parameterType="EhsMyMessage" resultMap="EhsMyMessageResult">
|
||||
<include refid="selectEhsMyMessageVo"/>
|
||||
where my_message_id =(
|
||||
select max(my_message_id) from ehs_my_message
|
||||
<where>
|
||||
<if test="myMessageKey != null and myMessageKey != ''"> and my_message_key = #{myMessageKey}</if>
|
||||
<if test="myMessageType != null and myMessageType != ''"> and my_message_type = #{myMessageType}</if>
|
||||
<if test="myMessageDesc != null and myMessageDesc != ''"> and my_message_desc = #{myMessageDesc}</if>
|
||||
<if test="myMessageState != null and myMessageState != ''"> and my_message_state = #{myMessageState}</if>
|
||||
<if test="myUserId != null "> and my_user_id = #{myUserId}</if>
|
||||
</where>
|
||||
)
|
||||
<if test="myMessageKey != null and myMessageKey != ''"> and my_message_key = #{myMessageKey}</if>
|
||||
<if test="myMessageType != null and myMessageType != ''"> and my_message_type = #{myMessageType}</if>
|
||||
<if test="myMessageDesc != null and myMessageDesc != ''"> and my_message_desc = #{myMessageDesc}</if>
|
||||
<if test="myMessageState != null and myMessageState != ''"> and my_message_state = #{myMessageState}</if>
|
||||
<if test="myUserId != null "> and my_user_id = #{myUserId}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUnReadNotice" parameterType="EhsMyMessage" resultMap="EhsMyMessageResult">
|
||||
SELECT m.notice_message_id my_message_id FROM ehs_notice_message m
|
||||
LEFT JOIN sys_user e ON e.user_id = m.CREATE_USER_ID
|
||||
LEFT JOIN sys_dept d ON m.dept_id = d.dept_id AND d.parent_id != 0
|
||||
WHERE m.STATUS = #{noticeStatus}
|
||||
AND ( FIND_IN_SET( #{noticeDeptId}, m.dept_list ) OR m.all_dept = 1 )
|
||||
AND m.mesg_type = #{noticeMesgType}
|
||||
and m.notice_message_id not in (
|
||||
select my_message_key from ehs_my_message
|
||||
<where>
|
||||
<if test="myMessageKey != null and myMessageKey != ''"> and my_message_key = #{myMessageKey}</if>
|
||||
<if test="myMessageType != null and myMessageType != ''"> and my_message_type = #{myMessageType}</if>
|
||||
<if test="myMessageDesc != null and myMessageDesc != ''"> and my_message_desc = #{myMessageDesc}</if>
|
||||
<if test="myMessageState != null and myMessageState != ''"> and my_message_state = #{myMessageState}</if>
|
||||
<if test="myUserId != null "> and my_user_id = #{myUserId}</if>
|
||||
</where>
|
||||
)
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,52 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询我的的消息列表
|
||||
export function listEhsMyMessage(query) {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询我的的消息详细
|
||||
export function getEhsMyMessage(myMessageId) {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage/' + myMessageId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增我的的消息
|
||||
export function addEhsMyMessage(data) {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改我的的消息
|
||||
export function updateEhsMyMessage(data) {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除我的的消息
|
||||
export function delEhsMyMessage(myMessageId) {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage/' + myMessageId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询我的的未读消息
|
||||
export function getUnread() {
|
||||
return request({
|
||||
url: '/ehsMyMessage/ehsMyMessage/getUnread',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
@ -0,0 +1,328 @@
|
||||
<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="myMessageType">
|
||||
<el-select v-model="queryParams.myMessageType" placeholder="请选择消息类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.my_message_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!--<el-form-item label="消息内容" prop="myMessageDesc">
|
||||
<el-input
|
||||
v-model="queryParams.myMessageDesc"
|
||||
placeholder="请输入消息内容"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否已读" prop="myMessageState">
|
||||
<el-select v-model="queryParams.myMessageState" 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="myUserId">
|
||||
<el-input
|
||||
v-model="queryParams.myUserId"
|
||||
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="['ehsMyMessage:ehsMyMessage: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="['ehsMyMessage:ehsMyMessage: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="['ehsMyMessage:ehsMyMessage: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="['ehsMyMessage:ehsMyMessage:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="ehsMyMessageList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--<el-table-column label="主键" align="center" prop="myMessageId" />
|
||||
<el-table-column label="关键字" align="center" prop="myMessageKey" />-->
|
||||
<el-table-column label="消息类型" align="center" prop="myMessageType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.my_message_type" :value="scope.row.myMessageType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="消息内容" align="center" prop="myMessageDesc" />
|
||||
<el-table-column label="是否已读" align="center" prop="myMessageState">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.myMessageState"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="消息所有者" align="center" prop="myUserId" />-->
|
||||
<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="['ehsMyMessage:ehsMyMessage:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ehsMyMessage:ehsMyMessage: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="myMessageKey">
|
||||
<el-input v-model="form.myMessageKey" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="消息类型" prop="myMessageType">
|
||||
<el-select v-model="form.myMessageType" placeholder="请选择消息类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.my_message_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="消息内容" prop="myMessageDesc">
|
||||
<el-input v-model="form.myMessageDesc" placeholder="请输入消息内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否已读" prop="myMessageState">
|
||||
<el-select v-model="form.myMessageState" placeholder="请选择是否已读">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="消息所有者" prop="myUserId">
|
||||
<el-input v-model="form.myUserId" 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 { listEhsMyMessage, getEhsMyMessage, delEhsMyMessage, addEhsMyMessage, updateEhsMyMessage } from "@/api/ehs/ehsMyMessage";
|
||||
|
||||
export default {
|
||||
name: "EhsMyMessage",
|
||||
dicts: ['my_message_type', 'sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 我的的消息表格数据
|
||||
ehsMyMessageList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
myMessageKey: null,
|
||||
myMessageType: null,
|
||||
myMessageDesc: null,
|
||||
myMessageState: null,
|
||||
myUserId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询我的的消息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listEhsMyMessage(this.queryParams).then(response => {
|
||||
this.ehsMyMessageList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
myMessageId: null,
|
||||
myMessageKey: null,
|
||||
myMessageType: null,
|
||||
myMessageDesc: null,
|
||||
myMessageState: null,
|
||||
myUserId: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null,
|
||||
deptId: null,
|
||||
createUserId: null,
|
||||
updateUserId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.myMessageId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加我的的消息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const myMessageId = row.myMessageId || this.ids
|
||||
getEhsMyMessage(myMessageId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改我的的消息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.myMessageId != null) {
|
||||
updateEhsMyMessage(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addEhsMyMessage(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const myMessageIds = row.myMessageId || this.ids;
|
||||
this.$modal.confirm('是否确认删除我的的消息编号为"' + myMessageIds + '"的数据项?').then(function() {
|
||||
return delEhsMyMessage(myMessageIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('ehsMyMessage/ehsMyMessage/export', {
|
||||
...this.queryParams
|
||||
}, `ehsMyMessage_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue