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查询所接收的公告
|
//根据登录用户id查询所接收的公告
|
||||||
@GetMapping("/self")
|
@GetMapping("/self")
|
||||||
@PreAuthorize("hasAuthority('notice:self:get')")
|
@PreAuthorize("hasAuthority('notice:self:get')")
|
||||||
public ResponseResult<List<Notice>> selectByUserId(Integer readStatus) {
|
public ResponseResult<List<Notice>> selectByUserId(Integer readStatus,String title, String type, String startTime, String endTime) {
|
||||||
List<Notice> noticesByUserId = noticeReceiveService.selectByUserId(readStatus);
|
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;
|
Integer code = noticesByUserId != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
String msg = noticesByUserId != null ? "" : "数据查询失败,请重试!";
|
String msg = noticesByUserId != null ? "" : "数据查询失败,请重试!";
|
||||||
return ResponseResult.build(code, msg, noticesByUserId);
|
return ResponseResult.build(code, msg, noticesByUserId);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.cfive.pinnacle.entity.NoticeReceive;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +18,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
|
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);
|
List<Notice> selectLimitByUserId(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Notice;
|
|||||||
import com.cfive.pinnacle.entity.NoticeReceive;
|
import com.cfive.pinnacle.entity.NoticeReceive;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +16,7 @@ import java.util.List;
|
|||||||
* @since 2023-04-30
|
* @since 2023-04-30
|
||||||
*/
|
*/
|
||||||
public interface INoticeReceiveService extends IService<NoticeReceive> {
|
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();
|
List<Notice> selectLimitByUserId();
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import com.cfive.pinnacle.utils.WebUtil;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,10 +26,16 @@ import java.util.List;
|
|||||||
public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, NoticeReceive> implements INoticeReceiveService {
|
public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, NoticeReceive> implements INoticeReceiveService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoticeReceiveMapper noticeReceiveMapper;
|
private NoticeReceiveMapper noticeReceiveMapper;
|
||||||
|
|
||||||
@Override
|
@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();
|
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
|
@Override
|
||||||
|
|||||||
@@ -30,6 +30,18 @@
|
|||||||
<if test="null!=readStatus and readStatus>=0">
|
<if test="null!=readStatus and readStatus>=0">
|
||||||
and notice_receive.already_read=#{readStatus}
|
and notice_receive.already_read=#{readStatus}
|
||||||
</if>
|
</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.user_id=#{userId}
|
||||||
and notice_receive.deleted=0
|
and notice_receive.deleted=0
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
:model="search"
|
:model="search"
|
||||||
class="demo-form-inline"
|
class="demo-form-inline"
|
||||||
label-width="auto"
|
label-width="auto"
|
||||||
ref="searchForm"
|
|
||||||
style="min-width: 1185px"
|
style="min-width: 1185px"
|
||||||
>
|
>
|
||||||
<el-row :span="24">
|
<el-row :span="24">
|
||||||
@@ -175,7 +175,7 @@ export default {
|
|||||||
} else if (this.currentViewPage === 'AlRead') {
|
} else if (this.currentViewPage === 'AlRead') {
|
||||||
flag = 1
|
flag = 1
|
||||||
}
|
}
|
||||||
await noticeStore.selectAllNoticeSelf(flag)
|
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||||
},
|
},
|
||||||
handleDialogClose() {
|
handleDialogClose() {
|
||||||
noticeStore.$patch((state) => {
|
noticeStore.$patch((state) => {
|
||||||
@@ -208,7 +208,7 @@ export default {
|
|||||||
} else if (this.currentViewPage === 'AlRead') {
|
} else if (this.currentViewPage === 'AlRead') {
|
||||||
flag = 1
|
flag = 1
|
||||||
}
|
}
|
||||||
await noticeStore.selectAllNoticeSelf(flag)
|
await noticeStore.selectAllNoticeSelf(flag, '', '', '', '')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {},
|
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.showLoading = true
|
||||||
state.currentViewPage = 'AlRead'
|
state.currentViewPage = 'AlRead'
|
||||||
})
|
})
|
||||||
noticeStore.selectAllNoticeSelf(1)
|
noticeStore.selectAllNoticeSelf(1, '', '', '', '')
|
||||||
|
noticeStore.$patch((state) => {
|
||||||
|
state.searchBySelf = {
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -15,7 +15,15 @@ export default {
|
|||||||
state.showLoading = true
|
state.showLoading = true
|
||||||
state.currentViewPage = 'All'
|
state.currentViewPage = 'All'
|
||||||
})
|
})
|
||||||
noticeStore.selectAllNoticeSelf(-1)
|
noticeStore.selectAllNoticeSelf(-1, '', '', '', '')
|
||||||
|
noticeStore.$patch((state) => {
|
||||||
|
state.searchBySelf = {
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useNoticeStore, ['showLoading'])
|
...mapState(useNoticeStore, ['showLoading'])
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<notice-head @selectByCond="getLoading"></notice-head>
|
<notice-manage-head @selectByCond="getLoading"></notice-manage-head>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -52,7 +52,11 @@ import 'element-plus/theme-chalk/el-message-box.css'
|
|||||||
import request from '@/services'
|
import request from '@/services'
|
||||||
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
import { useNoticeStore, useNoticeTypeStore } from '@/store/notice'
|
||||||
import { mapState } from 'pinia'
|
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 noticeStore = useNoticeStore()
|
||||||
const noticeTypeStore = useNoticeTypeStore()
|
const noticeTypeStore = useNoticeTypeStore()
|
||||||
|
|
||||||
@@ -82,7 +86,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
request.delete('/notice/' + deleteID).then((response) => {
|
request.delete('/notice/' + deleteID).then((response) => {
|
||||||
if (response.data.code === 20024) {
|
if (response.data.code === DATABASE_DELETE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '删除成功.',
|
message: '删除成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@@ -96,7 +100,7 @@ export default {
|
|||||||
'',
|
'',
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
} else if (response.data.code === 20034) {
|
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -123,7 +127,6 @@ export default {
|
|||||||
this.search.endTime,
|
this.search.endTime,
|
||||||
this.search.userIdList
|
this.search.userIdList
|
||||||
)
|
)
|
||||||
// noticeStore.search.userIdList = []
|
|
||||||
},
|
},
|
||||||
deleteBatchByIds() {
|
deleteBatchByIds() {
|
||||||
const multiDeleteIds = []
|
const multiDeleteIds = []
|
||||||
@@ -138,7 +141,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
request.post('/notice/batch', multiDeleteIds).then((response) => {
|
request.post('/notice/batch', multiDeleteIds).then((response) => {
|
||||||
if (response.data.code === 20024) {
|
if (response.data.code === DATABASE_DELETE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '删除成功.',
|
message: '删除成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@@ -152,7 +155,7 @@ export default {
|
|||||||
'',
|
'',
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
} else if (response.data.code === 20034) {
|
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
|
|||||||
@@ -45,7 +45,11 @@
|
|||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<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 { useNoticeTypeStore } from '@/store/notice'
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
@@ -113,13 +117,13 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
request.delete('/notice_type/' + typeId).then((response) => {
|
request.delete('/notice_type/' + typeId).then((response) => {
|
||||||
if (response.data.code === 20024) {
|
if (response.data.code === DATABASE_DELETE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '删除成功.',
|
message: '删除成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||||
} else if (response.data.code === 20034) {
|
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -142,13 +146,13 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
request.post('/notice_type/batch', multiDeleteTypeIds).then((response) => {
|
request.post('/notice_type/batch', multiDeleteTypeIds).then((response) => {
|
||||||
if (response.data.code === 20024) {
|
if (response.data.code === DATABASE_DELETE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '删除成功.',
|
message: '删除成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
noticeTypeStore.selectNoticeType(this.currentPage, this.pageSize)
|
||||||
} else if (response.data.code === 20034) {
|
} else if (response.data.code === DATABASE_DELETE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<notice-head></notice-head>
|
<notice-view-head @selectSelfByCond="getLoading" />
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
|
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
|
||||||
@@ -15,14 +15,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { useNoticeTypeStore } from '@/store/notice'
|
import { useNoticeTypeStore, useNoticeStore } from '@/store/notice'
|
||||||
|
import { mapState } from 'pinia'
|
||||||
const noticeTypeStore = useNoticeTypeStore()
|
const noticeTypeStore = useNoticeTypeStore()
|
||||||
|
const noticeStore = useNoticeStore()
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NoticeView',
|
name: 'NoticeView',
|
||||||
|
computed: {
|
||||||
|
...mapState(useNoticeStore, ['showLoading', 'searchBySelf'])
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {
|
||||||
|
getLoading(status) {
|
||||||
|
noticeStore.showLoading = true
|
||||||
|
noticeStore.selectAllNoticeSelf(
|
||||||
|
status,
|
||||||
|
this.searchBySelf.title,
|
||||||
|
this.searchBySelf.type,
|
||||||
|
this.searchBySelf.startTime,
|
||||||
|
this.searchBySelf.endTime
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
noticeTypeStore.selectEnableNoticeType()
|
noticeTypeStore.selectEnableNoticeType()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,15 @@ export default {
|
|||||||
state.showLoading = true
|
state.showLoading = true
|
||||||
state.currentViewPage = 'ToRead'
|
state.currentViewPage = 'ToRead'
|
||||||
})
|
})
|
||||||
noticeStore.selectAllNoticeSelf(0)
|
noticeStore.selectAllNoticeSelf(0, '', '', '', '')
|
||||||
|
noticeStore.$patch((state) => {
|
||||||
|
state.searchBySelf = {
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import request from '@/services'
|
import request from '@/services'
|
||||||
import { ElMessage } from 'element-plus'
|
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 {
|
export interface IAddNoticeData {
|
||||||
title: string
|
title: string
|
||||||
@@ -55,6 +62,12 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
endTime: '',
|
endTime: '',
|
||||||
userIdList: []
|
userIdList: []
|
||||||
},
|
},
|
||||||
|
searchBySelf: {
|
||||||
|
title: '',
|
||||||
|
type: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime: ''
|
||||||
|
},
|
||||||
selectData: [
|
selectData: [
|
||||||
{
|
{
|
||||||
content: '',
|
content: '',
|
||||||
@@ -142,7 +155,7 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
userIdList: userIdList.toString() + ''
|
userIdList: userIdList.toString() + ''
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.code === 20021) {
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
this.selectData = response.data.data
|
this.selectData = response.data.data
|
||||||
this.total = parseInt(response.data.msg)
|
this.total = parseInt(response.data.msg)
|
||||||
this.loading = false
|
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
|
await request
|
||||||
.get('/notice/self', {
|
.get('/notice/self', {
|
||||||
readStatus
|
readStatus,
|
||||||
|
title,
|
||||||
|
type,
|
||||||
|
startTime,
|
||||||
|
endTime
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.code === 20021) {
|
if (response.data.code === DATABASE_SELECT_OK) {
|
||||||
this.selectData = response.data.data
|
this.selectData = response.data.data
|
||||||
this.showLoading = false
|
this.showLoading = false
|
||||||
} else {
|
} else {
|
||||||
@@ -180,13 +203,13 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
},
|
},
|
||||||
handleAddNotice(addFormData: IAddNoticeData) {
|
handleAddNotice(addFormData: IAddNoticeData) {
|
||||||
void request.post('/notice', addFormData).then((response) => {
|
void request.post('/notice', addFormData).then((response) => {
|
||||||
if (response.data.code === 20022) {
|
if (response.data.code === DATABASE_SAVE_OK) {
|
||||||
this.dialogAddVisible = false
|
this.dialogAddVisible = false
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '发布成功.',
|
message: '发布成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20032) {
|
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -197,14 +220,14 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
},
|
},
|
||||||
handleUpdateNotice(updateNotice: IAddNoticeData) {
|
handleUpdateNotice(updateNotice: IAddNoticeData) {
|
||||||
void request.put('/notice', updateNotice).then((response) => {
|
void request.put('/notice', updateNotice).then((response) => {
|
||||||
if (response.data.code === 20023) {
|
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||||
this.dialogEditVisible = false
|
this.dialogEditVisible = false
|
||||||
this.editFlag = false
|
this.editFlag = false
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '修改成功.',
|
message: '修改成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20033) {
|
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -216,7 +239,7 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
},
|
},
|
||||||
async modifyNoticeIsRead(notice: INotice) {
|
async modifyNoticeIsRead(notice: INotice) {
|
||||||
await request.put('/notice/modify_notice_read', notice).then((response) => {
|
await request.put('/notice/modify_notice_read', notice).then((response) => {
|
||||||
if (response.data.code === 20033) {
|
if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -226,12 +249,12 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
},
|
},
|
||||||
async modifyTop(notice: INotice) {
|
async modifyTop(notice: INotice) {
|
||||||
await request.put('/notice/update_notice_top', notice).then((response) => {
|
await request.put('/notice/update_notice_top', notice).then((response) => {
|
||||||
if (response.data.code === 20023) {
|
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20033) {
|
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -282,7 +305,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
|||||||
},
|
},
|
||||||
async selectNoticeType(currentPage: number, pageSize: number) {
|
async selectNoticeType(currentPage: number, pageSize: number) {
|
||||||
await request.get('/notice_type/page', { currentPage, pageSize }).then((response) => {
|
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.noticeTypeList = response.data.data
|
||||||
this.total = parseInt(response.data.msg)
|
this.total = parseInt(response.data.msg)
|
||||||
if (this.noticeTypeList.length !== 0) {
|
if (this.noticeTypeList.length !== 0) {
|
||||||
@@ -304,12 +327,12 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
|||||||
enable
|
enable
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.code === 20023) {
|
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '修改成功.',
|
message: '修改成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20033) {
|
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -319,13 +342,13 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
|||||||
},
|
},
|
||||||
async handleAddNoticeType(addFormData: IAddNoticeTypeData) {
|
async handleAddNoticeType(addFormData: IAddNoticeTypeData) {
|
||||||
await request.post('/notice_type', addFormData).then((response) => {
|
await request.post('/notice_type', addFormData).then((response) => {
|
||||||
if (response.data.code === 20022) {
|
if (response.data.code === DATABASE_SAVE_OK) {
|
||||||
this.dialogAddTypeVisible = false
|
this.dialogAddTypeVisible = false
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '添加成功.',
|
message: '添加成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20032) {
|
} else if (response.data.code === DATABASE_SAVE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@@ -336,7 +359,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
|||||||
},
|
},
|
||||||
async handleUpdateNoticeType(updateNotice: IAddNoticeTypeData) {
|
async handleUpdateNoticeType(updateNotice: IAddNoticeTypeData) {
|
||||||
await request.put('/notice_type', updateNotice).then((response) => {
|
await request.put('/notice_type', updateNotice).then((response) => {
|
||||||
if (response.data.code === 20023) {
|
if (response.data.code === DATABASE_UPDATE_OK) {
|
||||||
this.dialogEditTypeVisible = false
|
this.dialogEditTypeVisible = false
|
||||||
this.editFlag = false
|
this.editFlag = false
|
||||||
this.hackReset = false
|
this.hackReset = false
|
||||||
@@ -349,7 +372,7 @@ export const useNoticeTypeStore = defineStore('notice_type', {
|
|||||||
message: '修改成功.',
|
message: '修改成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
} else if (response.data.code === 20033) {
|
} else if (response.data.code === DATABASE_UPDATE_ERROR) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data.msg,
|
message: response.data.msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
|
|||||||
Reference in New Issue
Block a user