feat: 完善消息接收设置

This commit is contained in:
fit2cloud-chenyw 2021-07-12 11:30:57 +08:00
parent ff82cffff4
commit b329f894d1
19 changed files with 206 additions and 59 deletions

View File

@ -4,4 +4,5 @@ public class SysMsgConstants {
public final static String SYS_MSG_CHANNEL = "sys_msg_channel"; public final static String SYS_MSG_CHANNEL = "sys_msg_channel";
public final static String SYS_MSG_TYPE = "sys_msg_type"; public final static String SYS_MSG_TYPE = "sys_msg_type";
public final static String SYS_MSG_USER_SUBSCRIBE = "sys_msg_user_subscribe";
} }

View File

@ -8,7 +8,6 @@ import io.dataease.base.domain.SysMsgType;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager; import io.dataease.commons.utils.Pager;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.message.dto.MsgGridDto; import io.dataease.controller.message.dto.MsgGridDto;
import io.dataease.controller.message.dto.MsgRequest; import io.dataease.controller.message.dto.MsgRequest;
import io.dataease.controller.message.dto.MsgSettingRequest; import io.dataease.controller.message.dto.MsgSettingRequest;
@ -53,14 +52,12 @@ public class MsgController {
sysMsgService.batchDelete(msgIds); sysMsgService.batchDelete(msgIds);
} }
@I18n
@PostMapping("/treeNodes") @PostMapping("/treeNodes")
public List<SettingTreeNode> treeNodes() { public List<SettingTreeNode> treeNodes() {
return sysMsgService.treeNodes(); return sysMsgService.treeNodes();
} }
@I18n
@PostMapping("/channelList") @PostMapping("/channelList")
public List<SysMsgChannel> channelList() { public List<SysMsgChannel> channelList() {
return sysMsgService.channelList(); return sysMsgService.channelList();
@ -73,10 +70,10 @@ public class MsgController {
@PostMapping("/updateSetting") @PostMapping("/updateSetting")
public void updateSetting(@RequestBody MsgSettingRequest request) { public void updateSetting(@RequestBody MsgSettingRequest request) {
sysMsgService.updateSetting(request); Long userId = AuthUtils.getUser().getUserId();
sysMsgService.updateSetting(request, userId);
} }
@I18n
@PostMapping("/types") @PostMapping("/types")
public List<SysMsgType> allTypes() { public List<SysMsgType> allTypes() {
List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes(); List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes();

View File

@ -0,0 +1,20 @@
package io.dataease.controller.message.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class SubscribeNode implements Serializable {
private static final long serialVersionUID = -1680823237289721438L;
private Long typeId;
private Long channelId;
public Boolean match(Long type, Long channel) {
return type == typeId && channel == channelId;
}
}

View File

@ -1,6 +1,5 @@
package io.dataease.service.message; package io.dataease.service.message;
import io.dataease.base.domain.SysMsg;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,14 +19,14 @@ public class DeMsgutil {
public static void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) { public static void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
SysMsg sysMsg = new SysMsg(); // SysMsg sysMsg = new SysMsg();
sysMsg.setUserId(userId); // sysMsg.setUserId(userId);
sysMsg.setTypeId(typeId); // sysMsg.setTypeId(typeId);
sysMsg.setContent(content); // sysMsg.setContent(content);
sysMsg.setStatus(false); // sysMsg.setStatus(false);
sysMsg.setCreateTime(System.currentTimeMillis()); // sysMsg.setCreateTime(System.currentTimeMillis());
sysMsg.setParam(param); // sysMsg.setParam(param);
sysMsgService.save(sysMsg); sysMsgService.sendMsg(userId, typeId, channelId, content, param);
} }

View File

@ -1,20 +1,25 @@
package io.dataease.service.message; package io.dataease.service.message;
import io.dataease.base.domain.SysMsgSettingExample;
import io.dataease.base.mapper.SysMsgSettingMapper; import io.dataease.controller.message.dto.SubscribeNode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
@Aspect @Aspect
@Component @Component
public class MsgAop { public class MsgAop {
@Resource @Resource
private SysMsgSettingMapper sysMsgSettingMapper; private SysMsgService sysMsgService;
@ -24,7 +29,7 @@ public class MsgAop {
* 对sendMsg 切面拦截 * 对sendMsg 切面拦截
* @param point * @param point
*/ */
@Around("(execution(* io.dataease.service.message.DeMsgutil.sendMsg(..)))") @Around("(execution(* io.dataease.service.message.SysMsgService.sendMsg(..)))")
public Object cutPoint(ProceedingJoinPoint point) { public Object cutPoint(ProceedingJoinPoint point) {
Object[] args = point.getArgs(); Object[] args = point.getArgs();
@ -39,11 +44,11 @@ public class MsgAop {
Long typeId = (Long) arg1; Long typeId = (Long) arg1;
Long channelId = (Long) arg2; Long channelId = (Long) arg2;
SysMsgSettingExample example = new SysMsgSettingExample(); List<SubscribeNode> subscribes = sysMsgService.subscribes(userId);
example.createCriteria().andChannelIdEqualTo(channelId).andUserIdEqualTo(userId).andTypeIdEqualTo(typeId).andEnableEqualTo(true);
try { try {
if (sysMsgSettingMapper.countByExample(example) > 0) // 如果已经订阅了这种类型的消息 直接发送 否则直接返回
if (CollectionUtils.isNotEmpty(subscribes) && subscribes.stream().anyMatch(item -> item.match(typeId, channelId)))
return point.proceed(args); return point.proceed(args);
return null; return null;
} catch (Throwable throwable) { } catch (Throwable throwable) {

View File

@ -7,16 +7,13 @@ import io.dataease.base.mapper.SysMsgMapper;
import io.dataease.base.mapper.SysMsgSettingMapper; import io.dataease.base.mapper.SysMsgSettingMapper;
import io.dataease.base.mapper.SysMsgTypeMapper; import io.dataease.base.mapper.SysMsgTypeMapper;
import io.dataease.base.mapper.ext.ExtSysMsgMapper; import io.dataease.base.mapper.ext.ExtSysMsgMapper;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.SysMsgConstants; import io.dataease.commons.constants.SysMsgConstants;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CommonBeanFactory; import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.message.dto.MsgGridDto; import io.dataease.controller.message.dto.*;
import io.dataease.controller.message.dto.MsgRequest;
import io.dataease.controller.message.dto.MsgSettingRequest;
import io.dataease.controller.message.dto.SettingTreeNode;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -179,11 +176,17 @@ public class SysMsgService {
return sysMsgSettings; return sysMsgSettings;
} }
/**
* 修改了订阅信息 需要清除缓存
* @param request
* @param userId
*/
@Transactional @Transactional
public void updateSetting(MsgSettingRequest request) { @CacheEvict(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
public void updateSetting(MsgSettingRequest request, Long userId) {
Long typeId = request.getTypeId(); Long typeId = request.getTypeId();
Long channelId = request.getChannelId(); Long channelId = request.getChannelId();
Long userId = AuthUtils.getUser().getUserId(); // Long userId = AuthUtils.getUser().getUserId();
SysMsgSettingExample example = new SysMsgSettingExample(); SysMsgSettingExample example = new SysMsgSettingExample();
example.createCriteria().andUserIdEqualTo(userId).andTypeIdEqualTo(typeId).andChannelIdEqualTo(channelId); example.createCriteria().andUserIdEqualTo(userId).andTypeIdEqualTo(typeId).andChannelIdEqualTo(channelId);
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example); List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
@ -202,5 +205,34 @@ public class SysMsgService {
sysMsgSettingMapper.insert(sysMsgSetting); sysMsgSettingMapper.insert(sysMsgSetting);
} }
public void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
SysMsg sysMsg = new SysMsg();
sysMsg.setUserId(userId);
sysMsg.setTypeId(typeId);
sysMsg.setContent(content);
sysMsg.setStatus(false);
sysMsg.setCreateTime(System.currentTimeMillis());
sysMsg.setParam(param);
save(sysMsg);
}
/**
* 查询用户订阅的消息 并缓存
* @param userId
* @return
*/
@Cacheable(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
public List<SubscribeNode> subscribes(Long userId) {
SysMsgSettingExample example = new SysMsgSettingExample();
example.createCriteria().andUserIdEqualTo(userId).andEnableEqualTo(true);
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
List<SubscribeNode> resultLists = sysMsgSettings.stream().map(item -> {
SubscribeNode subscribeNode = new SubscribeNode();
subscribeNode.setTypeId(item.getTypeId());
subscribeNode.setChannelId(item.getChannelId());
return subscribeNode;
}).collect(Collectors.toList());
return resultLists;
}
} }

View File

@ -5,24 +5,81 @@ DROP TABLE IF EXISTS `sys_msg`;
CREATE TABLE `sys_msg` ( CREATE TABLE `sys_msg` (
`msg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息主键', `msg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息主键',
`user_id` bigint(20) NOT NULL COMMENT '用户ID', `user_id` bigint(20) NOT NULL COMMENT '用户ID',
`type` int(4) NOT NULL COMMENT '类型', `type_id` bigint(20) NOT NULL COMMENT '类型',
`status` tinyint(1) NOT NULL COMMENT '状态', `status` tinyint(1) NOT NULL COMMENT '状态',
`router` varchar(255) DEFAULT NULL COMMENT '跳转路由',
`param` varchar(255) DEFAULT NULL COMMENT '路由参数', `param` varchar(255) DEFAULT NULL COMMENT '路由参数',
`create_time` bigint(13) NOT NULL COMMENT '发送时间', `create_time` bigint(13) NOT NULL COMMENT '发送时间',
`read_time` bigint(13) DEFAULT NULL COMMENT '读取时间', `read_time` bigint(13) DEFAULT NULL COMMENT '读取时间',
`content` varchar(255) DEFAULT NULL COMMENT '消息内容', `content` varchar(255) DEFAULT NULL COMMENT '消息内容',
PRIMARY KEY (`msg_id`) USING BTREE, PRIMARY KEY (`msg_id`) USING BTREE,
KEY `inx_msg_userid` (`user_id`) USING BTREE, KEY `inx_msg_userid` (`user_id`) USING BTREE,
KEY `inx_msg_type` (`type`) USING BTREE, KEY `inx_msg_type` (`type_id`) USING BTREE,
KEY `inx_msg_status` (`status`) USING BTREE KEY `inx_msg_status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='消息通知表'; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='消息通知表';
-- ----------------------------
-- Table structure for sys_msg_channel
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_channel`;
CREATE TABLE `sys_msg_channel` (
`msg_channel_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`channel_name` varchar(255) DEFAULT NULL COMMENT '渠道名称',
PRIMARY KEY (`msg_channel_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='消息渠道表';
-- ----------------------------
-- Records of sys_msg_channel
-- ----------------------------
BEGIN;
INSERT INTO `sys_msg_channel` VALUES (1, 'webmsg.channel_inner_msg');
COMMIT;
-- ----------------------------
-- Table structure for sys_msg_type
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_type`;
CREATE TABLE `sys_msg_type` (
`msg_type_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`pid` bigint(20) NOT NULL COMMENT '父类ID',
`type_name` varchar(255) DEFAULT NULL COMMENT '类型名称',
`router` varchar(255) DEFAULT NULL COMMENT '跳转路由',
`callback` varchar(255) DEFAULT NULL COMMENT '回调方法',
PRIMARY KEY (`msg_type_id`) USING BTREE,
KEY `inx_msgtype_pid` (`pid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='消息类型表';
-- ----------------------------
-- Records of sys_msg_type
-- ----------------------------
BEGIN;
INSERT INTO `sys_msg_type` VALUES (1, 0, 'i18n_msg_type_panel_share', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (2, 1, 'i18n_msg_type_panel_share', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (3, 1, 'i18n_msg_type_panel_share_cacnel', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (4, 0, 'i18n_msg_type_dataset_sync', 'dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (5, 4, 'i18n_msg_type_dataset_sync_success', 'dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (6, 4, 'i18n_msg_type_dataset_sync_faild', 'dataset', 'to-msg-dataset');
COMMIT;
-- ----------------------------
-- Table structure for sys_msg_setting
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_setting`;
CREATE TABLE `sys_msg_setting` (
`msg_setting_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`type_id` bigint(20) NOT NULL COMMENT '类型ID',
`channel_id` bigint(20) NOT NULL COMMENT '渠道ID',
`enable` tinyint(1) DEFAULT NULL COMMENT '是否启用',
PRIMARY KEY (`msg_setting_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='消息设置表';
BEGIN; BEGIN;
INSERT INTO `sys_menu` VALUES (53, 1, 3, 1, '站内消息', 'sys-msg-web', 'msg/index', 1000, 'all-msg', 'system-msg-web', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (53, 1, 3, 1, '站内消息', 'sys-msg-web', 'msg/index', 1000, 'all-msg', 'system-msg-web', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (54, 53, 0, 1, '所有消息', 'sys-msg-web-all', 'msg/all', 1, 'web-msg', 'all', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (54, 53, 0, 1, '所有消息', 'sys-msg-web-all', 'msg/all', 1, 'web-msg', 'all', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (55, 53, 0, 1, '未读消息', 'sys-msg-web-unread', 'msg/unread', 2, 'unread-msg', 'unread', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (55, 53, 0, 1, '未读消息', 'sys-msg-web-unread', 'msg/unread', 2, 'unread-msg', 'unread', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-readed', 'msg/readed', 3, 'readed-msg', 'readed', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-readed', 'msg/readed', 3, 'readed-msg', 'readed', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (59, 53, 0, 1, '接收管理', 'sys-msg-setting', 'msg/setting', 4, 'msg-setting', 'setting', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
COMMIT; COMMIT;
BEGIN; BEGIN;

View File

@ -102,7 +102,7 @@
maxElementsInMemory="100" maxElementsInMemory="100"
maxElementsOnDisk="1000" maxElementsOnDisk="1000"
overflowToDisk="true" overflowToDisk="true"
diskPersistent="true" diskPersistent="false"
/> />
<!--消息类型缓存--> <!--消息类型缓存-->
@ -112,7 +112,20 @@
maxElementsInMemory="100" maxElementsInMemory="100"
maxElementsOnDisk="1000" maxElementsOnDisk="1000"
overflowToDisk="true" overflowToDisk="true"
diskPersistent="true" diskPersistent="false"
/>
<!--消息类型缓存-->
<cache
name="sys_msg_user_subscribe"
eternal="false"
maxElementsInMemory="100"
maxElementsOnDisk="10000"
overflowToDisk="true"
diskPersistent="false"
timeToIdleSeconds="28800"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU"
/> />

View File

@ -108,7 +108,7 @@ export default {
// console.log(lang) // console.log(lang)
// }, // },
showDetail(row) { showDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }} const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.visible = false this.visible = false
// if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) { // if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
// bus.$emit('to-msg-share', param) // bus.$emit('to-msg-share', param)
@ -162,7 +162,7 @@ export default {
}) })
}, },
getTypeName(value) { getTypeName(value) {
return getTypeName(value) return this.$t('webmsg.' + getTypeName(value))
}, },
open() { open() {
this.visible = true this.visible = true

View File

@ -1240,6 +1240,13 @@ export default {
mark_readed: 'Mark As Read', mark_readed: 'Mark As Read',
please_select: 'Please select at least one message', please_select: 'Please select at least one message',
mark_success: 'Mark read successfully', mark_success: 'Mark read successfully',
receive_manage: 'Receive Manage' receive_manage: 'Receive Manage',
i18n_msg_type_panel_share: 'Dashboard sharing',
i18n_msg_type_panel_share_cacnel: 'Dashboard unshared',
i18n_msg_type_dataset_sync: 'Data set synchronization',
i18n_msg_type_dataset_sync_success: 'Dataset synchronization successful',
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type',
channel_inner_msg: 'On site news'
} }
} }

View File

@ -1240,6 +1240,13 @@ export default {
mark_readed: '標記已讀', mark_readed: '標記已讀',
please_select: '請至少選擇一條消息', please_select: '請至少選擇一條消息',
mark_success: '標記已讀成功', mark_success: '標記已讀成功',
receive_manage: '接收管理' receive_manage: '接收管理',
i18n_msg_type_panel_share: '儀表板分享',
i18n_msg_type_panel_share_cacnel: '儀表板取消分享',
i18n_msg_type_dataset_sync: '數據集同步',
i18n_msg_type_dataset_sync_success: '數據集同步成功',
i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息'
} }
} }

View File

@ -1242,6 +1242,13 @@ export default {
mark_readed: '标记已读', mark_readed: '标记已读',
please_select: '请至少选择一条消息', please_select: '请至少选择一条消息',
mark_success: '标记已读成功', mark_success: '标记已读成功',
receive_manage: '接收管理' receive_manage: '接收管理',
i18n_msg_type_panel_share: '仪表板分享',
i18n_msg_type_panel_share_cacnel: '仪表板取消分享',
i18n_msg_type_dataset_sync: '数据集同步',
i18n_msg_type_dataset_sync_success: '数据集同步成功',
i18n_msg_type_dataset_sync_faild: '数据集同步失败',
i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息'
} }
} }

View File

@ -6,7 +6,7 @@ export const loadMsgTypes = value => {
if (!msgTypes || Object.keys(msgTypes).length === 0) { if (!msgTypes || Object.keys(msgTypes).length === 0) {
allTypes().then(res => { allTypes().then(res => {
msgTypes = res.data msgTypes = res.data
const defaultType = { msgTypeId: -1, pid: 0, typeName: '全部类型' } const defaultType = { msgTypeId: -1, pid: 0, typeName: 'i18n_msg_type_all' }
msgTypes.splice(0, 0, defaultType) msgTypes.splice(0, 0, defaultType)
store.dispatch('msg/setMsgTypes', msgTypes) store.dispatch('msg/setMsgTypes', msgTypes)
}) })

View File

@ -99,15 +99,16 @@ export default {
toMsgShare(routerParam) { toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) { if (routerParam !== null && routerParam.msgNotification) {
// const panelShareTypeIds = [4, 5, 6]
if (routerParam.msgType === 1) { // //
if (panelShareTypeIds.includes(routerParam.msgType)) { //
if (routerParam.sourceParam) { if (routerParam.sourceParam) {
try { try {
const msgParam = JSON.parse(routerParam.sourceParam) const msgParam = JSON.parse(routerParam.sourceParam)
this.param = msgParam.tableId this.param = msgParam.tableId
this.component = ViewTable this.component = ViewTable
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dynamic_component.msg2Current(routerParam.sourceParam) this.$refs.dynamic_component && this.$refs.dynamic_component.msg2Current && this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]"> <layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange"> <el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t(item.typeName) }}</el-radio-button> <el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group> </el-radio-group>
<complex-table <complex-table
@ -113,13 +113,13 @@ export default {
}) })
}, },
getTypeName(value) { getTypeName(value) {
return getTypeName(value) return this.$t('webmsg.' + getTypeName(value))
}, },
typeChange(value) { typeChange(value) {
this.search() this.search()
}, },
toDetail(row) { toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }} const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param }) this.$router.push({ name: row.router, params: param })
row.status || this.setReaded(row) row.status || this.setReaded(row)
}, },

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]"> <layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange"> <el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t(item.typeName) }}</el-radio-button> <el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group> </el-radio-group>
<complex-table <complex-table
@ -42,7 +42,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120"> <el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getTypeName(scope.row.typeId) }}</span> <span>{{ getTypeName(scope.row.typeId) }}</span>
</template> </template>
@ -118,13 +118,13 @@ export default {
}) })
}, },
getTypeName(value) { getTypeName(value) {
return getTypeName(value) return this.$t('webmsg.' + getTypeName(value))
}, },
typeChange(value) { typeChange(value) {
this.search() this.search()
}, },
toDetail(row) { toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }} const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param }) this.$router.push({ name: row.router, params: param })
}, },
sortChange({ column, prop, order }) { sortChange({ column, prop, order }) {

View File

@ -4,7 +4,7 @@
<el-row class="tree-head"> <el-row class="tree-head">
<span style="float: left;padding-left: 10px">{{ $t('webmsg.type') }}</span> <span style="float: left;padding-left: 10px">{{ $t('webmsg.type') }}</span>
<span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span"> <span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span">
{{ channel.channelName }} {{ $t(channel.channelName) }}
</span> </span>
</el-row> </el-row>
<el-row style="margin-top: 5px"> <el-row style="margin-top: 5px">
@ -18,7 +18,7 @@
> >
<span slot-scope="{ node, data }" class="custom-tree-node"> <span slot-scope="{ node, data }" class="custom-tree-node">
<span> <span>
<span style="margin-left: 6px" v-html="data.name" /> <span style="margin-left: 6px">{{ $t('webmsg.' + data.name) }}</span>
</span> </span>
<span @click.stop> <span @click.stop>
<!-- <div v-if="setting_data[data.id]"> <!-- <div v-if="setting_data[data.id]">

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]"> <layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange"> <el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t(item.typeName) }}</el-radio-button> <el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group> </el-radio-group>
<complex-table <complex-table
@ -45,7 +45,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120"> <el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getTypeName(scope.row.typeId) }}</span> <span>{{ getTypeName(scope.row.typeId) }}</span>
</template> </template>
@ -128,13 +128,13 @@ export default {
}) })
}, },
getTypeName(value) { getTypeName(value) {
return getTypeName(value) return this.$t('webmsg.' + getTypeName(value))
}, },
typeChange(value) { typeChange(value) {
this.search() this.search()
}, },
toDetail(row) { toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }} const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param }) this.$router.push({ name: row.router, params: param })
this.setReaded(row) this.setReaded(row)
}, },

View File

@ -75,11 +75,12 @@ export default {
methods: { methods: {
toMsgShare(routerParam) { toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) { if (routerParam !== null && routerParam.msgNotification) {
// const panelShareTypeIds = [1, 2, 3]
if (routerParam.msgType === 0) { // //
if (panelShareTypeIds.includes(routerParam.msgType)) { //
this.componentName = 'PanelMain' this.componentName = 'PanelMain'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.panel_main.msg2Current(routerParam.sourceParam) this.$refs.panel_main && this.$refs.panel_main.msg2Current && this.$refs.panel_main.msg2Current(routerParam.sourceParam)
}) })
} }
} }