通知公告开发

This commit is contained in:
aoli.qu 2021-12-23 09:31:23 +08:00
parent ae0a18ab4e
commit 5163502796
2 changed files with 109 additions and 23 deletions

View File

@ -5,7 +5,8 @@ const noticeApi = {
del: 'notice/del', del: 'notice/del',
get: 'notice/get', get: 'notice/get',
page: 'notice/pageList', page: 'notice/pageList',
read: 'notice/read' read: 'notice/read',
pagePerson: 'notice/pagePersonList'
} }
export function noticeAdd (params) { export function noticeAdd (params) {
@ -44,3 +45,10 @@ export function noticeRead (params) {
params: params params: params
}) })
} }
export function noticePagePerson (params) {
return request({
url: noticeApi.pagePerson,
method: 'post',
params: params
})
}

View File

@ -1,10 +1,11 @@
<template> <template>
<div>
<a-card :bordered="false"> <a-card :bordered="false">
<template slot="extra"> <template slot="extra">
<a-button size="small" @click="close">返回</a-button> <a-button size="small" @click="close">返回</a-button>
</template> </template>
<div class="page-panel__body"> <div>
<div class="article"> <div>
<h1 class="article-title">{{ model.title }}</h1> <h1 class="article-title">{{ model.title }}</h1>
<div class="article-attr"> <div class="article-attr">
<div class="article-attr__item"> <div class="article-attr__item">
@ -20,15 +21,81 @@
</div> </div>
</div> </div>
</a-card> </a-card>
<a-card v-if="hasPerm('notice:edit')" >
<a-tabs default-active-key="1" @change="tabsCallback">
<a-tab-pane key="1" tab="已读人员">
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:pagination="{ pageSize: 5 }"
:showSizeChanger="false"
>
<template slot="readTime" slot-scope="text, record">
{{ record.readTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
</s-table>
</a-tab-pane>
<a-tab-pane key="1" tab="未读人员" >
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:pagination="{ pageSize: 5 }"
:showSizeChanger="false"
>
<template slot="readTime" slot-scope="text, record">
{{ record.readTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
</s-table>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template> </template>
<script> <script>
import { noticeGet } from '@/api/notice/notice' import { noticeGet, noticePagePerson } from '@/api/notice/notice'
export default { export default {
data () { data () {
return { return {
model: {} model: {},
queryParam: { noticeId: this.$route.query.id, isRead: 1 },
//
columns: [
{
title: '公告标题',
dataIndex: 'title'
},
{
title: '发布单位/人',
dataIndex: 'createOrgName'
},
{
title: '发布时间',
width: 200,
dataIndex: 'readTime',
key: 'readTime',
scopedSlots: { customRender: 'readTime' }
},
{
title: '菜单类型',
dataIndex: 'type',
scopedSlots: { customRender: 'type' }
}
],
// Promise
loadData: parameter => {
return noticePagePerson(Object.assign(parameter, this.queryParam)).then((res) => {
console.log(res)
return res
})
}
} }
}, },
created () { created () {
@ -37,16 +104,29 @@ export default {
this.getDetail(noticeId) this.getDetail(noticeId)
}, },
methods: { methods: {
//
close () {
this.$router.push({ path: '/notice/list', query: {} })
},
getDetail (id) { getDetail (id) {
noticeGet({ id: id }).then(res => { noticeGet({ id: id }).then(res => {
this.model = res.data this.model = res.data
}) })
},
tabsCallback (key) {
if (key === '1') {
this.queryParam.isRead = 1
this.$refs.table.refresh(true)
}
if (key === '2') {
this.queryParam.isRead = 0
this.$refs.table.refresh(true)
}
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style>
.article {
.article-attr { .article-attr {
color: black; color: black;
text-align: center; text-align: center;
@ -55,6 +135,4 @@ export default {
.article-title { .article-title {
text-align: center; text-align: center;
} }
}
</style> </style>