1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 15:01:23 +08:00

Redesign the page of NoticeView.vue

This commit is contained in:
cccccyb
2023-05-17 03:47:51 +08:00
parent 739971d14b
commit 5afd8ff4e3
11 changed files with 341 additions and 163 deletions

View File

@@ -4,6 +4,8 @@ import com.cfive.pinnacle.entity.NoticeType;
import com.cfive.pinnacle.entity.common.ResponseCode; import com.cfive.pinnacle.entity.common.ResponseCode;
import com.cfive.pinnacle.entity.common.ResponseResult; import com.cfive.pinnacle.entity.common.ResponseResult;
import com.cfive.pinnacle.service.INoticeTypeService; import com.cfive.pinnacle.service.INoticeTypeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -22,6 +24,8 @@ import java.util.List;
@RequestMapping("/noticeType") @RequestMapping("/noticeType")
@CrossOrigin @CrossOrigin
public class NoticeTypeController { public class NoticeTypeController {
private final Logger LOGGER = LoggerFactory.getLogger(getClass());
@Autowired @Autowired
INoticeTypeService noticeTypeService; INoticeTypeService noticeTypeService;
@@ -41,11 +45,10 @@ public class NoticeTypeController {
return ResponseResult.build(code, msg, selectTypeList); return ResponseResult.build(code, msg, selectTypeList);
} }
@PutMapping @GetMapping("/update")
public ResponseResult updateTypeEnableById(String typeId,Boolean enable){ public ResponseResult updateTypeEnableById(String typeId,Boolean enable){
System.out.println(typeId+'\t'+enable);
Long tid=null; Long tid=null;
Integer isEnable=null; Integer isEnable = null;
if (StringUtils.hasText(typeId)&&null!=enable){ if (StringUtils.hasText(typeId)&&null!=enable){
tid = Long.parseLong(typeId); tid = Long.parseLong(typeId);
isEnable = (enable == true ? 1 : 0); isEnable = (enable == true ? 1 : 0);

View File

@@ -99,11 +99,14 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
@Override @Override
public Boolean updateNotice(Notice notice) { public Boolean updateNotice(Notice notice) {
noticeMapper.update(null, new UpdateWrapper<Notice>().eq("id", notice.getId()).set("old", 1)); //修改原始数据 noticeMapper.update(null, new UpdateWrapper<Notice>().eq("id", notice.getId()).set("old", 1)); //修改原始数据
LambdaQueryWrapper<NoticeReceive> lqw = new LambdaQueryWrapper<>();
lqw.eq(NoticeReceive::getNoticeId, notice.getId());
noticeReceiveMapper.delete(lqw);
notice.setOriginId(notice.getId()); notice.setOriginId(notice.getId());
notice.setId(null); //清除id使新插入的数据id重新生成 notice.setId(null); //清除id使新插入的数据id重新生成
notice.setModifyTime(null); notice.setModifyTime(null);
notice.setOld(0); notice.setOld(0);
return noticeMapper.insert(notice) > 0; return this.addNotice(notice);
} }
@Override @Override

View File

@@ -31,7 +31,9 @@
and notice_receive.already_read=#{readStatus} and notice_receive.already_read=#{readStatus}
</if> </if>
and notice_receive.user_id=#{userId} and notice_receive.user_id=#{userId}
and notice_receive.deleted=0
</where> </where>
order by n.send_time desc
</select> </select>
<resultMap id="selectAllMap" type="notice" autoMapping="true"> <resultMap id="selectAllMap" type="notice" autoMapping="true">
<id property="id" column="nid"/> <id property="id" column="nid"/>

View File

@@ -112,7 +112,7 @@ export default {
rules: { rules: {
title: [ title: [
{ required: true, message: '请输入公告标题', trigger: 'blur' }, { required: true, message: '请输入公告标题', trigger: 'blur' },
{ min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' } { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
], ],
typeId: [ typeId: [
{ required: true, message: '请选择公告类型', trigger: 'change' } { required: true, message: '请选择公告类型', trigger: 'change' }
@@ -137,7 +137,7 @@ export default {
submitForm() { submitForm() {
this.addData.top=this.addData.top?1:0; this.addData.top=this.addData.top?1:0;
const receiveId=[] const receiveId=[]
if (this.addData.receivers!==[]){ if (this.addData.receivers.length!=null){
for (let i = 0; i < this.addData.receivers.length; i++) { for (let i = 0; i < this.addData.receivers.length; i++) {
receiveId.push(this.addData.receivers[i][1]) receiveId.push(this.addData.receivers[i][1])
} }

View File

@@ -1,10 +1,5 @@
<template> <template>
<el-button <el-button size="large" @click="clearFilter" type="primary">清除筛选条件 </el-button>
size="large"
@click="clearFilter"
style="background-color: rgba(71, 138, 173, 0.85); color: white"
>清除筛选条件
</el-button>
<el-table <el-table
v-loading="loading" v-loading="loading"
element-loading-text="加载中..." element-loading-text="加载中..."
@@ -13,22 +8,24 @@
border border
highlight-current-row highlight-current-row
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
style="font-size: 18px"
:header-cell-style="{ :header-cell-style="{
background: 'darksalmon', background: 'darksalmon',
'text-align': 'center', 'text-align': 'center',
color: '#fff', color: '#fff',
'font-size': '20px' 'font-size': '20px'
}" }"
><el-table-column type="selection" width="55" /> ><el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" /> <el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column <el-table-column
prop="title" prop="title"
label="公告标题" label="公告标题"
width="180" width="200"
:formatter="formatter" :formatter="formatter"
show-overflow-tooltip show-overflow-tooltip
align="center"
/> />
<el-table-column prop="noticeType.name" label="公告类别" width="150"> <el-table-column prop="noticeType.name" label="公告类别" width="160" align="center">
<template #default="scope"> <template #default="scope">
<el-tag <el-tag
size="default" size="default"
@@ -39,27 +36,30 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="priority" label="优先级" width="100" /> <el-table-column prop="priority" label="优先级" width="100" align="center" />
<el-table-column <el-table-column
prop="createTime" prop="createTime"
label="创建时间" label="创建时间"
sortable sortable
width="180" width="220"
:formatter="formatDate" :formatter="formatDate"
align="center"
/> />
<el-table-column <el-table-column
prop="sendTime" prop="sendTime"
label="生效时间" label="生效时间"
sortable sortable
width="180" width="220"
:formatter="formatDate" :formatter="formatDate"
align="center"
/> />
<el-table-column <el-table-column
prop="endTime" prop="endTime"
label="失效时间" label="失效时间"
sortable sortable
width="180" width="220"
:formatter="formatDate" :formatter="formatDate"
align="center"
/> />
<el-table-column <el-table-column
prop="sender.username" prop="sender.username"
@@ -69,6 +69,7 @@
:filters="filterSenderName" :filters="filterSenderName"
:filter-method="filterTag" :filter-method="filterTag"
filter-placement="bottom-end" filter-placement="bottom-end"
align="center"
> >
<template #default="scope"> <template #default="scope">
<el-tag <el-tag
@@ -78,7 +79,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200"> <el-table-column label="操作" min-width="200px" align="center">
<template #default="scope"> <template #default="scope">
<el-button size="small" color="#626aef" @click="handleShow(scope.$index, scope.row)" <el-button size="small" color="#626aef" @click="handleShow(scope.$index, scope.row)"
>查看 >查看
@@ -235,6 +236,9 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-table {
margin-top: 10px;
}
.pagination { .pagination {
margin: 30px 400px; margin: 30px 400px;
} }

View File

@@ -1,19 +1,21 @@
<template> <template>
<el-descriptions direction="vertical" :column="3" border> <el-descriptions direction="vertical" :column="3" border>
<template #title>{{ this.noticeShowData.title }}</template> <template #title>{{ this.noticeShowData.title }}</template>
<el-descriptions-item label="发布人" <el-descriptions-item label="发布人" width="120"
><el-tag size="large" type="success">{{ ><el-tag size="large" type="success">{{
this.noticeShowData.sender.username this.noticeShowData.sender.username
}}</el-tag></el-descriptions-item }}</el-tag></el-descriptions-item
> >
<el-descriptions-item label="生效时间">{{ <el-descriptions-item label="生效时间" width="180">{{
formatDate(this.noticeShowData.sendTime) formatDate(this.noticeShowData.sendTime)
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="优先级" :span="12">{{ <el-descriptions-item label="公告类型"
this.noticeShowData.priority ><el-tag size="large">{{
}}</el-descriptions-item> this.noticeShowData.noticeType.name
<el-descriptions-item label="公告类型"> }}</el-tag></el-descriptions-item
<el-tag size="large">{{ this.noticeShowData.noticeType.name }}</el-tag> >
<el-descriptions-item label="优先级"
>{{ this.noticeShowData.priority }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="失效时间">{{ <el-descriptions-item label="失效时间">{{
formatDate(this.noticeShowData.endTime) formatDate(this.noticeShowData.endTime)

View File

@@ -22,7 +22,7 @@
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.enable" v-model="scope.row.enable"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #afb2b8"
active-text="启用" active-text="启用"
inactive-text="禁用" inactive-text="禁用"
@change="switchChang(scope.row.id, scope.row.enable)" @change="switchChang(scope.row.id, scope.row.enable)"
@@ -100,9 +100,10 @@ export default {
this.multipleSelection = val this.multipleSelection = val
}, },
switchChang(id, value) { switchChang(id, value) {
if (!noticeStore.updateNoticeTypeEnable(id, value)) { noticeStore.updateNoticeTypeEnable(id, value)
setTimeout(() => {
noticeStore.selectNoticeType() noticeStore.selectNoticeType()
} }, 800)
}, },
handleEdit(index, row) { handleEdit(index, row) {
noticeStore.$patch((state) => { noticeStore.$patch((state) => {

View File

@@ -1,103 +1,189 @@
<template> <template>
<el-table <div class="myTimeline">
v-loading="this.loading" <el-timeline>
element-loading-text="加载中..." <el-timeline-item
ref="tableRef" v-for="notice in selectData"
:data="this.selectData" :key="notice.id"
style="width: 100%" :timestamp="formatDate(notice.sendTime)"
border placement="top"
highlight-current-row
:header-cell-style="{
background: 'darksalmon',
'text-align': 'center',
color: '#fff',
'font-size': '20px'
}"
> >
<el-table-column <template #dot v-if="notice.isRead === 0">
prop="title" <el-badge is-dot class="item" />
label="公告标题"
width="180"
:formatter="formatter"
show-overflow-tooltip
/>
<el-table-column prop="noticeType.name" label="公告类别" width="150">
<template #default="scope">
<el-tag
size="default"
:type="scope.row.noticeType.name === '通知公告' ? 'warning' : 'success'"
disable-transitions
>
{{ scope.row.noticeType.name }}
</el-tag>
</template> </template>
</el-table-column> <el-card @click="showNoticeDetail(notice)">
<el-table-column prop="priority" label="优先级" width="100" /> <h4></h4>
<el-table-column prop="isRead" label="公告状态" width="180"> <p>Tom committed 2018/4/12 20:46</p>
<template #default="scope"> </el-card>
<el-tag </el-timeline-item>
size="large" </el-timeline>
:type="scope.row.isRead === 0 ? 'danger' : 'success'"
disable-transitions
>
{{ scope.row.isRead === 0 ? '未读' : '已读' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="sendTime"
label="生效时间"
sortable
width="180"
:formatter="formatDate"
/>
<el-table-column
prop="endTime"
label="失效时间"
sortable
width="180"
:formatter="formatDate"
/>
<el-table-column
prop="sender.username"
label="发布人"
width="100"
column-key="senderName"
:filters="filterSenderName"
:filter-method="filterTag"
filter-placement="bottom-end"
>
<template #default="scope">
<el-tag
:type="scope.row.sender.username === 'cyb' ? '' : 'success'"
disable-transitions
>{{ scope.row.sender.username }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button size="small" color="#626aef" @click="handleShow(scope.$index, scope.row)"
>查看
</el-button>
<el-button size="small" type="danger" @click="modifyStatus(scope.row)"
>标记为{{ scope.row.isRead === 0 ? '已读' : '未读' }}
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 查看会话框--> <!-- 查看会话框-->
<el-dialog v-model="dialogShowVisible" center> <el-dialog v-model="dialogShowVisible" center>
<template #header> <template #header>
<h2 style="color: red">查看公告</h2> <h2 style="color: red">公告详情</h2>
</template> </template>
<notice-show-dialog /> <notice-show-dialog />
</el-dialog> </el-dialog>
<!-- <el-collapse-->
<!-- @change="handleChange"-->
<!-- v-loading="this.loading"-->
<!-- element-loading-text="加载中..."-->
<!-- >-->
<!-- <el-collapse-item v-for="notice in selectData" :key="notice.id" :name="notice.id">-->
<!-- <template #title>-->
<!-- <el-tag-->
<!-- size="small"-->
<!-- :type="-->
<!-- notice.noticeType.name === '通知公告'-->
<!-- ? 'warning'-->
<!-- : notice.noticeType.name === '紧急公告'-->
<!-- ? 'danger'-->
<!-- : 'success'-->
<!-- "-->
<!-- disable-transitions-->
<!-- style="margin-right: 30px"-->
<!-- >-->
<!-- {{ notice.noticeType.name }}-->
<!-- </el-tag>-->
<!-- <h3>{{ notice.title }}</h3>-->
<!-- </template>-->
<!-- <div>-->
<!-- <el-card class="box-card" shadow="always">-->
<!-- <template #header>-->
<!-- <div class="card-header">-->
<!-- <h4>优先级</h4>-->
<!-- <el-tag effect="light" size="large">{{ notice.priority }}</el-tag>-->
<!-- </div>-->
<!-- <div class="card-header">-->
<!-- <h4>发布者</h4>-->
<!-- <el-tag effect="light" size="large">{{-->
<!-- notice.sender.username-->
<!-- }}</el-tag>-->
<!-- </div>-->
<!-- </template>-->
<!-- <h2 class="contentTitle">公告内容</h2>-->
<!-- <div class="content">-->
<!-- {{ notice.content }}-->
<!-- </div>-->
<!-- <div class="date">-->
<!-- <div class="sendTime">-->
<!-- <h4>生效日期</h4>-->
<!-- <el-tag effect="plain" size="large" type="success">{{-->
<!-- formatDate(notice.sendTime)-->
<!-- }}</el-tag>-->
<!-- </div>-->
<!-- <div class="endTime">-->
<!-- <h4>失效日期</h4>-->
<!-- <el-tag effect="plain" size="large" type="info">{{-->
<!-- formatDate(notice.endTime)-->
<!-- }}</el-tag>-->
<!-- </div>-->
<!-- </div>-->
<!-- </el-card>-->
<!-- </div>-->
<!-- </el-collapse-item>-->
<!-- </el-collapse>-->
</div>
<!-- <el-table-->
<!-- v-loading="this.loading"-->
<!-- element-loading-text="加载中..."-->
<!-- ref="tableRef"-->
<!-- :data="this.selectData"-->
<!-- style="font-size: 18px"-->
<!-- border-->
<!-- highlight-current-row-->
<!-- :header-cell-style="{-->
<!-- background: 'darksalmon',-->
<!-- 'text-align': 'center',-->
<!-- color: '#fff',-->
<!-- 'font-size': '20px'-->
<!-- }"-->
<!-- >-->
<!-- <el-table-column-->
<!-- prop="title"-->
<!-- label="公告标题"-->
<!-- width="230"-->
<!-- :formatter="formatter"-->
<!-- show-overflow-tooltip-->
<!-- align="center"-->
<!-- />-->
<!-- <el-table-column prop="noticeType.name" label="公告类别" width="180" align="center">-->
<!-- <template #default="scope">-->
<!-- <el-tag-->
<!-- size="default"-->
<!-- :type="scope.row.noticeType.name === '通知公告' ? 'warning' : 'success'"-->
<!-- disable-transitions-->
<!-- >-->
<!-- {{ scope.row.noticeType.name }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="priority" label="优先级" width="100" align="center" />-->
<!-- <el-table-column prop="isRead" label="公告状态" width="180" align="center">-->
<!-- <template #default="scope">-->
<!-- <el-tag-->
<!-- size="large"-->
<!-- :type="scope.row.isRead === 0 ? 'danger' : 'success'"-->
<!-- disable-transitions-->
<!-- >-->
<!-- {{ scope.row.isRead === 0 ? '未读' : '已读' }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="sendTime"-->
<!-- label="生效时间"-->
<!-- sortable-->
<!-- width="250"-->
<!-- :formatter="formatDate"-->
<!-- align="center"-->
<!-- />-->
<!-- <el-table-column-->
<!-- prop="endTime"-->
<!-- label="失效时间"-->
<!-- sortable-->
<!-- width="250"-->
<!-- :formatter="formatDate"-->
<!-- align="center"-->
<!-- />-->
<!-- <el-table-column-->
<!-- prop="sender.username"-->
<!-- label="发布人"-->
<!-- width="130"-->
<!-- column-key="senderName"-->
<!-- :filters="filterSenderName"-->
<!-- :filter-method="filterTag"-->
<!-- filter-placement="bottom-end"-->
<!-- align="center"-->
<!-- >-->
<!-- <template #default="scope">-->
<!-- <el-tag-->
<!-- :type="scope.row.sender.username === 'cyb' ? '' : 'success'"-->
<!-- disable-transitions-->
<!-- >{{ scope.row.sender.username }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作" align="center">-->
<!-- <template #default="scope">-->
<!-- <el-button size="small" color="#626aef" @click="handleShow(scope.$index, scope.row)"-->
<!-- >查看-->
<!-- </el-button>-->
<!-- <el-button size="small" type="danger" @click="modifyStatus(scope.row)"-->
<!-- >标记为{{ scope.row.isRead === 0 ? '已读' : '未读' }}-->
<!-- </el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- &lt;!&ndash; 查看会话框&ndash;&gt;-->
<!-- <el-dialog v-model="dialogShowVisible" center>-->
<!-- <template #header>-->
<!-- <h2 style="color: red">查看公告</h2>-->
<!-- </template>-->
<!-- <notice-show-dialog />-->
<!-- </el-dialog>-->
</template> </template>
<script lang="ts"> <script lang="ts">
// import { storeToRefs } from 'pinia'
// const { selectData, getLoading } = storeToRefs(noticeViewStore)
import { mapState } from 'pinia' import { mapState } from 'pinia'
import { useNoticeStore } from '@/store/notice' import { useNoticeStore } from '@/store/notice'
const noticeStore = useNoticeStore() const noticeStore = useNoticeStore()
@@ -110,24 +196,22 @@ export default {
}, },
props: [], props: [],
methods: { methods: {
// ...mapActions(useNoticeStore, ['selectAllNoticeByUserId']), showNoticeDetail(data) {
clearFilter() { noticeStore.$patch((state) => {
this.$refs.tableRef.clearFilter(['senderName']) state.dialogShowVisible = true
this.$emit('clearFilter') state.noticeShowData = data
})
}, },
formatter(row, column) { formatDate(date) {
return row.title if (date == null) return null
return new Date(date).toLocaleString()
}, },
filterTag(value, row) { filterTag(value, row) {
return row.sender.username === value return row.sender.username === value
}, },
formatDate(row, column) { modifyStatus(row) {
// 获取单元格数据 console.log(row)
const data = row[column.property]
if (data == null) return '暂无数据'
return new Date(data).toLocaleString()
}, },
modifyStatus(row) {},
handleShow(index, row) { handleShow(index, row) {
noticeStore.$patch((state) => { noticeStore.$patch((state) => {
state.dialogShowVisible = true state.dialogShowVisible = true
@@ -136,23 +220,7 @@ export default {
} }
}, },
mounted() {}, mounted() {},
updated() { updated() {},
this.$refs.tableRef.clearFilter(['senderName'])
this.filterSenderName = []
const nameArray = []
for (let i = 0; i < this.selectData.length; i++) {
nameArray.push(this.selectData[i].sender.username)
}
const newArr = nameArray.filter((item, i, arr) => {
return arr.indexOf(item) === i
})
for (let j = 0; j < newArr.length; j++) {
const senderName = { text: '', value: '' }
senderName.text = newArr[j]
senderName.value = newArr[j]
this.filterSenderName.push(senderName)
}
},
computed: { computed: {
...mapState(useNoticeStore, [ ...mapState(useNoticeStore, [
'selectData', 'selectData',
@@ -165,7 +233,67 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-table { .myTimeline {
margin-top: 10px; margin-top: 20px;
}
.el-timeline {
--el-timeline-node-size-normal: 16px;
--el-timeline-node-size-large: 16px;
}
/deep/ .el-badge__content.is-dot {
height: 16px;
width: 16px;
}
/deep/ .el-timeline-item__timestamp.is-top {
font-size: 16px;
font-weight: 600;
}
.el-collapse {
--el-collapse-header-height: 68px;
}
/deep/ .el-collapse-item__header {
padding-left: 25px;
font-weight: 400;
border-bottom: 2px solid #dcdfe6;
}
.box-card {
font-size: 16px;
}
/deep/ .el-card__header {
border-bottom: 1px dashed #6bd4ff;
}
.card-header {
display: inline-block;
margin-right: 40px;
}
.el-tag {
font-size: 15px;
}
.contentTitle {
font-size: 20px;
font-weight: bold;
}
.content {
margin-top: 20px;
margin-left: 20px;
height: fit-content;
}
.date {
margin-top: 50px;
}
.sendTime {
display: inline-block;
margin-right: 25px;
}
.endTime {
display: inline-block;
}
h3 {
font-weight: 550;
font-size: 18px;
}
h4 {
font-weight: 500;
display: inline-block;
} }
</style> </style>

View File

@@ -6,8 +6,11 @@
<el-main> <el-main>
<el-button <el-button
size="large" size="large"
style="background-color: rgba(71, 138, 173, 0.85); color: white" type="primary"
@click="openAddNoticeDialog" @click="openAddNoticeDialog"
style="margin-right: 15px"
><el-icon :size="SIZE_ICON_MD()" style="color: white; margin-right: 3px">
<icon-pinnacle-add /> </el-icon
>发布公告</el-button >发布公告</el-button
> >
<!-- 添加公告对话框--> <!-- 添加公告对话框-->
@@ -32,6 +35,7 @@ import 'element-plus/theme-chalk/el-message-box.css'
import request from '@/services' import request from '@/services'
import { useNoticeStore } from '@/store/notice' import { useNoticeStore } from '@/store/notice'
import { mapState } from 'pinia' import { mapState } from 'pinia'
import { SIZE_ICON_MD } from '@/constants/Common.constants'
const noticeStore = useNoticeStore() const noticeStore = useNoticeStore()
export default { export default {
@@ -40,6 +44,9 @@ export default {
return {} return {}
}, },
methods: { methods: {
SIZE_ICON_MD() {
return SIZE_ICON_MD
},
selectByCond(currentPage, pageSize, search) { selectByCond(currentPage, pageSize, search) {
request request
.get('/notice/page', { .get('/notice/page', {

View File

@@ -21,6 +21,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { useNoticeStore } from '@/store/notice'
const noticeStore = useNoticeStore()
export default { export default {
name: 'NoticeView', name: 'NoticeView',
data() { data() {
@@ -31,7 +33,9 @@ export default {
console.log(key, keyPath) console.log(key, keyPath)
} }
}, },
mounted() {} mounted() {
noticeStore.selectEnableNoticeType()
}
} }
</script> </script>

View File

@@ -16,7 +16,33 @@ export const useNoticeStore = defineStore('notice', {
state: () => { state: () => {
return { return {
total: 0, total: 0,
selectData: [], selectData: [
{
content: '',
createTime: '',
endTime: '',
id: '',
modifyTime: '',
priority: 0,
receivers: [],
sendTime: '',
title: '',
top: 0,
isRead: 0,
noticeType: {
id: '',
name: '',
enable: 0
},
sender: {
id: '',
username: '',
enable: 0
},
senderId: '',
typeId: ''
}
],
loading: true, loading: true,
dialogShowVisible: false, dialogShowVisible: false,
dialogAddVisible: false, dialogAddVisible: false,
@@ -152,7 +178,7 @@ export const useNoticeStore = defineStore('notice', {
}, },
async updateNoticeTypeEnable(typeId: string, enable: boolean) { async updateNoticeTypeEnable(typeId: string, enable: boolean) {
await request await request
.put('/noticeType', { .get('/noticeType/update', {
typeId, typeId,
enable enable
}) })
@@ -162,13 +188,11 @@ export const useNoticeStore = defineStore('notice', {
message: '修改成功.', message: '修改成功.',
type: 'success' type: 'success'
}) })
return true
} else if (response.data.code === 20033) { } else if (response.data.code === 20033) {
ElMessage({ ElMessage({
message: response.data.msg, message: response.data.msg,
type: 'error' type: 'error'
}) })
return false
} }
}) })
} }