--添加测试模块
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<BasicForm @register="registerForm" />
|
||||
<!-- <BasicForm @register="registerForm" /> -->
|
||||
|
||||
<div :class="`${prefixCls}__footer`">
|
||||
<a-button type="primary" block class="mt-2" @click="handleLock">
|
||||
@ -44,7 +44,7 @@
|
||||
const userStore = useUserStore();
|
||||
const lockStore = useLockStore();
|
||||
|
||||
const getRealName = computed(() => userStore.getUserInfo?.realName);
|
||||
const getRealName = computed(() => userStore.getUserInfo?.name);
|
||||
const [register, { closeModal }] = useModalInner();
|
||||
|
||||
const [registerForm, { validateFields, resetFields }] = useForm({
|
||||
@ -63,15 +63,14 @@
|
||||
});
|
||||
|
||||
async function handleLock() {
|
||||
const values = (await validateFields()) as any;
|
||||
const password: string | undefined = values.password;
|
||||
// const values = (await validateFields()) as any;
|
||||
// const password: string | undefined = values.password;
|
||||
closeModal();
|
||||
|
||||
lockStore.setLockInfo({
|
||||
isLock: true,
|
||||
pwd: password,
|
||||
});
|
||||
await resetFields();
|
||||
// await resetFields();
|
||||
}
|
||||
|
||||
const avatar = computed(() => {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { is } from '/@/utils/is';
|
||||
const { t } = useI18n();
|
||||
export interface ListItem {
|
||||
id: string;
|
||||
@ -18,6 +19,7 @@ export interface ListItem {
|
||||
processId?: string;
|
||||
schemaId?: string;
|
||||
timeFormat?: string;
|
||||
isRead?: number;
|
||||
}
|
||||
|
||||
export interface TabItem {
|
||||
@ -55,4 +57,10 @@ export const tabListData: TabItem[] = [
|
||||
read: [],
|
||||
unreadNum: 0,
|
||||
},
|
||||
{
|
||||
key: '5',
|
||||
name: t('系统通知'),
|
||||
list: [],
|
||||
unreadNum: 0,
|
||||
},
|
||||
];
|
||||
|
||||
@ -72,6 +72,33 @@
|
||||
<span @click="setReadAll(item.key)">{{ t('全部设置已读') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--系统通知消息-->
|
||||
<div v-else-if="item.key === '5'" class="h-88">
|
||||
<div v-if="item.list.length > 0" class="h-82">
|
||||
<div
|
||||
class="list-item readed-mark"
|
||||
v-for="it in item.list"
|
||||
:key="it.id"
|
||||
:class="it.isRead === 1 ? 'readed' : ''"
|
||||
@click="
|
||||
() => {
|
||||
it.isRead = 1;
|
||||
setReadSingle(it.id, item.key);
|
||||
goToRouter(it);
|
||||
}
|
||||
"
|
||||
>
|
||||
<span class="list-item-title" style="width: 220px;">
|
||||
<a-tooltip>
|
||||
<template #title>{{ it.title }}</template>
|
||||
{{ it.title }}
|
||||
</a-tooltip>
|
||||
</span>
|
||||
<span class="list-item-time">{{ it.createDate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a-empty :image="simpleImage" v-else/>
|
||||
</div>
|
||||
<div v-else class="h-88">
|
||||
<div v-if="item.list.length > 0" class="h-82">
|
||||
<div
|
||||
@ -138,6 +165,7 @@
|
||||
import { tabListData } from './data';
|
||||
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
|
||||
import {
|
||||
getOaMessage,
|
||||
@ -149,11 +177,14 @@
|
||||
setScheduleRead,
|
||||
setScheduleReadAll,
|
||||
} from '/@/api/system/login';
|
||||
import {queryLoginUserNotices, setSystemNoticeRead} from '/@/api/system/systemNotice/index'
|
||||
import { getInfoByDownloadUrl } from '/@/api/system/file';
|
||||
import { Empty } from 'ant-design-vue';
|
||||
|
||||
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
|
||||
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import {useRouter } from 'vue-router';
|
||||
const { t } = useI18n();
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@ -166,6 +197,7 @@
|
||||
LookProcess,
|
||||
},
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const Approval = ref<{
|
||||
taskId?: string;
|
||||
processId?: string;
|
||||
@ -196,87 +228,97 @@
|
||||
if (o.read) o.read = [];
|
||||
});
|
||||
try {
|
||||
let res = import.meta.env.VITE_GLOB_DISABLE_NEWS ? [] : await getOaNews(1);
|
||||
res.list.forEach((o) => {
|
||||
if (!o.readId) listData.value[0].unreadNum += 1;
|
||||
listData.value[0].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.briefHead,
|
||||
description: '',
|
||||
datetime: o.releaseTime,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
if(import.meta.env.VITE_GLOB_DISABLE_NEWS !== 'true') {
|
||||
let res = await getOaNews(1);
|
||||
res.list.forEach((o) => {
|
||||
if (!o.readId) listData.value[0].unreadNum += 1;
|
||||
listData.value[0].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.briefHead,
|
||||
description: '',
|
||||
datetime: o.releaseTime,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
});
|
||||
});
|
||||
});
|
||||
let res1 = import.meta.env.VITE_GLOB_DISABLE_NEWS ? [] : await getOaNews(2);
|
||||
res1.list.forEach((o) => {
|
||||
if (!o.readId) listData.value[1].unreadNum += 1;
|
||||
listData.value[1].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.briefHead,
|
||||
description: '',
|
||||
datetime: o.releaseTime,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
let res1 = await getOaNews(2);
|
||||
res1.list.forEach((o) => {
|
||||
if (!o.readId) listData.value[1].unreadNum += 1;
|
||||
listData.value[1].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.briefHead,
|
||||
description: '',
|
||||
datetime: o.releaseTime,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
});
|
||||
});
|
||||
});
|
||||
let res2 = import.meta.env.VITE_GLOB_DISABLE_NEWS ? [] : await getOaMessage();
|
||||
res2.forEach((o) => {
|
||||
if (o.messageType === 0) {
|
||||
if (!o.isRead) listData.value[2].unreadNum += 1;
|
||||
listData.value[2].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
});
|
||||
} else if (o.messageType == 1) {
|
||||
if (!o.isRead) listData.value[3].unreadNum += 1;
|
||||
listData.value[3].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
taskId: o.objectId,
|
||||
processId: o.processId,
|
||||
schemaId: o.schemaId,
|
||||
read: o.isRead,
|
||||
});
|
||||
} else if (o.messageType == 2) {
|
||||
if (!o.isRead) listData.value[3].unreadNum += 1;
|
||||
listData.value[3].read?.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
read: o.isRead,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
taskId: o.objectId,
|
||||
processId: o.processId,
|
||||
});
|
||||
}
|
||||
});
|
||||
let res2 = await getOaMessage();
|
||||
res2.forEach((o) => {
|
||||
if (o.messageType === 0) {
|
||||
if (!o.isRead) listData.value[2].unreadNum += 1;
|
||||
listData.value[2].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
read: o.isRead,
|
||||
});
|
||||
} else if (o.messageType == 1) {
|
||||
if (!o.isRead) listData.value[3].unreadNum += 1;
|
||||
listData.value[3].list.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
taskId: o.objectId,
|
||||
processId: o.processId,
|
||||
schemaId: o.schemaId,
|
||||
read: o.isRead,
|
||||
});
|
||||
} else if (o.messageType == 2) {
|
||||
if (!o.isRead) listData.value[3].unreadNum += 1;
|
||||
listData.value[3].read?.push({
|
||||
id: o.id,
|
||||
avatar: '',
|
||||
title: o.messageContent,
|
||||
description: '',
|
||||
datetime: o.sendTime,
|
||||
read: o.isRead,
|
||||
timeFormat: o.timeFormat,
|
||||
color: '',
|
||||
type: '3',
|
||||
taskId: o.objectId,
|
||||
processId: o.processId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//系统消息
|
||||
let res4 = import.meta.env.VITE_DISABLE_NOTE === 'true' ? {list:[]} : await queryLoginUserNotices({limit: 1, size: 10});
|
||||
listData.value[4].list = res4.list;
|
||||
listData.value[4].unreadNum = res4.list.filter((item) => item.isRead == 0).length;
|
||||
}
|
||||
|
||||
let res3 = await getScheduleMsg();
|
||||
res3.list.forEach((item) => (item.read = item.isRead));
|
||||
listData.value[2].unreadNum = res3.list.filter((x) => !x.isRead).length;
|
||||
listData.value[2].list.push(...res3.list);
|
||||
console.log('message', listData.value);
|
||||
} catch (error) {
|
||||
console.error('message error', error)
|
||||
clearInterval(times.value);
|
||||
}
|
||||
}
|
||||
@ -317,11 +359,26 @@
|
||||
await setScheduleRead([ids]);
|
||||
} else if (num == 4) {
|
||||
await setSingleRead(ids);
|
||||
} else if (num == 5) {
|
||||
await setSystemNoticeRead([ids]);
|
||||
} else {
|
||||
await setOaRead([ids]);
|
||||
}
|
||||
if (listData.value[num - 1].unreadNum > 0) listData.value[num - 1].unreadNum -= 1;
|
||||
}
|
||||
function goToRouter(record){
|
||||
if(record.type === '99') {
|
||||
//异步打包下载
|
||||
record.paramsJson = record.paramsJson ? JSON.parse(record.paramsJson) : {};
|
||||
let fileId = record.paramsJson.id || [];
|
||||
getInfoByDownloadUrl({id: fileId}).then((res)=>{
|
||||
let fileUrl = res.fileUrlFixed || res.fileUrl;
|
||||
downloadByUrl({ url: fileUrl, fileName: (res.fileName+res.fileType) || 'files.zip' });
|
||||
});
|
||||
return;
|
||||
}
|
||||
router.push(record.path)
|
||||
}
|
||||
onUnmounted(() => {
|
||||
clearInterval(times.value);
|
||||
});
|
||||
@ -358,6 +415,7 @@
|
||||
Approval,
|
||||
LookData,
|
||||
t,
|
||||
goToRouter,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
:width="24"
|
||||
:height="24"
|
||||
:src="getUserInfo.avatar"
|
||||
fallback="src/assets/images/header.jpg"
|
||||
:fallback="headerImg"
|
||||
/>
|
||||
</div>
|
||||
<span :class="`${prefixCls}__info hidden md:block`">
|
||||
|
||||
Reference in New Issue
Block a user