v3.8.2 系统通知改造支持分类

This commit is contained in:
JEECG 2025-07-30 18:28:10 +08:00
parent 219869f4c0
commit 0cfa1e223a
3 changed files with 634 additions and 88 deletions

View File

@ -1,5 +1,5 @@
<template>
<a-list item-layout="horizontal" :data-source="messageList">
<a-list item-layout="horizontal" :data-source="messageList" :locale="locale">
<template #loadMore>
<div
v-if="messageList && messageList.length > 0 && !loadEndStatus && !loadingMoreStatus"
@ -16,12 +16,23 @@
</template>
<template #renderItem="{ item }">
<a-list-item>
<a-list-item :style="{ background: item?.izTop && item.izTop == 1 ? '#f7f7f7' : 'auto' }">
<template #actions>
<a-rate :value="item.starFlag=='1'?1:0" :count="1" @click="clickStar(item)" style="cursor: pointer" disabled />
</template>
<a-list-item-meta :description="item.createTime">
<!-- update-begin-author:taoyan date:2023-5-10 for: QQYUN-4744系统通知6系统通知@人后对方看不到是哪个表单@没有超链接 -->
<a-list-item-meta>
<template #description>
<div v-if="isFormComment(item)" style="background: #f7f7f7;color: #555;padding: 2px 5px;white-space:nowrap;overflow: hidden">
<div v-html="getHtml(item.msgContent)"></div>
</div>
<div>
{{item.createTime}}
</div>
</template>
<!-- update-end-author:taoyan date:2023-5-10 for: QQYUN-4744系统通知6系统通知@人后对方看不到是哪个表单@没有超链接 -->
<template #title>
<div style="position: relative">
<!-- <span style="display: inline-block; position: absolute; left: -16px">
@ -29,16 +40,17 @@
</span>-->
<span>{{ getMsgCategory(item) }}</span>
<span v-if="item.busType == 'bpm'" class="bpm-cuiban-content" v-html="item.msgContent">
<span v-if="item.busType == 'bpm' || item.busType == 'bpm_cc' || item.busType == 'msg_node' || item.busType == 'bpm_msg_node'" class="bpm-cuiban-content" v-html="item.msgContent">
</span>
<a-tooltip v-else>
<template #title>
<div v-html="item.msgContent"></div>
</template>
{{ item.titile }}
</a-tooltip>
<!-- <a-tooltip v-else>-->
<!-- <template #title>-->
<!-- <div v-html="item.msgContent"></div>-->
<!-- </template>-->
<!-- {{ item.titile }}-->
<!-- </a-tooltip>-->
<span v-else>{{ item.titile }}</span>
<a @click="showMessageDetail(item)" style="margin-left: 16px">查看详情</a>
<a @click="showMessageDetail(item)" style="margin-left: 16px">{{ getHrefText(item) }}</a>
</div>
</template>
<template #avatar>
@ -62,7 +74,7 @@
</a-badge>
<a-avatar v-else style="background: #79919d"><alert-outlined style="font-size: 16px"/></a-avatar>
</template>
<template v-else>
<a-badge dot v-if="noRead(item)" class="msg-no-read">
<a-avatar style="background: #79919d"><bell-filled style="font-size: 16px" title="未读消息"/></a-avatar>
@ -74,14 +86,21 @@
</a-list-item>
</template>
</a-list>
<!-- update-begin-author:liusq date:2023-10-26 for: [QQYUN-6713]系统通知打开弹窗修改 -->
<keep-alive>
<component v-if="currentModal" v-bind="bindParams" :key="currentModal" :is="currentModal" @register="modalRegCache[currentModal].register" />
</keep-alive>
<!-- update-end-author:liusq date:2023-10-26 for: [QQYUN-6713]系统通知打开弹窗修改 -->
</template>
<script>
import { FilterOutlined, CloseOutlined, BellFilled, ExclamationOutlined, MailOutlined,InteractionOutlined, AlertOutlined } from '@ant-design/icons-vue';
import { useSysMessage, useMessageHref } from './useSysMessage';
import {getGloablEmojiIndex, useEmojiHtml} from "/@/components/jeecg/comment/useComment";
import { ref, h, watch } from "vue";
export default {
name: 'SysMessageList',
components: {
@ -91,23 +110,41 @@
ExclamationOutlined,
MailOutlined,
InteractionOutlined,
AlertOutlined
AlertOutlined,
},
props:{
star: {
type:Boolean,
default: false
}
},
isLowApp:{
type:Boolean,
default: false
},
messageCount: {
type: Number,
default: 0
},
cancelStarAfterDel: {
type: Boolean,
default: false,
},
},
emits:['close', 'detail'],
emits:['close', 'detail', 'clear', 'close-modal'],
setup(props, {emit}){
const { messageList,loadEndStatus,loadingMoreStatus,onLoadMore,noRead, getMsgCategory, searchParams, reset, loadData, updateStarMessage } = useSysMessage();
const { messageList,loadEndStatus,loadingMoreStatus,onLoadMore,noRead, getMsgCategory, getHrefText, searchParams, reset, loadData, updateStarMessage } = useSysMessage(setLocaleText);
//
const messageCount = ref(0);
function reload(params){
let { fromUser, rangeDateKey, rangeDate } = params;
let { fromUser, rangeDateKey, rangeDate, noticeType } = params;
searchParams.fromUser = fromUser||'';
searchParams.rangeDateKey = rangeDateKey||'';
searchParams.rangeDate = rangeDate||[];
searchParams.noticeType = noticeType || '';
//list
locale.value = { locale: { emptyText: `<a-empty />` }};
if(props.star===true){
searchParams.starFlag = '1'
}else{
@ -116,25 +153,84 @@
reset();
loadData();
}
function clickStar(item){
console.log(item)
updateStarMessage(item);
// update-begin--author:liaozhiyang---date:20240717---forTV360X-349-tab
if (item.starFlag == '1' && props.cancelStarAfterDel) {
const findIndex = messageList.value.findIndex((item) => item.id === item.id);
if (findIndex !== -1) {
messageList.value.splice(findIndex, 1);
return;
}
}
// update-end--author:liaozhiyang---date:20240717---forTV360X-349-tab
if(item.starFlag=='1'){
item.starFlag = '0'
}else{
item.starFlag = '1'
}
}
const { goPage } = useMessageHref(emit);
// update-begin-author:taoyan date:2023-5-10 for: QQYUN-47446@@
const { goPage, currentModal, modalRegCache, bindParams, isFormComment } = useMessageHref(emit, props);
//const emojiIndex = inject('$globalEmojiIndex')
const emojiIndex = getGloablEmojiIndex()
const { getHtml } = useEmojiHtml(emojiIndex);
// update-end-author:taoyan date:2023-5-10 for: QQYUN-47446@@
function showMessageDetail(record){
record.readFlag = '1'
goPage(record);
emit('close', record.id)
//update-begin---author:wangshuai---date:2024-06-11---for:TV360X-791---
if(record.busType==='email'){
emit('close-modal')
}
//update-end---author:wangshuai---date:2024-06-11---for:TV360X-791---
}
//list
const locale = ref({});
/**
* 未读点击事件
*/
function noReadClick() {
emit('clear')
}
/**
* 设置list为空的时候提示文本
*
*/
function setLocaleText() {
//update-begin---author:wangshuai---date:2024-04-24---for:QQYUN-9105---
let rangeDateKey = searchParams.rangeDateKey;
let value = messageCount.value;
if (value > 0 && !props.star && rangeDateKey && rangeDateKey === '7day') {
//update-end---author:wangshuai---date:2024-04-24---for:QQYUN-9105---
locale.value = {
emptyText: h(
'span',
{
style: {'color': 'rgb(255,154,0)', 'cursor': 'pointer', 'text-align': 'left', 'display': 'block'},
onClick: () => {
noReadClick();
},
}, `还剩余未读消息(${value > 99 ? '99+' : value})`)
}
} else {
locale.value = { locale: {emptyText: `<a-empty />` }};
}
}
//
watch(() => props.messageCount, (value) => {
messageCount.value = value;
}, { immediate: true })
return {
messageList,
loadEndStatus,
@ -142,11 +238,18 @@
onLoadMore,
noRead,
getMsgCategory,
getHrefText,
reload,
clickStar,
showMessageDetail
}
}
showMessageDetail,
isFormComment,
getHtml,
modalRegCache,
currentModal,
bindParams,
locale,
};
},
};
</script>

View File

@ -65,7 +65,7 @@
<a-button v-else type="dashed" shape="circle" @click="openSelectPerson">
<plus-outlined />
</a-button>
</span>
</div>
<div class="search-date">
@ -81,14 +81,32 @@
</div>
</div>
</div>
<div class="search-date">
<div class="date-label">类型</div>
<div class="date-tags">
<div class="tags-container">
<div v-for="item in noticeTypeOption" :class="item.active == true ? 'tag active flex' : 'tag flex'" @click="handleClickNoticeType(item)">
<img class="notice-type-img" v-if="item.img" :src="item.img" />
{{ item.text }}
</div>
</div>
</div>
</div>
</template>
<span v-if="conditionStr" class="anticon filtera">
<filter-outlined />
<span style="font-size:12px;margin-left: 3px">{{conditionStr}}</span>
<span style="display: flex;margin:0 5px;"><close-outlined style="font-size: 12px" @click="clearAll"/></span>
<img v-if="noticeImg" :src="noticeImg" class="notice-type-header-img">
<filter-outlined v-else/>
<span style="font-size:12px;margin-left: 3px;position: relative;">{{conditionStr}}</span>
<span style="display: flex;margin:0 5px;">
<svg @click="clearAll" t="1715689724802" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10694" width="14" height="14"><path d="M624.593455 23.272727a93.090909 93.090909 0 0 1 93.090909 93.090909v168.587637l143.406545 0.023272a116.363636 116.363636 0 0 1 116.247273 111.313455l0.116363 5.050182V861.090909a116.363636 116.363636 0 0 1-116.363636 116.363636H162.909091a116.363636 116.363636 0 0 1-116.363636-116.363636V401.338182a116.363636 116.363636 0 0 1 116.363636-116.363637l146.664727-0.023272V116.363636a93.090909 93.090909 0 0 1 88.459637-92.974545l4.654545-0.116364zM139.636364 581.818182v279.272727a23.272727 23.272727 0 0 0 23.272727 23.272727h302.545454v-162.909091a46.545455 46.545455 0 1 1 93.09091 0v162.909091h93.090909v-162.909091a46.545455 46.545455 0 1 1 93.090909 0v162.909091h116.363636a23.272727 23.272727 0 0 0 23.272727-23.272727V581.818182H139.636364z m0-93.090909h744.727272v-87.389091a23.272727 23.272727 0 0 0-23.272727-23.272727h-166.679273a69.818182 69.818182 0 0 1-69.818181-69.818182V116.363636h-221.905455v191.883637a69.818182 69.818182 0 0 1-69.818182 69.818182H162.909091a23.272727 23.272727 0 0 0-23.272727 23.272727V488.727273z" fill="currentColor" p-id="10695"></path></svg>
</span>
</span>
<filter-outlined v-else/>
<div v-else style="align-content: center;">
<img v-if="noticeImg" :src="noticeImg" class="notice-type-header-img" style="position: relative;top: -2px">
<filter-outlined v-else />
</div>
</a-popover>
<close-outlined @click="closeModal" />
</div>
@ -103,12 +121,12 @@
</template>
<a-tab-pane tab="全部消息" key="all" forceRender>
<sys-message-list ref="allMessageRef" @close="hrefThenClose" @detail="showDetailModal"/>
<sys-message-list :isLowApp="isLowApp" ref="allMessageRef" @close="hrefThenClose" @detail="showDetailModal" @clear="clearAll" :messageCount="messageCount" @closeModal="closeModal"/>
</a-tab-pane>
<!-- 标星 -->
<a-tab-pane tab="标星消息" key="star" forceRender>
<sys-message-list ref="starMessageRef" star @close="hrefThenClose" @detail="showDetailModal"/>
<sys-message-list :isLowApp="isLowApp" ref="starMessageRef" star @close="hrefThenClose" @detail="showDetailModal" @clear="clearAll" :messageCount="messageCount" @closeModal="closeModal" :cancelStarAfterDel="true"/>
</a-tab-pane>
</a-tabs>
</div>
@ -116,7 +134,7 @@
<user-select-modal isRadioSelection :showButton="false" labelKey="realname" rowKey="username" @register="regModal" @getSelectResult="getSelectedUser"></user-select-modal>
<DetailModal @register="registerDetail" :zIndex="1001"/>
<DetailModal @register="registerDetail" :zIndex="1001" @close="handleDetailColse"/>
</template>
<script>
@ -128,7 +146,10 @@
import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue'
import DetailModal from '/@/views/monitor/mynews/DetailModal.vue';
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
import calendar from '/@/assets/icons/calendarNotice.png';
import folder from '/@/assets/icons/folderNotice.png';
import system from '/@/assets/icons/systemNotice.png';
import flow from '/@/assets/icons/flowNotice.png';
export default {
name: 'SysMessageModal',
components: {
@ -138,16 +159,35 @@
BellFilled,
ExclamationOutlined,
JSelectUser,
// update-begin--author:liaozhiyang---date:20240308---forQQYUN-8241emoji-mart-vue-fast
SysMessageList: createAsyncComponent(() => import('./SysMessageList.vue')),
// SysMessageList,
// update-end--author:liaozhiyang---date:20240308---forQQYUN-8241emoji-mart-vue-fast
UserSelectModal,
PlusOutlined,
DetailModal
},
props:{
messageCount: {
type: Number,
default: 0
}
},
emits:['register', 'refresh'],
setup(_p, {emit}) {
const allMessageRef = ref();
const starMessageRef = ref();
const activeKey = ref('all');
//
const noticeType = ref('');
//
const noticeTypeOption = reactive([
{ key: 'system', text: '系统通知', active: false, img: system },
{ key: 'flow', text: '流程通知', active: false, img: flow },
{ key: 'plan', text: '日程通知', active: false, img: calendar },
{ key: 'file', text: '知识通知', active: false, img: folder },
]);
const noticeImg = ref('');
function handleChangeTab(e, key) {
activeKey.value = key;
loadData();
@ -155,7 +195,7 @@
function handleChangePanel(key) {
activeKey.value = key;
}
//
const searchParams = reactive({
fromUser: '',
@ -169,6 +209,7 @@
fromUser: searchParams.fromUser,
rangeDateKey: searchParams.rangeDateKey,
rangeDate: searchParams.rangeDate,
noticeType: noticeType.value ? noticeType.value:''
}
if(activeKey.value == 'all'){
getRefPromise(allMessageRef).then(() => {
@ -178,15 +219,36 @@
starMessageRef.value.reload(params);
}
}
const isLowApp = ref(false);
//useModalInner
const [registerModal, { closeModal }] = useModalInner(async (data) => {
showSearch.value = false
if(data.noticeType){
noticeType.value = data.noticeType;
//update-begin---author:wangshuai---date:2025-07-01---for:QQYUN-12998---
for (const item of noticeTypeOption) {
if(item.key === data.noticeType){
item.active = true;
noticeImg.value = item.img;
}else{
item.active = false;
}
}
//update-end---author:wangshuai---date:2025-07-01---for:QQYUN-12998---
delete data.noticeType;
}
//
loadData();
if(data){
isLowApp.value = data.isLowApp||false
}else{
isLowApp.value = false;
}
});
const showSearch = ref(false);
function handleChangeSearchPerson(value, a) {
console.log('选择改变', value, a);
showSearch.value = true;
@ -239,12 +301,12 @@
searchParams.rangeDate = [...dateStringArray]
loadData();
}
function hrefThenClose(id){
emit('refresh', id)
// closeModal();
}
//
const conditionStr = computed(()=>{
const { fromUser, rangeDateKey, realname } = searchParams;
@ -273,16 +335,32 @@
searchParams.realname = options[0].label;
}
}
function openSelectPerson(){
openModal(true, {})
}
function clearSearchParamsUser(){
searchParams.fromUser = ''
searchParams.realname = ''
}
function clearAll(){
searchParams.fromUser='';
searchParams.realname='';
searchParams.rangeDateKey='';
searchParams.rangeDate=[];
for (let a of dateTags) {
a.active = false;
}
noticeType.value = "";
noticeImg.value = "";
for (const item of noticeTypeOption) {
item.active = false;
}
loadData();
}
function getRefPromise(componentRef) {
return new Promise((resolve) => {
(function next() {
@ -297,22 +375,36 @@
})();
});
}
function clearAll(){
searchParams.fromUser='';
searchParams.realname='';
searchParams.rangeDateKey='';
searchParams.rangeDate=[];
for (let a of dateTags) {
a.active = false;
}
loadData();
}
const [registerDetail, { openModal: openDetailModal }] = useModal();
function showDetailModal(record){
openDetailModal(true, {record: unref(record), isUpdate: true})
}
function handleDetailColse(){
loadData();
}
/**
* 只是通知
* @param item
*/
function handleClickNoticeType(item) {
for (let a of noticeTypeOption) {
if(a.key !== item.key){
a.active = false;
}
}
item.active = !item.active;
if(item.active === false){
noticeType.value = "";
noticeImg.value = "";
}else{
noticeType.value = item.key;
noticeImg.value = item.img;
}
loadData();
}
return {
conditionStr,
regModal,
@ -320,7 +412,7 @@
openSelectPerson,
clearSearchParamsUser,
clearAll,
registerModal,
activeKey,
handleChangePanel,
@ -340,8 +432,12 @@
allMessageRef,
starMessageRef,
registerDetail,
showDetailModal
showDetailModal,
isLowApp,
handleDetailColse,
noticeTypeOption,
handleClickNoticeType,
noticeImg,
};
},
};
@ -354,7 +450,7 @@
100%{transform:translateY(600px);}
}
.sys-msg-modal {
.ant-modal-header {
padding-bottom: 0;
@ -383,13 +479,13 @@
display: inline-block;
width: 220px;
vertical-align: top;
.icons {
display: flex;
height: 100%;
flex-direction: row;
justify-content: flex-end;
> span.anticon {
padding: 10px;
display: inline-block;
@ -407,7 +503,7 @@
line-height: 25px;
//color: #2196f3;
display: flex;
>span.anticon{
height: auto;
line-height: 9px;
@ -415,7 +511,7 @@
}
}
}
}
.ant-tabs-nav-wrap {
@ -521,3 +617,23 @@
}
}
</style>
<style lang="less" scoped>
.notice-type-img{
width: 16px;
height: 16px;
position: relative;
top: 2px;
margin-right: 1px;
}
.notice-type-header-img{
width: 16px;
height: 16px;
position: relative;
left: 2px;
top: 1px;
}
.flex{
display: flex;
flex: unset;
}
</style>

View File

@ -1,4 +1,4 @@
import { ref, reactive } from 'vue';
import { ref, reactive, nextTick } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { getDictItemsByCode } from '/@/utils/dict/index';
import { useRouter, useRoute } from 'vue-router'
@ -18,8 +18,10 @@ const queryMessageList = (params) => {
/**
* 获取消息列表数据
*
* setLocaleText 设置未读消息
*/
export function useSysMessage() {
export function useSysMessage(setLocaleText) {
const { createMessage } = useMessage();
const rangeDateArray = getDictItemsByCode('rangeDate');
console.log('+++++++++++++++++++++');
@ -29,17 +31,18 @@ export function useSysMessage() {
const messageList = ref<any[]>([]);
const pageNo = ref(1)
let pageSize = 10;
const searchParams = reactive({
fromUser: '',
rangeDateKey: '',
rangeDate: [],
starFlag: ''
starFlag: '',
noticeType: ''
});
function getQueryParams() {
let { fromUser, rangeDateKey, rangeDate, starFlag } = searchParams;
let { fromUser, rangeDateKey, rangeDate, starFlag, noticeType } = searchParams;
let params = {
fromUser,
starFlag,
@ -47,7 +50,8 @@ export function useSysMessage() {
beginDate: '',
endDate: '',
pageNo: pageNo.value,
pageSize
pageSize,
noticeType
};
if (rangeDateKey == 'zdy') {
params.beginDate = rangeDate[0]+' 00:00:00';
@ -58,7 +62,7 @@ export function useSysMessage() {
//
const loadEndStatus = ref(false);
//
async function loadData() {
if(loadEndStatus.value === true){
@ -69,6 +73,7 @@ export function useSysMessage() {
console.log('获取结果', data);
if(!data || data.length<=0){
loadEndStatus.value = true;
setLocaleText();
return;
}
if(data.length<pageSize){
@ -78,6 +83,7 @@ export function useSysMessage() {
let temp:any[] = messageList.value;
temp.push(...data);
messageList.value = temp;
setLocaleText();
}
//
@ -86,7 +92,7 @@ export function useSysMessage() {
pageNo.value = 1;
loadEndStatus.value = false;
}
//
async function updateStarMessage(item){
const url = '/sys/sysAnnouncementSend/edit';
@ -139,7 +145,27 @@ export function useSysMessage() {
}
return '';
}
// QQYUN-4472 --
function getHrefText(item) {
if(item.busType === 'bpm'|| item.busType === 'bpm_task' || item.busType === 'tenant_invite'){
//
if (item.msgAbstract) {
try {
const json = JSON.parse(item.msgAbstract);
if (json.taskDetail) {
return '查看详情';
}
} catch (e) {
console.error('getHrefText:msgAbstract参数不是JSON格式', item.msgAbstract);
}
}
return '去处理'
}else{
return '查看详情'
}
}
return {
messageList,
reset,
@ -147,11 +173,11 @@ export function useSysMessage() {
loadEndStatus,
searchParams,
updateStarMessage,
onLoadMore,
noRead,
getMsgCategory,
getHrefText
};
}
@ -159,14 +185,115 @@ export function useSysMessage() {
* 用于消息跳转
*/
export function useMessageHref(emit, props){
//const [registerHistoryModal, { openModal: openHistoryModal }] = useModal();
//const [registerTaskModal, { openModal: openTaskModal }] = useModal();
//
//const [registerDesignFormModal, { openModal: openDesignFormModal }] = useModal();
const messageHrefArray: any[] = getDictItemsByCode('messageHref');
const router = useRouter();
const appStore = useAppStore();
const rt = useRoute();
const { close: closeTab, closeSameRoute } = useTabs();
// const defaultPath = '/monitor/mynews';
//*********************************[QQYUN-6713]begin******************************************
//
const currentModal = ref<string | null>(null);
//
const modalParams = ref<Recordable>({});
//
const modalRegCache = ref<Recordable>({});
//
const bindParams = ref<Recordable>({});
/**
* 根据类型打开不同弹窗
* @param type
* @param params
*/
async function handleOpenType(type, params) {
currentModal.value = null;
modalParams.value = { ...params };
switch (type) {
case 'task':
//
bindParams.value = { actionType: 'todo' };
currentModal.value = 'ProcessTaskHandleModal';
break;
case 'history':
bindParams.value = {};
//
currentModal.value = 'MyTaskHandleModal';
break;
case 'design':
//
currentModal.value = 'DesformViewModal';
bindParams.value = {
showRecordCopy: false,
showRecordShare: false,
showRecordSysPrint: false,
showDesignFormBtn: false,
};
break;
case 'cgform':
//Online
currentModal.value = 'OnlineAutoModal';
bindParams.value = {
id: params.formId,
}
break;
default:
currentModal.value = null;
break;
}
//
initModalRegister();
await nextTick(() => {
if (modalRegCache.value[currentModal.value!]?.isRegister) {
console.log('已注冊,走缓存');
modalRegCache.value[currentModal.value!].modalMethods.openModal(true, modalParams.value);
}
});
}
/**
* 初始化弹窗注册
*/
function initModalRegister() {
//null
if (!currentModal.value) {
return;
}
//
if (!modalRegCache.value[currentModal.value]) {
const [registerModal, modalMethods] = useModal();
modalRegCache.value[currentModal.value] = {
isRegister: false,
register: bindRegisterModal(registerModal, modalMethods),
modalMethods,
};
}
}
/**
* 绑定注册弹窗
* @param regFn
* @param modalMethod
*/
function bindRegisterModal(regFn, modalMethod) {
return async (...args) => {
console.log('开始注册:', currentModal.value);
await regFn(...args);
console.log('注册完成:', currentModal.value);
//
modalMethod.openModal(true, modalParams.value);
//
modalRegCache.value[currentModal.value!].isRegister = true;
};
}
//*************************************[QQYUN-6713]end*********************************************
// const defaultPath = '/monitor/mynews';
//const bpmPath = '/task/handle/'
async function goPage(record, openModalFun?){
if(!record.busType || record.busType == 'msg_node'){
if(!openModalFun){
@ -176,8 +303,38 @@ export function useMessageHref(emit, props){
// modal
openModalFun()
}
// update-begin-author:taoyan date:2023-5-10 for: QQYUN-47446@@
}else if(record.busType == 'comment'){
// de
let msgAbstract = record.msgAbstract;
if(msgAbstract){
try {
let data = JSON.parse(msgAbstract.toString());
if(data.type == 'designForm'){
showDesignFormModal(data);
} else {
showOnlineCgformModal(data);
}
}catch (e) {
console.error('打开评论表单但是msgAbstract参数不是JSON格式', msgAbstract)
if(openModalFun){
openModalFun();
}
}
}
// update-end-author:taoyan date:2023-5-10 for: QQYUN-47446@@
}else if(record.busType == 'tenant_invite'){
if(props.isLowApp===true){
router.push({ name:"myapps-settings-user", query:{ page:'tenantSetting' }})
}else{
router.push({ name:"system-usersetting", query:{ page:'tenantSetting' }})
}
}else{
await goPageWithBusType(record)
if(props && props.isLowApp===true){
openLowAppFlowModal(record)
}else{
await goPageWithBusType(record)
}
}
/* busId: "1562035005173587970"
busType: "email"
@ -185,6 +342,95 @@ export function useMessageHref(emit, props){
openType: "component"*/
}
/**
* 打开表单设计器 表单弹窗
* @param data
*/
function showDesignFormModal(data) {
handleOpenType('design', {
mode: 'detail',
desformCode: data.code,
dataId: data.dataId,
isOnline: false,
});
}
/**
* 打开Online表单 弹窗
* @param data
*/
function showOnlineCgformModal(data) {
handleOpenType('cgform', {
formId: data.formId,
isUpdate: true,
disableSubmit: true,
record: {
id: data.dataId,
},
});
}
/**
* 判断是不是表单的评论消息
* @param record
*/
function isFormComment(record) {
if(record.busType == 'comment'){
let msgAbstract = record.msgAbstract;
if(msgAbstract){
try {
let data = JSON.parse(msgAbstract);
if(['cgform', 'designForm'].includes(data.type)){
return true
}
}catch (e) {
console.error('打开评论表单但是msgAbstract参数不是JSON格式', msgAbstract)
}
}
}
return false
}
/**
* 如果是工作流任务 在lowApp中 直接打开modal
*/
function openLowAppFlowModal(record){
const { busType, busId, msgAbstract } = record;
let temp = messageHrefArray.filter(item=>item.value === busType);
if(!temp || temp.length==0){
console.error('当前业务类型不识别', busType);
return;
}
if(busType.indexOf('bpm')<0){
console.error('low-app不支持跳转邮箱', busType);
return;
}
// detailId
let query:any = {
detailId: busId
};
//
if(msgAbstract){
try {
let json = JSON.parse(msgAbstract);
Object.keys(json).map(k=>{
query[k] = json[k]
});
}catch (e) {
console.error('msgAbstract参数不是JSON格式', msgAbstract)
}
}
console.log("busType = ", busType)
handleOpenType('task', {
record: {
id: busId,
procInsId: query.procInsId,
processDefinitionId: query.processDefinitionId,
isDetail: query.taskDetail || 'bpm_cc' == busType
}
})
}
/**
* 根据busType不同跳转不同页面
* @param record
@ -213,14 +459,19 @@ export function useMessageHref(emit, props){
console.error('msgAbstract参数不是JSON格式', msgAbstract)
}
}
//
appStore.setMessageHrefParams(query);
if(rt.path.indexOf(path)>=0){
await closeTab();
await router.replace({ path: path, query:{ time: new Date().getTime() } });
if(query.taskDetail){
//
await showHistory(query.procInsId)
}else{
closeSameRoute(path)
await router.push({ path: path });
//
appStore.setMessageHrefParams(query);
if(rt.path.indexOf(path)>=0){
await closeTab();
await router.replace({ path: path, query:{ time: new Date().getTime() } });
}else{
closeSameRoute(path)
await router.push({ path: path });
}
}
}
@ -232,8 +483,84 @@ export function useMessageHref(emit, props){
//
emit('detail', record)
}
//===============================================================================================================
//update-begin-author:taoyan date:2022-12-31 for: QQYUN-3485
async function showHistory(processInstanceId) {
let { formData, formUrl } = await getTaskInfoForHistory({ processInstanceId });
formData['PROCESS_TAB_TYPE'] = 'history';
handleOpenType('history', {
formData,
formUrl,
title: '流程历史',
});
}
const nodeInfoUrl = '/act/process/extActProcessNode/getHisProcessNodeInfo'
const taskNodeInfo = (params) => defHttp.get({ url: nodeInfoUrl, params });
async function getTaskInfoForHistory(record) {
//
let params = { procInstId: record.processInstanceId };
const result = await taskNodeInfo(params);
console.log('获取历史任务信息', result);
let formData: any = {
dataId: result.dataId,
taskId: record.id,
taskDefKey: record.taskId,
procInsId: record.processInstanceId,
tableName: result.tableName,
vars: result.records,
};
let tempFormUrl = result.formUrl;
console.log('获取流程节点表单URL', tempFormUrl);
//URLVUE
if (tempFormUrl && tempFormUrl.indexOf('?') != -1 && !isURL(tempFormUrl) && tempFormUrl.indexOf('{{DOMAIN_URL}}') == -1) {
tempFormUrl = result.formUrl.split('?')[0];
console.log('获取流程节点表单URL去掉参数', tempFormUrl);
formData.extendUrlParams = getQueryVariable(result.formUrl);
}
return {
formData,
formUrl: tempFormUrl,
};
}
/**
* 获取URL上参数
* @param url
*/
function getQueryVariable(url) {
if (!url) return;
let t,
n,
r,
i = url.split('?')[1],
s = {};
(t = i.split('&')), (r = null), (n = null);
for (let o in t) {
let u = t[o].indexOf('=');
u !== -1 && ((r = t[o].substr(0, u)), (n = t[o].substr(u + 1)), (s[r] = n));
}
return s;
}
/**
* URL地址
* @param {*} s
*/
function isURL(s) {
return /^http[s]?:\/\/.*/.test(s);
}
//update-end-author:taoyan date:2022-12-31 for: QQYUN-3485
//===============================================================================================================
return {
goPage
goPage,
isFormComment,
modalRegCache,
currentModal,
bindParams,
}
}