feat: 站内信工作流通知

This commit is contained in:
leiqiaochu 2023-11-01 11:32:50 +08:00
parent b79e345cc5
commit 33c92b72e1
5 changed files with 72 additions and 13 deletions

View File

@ -107,7 +107,10 @@ const getType = computed(() => {
return ['device-transparent-codec']; return ['device-transparent-codec'];
} else if (props.type === 'system-monitor') { } else if (props.type === 'system-monitor') {
return ['system-event']; return ['system-event'];
} else { } else if(props.type === 'workflow-notification'){
return ['workflow-task-cc','workflow-task-todo','workflow-task-completed']
}
else {
return [ return [
'alarm', 'alarm',
'alarm-product', 'alarm-product',

View File

@ -20,7 +20,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import NotificationRecord from './components/NotificationRecord/index.vue'; import NotificationRecord from './components/NotificationRecord/index.vue';
import { initData } from '../data'; import { getInitData } from '../data';
import { getAllNotice } from '@/api/account/center'; import { getAllNotice } from '@/api/account/center';
import { useRouterParams } from '@/utils/hooks/useParams'; import { useRouterParams } from '@/utils/hooks/useParams';
import { useUserInfo } from '@/store/userInfo'; import { useUserInfo } from '@/store/userInfo';
@ -28,7 +28,7 @@ import { useUserInfo } from '@/store/userInfo';
const tabs = ref<any[]>([]); const tabs = ref<any[]>([]);
const router = useRouterParams(); const router = useRouterParams();
const user = useUserInfo(); const user = useUserInfo();
let initData:any[]
const queryTypeList = () => { const queryTypeList = () => {
getAllNotice().then((resp: any) => { getAllNotice().then((resp: any) => {
if (resp.status === 200) { if (resp.status === 200) {
@ -73,6 +73,7 @@ watchEffect(() => {
}); });
onMounted(() => { onMounted(() => {
initData = getInitData()
queryTypeList(); queryTypeList();
}); });
</script> </script>

View File

@ -55,14 +55,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getAllNotice } from '@/api/account/center'; import { getAllNotice } from '@/api/account/center';
import { getNoticeList_api } from '@/api/account/notificationSubscription'; import { getNoticeList_api } from '@/api/account/notificationSubscription';
import { initData } from '../data'; import { getInitData } from '../data';
import Item from './components/Item.vue'; import Item from './components/Item.vue';
import { useMenuStore } from '@/store/menu';
const menuStore = useMenuStore();
const subscribe = ref<any[]>([]); const subscribe = ref<any[]>([]);
const dataSource = ref<any[]>([]); const dataSource = ref<any[]>([]);
const activeKey = ref<string[]>(['alarm', 'system-monitor', 'system-business']); const activeKey = ref<string[]>();
const loading = ref<boolean>(false) const loading = ref<boolean>(false)
let initData:any[]
const handleSearch = () => { const handleSearch = () => {
loading.value = true loading.value = true
getAllNotice().then((resp: any) => { getAllNotice().then((resp: any) => {
@ -105,6 +106,8 @@ const handleSearch = () => {
}; };
onMounted(() => { onMounted(() => {
activeKey.value = menuStore.hasMenu('code') ? ['alarm', 'system-monitor', 'system-business','workflow-notification'] : ['alarm', 'system-monitor', 'system-business']
initData = getInitData()
handleSearch(); handleSearch();
}); });
</script> </script>

View File

@ -1,4 +1,6 @@
const initData: any[] = [ import { useMenuStore } from '@/store/menu';
const menuStore = useMenuStore();
const systemNotice = [
{ {
provider: 'alarm', provider: 'alarm',
name: '告警', name: '告警',
@ -50,5 +52,26 @@ const initData: any[] = [
], ],
}, },
]; ];
const workflowNotice = [
export { initData }; {
provider: 'workflow-notification',
name: '工作流通知',
children: [
{
provider: 'workflow-task-cc',
name: '抄送通知',
},
{
provider: 'workflow-task-todo',
name: '待办通知'
},{
provider: 'workflow-task-completed',
name: '完成通知'
}
],
},
]
export const getInitData = () =>{
let initData:any[]
return initData = menuStore.hasMenu('code') ? [...systemNotice,...workflowNotice] : [...systemNotice]
}

View File

@ -54,8 +54,10 @@
<script lang="ts" setup> <script lang="ts" setup>
import { queryChannelConfig } from '@/api/system/noticeRule'; import { queryChannelConfig } from '@/api/system/noticeRule';
import Item from './components/Item/index.vue'; import Item from './components/Item/index.vue';
import { useMenuStore } from '@/store/menu';
const dataSource = [ const menuStore = useMenuStore();
let dataSource:any[] =[]
const systemNotice = [
{ {
provider: 'alarm', provider: 'alarm',
name: '告警', name: '告警',
@ -99,7 +101,27 @@ const dataSource = [
], ],
}, },
]; ];
const activeKey = ref<string[]>(['alarm', 'system-monitor', 'system-business']); const lowCodeNotice = [
{
provider: 'workflow-notification',
name: '工作流通知',
children: [
{
provider: 'workflow-task-cc',
name: '抄送通知',
},
{
provider: 'workflow-task-todo',
name: '待办通知'
},{
provider: 'workflow-task-completed',
name: '完成通知'
}
],
},
]
const activeKey = ref<string[]>();
const dataMap = new Map(); const dataMap = new Map();
@ -159,6 +181,13 @@ onMounted(() => {
// data.value = Array.from(dataMap).map((item) => { // data.value = Array.from(dataMap).map((item) => {
// return item?.[1]; // return item?.[1];
// }); // });
if(menuStore.hasMenu('code')){
dataSource = [...systemNotice,...lowCodeNotice]
activeKey.value = ['alarm', 'system-monitor', 'system-business','workflow-notification']
}else{
dataSource = [...systemNotice]
activeKey.value = ['alarm', 'system-monitor', 'system-business']
}
handleSearch(); handleSearch();
}); });
</script> </script>