fix: 修复公告显示及详情页跳转错误

This commit is contained in:
2024-10-30 19:49:51 +08:00
parent b9ebbca0e8
commit 6b265f74bb
3 changed files with 23 additions and 17 deletions

View File

@@ -184,19 +184,19 @@ export interface DictItemPageQuery extends DictItemQuery, PageQuery {
/** 系统公告类型 */ /** 系统公告类型 */
export interface NoticeResp { export interface NoticeResp {
id: string id?: string
title: string title?: string
content: string content: string
status: number status?: number
type: string type?: string
effectiveTime: string effectiveTime?: string
terminateTime: string terminateTime?: string
noticeScope: number noticeScope?: number
noticeUsers: Array<string> noticeUsers?: Array<string>
createUserString: string createUserString?: string
createTime: string createTime?: string
updateUserString: string updateUserString?: string
updateTime: string updateTime?: string
} }
export interface NoticeQuery { export interface NoticeQuery {

View File

@@ -23,7 +23,7 @@
</a-typography-paragraph> </a-typography-paragraph>
</a-typography> </a-typography>
<a-divider /> <a-divider />
<AiEditor v-if="dataDetail?.content" :model-value="dataDetail?.content" /> <AiEditor :model-value="dataDetail?.content" />
<a-divider /> <a-divider />
<div v-if="dataDetail?.updateTime" class="update-time-row"> <div v-if="dataDetail?.updateTime" class="update-time-row">
<span> <span>
@@ -41,18 +41,22 @@ import AiEditor from './components/detail/index.vue'
import { type NoticeResp, getNotice } from '@/apis/system' import { type NoticeResp, getNotice } from '@/apis/system'
const { width } = useWindowSize() const { width } = useWindowSize()
const dataDetail = ref<NoticeResp>() const dataDetail = ref<NoticeResp>({
content: '',
})
const visible = ref(false) const visible = ref(false)
// 详情 // 详情
const onDetail = async (id: string) => { const onDetail = async (id: string) => {
const res = await getNotice(id) const { data } = await getNotice(id)
dataDetail.value = res.data dataDetail.value = data
visible.value = true visible.value = true
} }
// 重置 // 重置
const reset = () => { const reset = () => {
dataDetail.value = {} dataDetail.value = {
content: '',
}
} }
defineExpose({ onDetail }) defineExpose({ onDetail })

View File

@@ -46,6 +46,7 @@ import { useForm } from '@/hooks'
const containerRef = ref<HTMLElement | null>() const containerRef = ref<HTMLElement | null>()
const tabsStore = useTabsStore() const tabsStore = useTabsStore()
const route = useRoute() const route = useRoute()
const router = useRouter()
const { id } = route.query const { id } = route.query
const { form, resetForm } = useForm({ const { form, resetForm } = useForm({
title: '', title: '',
@@ -62,6 +63,7 @@ const onDetail = async (id: string) => {
Object.assign(form, res.data) Object.assign(form, res.data)
} }
const onBack = () => { const onBack = () => {
router.back()
tabsStore.closeCurrent(route.path) tabsStore.closeCurrent(route.path)
} }