mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
add noticeTypeManage module
This commit is contained in:
@@ -38,7 +38,7 @@ public class NoticeController {
|
|||||||
public ResponseResult selectByNoticeId(@PathVariable Long nid) {
|
public ResponseResult selectByNoticeId(@PathVariable Long nid) {
|
||||||
Notice noticeById = noticeService.selectByNoticeId(nid);
|
Notice noticeById = noticeService.selectByNoticeId(nid);
|
||||||
Integer code = noticeById != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
Integer code = noticeById != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
String msg = noticeById != null ? "" : "数据查询失败,请尝试!";
|
String msg = noticeById != null ? "" : "数据查询失败,请重试!";
|
||||||
return ResponseResult.build(code, msg, noticeById);
|
return ResponseResult.build(code, msg, noticeById);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,16 +53,16 @@ public class NoticeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int code = noticeList != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
int code = noticeList != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
String msg = noticeList != null ? "" : "数据查询失败,请尝试!";
|
String msg = noticeList != null ? "" : "数据查询失败,请重试!";
|
||||||
return ResponseResult.build(code, msg, noticeList);
|
return ResponseResult.build(code, msg, noticeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据登录用户id查询所接收的公告
|
//根据登录用户id查询所接收的公告
|
||||||
@GetMapping("/ByUserId")
|
@GetMapping("/ByUserId")
|
||||||
public ResponseResult selectAllByUserId() {
|
public ResponseResult selectByUserId(Integer readStatus) {
|
||||||
List<Notice> noticesByUserId = noticeReceiveService.selectAllByUserId();
|
List<Notice> noticesByUserId = noticeReceiveService.selectByUserId(readStatus);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public class NoticeController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public ResponseResult updateNotice(@RequestBody Notice notice) {
|
public ResponseResult updateNotice(@RequestBody Notice notice) {
|
||||||
boolean updateById = noticeService.updateNotice(notice);
|
boolean updateById = noticeService.updateNotice(notice);
|
||||||
String msg = updateById ? "" : "数据修改失败,请尝试!";
|
String msg = updateById ? "" : "数据修改失败,请重试!";
|
||||||
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateById);
|
return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateById);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class NoticeController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseResult addNotice(@RequestBody Notice notice) {
|
public ResponseResult addNotice(@RequestBody Notice notice) {
|
||||||
Boolean insertNotice = noticeService.addNotice(notice);
|
Boolean insertNotice = noticeService.addNotice(notice);
|
||||||
String msg = insertNotice ? "" : "数据添加失败,请尝试!";
|
String msg = insertNotice ? "" : "数据添加失败,请重试!";
|
||||||
return ResponseResult.build(insertNotice ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg, insertNotice);
|
return ResponseResult.build(insertNotice ? ResponseCode.DATABASE_SAVE_OK : ResponseCode.DATABASE_SAVE_ERROR, msg, insertNotice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class NoticeController {
|
|||||||
@DeleteMapping("/{nid}")
|
@DeleteMapping("/{nid}")
|
||||||
public ResponseResult deleteByNoticeId(@PathVariable Long nid) {
|
public ResponseResult deleteByNoticeId(@PathVariable Long nid) {
|
||||||
boolean removeById = noticeService.deleteById(nid);
|
boolean removeById = noticeService.deleteById(nid);
|
||||||
String msg = removeById ? "" : "数据删除失败,请尝试!";
|
String msg = removeById ? "" : "数据删除失败,请重试!";
|
||||||
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, removeById);
|
return ResponseResult.build(removeById ? ResponseCode.DATABASE_DELETE_OK : ResponseCode.DATABASE_DELETE_ERROR, msg, removeById);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class NoticeController {
|
|||||||
noticePageList = noticeService.selectPageByCond(page,title, type, startTime, endTime);
|
noticePageList = noticeService.selectPageByCond(page,title, type, startTime, endTime);
|
||||||
}
|
}
|
||||||
int code = noticePageList.getRecords() != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
int code = noticePageList.getRecords() != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
String msg = noticePageList.getRecords() != null ? String.valueOf(noticePageList.getTotal()) : "数据查询失败,请尝试!";
|
String msg = noticePageList.getRecords() != null ? String.valueOf(noticePageList.getTotal()) : "数据查询失败,请重试!";
|
||||||
return ResponseResult.build(code, msg, noticePageList.getRecords());
|
return ResponseResult.build(code, msg, noticePageList.getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
package com.cfive.pinnacle.controller;
|
package com.cfive.pinnacle.controller;
|
||||||
|
|
||||||
import com.cfive.pinnacle.entity.Notice;
|
|
||||||
import com.cfive.pinnacle.entity.NoticeType;
|
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -28,12 +25,33 @@ public class NoticeTypeController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
INoticeTypeService noticeTypeService;
|
INoticeTypeService noticeTypeService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping("/enable")
|
||||||
public ResponseResult selectTypeList(){
|
public ResponseResult selectEnableTypeList(){
|
||||||
List<NoticeType> selectTypeName = noticeTypeService.selectTypeList();
|
List<NoticeType> selectTypeName = noticeTypeService.selectEnableTypeList();
|
||||||
Integer code = selectTypeName != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
Integer code = selectTypeName != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
String msg = selectTypeName != null ? "" : "数据查询失败,请尝试!";
|
String msg = selectTypeName != null ? "" : "数据查询失败,请重试!";
|
||||||
return ResponseResult.build(code, msg, selectTypeName);
|
return ResponseResult.build(code, msg, selectTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseResult selectTypeList(){
|
||||||
|
List<NoticeType> selectTypeList = noticeTypeService.selectTypeList();
|
||||||
|
Integer code = selectTypeList != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||||
|
String msg = selectTypeList != null ? "" : "数据查询失败,请重试!";
|
||||||
|
return ResponseResult.build(code, msg, selectTypeList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public ResponseResult updateTypeEnableById(String typeId,Boolean enable){
|
||||||
|
System.out.println(typeId+'\t'+enable);
|
||||||
|
Long tid=null;
|
||||||
|
Integer isEnable=null;
|
||||||
|
if (StringUtils.hasText(typeId)&&null!=enable){
|
||||||
|
tid = Long.parseLong(typeId);
|
||||||
|
isEnable = (enable == true ? 1 : 0);
|
||||||
|
}
|
||||||
|
Boolean updateEnableById = noticeTypeService.updateTypeEnableById(tid, isEnable);
|
||||||
|
String msg = updateEnableById ? "" : "修改失败,请重试!";
|
||||||
|
return ResponseResult.build(updateEnableById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateEnableById);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
|
public interface NoticeReceiveMapper extends BaseMapper<NoticeReceive> {
|
||||||
List<Notice> selectAllByUserId(Long userId);
|
List<Notice> selectByUserId(Long userId,Integer readStatus);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ 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> selectAllByUserId();
|
List<Notice> selectByUserId(Integer readStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface INoticeTypeService extends IService<NoticeType> {
|
public interface INoticeTypeService extends IService<NoticeType> {
|
||||||
List<NoticeType> selectTypeList();
|
List<NoticeType> selectTypeList();
|
||||||
|
List<NoticeType> selectEnableTypeList();
|
||||||
|
|
||||||
|
Boolean updateTypeEnableById(Long typeId, Integer enable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class NoticeReceiveServiceImpl extends ServiceImpl<NoticeReceiveMapper, N
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NoticeReceiveMapper noticeReceiveMapper;
|
private NoticeReceiveMapper noticeReceiveMapper;
|
||||||
@Override
|
@Override
|
||||||
public List<Notice> selectAllByUserId() {
|
public List<Notice> selectByUserId(Integer readStatus) {
|
||||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||||
return noticeReceiveMapper.selectAllByUserId(userId);
|
return noticeReceiveMapper.selectByUserId(userId,readStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.cfive.pinnacle.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cfive.pinnacle.entity.NoticeType;
|
import com.cfive.pinnacle.entity.NoticeType;
|
||||||
import com.cfive.pinnacle.mapper.NoticeTypeMapper;
|
import com.cfive.pinnacle.mapper.NoticeTypeMapper;
|
||||||
import com.cfive.pinnacle.service.INoticeTypeService;
|
import com.cfive.pinnacle.service.INoticeTypeService;
|
||||||
@@ -26,9 +27,24 @@ public class NoticeTypeServiceImpl extends ServiceImpl<NoticeTypeMapper, NoticeT
|
|||||||
NoticeTypeMapper noticeTypeMapper;
|
NoticeTypeMapper noticeTypeMapper;
|
||||||
@Override
|
@Override
|
||||||
public List<NoticeType> selectTypeList() {
|
public List<NoticeType> selectTypeList() {
|
||||||
|
return noticeTypeMapper.selectList(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticeType> selectEnableTypeList() {
|
||||||
LambdaQueryWrapper<NoticeType> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<NoticeType> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(NoticeType::getEnable, 1);
|
lqw.eq(NoticeType::getEnable, 1);
|
||||||
List<NoticeType> noticeTypes = noticeTypeMapper.selectList(lqw);
|
List<NoticeType> noticeTypes = noticeTypeMapper.selectList(lqw);
|
||||||
return noticeTypes;
|
return noticeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateTypeEnableById(Long typeId, Integer enable) {
|
||||||
|
if ((null==typeId)||(null==enable)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<NoticeType> luw = new LambdaUpdateWrapper<>();
|
||||||
|
luw.eq(null!=typeId,NoticeType::getId, typeId).set(null!=enable,NoticeType::getEnable,enable);
|
||||||
|
return noticeTypeMapper.update(null, luw)>0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cfive.pinnacle.mapper.NoticeReceiveMapper">
|
<mapper namespace="com.cfive.pinnacle.mapper.NoticeReceiveMapper">
|
||||||
<select id="selectAllByUserId" parameterType="Long" resultMap="selectAllMap">
|
<!--查询所有或根据用户阅读状态进行查询-->
|
||||||
|
<select id="selectByUserId" resultMap="selectAllMap">
|
||||||
select u.id uid,
|
select u.id uid,
|
||||||
username,
|
u.username,
|
||||||
n.id nid,
|
n.id nid,
|
||||||
title,
|
n.title,
|
||||||
content,
|
n.content,
|
||||||
type_id,
|
n.type_id,
|
||||||
sender_id,
|
n.sender_id,
|
||||||
create_time,
|
n.create_time,
|
||||||
send_time,
|
n.send_time,
|
||||||
end_time,
|
n.end_time,
|
||||||
priority,
|
n.priority,
|
||||||
top,
|
n.top,
|
||||||
modify_time,
|
n.modify_time,
|
||||||
origin_id,
|
n.origin_id,
|
||||||
type.id typeId,
|
type.id typeId,
|
||||||
name,
|
type.name,
|
||||||
type.enable,
|
type.enable,
|
||||||
notice_receive.id receiveId,
|
notice_receive.id receiveId,
|
||||||
notice_receive.already_read receiveRead
|
notice_receive.already_read receiveRead
|
||||||
@@ -25,7 +26,12 @@
|
|||||||
left join t_notice n on n.id = notice_receive.notice_id
|
left join t_notice n on n.id = notice_receive.notice_id
|
||||||
left join t_notice_type type on type.id = n.type_id
|
left join t_notice_type type on type.id = n.type_id
|
||||||
left join t_user u on n.sender_id = u.id
|
left join t_user u on n.sender_id = u.id
|
||||||
where notice_receive.user_id=#{userId}
|
<where>
|
||||||
|
<if test="null!=readStatus and readStatus>=0">
|
||||||
|
and notice_receive.already_read=#{readStatus}
|
||||||
|
</if>
|
||||||
|
and notice_receive.user_id=#{userId}
|
||||||
|
</where>
|
||||||
</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"/>
|
||||||
|
|||||||
1
ui/src/assets/svg/add.svg
Normal file
1
ui/src/assets/svg/add.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684111521024" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2399" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M554.666667 469.333333h341.333333v85.333334h-341.333333v341.333333h-85.333334v-341.333333H128v-85.333334h341.333333V128h85.333334z" p-id="2400"></path></svg>
|
||||||
|
After Width: | Height: | Size: 488 B |
1
ui/src/assets/svg/delete.svg
Normal file
1
ui/src/assets/svg/delete.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684113188426" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2422" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M909.050991 169.476903l-217.554898 0 0-31.346939c0-39.5866-32.205493-71.792093-71.793116-71.792093L408.15591 66.337871c-39.5866 0-71.792093 32.205493-71.792093 71.792093l0 31.346939L113.349581 169.476903c-11.013845 0-19.942191 8.940626-19.942191 19.954471s8.928347 19.954471 19.942191 19.954471l84.264149 0 0 640.687918c0 60.479443 49.203632 109.683075 109.683075 109.683075l416.474366 0c60.479443 0 109.683075-49.203632 109.683075-109.683075L833.454246 209.385844l75.595722 0c11.012821 0 19.942191-8.940626 19.942191-19.954471S920.063813 169.476903 909.050991 169.476903zM376.2482 138.130987c0-17.593703 14.314007-31.907711 31.907711-31.907711l211.547067 0c17.593703 0 31.907711 14.314007 31.907711 31.907711l0 31.346939L376.2482 169.477926 376.2482 138.130987zM793.569864 850.074785c0 38.486546-31.312146 69.798692-69.798692 69.798692L307.297828 919.873478c-38.486546 0-69.798692-31.312146-69.798692-69.798692L237.499136 211.042577l556.070728 0L793.569864 850.074785z" p-id="2423"></path><path d="M510.662539 861.276918c11.012821 0 19.954471-8.92937 19.954471-19.942191L530.61701 294.912753c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191L490.708068 841.334727C490.708068 852.347548 499.649717 861.276918 510.662539 861.276918z" p-id="2424"></path><path d="M374.562814 801.449321c11.012821 0 19.954471-8.92937 19.954471-19.942191L394.517285 354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191l0 426.76678C354.608344 792.519951 363.549993 801.449321 374.562814 801.449321z" p-id="2425"></path><path d="M649.832182 801.449321c11.012821 0 19.954471-8.92937 19.954471-19.942191L669.786653 354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191l0 426.76678C629.877711 792.519951 638.81936 801.449321 649.832182 801.449321z" p-id="2426"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -6,7 +6,7 @@
|
|||||||
<el-form-item label="公告类型" prop="typeId">
|
<el-form-item label="公告类型" prop="typeId">
|
||||||
<el-select v-model="addData.typeId" filterable placeholder="请选择公告类型">
|
<el-select v-model="addData.typeId" filterable placeholder="请选择公告类型">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in noticeTypeList"
|
v-for="item in EnableNoticeTypeList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
@@ -94,7 +94,7 @@ import { mapState } from 'pinia'
|
|||||||
const noticeStore = useNoticeStore()
|
const noticeStore = useNoticeStore()
|
||||||
export default {
|
export default {
|
||||||
computed:{
|
computed:{
|
||||||
...mapState(useNoticeStore,['noticeTypeList','departmentList','noticeShowData'])
|
...mapState(useNoticeStore,['EnableNoticeTypeList','departmentList','noticeShowData'])
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -173,14 +173,11 @@ export default {
|
|||||||
// 编辑操作
|
// 编辑操作
|
||||||
if (noticeStore.editFlag===true) {
|
if (noticeStore.editFlag===true) {
|
||||||
this.addData = noticeStore.noticeShowData
|
this.addData = noticeStore.noticeShowData
|
||||||
console.log("created")
|
|
||||||
console.log(this.addData)
|
|
||||||
// 判断是否置顶
|
// 判断是否置顶
|
||||||
this.addData.top=(noticeStore.noticeShowData.top===1);
|
this.addData.top=(noticeStore.noticeShowData.top===1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log("mounted")
|
|
||||||
noticeStore.selectDepartment()
|
noticeStore.selectDepartment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<el-form-item label="公告类型:" prop="type">
|
<el-form-item label="公告类型:" prop="type">
|
||||||
<el-select v-model="search_info.type" placeholder="请选择公告类型">
|
<el-select v-model="search_info.type" placeholder="请选择公告类型">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in noticeTypeList"
|
v-for="item in EnableNoticeTypeList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.name"
|
:value="item.name"
|
||||||
@@ -111,7 +111,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useNoticeStore, ['noticeTypeList'])
|
...mapState(useNoticeStore, ['EnableNoticeTypeList'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -129,6 +129,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import _ from 'lodash'
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { useNoticeStore } from '@/store/notice'
|
import { useNoticeStore } from '@/store/notice'
|
||||||
const noticeStore = useNoticeStore()
|
const noticeStore = useNoticeStore()
|
||||||
@@ -172,7 +173,7 @@ export default {
|
|||||||
formatDate(row, column) {
|
formatDate(row, column) {
|
||||||
// 获取单元格数据
|
// 获取单元格数据
|
||||||
const data = row[column.property]
|
const data = row[column.property]
|
||||||
if (data == null) return null
|
if (data == null) return '暂无数据'
|
||||||
return new Date(data).toLocaleString()
|
return new Date(data).toLocaleString()
|
||||||
},
|
},
|
||||||
handleEdit(index, row) {
|
handleEdit(index, row) {
|
||||||
@@ -215,6 +216,7 @@ export default {
|
|||||||
this.$refs.tableRef.clearFilter(['sender.username'])
|
this.$refs.tableRef.clearFilter(['sender.username'])
|
||||||
this.filterSenderName = []
|
this.filterSenderName = []
|
||||||
const nameArray = []
|
const nameArray = []
|
||||||
|
if (!_.isEmpty(this.selectData)) {
|
||||||
for (let i = 0; i < this.selectData.length; i++) {
|
for (let i = 0; i < this.selectData.length; i++) {
|
||||||
nameArray.push(this.selectData[i].sender.username)
|
nameArray.push(this.selectData[i].sender.username)
|
||||||
}
|
}
|
||||||
@@ -229,6 +231,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
145
ui/src/components/notice/NoticeTypeTable.vue
Normal file
145
ui/src/components/notice/NoticeTypeTable.vue
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<template>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
element-loading-text="加载中..."
|
||||||
|
ref="tableRef"
|
||||||
|
:data="noticeTypeList.filter((data) => !search || data.name.includes(search))"
|
||||||
|
style="font-size: 20px"
|
||||||
|
stripe
|
||||||
|
border
|
||||||
|
highlight-current-row
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
:header-cell-style="{
|
||||||
|
background: 'darksalmon',
|
||||||
|
'text-align': 'center',
|
||||||
|
color: '#fff',
|
||||||
|
'font-size': '20px'
|
||||||
|
}"
|
||||||
|
><el-table-column type="selection" width="65" align="center" />
|
||||||
|
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||||
|
<el-table-column label="类型名" prop="name" width="500" align="center" />
|
||||||
|
<el-table-column label="是否启用" prop="enable" width="350" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.enable"
|
||||||
|
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||||
|
active-text="启用"
|
||||||
|
inactive-text="禁用"
|
||||||
|
@change="switchChang(scope.row.id, scope.row.enable)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center">
|
||||||
|
<template #header>
|
||||||
|
<el-input v-model="search" size="default" placeholder="请输入关键字搜索" />
|
||||||
|
</template>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
size="default"
|
||||||
|
type="primary"
|
||||||
|
@click="handleEdit(scope.$index, scope.row)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button size="default" type="danger" @click="handleDeleteById(scope.row)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页条-->
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
style="text-align: center"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
background
|
||||||
|
:page-sizes="[5, 10, 20, 40]"
|
||||||
|
:total="total"
|
||||||
|
v-model:current-page="currentPage"
|
||||||
|
v-model:page-size="pageSize"
|
||||||
|
>
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
<!-- 编辑会话框-->
|
||||||
|
<!-- <el-dialog-->
|
||||||
|
<!-- v-model="dialogEditVisible"-->
|
||||||
|
<!-- center-->
|
||||||
|
<!-- v-if="hackReset"-->
|
||||||
|
<!-- :before-close="handleDialogClose"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <template #header>-->
|
||||||
|
<!-- <h2 style="color: red">编辑公告</h2>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <commitForm />-->
|
||||||
|
<!-- </el-dialog>-->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { mapState } from 'pinia'
|
||||||
|
import { useNoticeStore } from '@/store/notice'
|
||||||
|
const noticeStore = useNoticeStore()
|
||||||
|
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
...mapState(useNoticeStore, ['total', 'noticeTypeList', 'loading', 'dialogEditVisible'])
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
filterSenderName: [],
|
||||||
|
multipleSelection: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 5,
|
||||||
|
search: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: [],
|
||||||
|
methods: {
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
// val的值为所勾选行的数组对象
|
||||||
|
this.multipleSelection = val
|
||||||
|
},
|
||||||
|
switchChang(id, value) {
|
||||||
|
if (!noticeStore.updateNoticeTypeEnable(id, value)) {
|
||||||
|
noticeStore.selectNoticeType()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleEdit(index, row) {
|
||||||
|
noticeStore.$patch((state) => {
|
||||||
|
state.hackReset = true
|
||||||
|
state.noticeShowData = row
|
||||||
|
state.editFlag = true
|
||||||
|
state.dialogEditVisible = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDialogClose() {
|
||||||
|
noticeStore.$patch((state) => {
|
||||||
|
state.dialogEditVisible = false
|
||||||
|
state.editFlag = false
|
||||||
|
state.hackReset = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDeleteById(deleteId) {
|
||||||
|
this.$emit('handleDeleteById', deleteId)
|
||||||
|
},
|
||||||
|
handleSizeChange(pageSize) {
|
||||||
|
// pageSize:每页多少条数据
|
||||||
|
noticeStore.selectAllNotice(this.currentPage, parseInt(pageSize))
|
||||||
|
},
|
||||||
|
handleCurrentChange(currentPage) {
|
||||||
|
// currentPage:当前第几页
|
||||||
|
noticeStore.selectAllNotice(parseInt(currentPage), this.pageSize)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
noticeStore.selectNoticeType()
|
||||||
|
},
|
||||||
|
updated() {}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pagination {
|
||||||
|
margin: 30px 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <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="this.loading"
|
v-loading="this.loading"
|
||||||
element-loading-text="加载中..."
|
element-loading-text="加载中..."
|
||||||
@@ -130,7 +124,7 @@ export default {
|
|||||||
formatDate(row, column) {
|
formatDate(row, column) {
|
||||||
// 获取单元格数据
|
// 获取单元格数据
|
||||||
const data = row[column.property]
|
const data = row[column.property]
|
||||||
if (data == null) return null
|
if (data == null) return '暂无数据'
|
||||||
return new Date(data).toLocaleString()
|
return new Date(data).toLocaleString()
|
||||||
},
|
},
|
||||||
modifyStatus(row) {},
|
modifyStatus(row) {},
|
||||||
@@ -141,9 +135,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {},
|
||||||
noticeStore.selectAllNoticeByUserId()
|
|
||||||
},
|
|
||||||
updated() {
|
updated() {
|
||||||
this.$refs.tableRef.clearFilter(['senderName'])
|
this.$refs.tableRef.clearFilter(['senderName'])
|
||||||
this.filterSenderName = []
|
this.filterSenderName = []
|
||||||
|
|||||||
21
ui/src/pages/notice/AlReadView.vue
Normal file
21
ui/src/pages/notice/AlReadView.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<notice-view-table />
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { useNoticeStore } from '@/store/notice'
|
||||||
|
const noticeStore = useNoticeStore()
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
|
mounted() {
|
||||||
|
noticeStore.selectAllNoticeByUserId(1)
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
console.log('alRead:unmounted')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
21
ui/src/pages/notice/AllReceiveNoticeView.vue
Normal file
21
ui/src/pages/notice/AllReceiveNoticeView.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<notice-view-table />
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { useNoticeStore } from '@/store/notice'
|
||||||
|
const noticeStore = useNoticeStore()
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
|
mounted() {
|
||||||
|
noticeStore.selectAllNoticeByUserId(-1)
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
console.log('all:unmounted')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -53,6 +53,7 @@ export default {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.code === 20021) {
|
if (response.data.code === 20021) {
|
||||||
noticeStore.selectData = response.data.data
|
noticeStore.selectData = response.data.data
|
||||||
|
noticeStore.total = parseInt(response.data.msg)
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '查询成功.',
|
message: '查询成功.',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@@ -102,7 +103,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
noticeStore.selectNoticeType()
|
noticeStore.selectEnableNoticeType()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useNoticeStore, ['dialogAddVisible'])
|
...mapState(useNoticeStore, ['dialogAddVisible'])
|
||||||
|
|||||||
48
ui/src/pages/notice/NoticeTypeManage.vue
Normal file
48
ui/src/pages/notice/NoticeTypeManage.vue
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<el-button type="primary" :size="'large'"
|
||||||
|
><el-icon :size="SIZE_ICON_MD()" style="color: white; margin-right: 3px">
|
||||||
|
<icon-pinnacle-add /> </el-icon
|
||||||
|
>添加类型</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" :size="'large'"
|
||||||
|
><el-icon :size="SIZE_ICON_MD()" style="color: white; margin-right: 3px">
|
||||||
|
<icon-pinnacle-delete /> </el-icon
|
||||||
|
>批量删除</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" :size="'large'"
|
||||||
|
><el-icon :size="SIZE_ICON_MD()" style="color: white; margin-right: 3px">
|
||||||
|
<icon-pinnacle-reset /> </el-icon
|
||||||
|
>刷新页面</el-button
|
||||||
|
>
|
||||||
|
</el-header>
|
||||||
|
<el-main>
|
||||||
|
<notice-type-table />
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { SIZE_ICON_LG, SIZE_ICON_MD, SIZE_ICON_SM } from '@/constants/Common.constants'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'NoticeTypeManage',
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
SIZE_ICON_MD() {
|
||||||
|
return SIZE_ICON_MD
|
||||||
|
},
|
||||||
|
SIZE_ICON_LG() {
|
||||||
|
return SIZE_ICON_LG
|
||||||
|
},
|
||||||
|
SIZE_ICON_SM() {
|
||||||
|
return SIZE_ICON_SM
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -5,16 +5,17 @@
|
|||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-menu
|
<el-menu
|
||||||
:default-active="activeIndex"
|
:default-active="$route.path"
|
||||||
class="el-menu-demo"
|
class="el-menu-demo"
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
|
router
|
||||||
>
|
>
|
||||||
<el-menu-item index="1">所有公告</el-menu-item>
|
<el-menu-item index="/notice/noticeView/all">所有公告</el-menu-item>
|
||||||
<el-menu-item index="2">已读</el-menu-item>
|
<el-menu-item index="/notice/noticeView/alRead">已读</el-menu-item>
|
||||||
<el-menu-item index="3"><a href="#">未读</a></el-menu-item>
|
<el-menu-item index="/notice/noticeView/toRead">未读</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<notice-view-table></notice-view-table>
|
<router-view />
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
@@ -23,9 +24,7 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'NoticeView',
|
name: 'NoticeView',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {}
|
||||||
activeIndex: '1'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSelect(key, keyPath) {
|
handleSelect(key, keyPath) {
|
||||||
|
|||||||
21
ui/src/pages/notice/ToReadView.vue
Normal file
21
ui/src/pages/notice/ToReadView.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template>
|
||||||
|
<notice-view-table />
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { useNoticeStore } from '@/store/notice'
|
||||||
|
const noticeStore = useNoticeStore()
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
|
mounted() {
|
||||||
|
noticeStore.selectAllNoticeByUserId(0)
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
console.log('toRead:unmounted')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -172,10 +172,42 @@ const router = createRouter({
|
|||||||
path: 'noticeView',
|
path: 'noticeView',
|
||||||
component: async () => await import('@/pages/notice/NoticeView.vue'),
|
component: async () => await import('@/pages/notice/NoticeView.vue'),
|
||||||
name: 'noticeView',
|
name: 'noticeView',
|
||||||
|
redirect: '/notice/noticeView/all',
|
||||||
meta: {
|
meta: {
|
||||||
title: '公告查看',
|
title: '公告查看',
|
||||||
requiresScrollbar: false,
|
requiresScrollbar: false,
|
||||||
requiresPadding: true
|
requiresPadding: true
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'all',
|
||||||
|
component: async () =>
|
||||||
|
await import('@/pages/notice/AllReceiveNoticeView.vue'),
|
||||||
|
name: 'all'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'alRead',
|
||||||
|
component: async () =>
|
||||||
|
await import('@/pages/notice/AlReadView.vue'),
|
||||||
|
name: 'alRead'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'toRead',
|
||||||
|
component: async () =>
|
||||||
|
await import('@/pages/notice/ToReadView.vue'),
|
||||||
|
name: 'toRead'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'noticeTypeManage',
|
||||||
|
component: async () =>
|
||||||
|
await import('@/pages/notice/NoticeTypeManage.vue'),
|
||||||
|
name: 'noticeTypeManage',
|
||||||
|
meta: {
|
||||||
|
title: '公告类型管理',
|
||||||
|
requiresScrollbar: false,
|
||||||
|
requiresPadding: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -23,7 +23,14 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
dialogEditVisible: false,
|
dialogEditVisible: false,
|
||||||
editFlag: false,
|
editFlag: false,
|
||||||
hackReset: true,
|
hackReset: true,
|
||||||
noticeTypeList: [],
|
EnableNoticeTypeList: [],
|
||||||
|
noticeTypeList: [
|
||||||
|
{
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
enable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
departmentList: [],
|
departmentList: [],
|
||||||
noticeShowData: {
|
noticeShowData: {
|
||||||
content: '',
|
content: '',
|
||||||
@@ -75,17 +82,32 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async selectAllNoticeByUserId() {
|
async selectAllNoticeByUserId(readStatus: number) {
|
||||||
await request.get('/notice/ByUserId').then((response) => {
|
await request
|
||||||
|
.get('/notice/ByUserId', {
|
||||||
|
readStatus
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
this.selectData = response.data.data
|
this.selectData = response.data.data
|
||||||
if (this.selectData.length !== 0) {
|
if (this.selectData.length !== 0) {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
async selectEnableNoticeType() {
|
||||||
|
await request.get('/noticeType/enable').then((response) => {
|
||||||
|
this.EnableNoticeTypeList = response.data.data
|
||||||
|
})
|
||||||
|
},
|
||||||
async selectNoticeType() {
|
async selectNoticeType() {
|
||||||
await request.get('/noticeType').then((response) => {
|
await request.get('/noticeType').then((response) => {
|
||||||
this.noticeTypeList = response.data.data
|
this.noticeTypeList = response.data.data
|
||||||
|
if (response.data.data.length >= 0) {
|
||||||
|
for (let i = 0; i < this.noticeTypeList.length; i++) {
|
||||||
|
this.noticeTypeList[i].enable = response.data.data[i].enable === 1
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async selectDepartment() {
|
async selectDepartment() {
|
||||||
@@ -127,6 +149,28 @@ export const useNoticeStore = defineStore('notice', {
|
|||||||
})
|
})
|
||||||
this.selectAllNotice(1, 5)
|
this.selectAllNotice(1, 5)
|
||||||
this.hackReset = false
|
this.hackReset = false
|
||||||
|
},
|
||||||
|
async updateNoticeTypeEnable(typeId: string, enable: boolean) {
|
||||||
|
await request
|
||||||
|
.put('/noticeType', {
|
||||||
|
typeId,
|
||||||
|
enable
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data.code === 20023) {
|
||||||
|
ElMessage({
|
||||||
|
message: '修改成功.',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
} else if (response.data.code === 20033) {
|
||||||
|
ElMessage({
|
||||||
|
message: response.data.msg,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user