qsh 7 days ago
parent d1c4632f72
commit a8e41fe889
  1. 29
      src/api/system/notify/message/index.ts
  2. 22
      src/layout/components/Message/src/Message.vue
  3. 2
      src/store/modules/app.ts
  4. 2
      src/store/modules/user.ts
  5. 12
      src/views/Basic/Role/Comp/RoleEmployee.vue

@ -1,5 +1,4 @@
import request from '@/config/axios' import request from '@/config/axios'
import qs from 'qs'
export interface NotifyMessageVO { export interface NotifyMessageVO {
id: number id: number
@ -16,35 +15,39 @@ export interface NotifyMessageVO {
} }
// 查询站内信消息列表 // 查询站内信消息列表
export const getNotifyMessagePage = async (params: PageParam) => { export const getNotifyMessagePage = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/page', params }) return await request.get({ url: '/admin-api/system/notify-message/page', params })
} }
// 获得我的站内信分页 // 获得我的站内信分页
export const getMyNotifyMessagePage = async (params: PageParam) => { export const getMyNotifyMessagePage = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/my-page', params }) return await request.get({ url: '/admin-api/system/notify-message/my-page', params })
} }
// 批量标记已读 // 批量标记已读
export const updateNotifyMessageRead = async (ids) => { export const updateNotifyMessageRead = async (data: any) => {
return await request.put({ return await request.put({
url: url: '/admin-api/system/notify-message/update-read?',
'/admin-api/system/notify-message/update-read?' + data
qs.stringify({ ids: ids }, { indices: false })
}) })
} }
// 标记所有站内信为已读 // 标记所有站内信为已读
export const updateAllNotifyMessageRead = async () => { export const updateAllNotifyMessageRead = async (data: any) => {
return await request.put({ url: '/admin-api/system/notify-message/update-all-read' }) return await request.put({ url: '/admin-api/system/notify-message/update-all-read', data })
} }
// 获取当前用户的最新站内信列表 // 获取当前用户的最新站内信列表
export const getUnreadNotifyMessageList = async () => { export const getUnreadNotifyMessageList = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-list' }) return await request.get({ url: '/admin-api/system/notify-message/get-unread-list', params })
} }
// 获得当前用户的未读站内信数量 // 获得当前用户的未读站内信数量
export const getUnreadNotifyMessageCount = async () => { export const getUnreadNotifyMessageCount = async (params: any) => {
return await request.get({ url: '/admin-api/system/notify-message/get-unread-count' }) return await request.get({ url: '/admin-api/system/notify-message/get-unread-count', params })
}
// 获取详情
export const getNotifyMessageDetail = async (id: number) => {
return await request.get({ url: '/admin-api/system/notify-message/get', params: { id } })
} }

@ -1,7 +1,9 @@
<script lang="ts" name="Message" setup> <script lang="ts" name="Message" setup>
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import * as NotifyMessageApi from '@/api/system/notify/message' // import * as NotifyMessageApi from '@/api/system/notify/message'
// import { useUserStore } from '@/store/modules/user'
// const userStore = useUserStore()
const { push } = useRouter() const { push } = useRouter()
const activeName = ref('notice') const activeName = ref('notice')
const unreadCount = ref(0) // const unreadCount = ref(0) //
@ -9,17 +11,21 @@ const list = ref<any[]>([]) // 消息列表
// //
const getList = async () => { const getList = async () => {
list.value = await NotifyMessageApi.getUnreadNotifyMessageList() // list.value = await NotifyMessageApi.getUnreadNotifyMessageList({
// roleId: userStore.getUser?.currentRole
// })
// unreadCount 0 // unreadCount 0
unreadCount.value = 0 unreadCount.value = 0
} }
// //
const getUnreadCount = async () => { // const getUnreadCount = async () => {
NotifyMessageApi.getUnreadNotifyMessageCount().then((data) => { // NotifyMessageApi.getUnreadNotifyMessageCount({ roleId: userStore.getUser?.currentRole }).then(
unreadCount.value = data // (data) => {
}) // unreadCount.value = data
} // }
// )
// }
// //
const goMyList = () => { const goMyList = () => {
@ -32,7 +38,7 @@ const goMyList = () => {
const msgInterval = ref<any>(null) const msgInterval = ref<any>(null)
onMounted(() => { onMounted(() => {
// //
getUnreadCount() // getUnreadCount()
// //
// msgInterval.value = setInterval(() => { // msgInterval.value = setInterval(() => {
// getUnreadCount() // getUnreadCount()

@ -56,7 +56,7 @@ export const useAppStore = defineStore('app', {
screenfull: true, // 全屏图标 screenfull: true, // 全屏图标
size: false, // 尺寸图标 size: false, // 尺寸图标
locale: false, // 多语言图标 locale: false, // 多语言图标
message: true, // 消息图标 message: false, // 消息图标
tagsView: true, // 标签页 tagsView: true, // 标签页
tagsViewIcon: false, // 是否显示标签图标 tagsViewIcon: false, // 是否显示标签图标
logo: true, // logo logo: true, // logo

@ -50,7 +50,7 @@ export const useUserStore = defineStore('admin-user', {
return null return null
} }
let userInfo = cache.local.get(CACHE_KEY.USER) let userInfo = cache.local.get(CACHE_KEY.USER)
if (!userInfo) { if (!userInfo || !userInfo?.menus || userInfo.menus.length == 0) {
userInfo = await getInfo({}) userInfo = await getInfo({})
} }
this.permissions = userInfo.permissions this.permissions = userInfo.permissions

@ -9,6 +9,18 @@
:label="col.label" :label="col.label"
:width="col.width" :width="col.width"
/> />
<el-table-column label="状态" key="status">
<template #default="scope">
<el-switch
v-model="scope.row.status"
:active-value="0"
active-text="在职"
inactive-text="离职"
:inactive-value="1"
disabled
/>
</template>
</el-table-column>
</el-table> </el-table>
<Pagination <Pagination
v-model:limit="pageSize" v-model:limit="pageSize"

Loading…
Cancel
Save