mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
add the function of fuzzy query in the page of NoticeView had been completed
This commit is contained in:
@@ -67,8 +67,8 @@ public class NoticeController {
|
||||
//根据登录用户id查询所接收的公告
|
||||
@GetMapping("/self")
|
||||
@PreAuthorize("hasAuthority('notice:self:get')")
|
||||
public ResponseResult<List<Notice>> selectByUserId(Integer readStatus) {
|
||||
List<Notice> noticesByUserId = noticeReceiveService.selectByUserId(readStatus);
|
||||
public ResponseResult<List<Notice>> selectByUserId(Integer readStatus,String title, String type, String startTime, String endTime) {
|
||||
List<Notice> noticesByUserId = noticeReceiveService.selectByUserId(readStatus, title.trim(), type.trim(), startTime.trim(), endTime.trim());
|
||||
Integer code = noticesByUserId != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||
String msg = noticesByUserId != null ? "" : "数据查询失败,请重试!";
|
||||
return ResponseResult.build(code, msg, noticesByUserId);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.cfive.pinnacle.entity.NoticeReceive;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -17,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
|
||||
List<Notice> selectByUserId(Long userId,Integer readStatus);
|
||||
List<Notice> selectByUserId(Long userId, Integer readStatus, String title, String type, LocalDateTime startTime, LocalDateTime endTime);
|
||||
List<Notice> selectLimitByUserId(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Notice;
|
||||
import com.cfive.pinnacle.entity.NoticeReceive;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ import java.util.List;
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
public interface INoticeReceiveService extends IService<NoticeReceive> {
|
||||
List<Notice> selectByUserId(Integer readStatus);
|
||||
List<Notice> selectByUserId(Integer readStatus, String title, String type, String startTime, String endTime);
|
||||
|
||||
List<Notice> selectLimitByUserId();
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.cfive.pinnacle.utils.WebUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -24,10 +26,16 @@ import java.util.List;
|
||||
public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, NoticeReceive> implements INoticeReceiveService {
|
||||
@Autowired
|
||||
private NoticeReceiveMapper noticeReceiveMapper;
|
||||
|
||||
@Override
|
||||
public List<Notice> selectByUserId(Integer readStatus) {
|
||||
public List<Notice> selectByUserId(Integer readStatus, String title, String type, String startTime, String endTime) {
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
return noticeReceiveMapper.selectByUserId(userId,readStatus);
|
||||
LocalDateTime start = null, end = null;
|
||||
if (startTime != "" && endTime != "") {
|
||||
start = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
return noticeReceiveMapper.selectByUserId(userId, readStatus, title, type, start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,12 +47,12 @@ public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, N
|
||||
@Override
|
||||
public Boolean modifyNoticeIsRead(Notice notice) {
|
||||
Integer readStatus = null;
|
||||
if (null!=notice.getIsRead()){
|
||||
readStatus=notice.getIsRead()==0?1:0;
|
||||
if (null != notice.getIsRead()) {
|
||||
readStatus = notice.getIsRead() == 0 ? 1 : 0;
|
||||
}
|
||||
LambdaUpdateWrapper<NoticeReceive> luw = new LambdaUpdateWrapper<>();
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
luw.eq(NoticeReceive::getNoticeId, notice.getId()).eq(NoticeReceive::getUserId, userId).set(null!=readStatus,NoticeReceive::getAlreadyRead, readStatus);
|
||||
return noticeReceiveMapper.update(null,luw)>0;
|
||||
luw.eq(NoticeReceive::getNoticeId, notice.getId()).eq(NoticeReceive::getUserId, userId).set(null != readStatus, NoticeReceive::getAlreadyRead, readStatus);
|
||||
return noticeReceiveMapper.update(null, luw) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,18 @@
|
||||
<if test="null!=readStatus and readStatus>=0">
|
||||
and notice_receive.already_read=#{readStatus}
|
||||
</if>
|
||||
<if test="null!=title and title!=''">
|
||||
and instr(n.title,#{title})>0
|
||||
</if>
|
||||
<if test="null!=type and type!=''">
|
||||
and instr(type.name,#{type})>0
|
||||
</if>
|
||||
<if test="null!=startTime">
|
||||
and n.send_time >= #{startTime}
|
||||
</if>
|
||||
<if test="null != endTime">
|
||||
and n.end_time < #{endTime}
|
||||
</if>
|
||||
and notice_receive.user_id=#{userId}
|
||||
and notice_receive.deleted=0
|
||||
</where>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
:model="search"
|
||||
class="demo-form-inline"
|
||||
label-width="auto"
|
||||
ref="searchForm"
|
||||
style="min-width: 1185px"
|
||||
>
|
||||
<el-row :span="24">
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
await noticeStore.selectAllNoticeSelf(flag)
|
||||
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||
},
|
||||
handleDialogClose() {
|
||||
noticeStore.$patch((state) => {
|
||||
@@ -208,7 +208,7 @@ export default {
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
await noticeStore.selectAllNoticeSelf(flag)
|
||||
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
143
ui/src/components/notice/NoticeViewHead.vue
Normal file
143
ui/src/components/notice/NoticeViewHead.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<el-form
|
||||
:inline="true"
|
||||
:model="searchBySelf"
|
||||
class="demo-form-inline"
|
||||
label-width="auto"
|
||||
style="min-width: 1185px"
|
||||
>
|
||||
<el-row :span="24">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告标题:" prop="title">
|
||||
<el-input v-model="searchBySelf.title" placeholder="请输入公告标题"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-form-item label="公告类型:" prop="type">
|
||||
<el-select v-model="searchBySelf.type" placeholder="请选择公告类型">
|
||||
<el-option
|
||||
v-for="item in enableNoticeTypeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="日期:" prop="timeRang">
|
||||
<el-date-picker
|
||||
v-model="timeRang"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
style="width: auto"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="selectByCondition"
|
||||
><el-icon :size="SIZE_ICON_SM()" style="color: white; margin-right: 5px">
|
||||
<icon-pinnacle-notice_search /> </el-icon
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button type="primary" @click="resetForm"
|
||||
><el-icon :size="SIZE_ICON_SM()" style="color: white">
|
||||
<icon-pinnacle-reset /> </el-icon
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { COLOR_PRODUCTION, SIZE_ICON_MD, SIZE_ICON_SM } from '@/constants/Common.constants'
|
||||
import _ from 'lodash'
|
||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
|
||||
const noticeStore = useNoticeStore()
|
||||
export default {
|
||||
name: 'NoticeHead',
|
||||
data() {
|
||||
return {
|
||||
timeRang: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
SIZE_ICON_SM() {
|
||||
return SIZE_ICON_SM
|
||||
},
|
||||
COLOR_PRODUCTION() {
|
||||
return COLOR_PRODUCTION
|
||||
},
|
||||
SIZE_ICON_MD() {
|
||||
return SIZE_ICON_MD
|
||||
},
|
||||
selectByCondition() {
|
||||
if (!_.isEmpty(this.timeRang)) {
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf.startTime = this.handleDateFormatUTC(this.timeRang[0])
|
||||
this.searchBySelf.endTime = this.handleDateFormatUTC(this.timeRang[1])
|
||||
})
|
||||
}
|
||||
let flag = 0
|
||||
if (this.currentViewPage === 'All') {
|
||||
flag = -1
|
||||
} else if (this.currentViewPage === 'ToRead') {
|
||||
flag = 0
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
this.$emit('selectSelfByCond', flag)
|
||||
},
|
||||
handleDateFormatUTC(date) {
|
||||
let newFormat = ''
|
||||
const dateParse = new Date(Date.parse(date))
|
||||
const yy = dateParse.getUTCFullYear()
|
||||
const mm = _.padStart((dateParse.getUTCMonth() + 1).toString(), 2, '0')
|
||||
const dd = _.padStart(dateParse.getUTCDate().toString(), 2, '0')
|
||||
const hh = _.padStart(dateParse.getUTCHours().toString(), 2, '0')
|
||||
const mf = _.padStart(dateParse.getUTCMinutes().toString(), 2, '0')
|
||||
const ss = _.padStart(dateParse.getUTCSeconds().toString(), 2, '0')
|
||||
newFormat = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
|
||||
return newFormat
|
||||
},
|
||||
resetForm() {
|
||||
this.timeRang = []
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
let flag = 0
|
||||
if (this.currentViewPage === 'All') {
|
||||
flag = -1
|
||||
} else if (this.currentViewPage === 'ToRead') {
|
||||
flag = 0
|
||||
} else if (this.currentViewPage === 'AlRead') {
|
||||
flag = 1
|
||||
}
|
||||
this.$emit('selectSelfByCond', flag)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['currentPage', 'pageSize', 'searchBySelf', 'currentViewPage']),
|
||||
...mapState(useNoticeTypeStore, ['enableNoticeTypeList'])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-form {
|
||||
margin-top: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -14,7 +14,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'AlRead'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(1)
|
||||
noticeStore.selectAllNoticeSelf(1, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -15,7 +15,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'All'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(-1)
|
||||
noticeStore.selectAllNoticeSelf(-1, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['showLoading'])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<notice-head @selectByCond="getLoading"></notice-head>
|
||||
<notice-manage-head @selectByCond="getLoading"></notice-manage-head>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-button
|
||||
@@ -52,7 +52,11 @@ import 'element-plus/theme-chalk/el-message-box.css'
|
||||
import request from '@/services'
|
||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
import { SIZE_ICON_MD } from '@/constants/Common.constants'
|
||||
import {
|
||||
DATABASE_DELETE_ERROR,
|
||||
DATABASE_DELETE_OK,
|
||||
SIZE_ICON_MD
|
||||
} from '@/constants/Common.constants'
|
||||
const noticeStore = useNoticeStore()
|
||||
const noticeTypeStore = useNoticeTypeStore()
|
||||
|
||||
@@ -82,7 +86,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.delete('/notice/' + deleteID).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
@@ -96,7 +100,7 @@ export default {
|
||||
'',
|
||||
[]
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -123,7 +127,6 @@ export default {
|
||||
this.search.endTime,
|
||||
this.search.userIdList
|
||||
)
|
||||
// noticeStore.search.userIdList = []
|
||||
},
|
||||
deleteBatchByIds() {
|
||||
const multiDeleteIds = []
|
||||
@@ -138,7 +141,7 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.post('/notice/batch', multiDeleteIds).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
@@ -152,7 +155,7 @@ export default {
|
||||
'',
|
||||
[]
|
||||
)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
@@ -45,7 +45,11 @@
|
||||
</el-container>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { SIZE_ICON_MD } from '@/constants/Common.constants'
|
||||
import {
|
||||
DATABASE_DELETE_ERROR,
|
||||
DATABASE_DELETE_OK,
|
||||
SIZE_ICON_MD
|
||||
} from '@/constants/Common.constants'
|
||||
import { useNoticeTypeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -113,13 +117,13 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.delete('/notice_type/' + typeId).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -142,13 +146,13 @@ export default {
|
||||
})
|
||||
.then(() => {
|
||||
request.post('/notice_type/batch', multiDeleteTypeIds).then((response) => {
|
||||
if (response.data.code === 20024) {
|
||||
if (response.data.code === DATABASE_DELETE_OK) {
|
||||
ElMessage({
|
||||
message: '删除成功.',
|
||||
type: 'success'
|
||||
})
|
||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||
} else if (response.data.code === 20034) {
|
||||
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<notice-head></notice-head>
|
||||
<notice-view-head @selectSelfByCond="getLoading" />
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
|
||||
@@ -15,14 +15,31 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { useNoticeTypeStore } from '@/store/notice'
|
||||
import { useNoticeTypeStore, useNoticeStore } from '@/store/notice'
|
||||
import { mapState } from 'pinia'
|
||||
const noticeTypeStore = useNoticeTypeStore()
|
||||
const noticeStore = useNoticeStore()
|
||||
|
||||
export default {
|
||||
name: 'NoticeView',
|
||||
computed: {
|
||||
...mapState(useNoticeStore, ['showLoading', 'searchBySelf'])
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {},
|
||||
methods: {
|
||||
getLoading(status) {
|
||||
noticeStore.showLoading = true
|
||||
noticeStore.selectAllNoticeSelf(
|
||||
status,
|
||||
this.searchBySelf.title,
|
||||
this.searchBySelf.type,
|
||||
this.searchBySelf.startTime,
|
||||
this.searchBySelf.endTime
|
||||
)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
noticeTypeStore.selectEnableNoticeType()
|
||||
}
|
||||
|
||||
@@ -14,7 +14,15 @@ export default {
|
||||
state.showLoading = true
|
||||
state.currentViewPage = 'ToRead'
|
||||
})
|
||||
noticeStore.selectAllNoticeSelf(0)
|
||||
noticeStore.selectAllNoticeSelf(0, '', '', '', '')
|
||||
noticeStore.$patch((state) => {
|
||||
state.searchBySelf = {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import request from '@/services'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
DATABASE_SAVE_ERROR,
|
||||
DATABASE_SAVE_OK,
|
||||
DATABASE_SELECT_OK,
|
||||
DATABASE_UPDATE_ERROR,
|
||||
DATABASE_UPDATE_OK
|
||||
} from '@/constants/Common.constants'
|
||||
|
||||
export interface IAddNoticeData {
|
||||
title: string
|
||||
@@ -55,6 +62,12 @@ export const useNoticeStore = defineStore('notice', {
|
||||
endTime: '',
|
||||
userIdList: []
|
||||
},
|
||||
searchBySelf: {
|
||||
title: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
},
|
||||
selectData: [
|
||||
{
|
||||
content: '',
|
||||
@@ -142,7 +155,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
userIdList: userIdList.toString() + ''
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.selectData = response.data.data
|
||||
this.total = parseInt(response.data.msg)
|
||||
this.loading = false
|
||||
@@ -155,13 +168,23 @@ export const useNoticeStore = defineStore('notice', {
|
||||
}
|
||||
})
|
||||
},
|
||||
async selectAllNoticeSelf(readStatus: number) {
|
||||
async selectAllNoticeSelf(
|
||||
readStatus: number,
|
||||
title: string,
|
||||
type: string,
|
||||
startTime: string,
|
||||
endTime: string
|
||||
) {
|
||||
await request
|
||||
.get('/notice/self', {
|
||||
readStatus
|
||||
readStatus,
|
||||
title,
|
||||
type,
|
||||
startTime,
|
||||
endTime
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.selectData = response.data.data
|
||||
this.showLoading = false
|
||||
} else {
|
||||
@@ -180,13 +203,13 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
handleAddNotice(addFormData: IAddNoticeData) {
|
||||
void request.post('/notice', addFormData).then((response) => {
|
||||
if (response.data.code === 20022) {
|
||||
if (response.data.code === DATABASE_SAVE_OK) {
|
||||
this.dialogAddVisible = false
|
||||
ElMessage({
|
||||
message: '发布成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20032) {
|
||||
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -197,14 +220,14 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
handleUpdateNotice(updateNotice: IAddNoticeData) {
|
||||
void request.put('/notice', updateNotice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
this.dialogEditVisible = false
|
||||
this.editFlag = false
|
||||
ElMessage({
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -216,7 +239,7 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
async modifyNoticeIsRead(notice: INotice) {
|
||||
await request.put('/notice/modify_notice_read', notice).then((response) => {
|
||||
if (response.data.code === 20033) {
|
||||
if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -226,12 +249,12 @@ export const useNoticeStore = defineStore('notice', {
|
||||
},
|
||||
async modifyTop(notice: INotice) {
|
||||
await request.put('/notice/update_notice_top', notice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -282,7 +305,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async selectNoticeType(currentPage: number, pageSize: number) {
|
||||
await request.get('/notice_type/page', { currentPage, pageSize }).then((response) => {
|
||||
if (response.data.code === 20021) {
|
||||
if (response.data.code === DATABASE_SELECT_OK) {
|
||||
this.noticeTypeList = response.data.data
|
||||
this.total = parseInt(response.data.msg)
|
||||
if (this.noticeTypeList.length !== 0) {
|
||||
@@ -304,12 +327,12 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
enable
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
ElMessage({
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -319,13 +342,13 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async handleAddNoticeType(addFormData: IAddNoticeTypeData) {
|
||||
await request.post('/notice_type', addFormData).then((response) => {
|
||||
if (response.data.code === 20022) {
|
||||
if (response.data.code === DATABASE_SAVE_OK) {
|
||||
this.dialogAddTypeVisible = false
|
||||
ElMessage({
|
||||
message: '添加成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20032) {
|
||||
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
@@ -336,7 +359,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
},
|
||||
async handleUpdateNoticeType(updateNotice: IAddNoticeTypeData) {
|
||||
await request.put('/notice_type', updateNotice).then((response) => {
|
||||
if (response.data.code === 20023) {
|
||||
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||
this.dialogEditTypeVisible = false
|
||||
this.editFlag = false
|
||||
this.hackReset = false
|
||||
@@ -349,7 +372,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
||||
message: '修改成功.',
|
||||
type: 'success'
|
||||
})
|
||||
} else if (response.data.code === 20033) {
|
||||
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||
ElMessage({
|
||||
message: response.data.msg,
|
||||
type: 'error'
|
||||
|
||||
Reference in New Issue
Block a user