|
|
@@ -19,7 +19,7 @@
|
|
|
</div>
|
|
|
</el-tooltip>
|
|
|
<!-- 弹框组件 -->
|
|
|
- <el-dialog v-model="dialogVisible2" title="通知" width="30%" :before-close="closeDetailDialog">
|
|
|
+ <el-dialog v-model="dialogVisible2" title="详情" width="30%" :before-close="closeDetailDialog">
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
|
<div class="dialog-item">
|
|
|
@@ -54,7 +54,7 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
<el-dialog v-model="dialogVisible" title="通知" width="50%" :before-close="closeListDialog">
|
|
|
- <el-table v-loading="loading" :data="noticeList">
|
|
|
+ <el-table v-loading="loading" :data="noticeList" :default-sort="defaultSort" @sort-change="handleSortChange">
|
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
|
<!-- <el-table-column label="序号" align="center" prop="notice_id" width="100" />-->
|
|
|
<el-table-column
|
|
|
@@ -74,7 +74,7 @@
|
|
|
</template>
|
|
|
</el-table-column>-->
|
|
|
<el-table-column label="创建者" align="center" prop="create_by" width="100"/>
|
|
|
- <el-table-column label="创建时间" align="center" prop="create_time" width="100">
|
|
|
+ <el-table-column label="创建时间" align="center" prop="create_time" width="100" sortable="custom">
|
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.create_time, '{y}-{m}-{d}') }}</span>
|
|
|
</template>
|
|
|
@@ -142,6 +142,7 @@ import {getNotice, show} from "@/api/system/notice";
|
|
|
import useAppStore from '@/store/modules/app'
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
import useSettingsStore from '@/store/modules/settings'
|
|
|
+import { h } from 'vue';
|
|
|
|
|
|
const {proxy} = getCurrentInstance();
|
|
|
const {sys_notice_status, sys_notice_type} = proxy.useDict("sys_notice_status", "sys_notice_type");
|
|
|
@@ -162,11 +163,27 @@ connectToWebSocket((newAnnounce) => {
|
|
|
// duration: 5000,
|
|
|
// position: 'top-right'
|
|
|
// });
|
|
|
- txt("新公告", "您有新的公告,请注意查收",'warning',6000);
|
|
|
+ txt2("新公告", "您有新的公告,请注意查收",'warning',3000);
|
|
|
getlistNotice()
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+function txt2(title,msg,type,time) {
|
|
|
+ ElNotification({
|
|
|
+ title: title,
|
|
|
+ message: h('div', { style: 'display: flex; align-items: center;' }, [
|
|
|
+ msg,
|
|
|
+ h('a', {
|
|
|
+ style: 'margin-left: 5px; color: #409eff; text-decoration: underline;',
|
|
|
+ onClick: () => showDetail()
|
|
|
+ }, '查看')
|
|
|
+ ]),
|
|
|
+ type: type,
|
|
|
+ duration: time,
|
|
|
+ position: 'top-right'
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const getNoticeTypeLabel = (type) => {
|
|
|
const dict = sys_notice_type.value.find(item => item.value === type)
|
|
|
return dict ? dict.label : type
|
|
|
@@ -201,6 +218,7 @@ const dialogVisible2 = ref(false); // 控制弹框显示/隐藏
|
|
|
const noticeTitle = ref(''); // 通知标题
|
|
|
const noticeType = ref(''); // 通知类型
|
|
|
const uniqueKey = ref(0); // 新增的唯一键属性
|
|
|
+const defaultSort = ref({prop: 'create_time', order: 'descending'}) // 默认排序
|
|
|
|
|
|
function toggleSideBar() {
|
|
|
appStore.toggleSideBar()
|
|
|
@@ -262,12 +280,17 @@ function closeListDialog() {
|
|
|
function closeDetailDialog() {
|
|
|
dialogVisible2.value = false;
|
|
|
}
|
|
|
-
|
|
|
+const queryParams = ref({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10000,
|
|
|
+ orderByColumn: 'create_time',
|
|
|
+ isAsc: 'desc'
|
|
|
+});
|
|
|
getlistNotice()
|
|
|
|
|
|
function getlistNotice() {
|
|
|
loading.value = true;
|
|
|
- listNoticeRead().then((response) => {
|
|
|
+ listNoticeRead(queryParams.value).then((response) => {
|
|
|
// 更新唯一键以强制重新渲染
|
|
|
noticeCount.value = response.data.length;
|
|
|
|
|
|
@@ -276,6 +299,11 @@ function getlistNotice() {
|
|
|
noticeContent.value = "您有" + noticeCount.value + "条未读的信息 (点击铃铛查看消息)";
|
|
|
});
|
|
|
}
|
|
|
+function handleSortChange({column, prop, order}) {
|
|
|
+ queryParams.value.orderByColumn = prop;
|
|
|
+ queryParams.value.isAsc = order === 'ascending' ? 'asc' : 'desc';
|
|
|
+ getlistNotice()
|
|
|
+}
|
|
|
|
|
|
function handleUpdate(row) {
|
|
|
const noticeId = row.notice_id || ids.value;
|