跳到主要内容

系统消息跳转至详情

vue3新版中,点击顶部消息图标,可以弹窗展示我的消息列表,点击详情,会跳转至相关表单页面@Date 2022-08-31

系统现支持4种方式跳转:

  • 1.流程催办-->跳转至任务办理列表,并弹出任务办理表单
  • 2.节点消息通知-->跳转至任务办理页面
  • 3.内部邮箱-->跳转至内部邮箱列表,并弹出邮件详情表单
  • 4.普通的系统消息/公告-->跳转至我的消息列表,并弹出消息详情表单(默认方式)

如果需要扩展,需要修改枚举类,增加busType和path的对应记录。

package org.jeecg.modules.message.enums;

import org.jeecg.common.system.annotation.EnumDict;
import org.jeecg.common.system.vo.DictModel;

import java.util.ArrayList;
import java.util.List;

/**
* 消息跳转【vue3】
**/
public enum Vue3MessageHrefEnum {

/**
* 流程催办
*/
BPM("bpm", "/task/myHandleTaskInfo"),

/**
* 节点通知
*/
BPM_TASK("bpm_task", "/task/handle/{DETAIL_ID}"),

/**
* 邮件消息
*/
EMAIL("email", "/eoa/email");

String busType;

String path;

Vue3MessageHrefEnum(String busType, String path) {
this.busType = busType;
this.path = path;
}

public String getBusType() {
return busType;
}

public String getPath() {
return path;
}
}

保存一个消息至sys_announcement表的时候,需要设置两个特殊的属性:busType,busId

备注
  1. 如不设置busType,默认执行上述第4种跳转
  2. busType用于识别枚举,找到具体的路由地址path
  3. busId是详情页面数据的唯一标识,通过该标识查询整个详情页面数据,

前端示例代码如下:


import { getOne } from './mynews.api';
import { useAppStore } from '/@/store/modules/app';
const appStore = useAppStore();

onMounted(()=>{
initHrefModal();
});
function initHrefModal(){
// 从appStore中获取参数
let params = appStore.getMessageHrefParams;
let detailId = params.detailId;
if(detailId){
// getOne这个查询代码未提供,就是根据ID从数据库查询数据
getOne(detailId).then(data=>{
openDetail(true, {
record: data,
isUpdate: true,
});
// 弹窗详情后,清除历史参数
appStore.setMessageHrefParams('')
})
}
}
}