This commit is contained in:
yy 2024-05-29 10:57:20 +08:00
parent 1eff24c36d
commit 6f88dd9d67
2 changed files with 79 additions and 71 deletions

View File

@ -55,39 +55,6 @@
</div> </div>
</div> </div>
</div> </div>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
@ -110,10 +77,6 @@ const userStore = useUserStore();
const userInfo = userStore.getlogin() const userInfo = userStore.getlogin()
const showLogMod = ref(false) const showLogMod = ref(false)
const messages = ref([] as any) const messages = ref([] as any)
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
const todoTotal = ref(0) // const todoTotal = ref(0) //
onMounted(() => { onMounted(() => {
@ -131,9 +94,6 @@ function init() {
}); });
getTodoCount(); getTodoCount();
messages.value = []; messages.value = [];
messageTable.value = [];
current.value = 1
total.value = 0
loadMsg(); loadMsg();
} }
@ -145,25 +105,11 @@ function getTodoCount() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() { async function loadMsg() {
const res = await msgApi.page(current.value, size.value) const res = await msgApi.page(0, 10)
if (res.code == 0) { if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => { res.data.records.forEach((row: any) => {
if (current.value == 1) {
messages.value.push(row) messages.value.push(row)
}
messageTable.value.push(row)
}) })
} }
} }
@ -307,4 +253,5 @@ async function loadMsg() {
background: white; background: white;
} }
} }
}</style> }
</style>

View File

@ -56,6 +56,39 @@
<el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false"> <el-drawer v-model="isShowUserInfoDrawer" size="35%" :with-header="false">
<userInfoForm @close="isShowUserInfoDrawer = false"/> <userInfoForm @close="isShowUserInfoDrawer = false"/>
</el-drawer> </el-drawer>
<el-drawer
class="message-drawer-box"
v-model="userStore.showHomeMsg"
title="通知消息"
>
<div class="body">
<el-card style="margin-top: 10px;" v-for="(item, index) in messageTable">
<template #header>
<div class="card-header">
<span>{{ item.category }}</span>
</div>
</template>
<p class="text item">{{ item.message }}</p>
<template #footer>
<span>{{ item.creatorName }}</span>
<span style="float: inline-end;">{{ item.createTime }}</span>
</template>
</el-card>
</div>
<div class="footer">
<el-pagination
v-model:page-size="size"
v-model:current-page="current"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
layout="prev, pager, next, jumper, sizes"
:page-sizes="[10, 20, 30, 50]"
:total="total"
/>
</div>
</el-drawer>
</div> </div>
</template> </template>
@ -67,6 +100,7 @@ import {useUserStore} from '@/stores/user-info-store'
import userInfoForm from '@/components/user-info.vue' import userInfoForm from '@/components/user-info.vue'
import {logout} from "@/api/login"; import {logout} from "@/api/login";
import * as hospitalApi from "@/api/hospital"; import * as hospitalApi from "@/api/hospital";
import * as msgApi from "@/api/sys-message";
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -78,6 +112,10 @@ const hospitals = ref([] as any)
const menus = ref([] as any) const menus = ref([] as any)
const isShowUserInfoDrawer = ref(false) const isShowUserInfoDrawer = ref(false)
const menuActive = ref('/') const menuActive = ref('/')
const messageTable = ref([] as any)
const current = ref(1);
const size = ref(10);
const total = ref(0);
router.isReady().then(() => { router.isReady().then(() => {
menuActive.value = route.path menuActive.value = route.path
@ -94,6 +132,9 @@ onMounted(() => {
function init() { function init() {
getHospitalList(); getHospitalList();
handleMenu(); handleMenu();
messageTable.value = [];
current.value = 1
total.value = 0
} }
function handleMenu() { function handleMenu() {
@ -102,6 +143,26 @@ function handleMenu() {
}); });
} }
function handleSizeChange() {
messageTable.value = [];
loadMsg()
}
function handleCurrentChange() {
messageTable.value = [];
loadMsg()
}
async function loadMsg() {
const res = await msgApi.page(current.value, size.value)
if (res.code == 0) {
total.value = res.data.total
res.data.records.forEach((row: any) => {
messageTable.value.push(row)
})
}
}
const menuToPath = (e: any) => { const menuToPath = (e: any) => {
menuActive.value = e.path menuActive.value = e.path
router.push(e.path) router.push(e.path)