消息通知

main
liukewei 12 months ago
parent 14fc936df7
commit 4fa04e0324

@ -8,7 +8,7 @@
<version>3.8.6</version> <version>3.8.6</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>war</packaging>
<artifactId>ruoyi-admin</artifactId> <artifactId>ruoyi-admin</artifactId>
<description> <description>

@ -0,0 +1,194 @@
package com.ruoyi.web.controller.ehs;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import com.github.pagehelper.util.StringUtil;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysDeptService;
import org.apache.commons.lang3.StringUtils;
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.ehsNoticeMessage.domain.EhsNoticeMessage;
import com.ruoyi.ehsNoticeMessage.service.IEhsNoticeMessageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-06
*/
@Api(tags="内部公告管理")
@RestController
@RequestMapping("/ehsNoticeMessage/ehsNoticeMessage")
public class EhsNoticeMessageController extends BaseController
{
@Autowired
private IEhsNoticeMessageService ehsNoticeMessageService;
@Autowired
private ISysDeptService deptService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:list')")
@GetMapping("/list")
public TableDataInfo list(EhsNoticeMessage ehsNoticeMessage)
{
startPage();
ehsNoticeMessage.setDeptId(SecurityUtils.getDeptId());
ehsNoticeMessage.setStatus("1");
ehsNoticeMessage.setFileDeptId(SecurityUtils.getDeptId());
List<EhsNoticeMessage> list = ehsNoticeMessageService.selectEhsNoticeMessageList(ehsNoticeMessage);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:listAdmin')")
@GetMapping("/listAdmin")
public TableDataInfo listAdmin(EhsNoticeMessage ehsNoticeMessage)
{
startPage();
ehsNoticeMessage.setCreateDeptId(SecurityUtils.getDeptId());
List<EhsNoticeMessage> list = ehsNoticeMessageService.selectEhsNoticeMessageListAdmin(ehsNoticeMessage);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:export')")
@Log(title = "内部公告", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsNoticeMessage ehsNoticeMessage)
{
List<EhsNoticeMessage> list = ehsNoticeMessageService.selectEhsNoticeMessageList(ehsNoticeMessage);
ExcelUtil<EhsNoticeMessage> util = new ExcelUtil<EhsNoticeMessage>(EhsNoticeMessage.class);
util.exportExcel(response, list, "内部公告数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:query')")
@GetMapping(value = "/{noticeMessageId}")
public AjaxResult getInfo(@PathVariable("noticeMessageId") Long noticeMessageId)
{
return success(ehsNoticeMessageService.selectEhsNoticeMessageByNoticeMessageId(noticeMessageId));
}
/**
*
*/
@ApiOperation("新增内部公告")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:add')")
@Log(title = "内部公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsNoticeMessage ehsNoticeMessage)
{
if (ehsNoticeMessage.getAllDept() == 0 && StringUtil.isEmpty(ehsNoticeMessage.getDeptList())) {
return error("未选择部门!");
} else {
ehsNoticeMessage.setStatus("0");
ehsNoticeMessage.setCreateUserId(SecurityUtils.getUserId());
ehsNoticeMessage.setCreateDeptId(SecurityUtils.getDeptId());
if (ehsNoticeMessage.getAllDept() == 1) {
List<String> deptList = new ArrayList<>();
SysDept dept = new SysDept();
dept.setParentId(0L);
List<SysDept> depts = deptService.selectAllDeptList(dept);
for (SysDept dd : depts) {
deptList.add(dd.getDeptId().toString());
}
ehsNoticeMessage.setDeptList(StringUtils.join(deptList, ","));
}
return toAjax(ehsNoticeMessageService.save(ehsNoticeMessage));
}
}
/**
*
*/
@ApiOperation("修改内部公告")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:edit')")
@Log(title = "内部公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsNoticeMessage ehsNoticeMessage)
{
if (ehsNoticeMessage.getAllDept() == 0 && StringUtil.isEmpty(ehsNoticeMessage.getDeptList())) {
return error("未选择部门!");
} else {
ehsNoticeMessage.setStatus("0");
ehsNoticeMessage.setCreateUserId(SecurityUtils.getUserId());
ehsNoticeMessage.setCreateDeptId(SecurityUtils.getDeptId());
if (ehsNoticeMessage.getAllDept() == 1) {
List<String> deptList = new ArrayList<>();
SysDept dept = new SysDept();
dept.setParentId(0L);
List<SysDept> depts = deptService.selectAllDeptList(dept);
for (SysDept dd : depts) {
deptList.add(dd.getDeptId().toString());
}
ehsNoticeMessage.setDeptList(StringUtils.join(deptList, ","));
}
return toAjax(ehsNoticeMessageService.updateById(ehsNoticeMessage));
}
}
/**
*
*/
@ApiOperation("删除内部公告")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:remove')")
@Log(title = "内部公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeMessageIds}")
public AjaxResult remove(@PathVariable Long[] noticeMessageIds)
{
return toAjax(ehsNoticeMessageService.removeByIds(Arrays.asList(noticeMessageIds)));
}
/**
*
*/
@ApiOperation("发布公告")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:issueNews')")
@Log(title = "发布公告", businessType = BusinessType.UPDATE)
@GetMapping("/issueNews")
public AjaxResult issueNews( EhsNoticeMessage ehsNoticeMessage)
{
ehsNoticeMessage.setStatus("1");
return toAjax(ehsNoticeMessageService.updateById(ehsNoticeMessage));
}
@ApiOperation("阅读公告")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessage:ehsNoticeMessage:detail')")
@Log(title = "阅读公告", businessType = BusinessType.UPDATE)
@GetMapping(value = "/detail/{noticeMessageId}")
public AjaxResult detail(@PathVariable("noticeMessageId") Long noticeMessageId)
{
EhsNoticeMessage ehsNoticeMessage = ehsNoticeMessageService.selectEhsNoticeMessageByNoticeMessageId(noticeMessageId);
EhsNoticeMessage nm = new EhsNoticeMessage();
if (StringUtils.isEmpty(ehsNoticeMessage.getReadDeptId()) || ehsNoticeMessage.getReadDeptId().indexOf(SecurityUtils.getDeptId()+ ",") < 0) {
nm.setReadDeptId(SecurityUtils.getDeptId() + ",");
nm.setNoticeMessageId(noticeMessageId);
ehsNoticeMessageService.updateReadCompany(nm);
}
return success(ehsNoticeMessage);
}
}

@ -0,0 +1,158 @@
package com.ruoyi.web.controller.ehs;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
import com.ruoyi.ehsNoticeMessage.service.IEhsNoticeMessageService;
import com.ruoyi.system.service.ISysDeptService;
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.ehsNoticeMessageFile.domain.EhsNoticeMessageFile;
import com.ruoyi.ehsNoticeMessageFile.service.IEhsNoticeMessageFileService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-07
*/
@Api(tags="通知公告附件管理")
@RestController
@RequestMapping("/ehsNoticeMessageFile/ehsNoticeMessageFile")
public class EhsNoticeMessageFileController extends BaseController
{
@Autowired
private IEhsNoticeMessageFileService ehsNoticeMessageFileService;
@Autowired
private ISysDeptService deptService;
@Autowired
private IEhsNoticeMessageService ehsNoticeMessageService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:list')")
@GetMapping("/list")
public TableDataInfo list(EhsNoticeMessageFile ehsNoticeMessageFile)
{
startPage();
List<EhsNoticeMessageFile> list = ehsNoticeMessageFileService.selectEhsNoticeMessageFileList(ehsNoticeMessageFile);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:export')")
@Log(title = "通知公告附件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsNoticeMessageFile ehsNoticeMessageFile)
{
List<EhsNoticeMessageFile> list = ehsNoticeMessageFileService.selectEhsNoticeMessageFileList(ehsNoticeMessageFile);
ExcelUtil<EhsNoticeMessageFile> util = new ExcelUtil<EhsNoticeMessageFile>(EhsNoticeMessageFile.class);
util.exportExcel(response, list, "通知公告附件数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(ehsNoticeMessageFileService.selectEhsNoticeMessageFileById(id));
}
/**
*
*/
@ApiOperation("新增通知公告附件")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:add')")
@Log(title = "通知公告附件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsNoticeMessageFile ehsNoticeMessageFile)
{
return toAjax(ehsNoticeMessageFileService.save(ehsNoticeMessageFile));
}
/**
*
*/
@ApiOperation("修改通知公告附件")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:edit')")
@Log(title = "通知公告附件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsNoticeMessageFile ehsNoticeMessageFile)
{
return toAjax(ehsNoticeMessageFileService.updateById(ehsNoticeMessageFile));
}
/**
*
*/
@ApiOperation("删除通知公告附件")
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:remove')")
@Log(title = "通知公告附件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(ehsNoticeMessageFileService.removeByIds(Arrays.asList(ids)));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehsNoticeMessageFile:ehsNoticeMessageFile:listFile')")
@GetMapping("/listFile")
public TableDataInfo listFile(EhsNoticeMessageFile ehsNoticeMessageFile)
{
EhsNoticeMessage ehsNoticeMessage =ehsNoticeMessageService.getById(ehsNoticeMessageFile.getNoticeMessageId());
SysDept dept = new SysDept();
dept.setDeptIds(ehsNoticeMessage.getDeptList());
List<SysDept> depts = deptService.selectDeptList(dept);
Map<Long, String> comMap = new HashMap<Long, String>() ;
Long[] cidsTemp = new Long[depts.size()];
int j=0;
for(SysDept bas :depts){
comMap.put(bas.getDeptId(),bas.getDeptName());
cidsTemp[j]=bas.getDeptId();
j++;
}
List<EhsNoticeMessageFile> fileList = ehsNoticeMessageFileService.selectEhsNoticeMessageFileList(ehsNoticeMessageFile);
String cids=",";
for(EhsNoticeMessageFile efile:fileList){
cids= efile.getDeptId()+",";
}
//String[] cc = ehsNoticeMessageFile.getCompaynList().split(",");
for(int i=0;i<cidsTemp.length;i++){
if(cids.indexOf(cidsTemp[i].toString())==-1){
EhsNoticeMessageFile emFile = new EhsNoticeMessageFile();
emFile.setDeptName(comMap.get(cidsTemp[i]));
fileList.add(emFile);
}
}
return getDataTable(fileList);
}
}

@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath profile: /data/ehs-tanghe/server/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证 # 验证码类型 math 数字计算 char 字符验证
@ -18,7 +18,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8083 port: 8082
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -74,7 +74,7 @@ spring:
# 端口默认为6379 # 端口默认为6379
port: 16379 port: 16379
# 数据库索引 # 数据库索引
database: 0 database: 3
# 密码 # 密码
password: a8EYUSoT8wHbuRkX password: a8EYUSoT8wHbuRkX
# 连接超时时间 # 连接超时时间

@ -6,6 +6,8 @@ import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
@ -51,7 +53,18 @@ public class SysDept extends BaseEntity
/** 父部门名称 */ /** 父部门名称 */
private String parentName; private String parentName;
@TableField(exist = false)
private String deptIds;
public String getDeptIds() {
return deptIds;
}
public void setDeptIds(String deptIds) {
this.deptIds = deptIds;
}
/** 子部门 */ /** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();

@ -0,0 +1,89 @@
package com.ruoyi.ehsNoticeMessage.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_notice_message
*
* @author ruoyi
* @date 2023-12-06
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_notice_message")
public class EhsNoticeMessage extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type= IdType.AUTO)
private Long noticeMessageId;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 内容 */
@Excel(name = "内容")
private String displayContent;
/** 文件下载列表 */
@Excel(name = "文件下载列表")
private String fileName;
/** 1:未发布 2:已发布 */
@Excel(name = "0:未发布 1:已发布")
private String status;
/** 已阅读企业id */
@Excel(name = "已阅读企业id")
private String readDeptId;
/** 0临时任务1通知公告 */
@Excel(name = "0临时任务1通知公告")
private Long mesgType;
/** 需要接收消息的企业列表 */
@Excel(name = "需要接收消息的企业列表")
private String deptList;
/** 0不是全部1全部企业 */
@Excel(name = "0不是全部1全部企业")
private Integer allDept;
/** 创建的部门,主要区别二级监管 */
@Excel(name = "创建的部门,主要区别二级监管")
private Long createDeptId;
@Excel(name = "已上传数")
@TableField(exist = false)
private Integer fileCount;
@TableField(exist = false)
private String fileState;
@TableField(exist = false)
private Long fileDeptId;
@TableField(exist = false)
private Long isRead;
@TableField(exist = false)
private Long noticeMessageFileId;
@TableField(exist = false)
private String originalName;
@TableField(exist = false)
private String messageFileId;
}

@ -0,0 +1,32 @@
package com.ruoyi.ehsNoticeMessage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-06
*/
public interface EhsNoticeMessageMapper extends BaseMapper<EhsNoticeMessage> {
/**
*
*
* @param noticeMessageId
* @return
*/
public EhsNoticeMessage selectEhsNoticeMessageByNoticeMessageId(Long noticeMessageId);
/**
*
*
* @param ehsNoticeMessage
* @return
*/
public List<EhsNoticeMessage> selectEhsNoticeMessageList(EhsNoticeMessage ehsNoticeMessage);
public List<EhsNoticeMessage> selectEhsNoticeMessageListAdmin(EhsNoticeMessage ehsNoticeMessage);
public int updateReadCompany(EhsNoticeMessage ehsNoticeMessage);
}

@ -0,0 +1,34 @@
package com.ruoyi.ehsNoticeMessage.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
/**
* Service
*
* @author ruoyi
* @date 2023-12-06
*/
public interface IEhsNoticeMessageService extends IService<EhsNoticeMessage> {
/**
*
*
* @param noticeMessageId
* @return
*/
public EhsNoticeMessage selectEhsNoticeMessageByNoticeMessageId(Long noticeMessageId);
/**
*
*
* @param ehsNoticeMessage
* @return
*/
public List<EhsNoticeMessage> selectEhsNoticeMessageList(EhsNoticeMessage ehsNoticeMessage);
public List<EhsNoticeMessage> selectEhsNoticeMessageListAdmin(EhsNoticeMessage ehsNoticeMessage);
public int updateReadCompany(EhsNoticeMessage ehsNoticeMessage);
}

@ -0,0 +1,79 @@
package com.ruoyi.ehsNoticeMessage.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 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.ehsNoticeMessage.mapper.EhsNoticeMessageMapper;
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
import com.ruoyi.ehsNoticeMessage.service.IEhsNoticeMessageService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-06
*/
@Service
public class EhsNoticeMessageServiceImpl extends ServiceImpl<EhsNoticeMessageMapper, EhsNoticeMessage> implements IEhsNoticeMessageService {
@Autowired
private EhsNoticeMessageMapper ehsNoticeMessageMapper;
/**
*
*
* @param noticeMessageId
* @return
*/
@Override
public EhsNoticeMessage selectEhsNoticeMessageByNoticeMessageId(Long noticeMessageId)
{
return ehsNoticeMessageMapper.selectEhsNoticeMessageByNoticeMessageId(noticeMessageId);
}
/**
*
*
* @param ehsNoticeMessage
* @return
*/
@Override
public List<EhsNoticeMessage> selectEhsNoticeMessageList(EhsNoticeMessage ehsNoticeMessage)
{
return ehsNoticeMessageMapper.selectEhsNoticeMessageList(ehsNoticeMessage);
}
@Override
public List<EhsNoticeMessage> selectEhsNoticeMessageListAdmin(EhsNoticeMessage ehsNoticeMessage)
{
return ehsNoticeMessageMapper.selectEhsNoticeMessageListAdmin(ehsNoticeMessage);
}
@Override
public int updateReadCompany(EhsNoticeMessage ehsNoticeMessage)
{
return ehsNoticeMessageMapper.updateReadCompany(ehsNoticeMessage);
}
private LambdaQueryWrapper<EhsNoticeMessage> buildQueryWrapper(EhsNoticeMessage query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsNoticeMessage> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(query.getTitle()), EhsNoticeMessage::getTitle, query.getTitle());
lqw.eq(StringUtils.isNotBlank(query.getDisplayContent()), EhsNoticeMessage::getDisplayContent, query.getDisplayContent());
lqw.like(StringUtils.isNotBlank(query.getFileName()), EhsNoticeMessage::getFileName, query.getFileName());
lqw.eq(StringUtils.isNotBlank(query.getStatus()), EhsNoticeMessage::getStatus, query.getStatus());
lqw.eq(StringUtils.isNotBlank(query.getReadDeptId()), EhsNoticeMessage::getReadDeptId, query.getReadDeptId());
lqw.eq(query.getMesgType() != null, EhsNoticeMessage::getMesgType, query.getMesgType());
lqw.eq(StringUtils.isNotBlank(query.getDeptList()), EhsNoticeMessage::getDeptList, query.getDeptList());
lqw.eq(query.getAllDept() != null, EhsNoticeMessage::getAllDept, query.getAllDept());
lqw.orderByDesc(EhsNoticeMessage::getCreateTime);
lqw.eq(query.getDeptId() != null, EhsNoticeMessage::getDeptId, query.getDeptId());
lqw.eq(query.getCreateUserId() != null, EhsNoticeMessage::getCreateUserId, query.getCreateUserId());
lqw.eq(query.getUpdateUserId() != null, EhsNoticeMessage::getUpdateUserId, query.getUpdateUserId());
return lqw;
}
}

@ -0,0 +1,62 @@
package com.ruoyi.ehsNoticeMessageFile.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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_notice_message_file
*
* @author ruoyi
* @date 2023-12-07
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_notice_message_file")
public class EhsNoticeMessageFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type= IdType.AUTO)
private Long id;
/** 消息表主键 */
@Excel(name = "消息表主键")
private Long noticeMessageId;
/** 上传文件名,只能保存一个文件 */
@Excel(name = "上传文件名,只能保存一个文件")
private String fileName;
/** 0已上传未提交 1已提交同一个消息的状态应该是一致的 */
@Excel(name = "0已上传未提交 1已提交同一个消息的状态应该是一致的")
private Integer state;
/** 上传文件的原始文件名,多个文件需要多个记录 */
@Excel(name = "上传文件的原始文件名,多个文件需要多个记录")
private String originalName;
/** 附件大小 */
@Excel(name = "附件大小")
private String fileSize;
/** 提交时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date submitTime;
@TableField(exist = false)
private String deptIName;
}

@ -0,0 +1,29 @@
package com.ruoyi.ehsNoticeMessageFile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsNoticeMessageFile.domain.EhsNoticeMessageFile;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-07
*/
public interface EhsNoticeMessageFileMapper extends BaseMapper<EhsNoticeMessageFile> {
/**
*
*
* @param id
* @return
*/
public EhsNoticeMessageFile selectEhsNoticeMessageFileById(String id);
/**
*
*
* @param ehsNoticeMessageFile
* @return
*/
public List<EhsNoticeMessageFile> selectEhsNoticeMessageFileList(EhsNoticeMessageFile ehsNoticeMessageFile);
}

@ -0,0 +1,31 @@
package com.ruoyi.ehsNoticeMessageFile.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsNoticeMessageFile.domain.EhsNoticeMessageFile;
/**
* Service
*
* @author ruoyi
* @date 2023-12-07
*/
public interface IEhsNoticeMessageFileService extends IService<EhsNoticeMessageFile> {
/**
*
*
* @param id
* @return
*/
public EhsNoticeMessageFile selectEhsNoticeMessageFileById(String id);
/**
*
*
* @param ehsNoticeMessageFile
* @return
*/
public List<EhsNoticeMessageFile> selectEhsNoticeMessageFileList(EhsNoticeMessageFile ehsNoticeMessageFile);
}

@ -0,0 +1,67 @@
package com.ruoyi.ehsNoticeMessageFile.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 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.ehsNoticeMessageFile.mapper.EhsNoticeMessageFileMapper;
import com.ruoyi.ehsNoticeMessageFile.domain.EhsNoticeMessageFile;
import com.ruoyi.ehsNoticeMessageFile.service.IEhsNoticeMessageFileService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-07
*/
@Service
public class EhsNoticeMessageFileServiceImpl extends ServiceImpl<EhsNoticeMessageFileMapper, EhsNoticeMessageFile> implements IEhsNoticeMessageFileService {
@Autowired
private EhsNoticeMessageFileMapper ehsNoticeMessageFileMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsNoticeMessageFile selectEhsNoticeMessageFileById(String id)
{
return ehsNoticeMessageFileMapper.selectEhsNoticeMessageFileById(id);
}
/**
*
*
* @param ehsNoticeMessageFile
* @return
*/
@Override
public List<EhsNoticeMessageFile> selectEhsNoticeMessageFileList(EhsNoticeMessageFile ehsNoticeMessageFile)
{
return ehsNoticeMessageFileMapper.selectEhsNoticeMessageFileList(ehsNoticeMessageFile);
}
private LambdaQueryWrapper<EhsNoticeMessageFile> buildQueryWrapper(EhsNoticeMessageFile query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsNoticeMessageFile> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(query.getFileName()), EhsNoticeMessageFile::getFileName, query.getFileName());
lqw.eq(query.getState() != null, EhsNoticeMessageFile::getState, query.getState());
lqw.like(StringUtils.isNotBlank(query.getOriginalName()), EhsNoticeMessageFile::getOriginalName, query.getOriginalName());
lqw.eq(StringUtils.isNotBlank(query.getFileSize()), EhsNoticeMessageFile::getFileSize, query.getFileSize());
lqw.eq(query.getSubmitTime() != null, EhsNoticeMessageFile::getSubmitTime, query.getSubmitTime());
lqw.orderByDesc(EhsNoticeMessageFile::getCreateTime);
lqw.eq(query.getDeptId() != null, EhsNoticeMessageFile::getDeptId, query.getDeptId());
lqw.eq(query.getCreateUserId() != null, EhsNoticeMessageFile::getCreateUserId, query.getCreateUserId());
lqw.eq(query.getUpdateUserId() != null, EhsNoticeMessageFile::getUpdateUserId, query.getUpdateUserId());
return lqw;
}
}

@ -0,0 +1,52 @@
<?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.ehsNoticeMessageFile.mapper.EhsNoticeMessageFileMapper">
<resultMap type="EhsNoticeMessageFile" id="EhsNoticeMessageFileResult">
<result property="id" column="id" />
<result property="noticeMessageId" column="notice_message_id" />
<result property="fileName" column="file_name" />
<result property="state" column="state" />
<result property="originalName" column="original_name" />
<result property="fileSize" column="file_size" />
<result property="submitTime" column="submit_time" />
<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" />
</resultMap>
<sql id="selectEhsNoticeMessageFileVo">
select id, notice_message_id, file_name, state, original_name, file_size, submit_time, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_notice_message_file
</sql>
<select id="selectEhsNoticeMessageFileList" parameterType="EhsNoticeMessageFile" resultMap="EhsNoticeMessageFileResult">
<include refid="selectEhsNoticeMessageFileVo"/>
<where>
<if test="noticeMessageId != null and noticeMessageId != ''"> and notice_message_id = #{noticeMessageId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="state != null "> and state = #{state}</if>
<if test="originalName != null and originalName != ''"> and original_name like concat('%', #{originalName}, '%')</if>
<if test="fileSize != null and fileSize != ''"> and file_size = #{fileSize}</if>
<if test="submitTime != null "> and submit_time = #{submitTime}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
<if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
</where>
</select>
<select id="selectEhsNoticeMessageFileById" parameterType="String" resultMap="EhsNoticeMessageFileResult">
<include refid="selectEhsNoticeMessageFileVo"/>
where id = #{id}
</select>
</mapper>

@ -0,0 +1,97 @@
<?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.ehsNoticeMessage.mapper.EhsNoticeMessageMapper">
<resultMap type="EhsNoticeMessage" id="EhsNoticeMessageResult">
<result property="noticeMessageId" column="notice_message_id" />
<result property="title" column="title" />
<result property="displayContent" column="display_content" />
<result property="fileName" column="file_name" />
<result property="status" column="status" />
<result property="readDeptId" column="read_dept_id" />
<result property="mesgType" column="mesg_type" />
<result property="deptList" column="dept_list" />
<result property="allDept" column="all_dept" />
<result property="createDeptId" column="create_dept_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="fileCount" column="file_count" />
<result property="fileState" column="file_state" />
<result property="fileDeptId" column="file_dept_id" />
<result property="isRead" column="is_read" />
<result property="messageFileId" column="message_file_id" />
<result property="originalName" column="original_name" />
<result property="noticeMessageFileId" column="notice_message_fele_id" />
</resultMap>
<sql id="selectEhsNoticeMessageVo">
select notice_message_id, title, display_content, file_name, status, read_dept_id, mesg_type, dept_list, all_dept, create_dept_id, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_notice_message
</sql>
<select id="selectEhsNoticeMessageList" parameterType="EhsNoticeMessage" resultMap="EhsNoticeMessageResult">
select m.notice_message_id, m.create_user_id, m.create_time, m.dept_id,m.title, m.display_content, m.status,d.dept_name dept_name
,FIND_IN_SET(#{deptId}, m.read_dept_id ) is_read,m.mesg_type,m.read_dept_id,m.all_dept,
(select f.id from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId} ) AS message_file_id,
(select f.file_name from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId}) file_name,
IFNULL((select IFNULL(f.state,0) from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId}),0) file_state,
(select f.original_name from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId}) original_name,
(select f.file_size from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId}) file_size,
(select f.dept_id from ehs_notice_message_file f where m.notice_message_id = f.notice_message_id and f.dept_ID =#{fileDeptId}) file_dept_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>
<if test="title != null and title != '' "> and m.title like '%${title}%'</if>
<if test="displayContent != null and displayContent != '' "> and m.display_content = #{displayContent}</if>
<!--<if test="createUserName != null and createUserName != '' "> and e.name like '%${createUserName}%'</if>-->
<if test="status != null and status != '' "> and m.status = #{status}</if>
<if test="deptId != null and deptId != '' "> and (FIND_IN_SET(#{deptId}, m.dept_list) or m.all_dept=1) </if>
<if test="mesgType != null and mesgType != '' "> and m.mesg_type = #{mesgType}</if>
<if test='isRead =="0" '> and FIND_IN_SET(#{deptId}, m.read_dept_id )=0</if>
<if test="fileState != null and fileState != '' "> and f.state = #{fileState}</if>
<if test="noticeMessageId != null and noticeMessageId != '' "> and f.id = #{noticeMessageId}</if>
</where>
</select>
<select id="selectEhsNoticeMessageListAdmin" parameterType="EhsNoticeMessage" resultMap="EhsNoticeMessageResult">
SELECT m.notice_message_id, m.create_user_id, m.create_time, m.dept_id,
m.title, m.display_content, m.STATUS, m.dept_list, GROUP_CONCAT( ft.dept_name SEPARATOR ';' ) dept_name,
m.mesg_type, m.read_dept_id, m.all_dept,
( SELECT count( 1 ) FROM ehs_notice_message_file f WHERE f.notice_message_id = m.notice_message_id ) file_count
FROM ehs_notice_message m
LEFT JOIN sys_user e ON e.user_id = m.CREATE_USER_ID
LEFT JOIN sys_dept ft ON FIND_IN_SET( ft.DEPT_ID, m.dept_list )
<where>
<if test="title != null and title != '' "> and m.title like '%${title}%'</if>
<if test="displayContent != null and displayContent != '' "> and m.display_content = #{displayContent}</if>
<!--<if test="createUserName != null and createUserName != '' "> and e.name like '%${createUserName}%'</if>-->
<if test="status != null and status != '' "> and m.status = #{status}</if>
<if test="deptList != null and companyId != '' "> and FIND_IN_SET(#{deptList}, m.dept_list) </if>
<if test="mesgType != null and mesgType != '' "> and m.mesg_type = #{mesgType}</if>
<if test="createDeptId != null and createDeptId != '' "> and m.create_dept_id = #{createDeptId} </if>
</where>
GROUP BY m.create_time desc
</select>
<select id="selectEhsNoticeMessageByNoticeMessageId" parameterType="Long" resultMap="EhsNoticeMessageResult">
<include refid="selectEhsNoticeMessageVo"/>
where notice_message_id = #{noticeMessageId}
</select>
<update id="updateReadCompany" parameterType="EhsNoticeMessage">
update ehs_notice_message
<trim prefix="SET" suffixOverrides=",">
<if test="readDeptId != null and readDeptId != '' ">read_Dept_id =CONCAT(read_Dept_id,#{readDeptId}) </if>
</trim>
where notice_message_id = #{noticeMessageId}
</update>
</mapper>

@ -42,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="deptIds != null and deptIds != ''">
and dept_id in ( ${deptIds} )
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
@ -60,6 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllDeptList" parameterType="SysDept" resultMap="SysDeptResult"> <select id="selectAllDeptList" parameterType="SysDept" resultMap="SysDeptResult">
select d.dept_id,d.dept_name select d.dept_id,d.dept_name
from sys_dept d from sys_dept d
<if test="parentId == 0">
where parent_id!=0
</if>
order by d.order_num order by d.order_num
</select> </select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">

@ -5,4 +5,4 @@ VUE_APP_TITLE = 唐河县安全隐患及应急救援管理平台
ENV = 'production' ENV = 'production'
# 若依管理系统/生产环境 # 若依管理系统/生产环境
VUE_APP_BASE_API = '/prod-api' VUE_APP_BASE_API = '/ehs'

@ -8,7 +8,7 @@ git clone https://gitee.com/y_project/RuoYi-Vue
cd ruoyi-ui cd ruoyi-ui
# 安装依赖 # 安装依赖
npm install n
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 # 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npmmirror.com npm install --registry=https://registry.npmmirror.com

@ -0,0 +1,65 @@
import request from '@/utils/request'
// 查询内部公告列表
export function listEhsNoticeMessage(query) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/list',
method: 'get',
params: query
})
}
export function listEhsNoticeMessageAdmin(query) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/listAdmin',
method: 'get',
params: query
})
}
// 查询内部公告详细
export function getEhsNoticeMessage(noticeMessageId) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/' + noticeMessageId,
method: 'get'
})
}
// 新增内部公告
export function addEhsNoticeMessage(data) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage',
method: 'post',
data: data
})
}
// 修改内部公告
export function updateEhsNoticeMessage(data) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage',
method: 'put',
data: data
})
}
// 删除内部公告
export function delEhsNoticeMessage(noticeMessageId) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/' + noticeMessageId,
method: 'delete'
})
}
//发布
export function issueNews(query) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/issueNews',
method: 'get',
params: query
})
}
// 阅读
export function detailEhsNoticeMessage(noticeMessageId) {
return request({
url: '/ehsNoticeMessage/ehsNoticeMessage/detail/' + noticeMessageId,
method: 'get'
})
}

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询通知公告附件列表
export function listEhsNoticeMessageFile(query) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile/list',
method: 'get',
params: query
})
}
// 查询通知公告附件详细
export function getEhsNoticeMessageFile(id) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile/' + id,
method: 'get'
})
}
// 新增通知公告附件
export function addEhsNoticeMessageFile(data) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile',
method: 'post',
data: data
})
}
// 修改通知公告附件
export function updateEhsNoticeMessageFile(data) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile',
method: 'put',
data: data
})
}
// 删除通知公告附件
export function delEhsNoticeMessageFile(id) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile/' + id,
method: 'delete'
})
}
// 文件上传列表
export function listFileEhsNoticeMessageFile(query) {
return request({
url: '/ehsNoticeMessageFile/ehsNoticeMessageFile/listFile',
method: 'get',
params: query
})
}

@ -58,3 +58,11 @@ export function listAllDept() {
method: 'get' method: 'get'
}) })
} }
//查询二级部门数据的id和name
export function listAllDept2() {
return request({
url: '/system/dept/getAllDeptList',
method: 'get',
params: {"parentId":0}
})
}

@ -0,0 +1,216 @@
<template>
<div class="upload-file">
<el-upload
multiple
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:show-file-list="false"
:headers="headers"
class="upload-file-uploader"
ref="fileUpload"
>
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
的文件
</div>
</el-upload>
<!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
name: "FileUpload",
props: {
//
value: [String, Object, Array],
//
limit: {
type: Number,
default: 5,
},
// (MB)
fileSize: {
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
//
isShowTip: {
type: Boolean,
default: true
}
},
data() {
return {
number: 0,
uploadList: [],
baseUrl: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
};
},
watch: {
value: {
handler(val) {
if (val) {
let temp = 1;
//
const list = Array.isArray(val) ? val : this.value.split(',');
//
this.fileList = list.map(item => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
deep: true,
immediate: true
}
},
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
//
handleBeforeUpload(file) {
//
if (this.fileType) {
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
if (!isTypeOk) {
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
}
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
this.$modal.loading("正在上传文件,请稍候...");
this.number++;
return true;
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
},
//
handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试");
this.$modal.closeLoading();
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName });
this.uploadedSuccessfully();
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.fileUpload.handleRemove(file);
this.uploadedSuccessfully();
}
},
//
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
}
},
//
getFileName(name) {
// url
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1);
} else {
return name;
}
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].url + separator;
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
}
}
};
</script>
<style scoped lang="scss">
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
</style>

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="部门" prop="deptId" v-show="deptShow"> <el-form-item label="部门" prop="deptId" v-show="deptShow">
<el-select v-model="queryParams.deptId" placeholder="请选择部门" clearable> <el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable>
<el-option <el-option
v-for="dict in allDeptList" v-for="dict in allDeptList"
:key="dict.deptId" :key="dict.deptId"

@ -0,0 +1,391 @@
<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="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否发布" prop="status" >
<el-select v-model="queryParams.deptId" placeholder="请选择状态" clearable>
<el-option
v-for="dict in statusList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ehsNoticeMessageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="noticeMessageId" />-->
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="内容" align="center" prop="displayContent" >
<template slot-scope="scope">
<span v-html="scope.row.displayContent"> </span>
</template>
</el-table-column>
<el-table-column label="部门列表" align="center" prop="deptName" style="white-space: pre-wrap;">
<template slot-scope="scope">
<span v-html='scope.row.allDept==1 ?"": scope.row.deptName.replace(/;/g ,"<br>")'> </span>
</template>
</el-table-column>
<el-table-column label="发布状态" align="center" prop="status" >
<template slot-scope="scope">
<span> {{ statusList[scope.row.status].label}}</span>
</template>
</el-table-column>
<el-table-column label="已阅读企业数" align="center" prop="readDeptId" >
<template slot-scope="scope">
<span> {{scope.row.readDeptId==""?"0":scope.row.readDeptId.split(",").length-1}}</span>
</template>
</el-table-column>
<el-table-column label="已上传数量" align="center" prop="fileCount" />
<!--<el-table-column label="0不是全部1全部企业" align="center" prop="allDept" />-->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-show="scope.row.status==0"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:edit']"
>修改</el-button>
<el-button v-show="scope.row.status==0"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:remove']"
>删除</el-button>
<el-button v-show="scope.row.status==0"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleIssueNews(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:issueNews']"
>发布</el-button>
<el-button v-show="scope.row.status==1"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleListFile(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:total']"
>统计</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="title">
<el-input v-model="form.title" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="部门" prop="deptList">
<el-checkbox v-model="allDeptCheck" @change="allDeptChange"></el-checkbox>
<el-select v-model="form.deptList" multiple collapse-tags v-if = "deptShow"
style="margin-left: 20px;" placeholder="请选择">
<el-option
v-for="dict in allDeptList"
:key="dict.deptId"
:label="dict.deptName"
:value="dict.deptId"
/>
</el-select>
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.displayContent" :min-height="192"/>
</el-form-item>
<!-- <el-form-item label="文件下载列表" prop="fileName">
<file-upload v-model="form.fileName" fileType=""/>
</el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" 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>
<!-- 上报企业统计 -->
<el-dialog :title="title" :visible.sync="openFile" width="500px" append-to-body>
<el-table v-loading="loading" :data="ehsNoticeMessageFileList" @selection-change="handleSelectionChange">
<el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="上报情况" align="center" prop="originalName" >
<template slot-scope="scope">
<span> {{scope.row.originalName==null?"未上报":scope.row.originalName}}</span>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { listEhsNoticeMessageAdmin,listEhsNoticeMessage, getEhsNoticeMessage, delEhsNoticeMessage, addEhsNoticeMessage,
updateEhsNoticeMessage,issueNews } from "@/api/ehs/ehsNoticeMessage";
import {listAllDept2 } from "@/api/system/dept";
import {listFileEhsNoticeMessageFile } from "@/api/ehs/ehsNoticeMessageFile";
export default {
name: "EhsNoticeMessage",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
totalFileList: 0,//
//
ehsNoticeMessageList: [],
//
title: "",
openFile:false,//
ehsNoticeMessageFileList:[],//
//
open: false,
//
isIssue:false,
//
deptShow:true,
//
allDeptCheck:false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
displayContent: null,
fileName: null,
status: null,
readDeptId: null,
mesgType: null,
deptList: null,
allDept: null,
createDeptId: null,
deptId: null,
createUserId: null,
updateUserId: null
},
statusList: [{
value: '0',
label: '未发布',
}, {
value: '1',
label: '已发布'
}],
//
allDeptList: [],
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getListAllDept();
},
methods: {
/** 查询内部公告列表 */
getList() {
this.loading = true;
listEhsNoticeMessageAdmin(this.queryParams).then(response => {
this.ehsNoticeMessageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 单位信息列表 */
getListAllDept() {
console.log(this.$store.state.user.deptId);
this.loading = true;
listAllDept2().then(response => {
this.allDeptList = response.data;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
noticeMessageId: null,
title: null,
displayContent: null,
fileName: null,
status: null,
readDeptId: null,
mesgType: null,
deptList: null,
allDept: null,
createDeptId: 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.noticeMessageId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加内部公告";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const noticeMessageId = row.noticeMessageId || this.ids
getEhsNoticeMessage(noticeMessageId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改内部公告";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
let ad = this.allDeptCheck ==true ? 1:0;
this.form.allDept = ad;
if(this.form.allDept==0)
this.form.deptList = this.form.deptList.join();
else
this.form.deptList = "";
if (this.form.noticeMessageId != null) {
updateEhsNoticeMessage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsNoticeMessage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const noticeMessageIds = row.noticeMessageId || this.ids;
this.$modal.confirm('是否确认删除内部公告编号为"' + noticeMessageIds + '"的数据项?').then(function() {
return delEhsNoticeMessage(noticeMessageIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehsNoticeMessage/ehsNoticeMessage/export', {
...this.queryParams
}, `ehsNoticeMessage_${new Date().getTime()}.xlsx`)
},
/** 发布 */
handleIssueNews(row) {
this.$modal.confirm('是否确认发布此通知?').then(function() {
return issueNews({"noticeMessageId":row.noticeMessageId});
}).then(() => {
this.getList();
this.$modal.msgSuccess("发布成功");
}).catch(() => {});
},
allDeptChange(selection) {
this.form.deptList = [];
console.log(selection);
this.deptShow =(!selection)
this.allDeptCheck = selection;
},
handleListFile(row) {
this.loading = true;
this.openFile = true;
listFileEhsNoticeMessageFile({"noticeMessageId":row.noticeMessageId}).then(response => {
this.ehsNoticeMessageFileList = response.rows;
this.totalFileList = response.total;
this.loading = false;
})
}
}
};
</script>

@ -0,0 +1,456 @@
<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="title">
<el-input
v-model="queryParams.title"
placeholder="请输入标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否发布" prop="status" >
<el-select v-model="queryParams.deptId" placeholder="请选择状态" clearable>
<el-option
v-for="dict in statusList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage: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="['ehsNoticeMessage:ehsNoticeMessage: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="['ehsNoticeMessage:ehsNoticeMessage: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="['ehsNoticeMessage:ehsNoticeMessage:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ehsNoticeMessageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="noticeMessageId" />-->
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="提交状态" align="center" prop="status" >
<template slot-scope="scope">
<span> {{ statusList[scope.row.fileState].label }}</span>
</template>
</el-table-column>
<el-table-column label="是否阅读" align="center" prop="isRead" >
<template slot-scope="scope">
<span> {{ scope.row.isRead==0?"未阅读":"已阅读"}}</span>
</template>
</el-table-column>
<el-table-column label="通知时间" align="center" prop="createTime" />
<el-table-column label="文件名" align="center" prop="originalName" />
<!--<el-table-column label="0不是全部1全部企业" align="center" prop="allDept" />-->
<el-table-column label="备注" align="center" prop="remark" />
<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)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:detail']"
>阅读</el-button>
<el-button v-show="scope.row.fileState==0 && scope.row.messageFileId==null"
size="mini"
type="text"
icon="el-icon-edit"
@click="handlefileUpload(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:uploadFile']"
>上传附件</el-button>
<el-button v-show="scope.row.fileState==0 && scope.row.messageFileId!=null"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDeleteFile(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:deleteFile']"
>删除附件</el-button>
<el-button v-show="scope.row.fileState!=1 && scope.row.messageFileId!=null"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleSubmitFile(scope.row)"
v-hasPermi="['ehsNoticeMessage:ehsNoticeMessage:submitFile']"
>提交监管平台</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="title">
<el-input v-model="form.title" placeholder="请输入标题" />
</el-form-item>
<!-- <el-form-item label="内容">
<editor v-model="form.displayContent" :min-height="192"/>
</el-form-item>-->
<el-form-item label="部门" prop="deptList">
<el-checkbox v-model="form.allDept"></el-checkbox>
<el-select v-model="form.deptList" multiple collapse-tags
style="margin-left: 20px;" placeholder="请选择">
<el-option
v-for="dict in allDeptList"
:key="dict.deptId"
:label="dict.deptName"
:value="dict.deptId"
/>
</el-select>
</el-form-item>
<el-form-item label="文件下载列表" prop="fileName">
<file-upload v-model="form.fileName" fileType=""/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" 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>
<el-dialog :title="title" :visible.sync="openDetail" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
{{form.title}}
</el-form-item>
<el-form-item label="内容">
{{form.displayContent}}
</el-form-item>
<el-form-item label="备注" prop="remark">
{{form.remark}}
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelDetail"> </el-button>
</div>
</el-dialog>
<!-- 文件上传 -->
<el-dialog title="文件上传" :visible.sync="openFile" width="500px" append-to-body>
<file-upload v-model="form.fileName" fileType=""/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="fileSave"> </el-button>
<el-button @click="cancelFile"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listEhsNoticeMessageAdmin,listEhsNoticeMessage, getEhsNoticeMessage, delEhsNoticeMessage, addEhsNoticeMessage,
updateEhsNoticeMessage,issueNews,detailEhsNoticeMessage } from "@/api/ehs/ehsNoticeMessage";
import {listAllDept2 } from "@/api/system/dept";
import {delEhsNoticeMessageFile,addEhsNoticeMessageFile,updateEhsNoticeMessageFile } from "@/api/ehs/ehsNoticeMessageFile";
export default {
name: "EhsNoticeMessage",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ehsNoticeMessageList: [],
//
title: "",
//
open: false,
//
isIssue:false,
//
openDetail:false,
//
openFile:false,
//id
curNoticeMessageId:"",
//
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
displayContent: null,
fileName: null,
status: null,
readDeptId: null,
mesgType: null,
deptList: null,
allDept: null,
createDeptId: null,
deptId: null,
createUserId: null,
updateUserId: null
},
statusList: [{
value: '0',
label: '未提交',
}, {
value: '1',
label: '已提交'
}],
//
allDeptList: [],
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getListAllDept();
},
methods: {
/** 查询内部公告列表 */
getList() {
this.loading = true;
listEhsNoticeMessage(this.queryParams).then(response => {
this.ehsNoticeMessageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 单位信息列表 */
getListAllDept() {
console.log(this.$store.state.user.deptId);
this.loading = true;
listAllDept2().then(response => {
this.allDeptList = response.data;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
cancelDetail() {
this.openDetail = false;
},
cancelFile() {
this.openFile = false;
},
//
reset() {
this.form = {
noticeMessageId: null,
title: null,
displayContent: null,
fileName: null,
status: null,
readDeptId: null,
mesgType: null,
deptList: null,
allDept: null,
createDeptId: 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.noticeMessageId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加内部公告";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const noticeMessageId = row.noticeMessageId || this.ids
getEhsNoticeMessage(noticeMessageId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改内部公告";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.noticeMessageId != null) {
updateEhsNoticeMessage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsNoticeMessage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const noticeMessageIds = row.noticeMessageId || this.ids;
this.$modal.confirm('是否确认删除内部公告编号为"' + noticeMessageIds + '"的数据项?').then(function() {
return delEhsNoticeMessage(noticeMessageIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehsNoticeMessage/ehsNoticeMessage/export', {
...this.queryParams
}, `ehsNoticeMessage_${new Date().getTime()}.xlsx`)
},
/** 发布 */
handleDelete(row) {
this.$modal.confirm('是否确认发布此通知?').then(function() {
return issueNews({"noticeMessageId":row.noticeMessageId});
}).then(() => {
this.getList();
this.$modal.msgSuccess("发布成功");
}).catch(() => {});
},
/** 阅读 */
handleDetail(row) {
detailEhsNoticeMessage(row.noticeMessageId).then(response => {
this.form = response.data;
this.openDetail = true;
this.title = "阅读消息通知";
this.getList();
});
},
/** 提交 */
handleSubmitFile(row) {
this.$modal.confirm('是否确认提交?').then(function() {
console.log()
return updateEhsNoticeMessageFile({"id":row.messageFileId,"state":1});
}).then(() => {
this.getList();
this.$modal.msgSuccess("提交成功");
}).catch(() => {});
},
handlefileUpload(row) {
this.openFile = true;
this.curNoticeMessageId = row.noticeMessageId
},
/** 删除文件按钮操作 */
handleDeleteFile(row) {
this.$modal.confirm('是否确认删除文件?').then(function() {
return delEhsNoticeMessageFile(row.messageFileId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
fileSave(row){
console.log(this.form.fileName)
// /profile/upload/2023/12/07/DCS_20231207142444A003.png,/profile/upload/2023/12/07/d138c31525828b6641a65f518fd9756_20231207142444A004.jpg
let fileTemp = this.form.fileName.split(",");
let oFile = [];
for(let i=0;i<fileTemp.length ;i++){
let f = fileTemp[i].split("/");
let f1 = f[f.length-1].split("_")[0];
let f2 = f[f.length-1].split(".")[1];
oFile.push(f1+f2);
}
let fileInfo = {};
fileInfo.noticeMessageId = this.curNoticeMessageId ;
fileInfo.originalName = oFile.join(",");
fileInfo.fileName = this.form.fileName;
addEhsNoticeMessageFile(fileInfo).then(response => {
this.$modal.msgSuccess("上传文件成功");
this.openFile = false;
this.getList();
});
},
}
};
</script>

@ -35,7 +35,8 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8083`, target: `http://127.0.0.1:8082`,
//target: `http://221.176.140.236`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save