累计跟新

main
liukewei 10 months ago
parent 8b5c2a4412
commit 274ee08d6b

@ -179,7 +179,10 @@ public class EhsHiddenDangerController extends BaseController
{
//获取临期或超时的隐患id比较本人的最后一条如果不一样就插入一条如果一样就不插入新插入的是未读
//如果点检首页弹窗的连接,就设置为已读,并转跳的隐患页面,并查询出所有临期或超时的隐患
EhsHiddenDanger ehsHiddenDanger = ehsHiddenDangerService.selectOverTimeId(new EhsHiddenDanger());
EhsHiddenDanger hdQuery = new EhsHiddenDanger();
hdQuery.setDeptId(SecurityUtils.getDeptId());
hdQuery.setOverTime(10);
EhsHiddenDanger ehsHiddenDanger = ehsHiddenDangerService.selectOverTimeId(hdQuery);
EhsMyMessage ehsMyMessage = new EhsMyMessage();
ehsMyMessage.setMyMessageType("0");
ehsMyMessage.setMyUserId(SecurityUtils.getUserId());
@ -202,20 +205,16 @@ public class EhsHiddenDangerController extends BaseController
}
}
}else{//两者一致
if(msg.getMyMessageState().equals("N")) {
return success(msg);
}else{
msg.setMyMessageDesc("");
return success(msg);
}
}
}
}
if (isNew) {//有新的id生成一个新记录
EhsMyMessage msgNew = new EhsMyMessage();
msgNew.setMyUserId(SecurityUtils.getUserId());
msgNew.setMyMessageType("0");
msgNew.setMyMessageDesc("您有新的将要逾期或已逾期的记录,请及及时处理");
msgNew.setMyMessageDesc("您有新的将要逾期或已逾期的记录");
msgNew.setMyMessageKey(ehsHiddenDanger.getOverTimeId());
msgNew.setMyMessageState("N");
ehsMyMessageService.save(msgNew);

@ -4,9 +4,18 @@ import java.util.List;
import java.util.Arrays;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger;
import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import com.ruoyi.ehsMaterial.service.IEhsMaterialService;
import com.ruoyi.ehsNoticeMessage.domain.EhsNoticeMessage;
import com.ruoyi.ehsNoticeMessage.service.IEhsNoticeMessageService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -43,6 +52,10 @@ public class EhsMyMessageController extends BaseController
private IEhsMyMessageService ehsMyMessageService;
@Autowired
private IEhsNoticeMessageService ehsNoticeMessageService;
@Autowired
private IEhsMaterialService ehsMaterialService;
@Autowired
private ISysDictDataService dictDataService;
/**
*
*/
@ -113,23 +126,34 @@ public class EhsMyMessageController extends BaseController
{
return toAjax(ehsMyMessageService.removeByIds(Arrays.asList(myMessageIds)));
}
/**
*
* @return
*/
@GetMapping("/getUnread")
public AjaxResult getUnread()
{
AjaxResult ajr = new AjaxResult();
//判断角色,只有局端和乡镇隐患管理员角色才计算
if(SecurityUtils.hasRole("HDDept") ||SecurityUtils.hasRole("HDAdmin")) {
EhsMyMessage ehsMyMessage = new EhsMyMessage();
ehsMyMessage.setMyMessageType("0");
ehsMyMessage.setMyUserId(SecurityUtils.getUserId());
EhsMyMessage msg = ehsMyMessageService.selectEhsMyMessageByMyMessageMax(ehsMyMessage);
if(msg == null){
ajr.put("msgHD","0");
}else{
if(msg.getMyMessageState().equals("N"))
ajr.put("msgHD","1");
if (msg == null) {
ajr.put("msgHD", "0");
} else {
int mCount = (msg.getMyMessageKey().split(",")).length;
ajr.put("msgHD", mCount);
/*if (msg.getMyMessageState().equals("N"))
ajr.put("msgHD", "1");
else
ajr.put("msgHD","0");
ajr.put("msgHD", "0");*/
}
}else{
ajr.put("msgHD", "0");
}
//分析是否有本人的未读消息通知
//消息通知的每一记录,我的消息都应该有一条记录,如果没有,说明未读,并向我的消息插入一条记录,并设置为未读
//消息通知模块点击阅读按钮后,需要同时修改我的消息的已读标志
@ -137,7 +161,7 @@ public class EhsMyMessageController extends BaseController
EhsMyMessage myMsg = new EhsMyMessage();
myMsg.setNoticeDeptId(SecurityUtils.getDeptId());
myMsg.setNoticeStatus("1");
myMsg.setNoticeMesgType(1L);
myMsg.setNoticeMesgType(0L);
myMsg.setMyMessageType("1");
myMsg.setMyUserId(SecurityUtils.getUserId());
List<EhsMyMessage> list = ehsMyMessageService.selectUnReadNotice(myMsg);
@ -154,6 +178,149 @@ public class EhsMyMessageController extends BaseController
msgQuery.setMyUserId(SecurityUtils.getUserId());
Long msgCount = ehsMyMessageService.msgCount(msgQuery);
ajr.put("msg",msgCount.toString());
///////////////////////// 物资消息
if(SecurityUtils.hasRole("store") ) {
for (int i = 1; i <= 4; i++) {
EhsMyMessage myMMsg = buildMaterialMsg(Long.parseLong(String.valueOf(i)));
int mCount = 0;
if (myMMsg != null && StringUtils.isNotEmpty(myMMsg.getMyMessageKey())) {
mCount = (myMMsg.getMyMessageKey().split(",")).length;
}
switch (i) {
case 1:
ajr.put("msgMaterial1", mCount);
break;
case 2:
ajr.put("msgMaterial2", mCount);
break;
case 3:
ajr.put("msgMaterial3", mCount);
break;
case 4:
ajr.put("msgMaterial4", mCount);
break;
}
}
}
return ajr;
}
@GetMapping("/setReadByHD")
public AjaxResult setReadByHD()
{
EhsMyMessage msgQuery = new EhsMyMessage();
msgQuery.setMyMessageState("Y");
msgQuery.setMyUserId(SecurityUtils.getUserId());
return toAjax(ehsMyMessageService.updateHDbyKeyUserId(msgQuery));
}
/**
*
* @return
*/
@GetMapping("/getSendQuantity/{classFirst}")
public AjaxResult getSendQuantity(@PathVariable Long classFirst)
{
return success(buildMaterialMsg(classFirst));
}
private EhsMyMessage buildMaterialMsg(Long classFirst){
EhsMaterial ehsMaterial = new EhsMaterial();
if(classFirst!=0)
ehsMaterial.setClassFirst(classFirst);
String myMsgType ="m"+classFirst.toString();
ehsMaterial.setIsSendQuantity(1);
List<EhsMaterial> list = ehsMaterialService.selectEhsMaterialList(ehsMaterial);
String[] MaterialIds = list.stream().map(item -> item.getMaterialId().toString()).toArray(String[]::new);
String strmIds = StringUtils.join(MaterialIds,",");
EhsMyMessage ehsMyMessage = new EhsMyMessage();
ehsMyMessage.setMyMessageType(myMsgType);
ehsMyMessage.setMyUserId(SecurityUtils.getUserId());
EhsMyMessage msg = ehsMyMessageService.selectEhsMyMessageByMyMessageMax(ehsMyMessage);
boolean isNew =false;
if(msg==null ){
if(StringUtils.isNotEmpty(strmIds))
isNew = true;
else
isNew = false;
}else{
if(StringUtils.isNotEmpty(strmIds)) {
if(!strmIds.equals(msg.getMyMessageKey())) {//两者不一致
String[] newIds = strmIds.split(",");
String oldIds = "," + msg.getMyMessageKey() + ",";
for (String id : newIds) {
if (oldIds.indexOf("," + id + ",") == -1) {//不包含表示有新的id
isNew = true;
break;
}
}
}else{//两者一致
msg.setMyMessageDesc("");
return msg;
}
}
}
if (isNew) {//有新的id生成一个新记录
EhsMyMessage msgNew = new EhsMyMessage();
msgNew.setMyUserId(SecurityUtils.getUserId());
msgNew.setMyMessageType(myMsgType);
String strMaterial = DictUtils.getDictLabel("material_class_fast",classFirst.toString());
msgNew.setMyMessageDesc(strMaterial+"有" +list.size()+"条待处理出库!");
msgNew.setMyMessageKey(strmIds);
msgNew.setMyMessageState("N");
ehsMyMessageService.save(msgNew);
return msgNew;
}
ehsMyMessage.setMyMessageDesc("");
return ehsMyMessage;
}
@GetMapping("/setMaterial/{myMessageId}")
public AjaxResult setMaterial(@PathVariable Long myMessageId)
{
EhsMyMessage msgQuery = new EhsMyMessage();
msgQuery.setMyMessageState("Y");
msgQuery.setMyMessageId(myMessageId);
return toAjax(ehsMyMessageService.updateById(msgQuery));
}
/**
*
* @return
*/
@GetMapping("/getNoticeMsg")
public AjaxResult getNoticeMsg(){
EhsMyMessage myMsg = new EhsMyMessage();
myMsg.setNoticeDeptId(SecurityUtils.getDeptId());
myMsg.setNoticeStatus("1");
myMsg.setNoticeMesgType(0L);
myMsg.setMyMessageType("1");
myMsg.setMyUserId(SecurityUtils.getUserId());
List<EhsMyMessage> list = ehsMyMessageService.selectUnReadNotice(myMsg);
Long[] ids =null;
EhsMyMessage returnMymsg = new EhsMyMessage();
if(!list.isEmpty()){//表示有新增的消息通知
for(EhsMyMessage emsg :list){
EhsMyMessage msgNew = new EhsMyMessage();
msgNew.setMyMessageKey(emsg.getMyMessageId().toString());
ehsMyMessageService.saveMyMessage(msgNew);
}
ids = list.stream().map(item->item.getMyMessageId()).toArray(Long[]::new);
returnMymsg.setMyMessageDesc("您有"+ids.length+"条新的消息通知未阅读!");
}else{//没有新增的消息通知,
returnMymsg.setMyMessageDesc("");
}
//计算全部未阅读的消息
EhsMyMessage msgQuery = new EhsMyMessage();
msgQuery.setMyMessageType("1");
msgQuery.setMyMessageState("N");
msgQuery.setMyUserId(SecurityUtils.getUserId());
Long msgCount = ehsMyMessageService.msgCount(msgQuery);
ids = new Long[Integer.parseInt(msgCount.toString())];
//需要根据现有未阅读消息通知数量生成一个数组,返回前端,以便前端根据这个数组计算未阅读数量
for(int i=0;i<msgCount;i++){
ids[i]=Long.valueOf(i) ;
}
returnMymsg.setMyMessageKey(StringUtils.join(ids,","));
returnMymsg.setMyMessageType("1");
returnMymsg.setMyMessageState("N");
return success(returnMymsg);
}
}

@ -208,6 +208,7 @@ public class EhsNoticeMessageController extends BaseController
}
EhsMyMessage msgNew = new EhsMyMessage();
msgNew.setMyMessageKey(noticeMessageId.toString());
msgNew.setMyMessageState("Y");
ehsMyMessageService.saveMyMessage(msgNew);
return success(ehsNoticeMessage);
}

@ -69,6 +69,7 @@ public class EhsMaterial extends BaseEntity
// @Excel(name = "待处理出库")
@TableField(exist = false)
private String sendQuantity;
@TableField(exist = false)
private Integer isSendQuantity;
}

@ -30,4 +30,6 @@ public interface EhsMyMessageMapper extends BaseMapper<EhsMyMessage> {
public EhsMyMessage selectEhsMyMessageByMyMessageMax(EhsMyMessage ehsMyMessage);
public List<EhsMyMessage> selectUnReadNotice(EhsMyMessage ehsMyMessage);
public int updatebyKeyUserId(EhsMyMessage ehsMyMessage);
public int updateHDbyKeyUserId(EhsMyMessage ehsMyMessage);
}

@ -31,4 +31,6 @@ public interface IEhsMyMessageService extends IService<EhsMyMessage> {
public Long msgCount(EhsMyMessage query);
public List<EhsMyMessage> selectUnReadNotice(EhsMyMessage ehsMyMessage);
public boolean saveMyMessage(EhsMyMessage msgNew);
public int updatebyKeyUserId(EhsMyMessage ehsMyMessage);
public int updateHDbyKeyUserId(EhsMyMessage ehsMyMessage);
}

@ -77,7 +77,18 @@ public class EhsMyMessageServiceImpl extends ServiceImpl<EhsMyMessageMapper, Ehs
msgNew.setMyUserId(SecurityUtils.getUserId());
msgNew.setMyMessageType("1");
msgNew.setMyMessageDesc("您有新的消息通知未阅读,请及及时处理!");
msgNew.setMyMessageState("N");
return saveOrUpdate(msgNew);
msgNew.setMyMessageState(StringUtils.isNotEmpty(msgNew.getMyMessageState())?msgNew.getMyMessageState():"N");
int i = ehsMyMessageMapper.updatebyKeyUserId(msgNew);
if(i==0){
save(msgNew);
}
return true;
}
public int updatebyKeyUserId(EhsMyMessage ehsMyMessage){
return ehsMyMessageMapper.updatebyKeyUserId(ehsMyMessage);
}
public int updateHDbyKeyUserId(EhsMyMessage ehsMyMessage){
return ehsMyMessageMapper.updateHDbyKeyUserId(ehsMyMessage);
}
}

@ -99,4 +99,10 @@ public class EhsNoticeMessage extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date issueTime;
@TableField(exist = false)
private Long myMessageId; //我的消息对应的id
@TableField(exist = false)
private Long myUserId;//我的消息的对应人员的id
@TableField(exist = false)
private String myMessageState;//我的消息阅读状态
}

@ -3,6 +3,7 @@ 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 com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
@ -45,6 +46,7 @@ public class EhsNoticeMessageServiceImpl extends ServiceImpl<EhsNoticeMessageMap
@Override
public List<EhsNoticeMessage> selectEhsNoticeMessageList(EhsNoticeMessage ehsNoticeMessage)
{
ehsNoticeMessage.setMyUserId(SecurityUtils.getUserId());
return ehsNoticeMessageMapper.selectEhsNoticeMessageList(ehsNoticeMessage);
}
@Override

@ -24,6 +24,7 @@
<result property="deptId" column="dept_id" />
<result property="createUserId" column="create_user_id" />
<result property="updateUserId" column="update_user_id" />
<result property="isSendQuantity" column="is_send_quantity" />
</resultMap>
<sql id="selectEhsMaterialVo">
@ -48,6 +49,8 @@
<if test="reserveLocation != null and reserveLocation != ''"> and reserve_location like concat('%', #{reserveLocation}, '%')</if>
<if test="managerPerson != null and managerPerson != ''"> and Manager_person like concat('%', #{managerPerson}, '%')</if>
<if test="tel != null and tel != ''"> and tel like concat('%', #{tel}, '%')</if>
<if test="isSendQuantity == 0 "> and a.send_quantity is null </if>
<if test="isSendQuantity == 1 "> and a.send_quantity is not null </if>
</where>
</select>

@ -84,5 +84,14 @@
)
</select>
<update id="updatebyKeyUserId" parameterType="GenTableColumn">
update ehs_my_message
set my_message_state = #{myMessageState}
where my_message_key = #{myMessageKey} and my_user_id = #{myUserId}
</update>
<update id="updateHDbyKeyUserId" parameterType="GenTableColumn">
update ehs_my_message
set my_message_state = #{myMessageState}
where my_message_type='0' and my_user_id = #{myUserId}
</update>
</mapper>

@ -33,6 +33,9 @@
<result property="originalName" column="original_name" />
<result property="noticeMessageFileId" column="notice_message_fele_id" />
<result property="issueTime" column="issue_time" />
<result property="myMessageId" column="my_message_id" />
<result property="myUserId" column="my_user_id" />
<result property="myMessageState" column="my_message_state" />
</resultMap>
<sql id="selectEhsNoticeMessageVo">
@ -48,9 +51,12 @@
(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
,mym.my_message_id,mym.my_message_state
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
left join ehs_my_message mym on m.notice_message_id = my_message_key
<if test="myUserId != null and myUserId != '' "> and my_user_id = #{myUserId} </if>
<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>

@ -50,3 +50,32 @@ export function getUnread() {
method: 'get'
})
}
//设置隐患消息已读取
export function setReadByHD() {
return request({
url: '/ehsMyMessage/ehsMyMessage/setReadByHD',
method: 'get'
})
}
//查询待出库
export function getSendQuantity(classFirst) {
return request({
url: '/ehsMyMessage/ehsMyMessage/getSendQuantity/'+classFirst,
method: 'get'
})
}
//设置物资消息已读
export function setMaterial(myMessageId) {
return request({
url: '/ehsMyMessage/ehsMyMessage/setMaterial/'+myMessageId,
method: 'get'
})
}
//查询消息通信新消息和消息总数
export function getNoticeMsg() {
return request({
url: '/ehsMyMessage/ehsMyMessage/getNoticeMsg',
method: 'get'
})
}

@ -7,7 +7,7 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<search id="header-search" class="right-menu-item"/>
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
@ -18,30 +18,43 @@
</el-tooltip>-->
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<screenfull id="screenfull" class="right-menu-item hover-effect"/>
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
<size-select id="size-select" class="right-menu-item hover-effect"/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<i class="el-icon-bell " style="font-size:22px "><el-badge :value="Number(hdMsgCount)+Number(msgCount)" class="item"/></i>
<i class="el-icon-caret-bottom" />
<i class="el-icon-bell " style="font-size:22px ">
<el-badge
:value="Number(hdMsgCount)+Number(msgCount)+Number(msgMaterial1)+Number(msgMaterial2)+Number(msgMaterial3)+Number(msgMaterial4)"
class="item"/>
</i>
<i class="el-icon-caret-bottom"/>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="goHD(hdMsgCount)">
<span>隐患消息 <el-badge class="mark" :value="hdMsgCount" /></span>
<!--<router-link :to="{ path: '/ehsHiddenDangerMenu/ehsHiddenDanger', query: {overTime: '10' }}">
隐患消息
<el-badge class="mark" :value="hdMsgCount" />
</router-link>-->
<el-dropdown-item v-show='this.$auth.hasRole("store")' @click.native="goMaterial(msgMaterial1,1)">
<span>通用应急救援装备 <el-badge class="mark" :value="msgMaterial1"/></span>
</el-dropdown-item>
<el-dropdown-item v-show='this.$auth.hasRole("store")' @click.native="goMaterial(msgMaterial2,2)">
<span>防汛抗旱装备 <el-badge class="mark" :value="msgMaterial2"/></span>
</el-dropdown-item>
<el-dropdown-item v-show='this.$auth.hasRole("store")' @click.native="goMaterial(msgMaterial3,3)">
<span>森林防灭火装备 <el-badge class="mark" :value="msgMaterial3"/></span>
</el-dropdown-item>
<el-dropdown-item v-show='this.$auth.hasRole("store")' @click.native="goMaterial(msgMaterial3,4)">
<span>救灾物资 <el-badge class="mark" :value="msgMaterial4"/></span>
</el-dropdown-item>
<el-dropdown-item v-show='this.$auth.hasRole("HDDept") || this.$auth.hasRole("HDAdmin")'
@click.native="goHD(hdMsgCount)">
<span>隐患消息 <el-badge class="mark" :value="hdMsgCount"/></span>
</el-dropdown-item>
<el-dropdown-item @click.native="goMsg(msgCount)">
<span>消息通知</span>
<el-badge class="mark" :value="msgCount" />
<el-badge class="mark" :value="msgCount"/>
</el-dropdown-item>
</el-dropdown-menu>
@ -50,7 +63,7 @@
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<i class="el-icon-caret-bottom" />
<i class="el-icon-caret-bottom"/>
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
@ -69,7 +82,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import {mapGetters} from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
@ -78,14 +91,19 @@
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import { getUnread} from "@/api/ehs/ehsMyMessage";
import {setReadByHD, updateEhsMyMessage, getSendQuantity, getUnread, getNoticeMsg} from "@/api/ehs/ehsMyMessage";
import {getOverTimeId} from "@/api/ehs/ehsHiddenDanger";
export default {
data() {
return {
hdMsgCount: 0,
msgCount: 0,
timer:null
timer: null,
msgMaterial1: 0,
msgMaterial2: 0,
msgMaterial3: 0,
msgMaterial4: 0,
}
},
components: {
@ -122,29 +140,55 @@
}
},
methods: {
goHD(msgC){
if(msgC!=0){
goMaterial(msgC, classFast) {
if (msgC != 0) {
this.$router.push({
path: '/ehsHiddenDangerMenu/ehsHiddenDanger', query: {overTime: "10" }
path: '/ehsMaterial/ehsMaterial' + classFast, query: {"classFirst": classFast,"isSendQuantity":1}
});
/* setMaterial().then(response => {
this.$router.push({
path: '/ehsMaterial/ehsMaterial' + classFast, query: {"classFirst": classFast}
});
});*/
}
},
goMsg(msgC){
if(msgC!=0){
goHD(msgC) {
if (msgC != 0) {
setReadByHD().then(response => {
this.$router.push({
path: '/ehsNoticeMessage/ehsNoticeMessageDept', query: {noticeType: "0" }
path: '/ehsHiddenDangerMenu/ehsHiddenDanger', query: {overTime: "10"}
});
});
}
},
goMsg(msgC) {
if (msgC != 0) {
this.$router.push({
path: '/ehsNoticeMessage/ehsNoticeMessageDept', query: {noticeType: "0"}
});
}
},
getUnread() {
console.log("定时任务");
getUnread().then(response => {
this.hdMsgCount = response.msgHD;
this.msgCount = response.msg;
//
//
//
this.getHdCount();
this.getMaterialMsg();
this.getNoticeMsg();
/* getUnread().then(response => {
//this.hdMsgCount = this.getCount(response.msgHD );
//this.msgCount = this.getCount(response.msg );
this.getHdCount();
this.getMaterialMsg();
this.getNoticeMsg();
console.log(response);
});
});*/
},
getCount(msgC) {
return (msgC == null|| msgC =="")? 0 : (msgC.split(",")).length;
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
@ -157,14 +201,160 @@
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
})
}).catch(() => {});
}).catch(() => {
});
},
getHdCount() {
if (this.$auth.hasRoleOr(["HDDept", "HDAdmin"])) {
getOverTimeId().then(response => {
console.log(response);
this.hdMsgCount = this.getCount(response.data.myMessageKey)
if (response.code == 200) {
if (response.data.myMessageDesc != "" && response.data.myMessageDesc != null) {
const h = this.$createElement;
this.$message({
type: "success",
message: h(
"div",
{style: "padding-right:20px display: flex;align-items: center;color:#00B42A"},
[
h("span", null, response.data.myMessageDesc),
h(
"span",
{
style: "position:absolute;right: 15px;cursor:pointer",
on: {
click: () => {
this.goHD((response.data.myMessageKey.split(",")).length);
},
},
},
"查看"
),
]
),
});
}
/* if(response.data.myMessageDesc!="" && response.data.myMessageDesc!=null){
this.$confirm(response.data.myMessageDesc , '隐患信息', {
confirmButtonText: '查看',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateEhsMyMessage({"myMessageId":response.data.myMessageId,"myMessageState":"Y"}).then(response => {
this.$router.push({
path: '/ehsHiddenDangerMenu/ehsHiddenDanger', query: {overTime: "10" }
});
});
}).catch(() => {
/!* this.$message({
type: 'info',
message: '已取消删除'
});*!/
});
}*/
}
});
} else {
console.log("不是隐患管理员!");
}
},
getMaterialMsg() {
if (this.$auth.hasRoleOr(["store"])) {
for (var i = 1; i <= 4; i++) {
getSendQuantity(i).then(response => {
console.log(response);
if (response.code == 200) {
var tt = response.data.myMessageType.substring(1, 2);
if (tt == 1) {
this.msgMaterial1 = this.getCount(response.data.myMessageKey);
} else if (tt == 2) {
this.msgMaterial2 = this.getCount(response.data.myMessageKey);
} else if (tt == 3) {
this.msgMaterial3 = this.getCount(response.data.myMessageKey);
} else if (tt == 4) {
this.msgMaterial4 = this.getCount(response.data.myMessageKey);
}
if (response.data.myMessageDesc != "" && response.data.myMessageDesc != null) {
const h = this.$createElement;
this.$message({
type: "success",
message: h(
"div",
{style: "padding-right:20px display: flex;align-items: center;color:#00B42A"},
[
h("span", null, response.data.myMessageDesc),
h(
"span",
{
style: "position:absolute;right: 15px;cursor:pointer",
on: {
click: () => {
this.goMaterial(response.data.myMessageId, response.data.myMessageType.substring(1, 2),this.getCount((response.data.myMessageKey.split(",")).length));
},
},
},
"查看"
),
]
),
});
}
}
});
}
} else {
console.log("不是仓库管理员!");
}
},
getNoticeMsg() {
getNoticeMsg( ).then(response => {
console.log(response);
if (response.code == 200) {
this.msgCount = this.getCount(response.data.myMessageKey);
if (response.data.myMessageDesc != "" && response.data.myMessageDesc != null) {
const h = this.$createElement;
this.$message({
type: "success",
message: h(
"div",
{style: "padding-right:20px display: flex;align-items: center;color:#00B42A"},
[
h("span", null, response.data.myMessageDesc),
h(
"span",
{
style: "position:absolute;right: 15px;cursor:pointer",
on: {
click: () => {
this.goMsg((response.data.myMessageKey.split(",")).length);
},
},
},
"查看"
),
]
),
});
}
}
});
},
/* goMaterial(myMessageId, classFast) {
setMaterial(myMessageId).then(response => {
this.$router.push({
path: '/ehsMaterial/ehsMaterial' + classFast, query: {"classFirst": classFast}
});
});
},*/
},
mounted() {
console.log("启动定时器");
this.getUnread();
//get1
this.timer = setInterval(this.getUnread, 10000);//
this.timer = setInterval(this.getUnread, 30000);//
},
//
@ -180,7 +370,7 @@
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
.hamburger-container {
line-height: 46px;
@ -188,7 +378,7 @@
float: left;
cursor: pointer;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
@ -261,6 +451,7 @@
}
}
}
.item {
margin-top: -20px;

@ -720,7 +720,6 @@ export default {
openAssist:false,//
assistDeptList:"",//
currAssistHiddenDangerId :-1,//id
queryOverTime:null,//
statusOptions: [{
value: '0',
label: '停业',
@ -841,9 +840,9 @@ export default {
console.log(this.$route.query.overTime);
},
beforeDestroy() {
/* beforeDestroy() {
eventBus.$emit('toLogo', this.$router,'');
},
},*/
methods: {
/** 查询隐患信息列表 */
getList() {

@ -29,6 +29,16 @@
:props="{ multiple: false, checkStrictly: true }"
@change="handleQueryChange"></el-cascader>
</el-form-item>
<el-form-item label="是否有待出库" prop="isSendQuantity" label-width="98px">
<el-select v-model="queryParams.isSendQuantity" placeholder="请选择" clearable>
<el-option
v-for="dict in isSendQuantityOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="类别" prop="classSecond">
<el-cascader style="width:500px"
@ -415,6 +425,7 @@
import {addEhsMaterialDetail,listEhsMaterialDetail, updateEhsMaterialDetail , delEhsMaterialDetail} from "@/api/ehs/EhsMaterialDetail";
import { getMaterialClassJson } from "@/api/ehs/materialClassMaster";
import importUpload from "@/components/upload/upload";
import { eventBus } from '@/main.js';
/* import { getDicts } from "@/api/system/dict/data";
import material1 from '../../../assets/materialClass.json';
import material2 from '../../../assets/materialClass2.json';
@ -478,6 +489,13 @@
label: '社会代储',
raw:{listClass: 'default'}
}],
isSendQuantityOptions: [{
value: '0',
label: '没有待出库物资',
}, {
value: '1',
label: '有待出库物资',
}],
//
queryParams: {
pageNum: 1,
@ -491,7 +509,8 @@
reserveLocation: null,
managerPerson: null,
tel: null,
classFirst:this.$route.query.classFirst
classFirst:this.$route.query.classFirst,
isSendQuantity:null
},
//
form: {
@ -534,7 +553,7 @@
{ required: true, message: "经手人不能为空", trigger: "blur" }
],
receiveTel: [
{ required: true, message: "经手人不能为空", trigger: "blur", pattern:/^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/ }
{ required: true, message: "领取人电话不能为空", trigger: "blur", pattern:/^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/ }
],
},
@ -542,13 +561,19 @@
};
},
created() {
eventBus.$emit('toLogo', this.$route,'应急救援物资管理');
this.queryParams.isSendQuantity = this.$route.query.isSendQuantity;
this.getList();
this.$route.query.isSendQuantity = null;
this.materialClass = this.$route.query.classFirst;
//this.getDictList();
this.getListAllDept();
this.deptShow = this.$store.state.user.parentId==0 ?true :false;
//console.log(this.curDict);
this.getMaterialClassJson(this.materialClass);
//this.getSendQuantityList();
/*if (this.materialClass == 1){
this.options = material1;
}else if (this.materialClass == 2){
@ -584,6 +609,21 @@
this.loading = false;
});
},
getSendQuantityList() {
if(this.$auth.hasRoleOr(["store"])){
let para = {};
para.classFirst = this.queryParams.classFirst;
para.isSendQuantity = 1;
listEhsMaterial(para).then(response => {
if(response.total>0){
this.$message('您有'+response.total+"条待处理出库!");
}else{
console.log("没有待处理出库!");
}
});
}
},
/** 单位信息列表 */
getListAllDept() {
console.log(this.$store.state.user.deptId);
@ -668,6 +708,7 @@
this.queryParams.materialNameId = null;
this.queryParams.materialName = null;
this.resetForm("queryForm");
this.queryParams.isSendQuantity = null;
this.handleQuery();
},
//
@ -858,7 +899,7 @@
}
})
}
console.log(str);
// console.log(str);
return str;
},
/** 批量导入 */

@ -302,11 +302,12 @@
};
},
created() {
this.getList();
this.materialClass = this.$route.query.classFirst;
this.getListAllDept();
this.deptShow = this.$store.state.user.parentId==0 ?true :false;
this.getMaterialClassJson();
this.getListAllDept();
//this.setMaterialClassJson();
},
@ -329,6 +330,7 @@
}
this.options=this.materialJson[0];
console.log(this.materialJson);
this.getList();
},
setMaterialClassJson() {
this.loading = true;

@ -87,11 +87,11 @@
</span>
</template>
</el-table-column>
<el-table-column label="发布状态" align="center" prop="status" >
<!-- <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>-->
<el-table-column label="发布时间" align="center" prop="issueTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.issueTime, '{y}-{m}-{d}') }}</span>

@ -103,11 +103,16 @@
<span> {{ statusList[scope.row.fileState].label }}</span>
</template>
</el-table-column>
<el-table-column label="是否阅读" align="center" prop="isRead" >
<el-table-column label="是否阅读" align="center" prop="isRead" v-if ="taskShow">
<template slot-scope="scope">
<span> {{ scope.row.isRead==0?"未阅读":"已阅读"}}</span>
</template>
</el-table-column>
<el-table-column label="是否阅读" align="center" prop="myMessageState" v-if ="!taskShow">
<template slot-scope="scope">
<span> {{ scope.row.myMessageState=="Y"?"已阅读":"未阅读"}}</span>
</template>
</el-table-column>
<el-table-column label="通知时间" align="center" prop="issueTime" />
<el-table-column label="上报文件" align="center" prop="originalName" >
<template slot-scope="scope">
@ -228,6 +233,7 @@ import { listEhsNoticeMessageAdmin,listEhsNoticeMessage, getEhsNoticeMessage, de
updateEhsNoticeMessage,issueNews,detailEhsNoticeMessage } from "@/api/ehs/ehsNoticeMessage";
import {listAllDept2 } from "@/api/system/dept";
import {delEhsNoticeMessageFile,addEhsNoticeMessageFile,updateEhsNoticeMessageFile } from "@/api/ehs/ehsNoticeMessageFile";
import { eventBus } from '@/main.js';
export default {
name: "EhsNoticeMessage",
data() {
@ -322,6 +328,7 @@ export default {
};
},
created() {
eventBus.$emit('toLogo', this.$route,'消息通知');
this.getList();
this.getListAllDept();
this.taskShow = this.$route.query.noticeType==1 ?true :false; //=0 =1

@ -25,8 +25,7 @@
<script>
import { constantRoutes } from "@/router";
import { eventBus } from '@/main.js';
import { getOverTimeId } from "@/api/ehs/ehsHiddenDanger";
import { updateEhsMyMessage } from "@/api/ehs/ehsMyMessage";
//
const hideList = ["/index", "/user/profile"];
@ -60,14 +59,20 @@ export default {
//
topMenus() {
let topMenus = [];
let imgArr= [this.img1,this.img2,this.img3,this.img4,this.img5,this.img6,this.img7,this.img8,this.img9,this.img10,this.img11,this.img12]
//let imgArr= [this.img1,this.img2,this.img3,this.img4,this.img5,this.img6,this.img7,this.img8,this.img9,this.img10,this.img11,this.img12]
let imgArr = {"/ehsRisk":this.img1,"/ehsMaterial":this.img2,"/ehsDocu":this.img3,"/ehsTeam":this.img4,"/ehsLawEnforce":this.img5,
"/ehsNoticeMessage":this.img6,"/enterprise":this.img7,"/ehsNoticeMessage1":this.img8,"/ehsHiddenDangerMenu":this.img9,
"/system":this.img10,"/monitor":this.img11,"/tool":this.img12} ;
this.routers.map((menu,index) => {
if (menu.hidden !== true) {
console.log(menu.path);
//
if (menu.path === "/") {
topMenus.push(menu.children[0]);
} else {
menu.meta.img = imgArr[index]
//menu.meta.img = imgArr[index]
menu.meta.img = imgArr[menu.path];
topMenus.push(menu);
}
@ -123,46 +128,22 @@ export default {
},
},
created() {
this.openAlert();
//使
// this.openAlert();
// this.openMaterialMsg();
},
mounted() {
/* mounted() {
//get1
this.timer = setTimeout(this.get, 1000);
},
//this.timer = setTimeout(this.get, 1000);
},*/
//
beforeDestroy() {
/* beforeDestroy() {
clearTimeout(this.timer);
},
},*/
methods: {
openAlert() {
getOverTimeId().then(response => {
console.log(response);
if(response.code == 200){
if(response.data.myMessageDesc!="" && response.data.myMessageDesc!=null){
this.$confirm(response.data.myMessageDesc , '隐患信息', {
confirmButtonText: '查看',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateEhsMyMessage({"myMessageId":response.data.myMessageId,"myMessageState":"Y"}).then(response => {
this.$router.push({
path: '/ehsHiddenDangerMenu/ehsHiddenDanger', query: {overTime: "10" }
});
});
}).catch(() => {
/* this.$message({
type: 'info',
message: '已取消删除'
});*/
});
}
}
});
},
//
handleSelect(key, keyPath) {
this.currentIndex = key;
@ -237,4 +218,7 @@ export default {
border: 1px solid #{'var(--theme)'} !important;
color: #3b3d41;
}
.el-message {
min-width: 580px;
}
</style>

Loading…
Cancel
Save