feat: 新增系统管理/公告管理(列表、查看详情、新增、修改、删除、导出)
This commit is contained in:
parent
46a75d0297
commit
46e125d8c9
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型枚举(计划 v1.2.0 增加字典管理,用于维护此类信息)
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum AnnouncementTypeEnum implements BaseEnum<Integer, String> {
|
||||||
|
|
||||||
|
/** 活动 */
|
||||||
|
ACTIVITY(1, "活动"),
|
||||||
|
|
||||||
|
/** 消息 */
|
||||||
|
MESSAGE(2, "消息"),
|
||||||
|
|
||||||
|
/** 通知 */
|
||||||
|
NOTICE(3, "通知"),;
|
||||||
|
|
||||||
|
private final Integer value;
|
||||||
|
private final String description;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.mapper;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseMapper;
|
||||||
|
import top.charles7c.cnadmin.system.model.entity.AnnouncementDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告 Mapper
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
public interface AnnouncementMapper extends BaseMapper<AnnouncementDO> {}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.model.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseDO;
|
||||||
|
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告实体
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_announcement")
|
||||||
|
public class AnnouncementDO extends BaseDO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private AnnouncementTypeEnum type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生效时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime effectiveTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime terminateTime;
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.model.query;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.annotation.Query;
|
||||||
|
import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告查询条件
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "公告查询条件")
|
||||||
|
public class AnnouncementQuery implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@Schema(description = "标题")
|
||||||
|
@Query(type = QueryTypeEnum.INNER_LIKE)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(1:活动,2:消息,3:通知)
|
||||||
|
*/
|
||||||
|
@Schema(description = "类型(1:活动,2:消息,3:通知)")
|
||||||
|
@Query(type = QueryTypeEnum.EQUAL)
|
||||||
|
private Integer type;
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.model.request;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseRequest;
|
||||||
|
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建或修改公告信息
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "创建或修改公告信息")
|
||||||
|
public class AnnouncementRequest extends BaseRequest {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@Schema(description = "标题")
|
||||||
|
@NotBlank(message = "标题不能为空")
|
||||||
|
@Length(max = 255, message = "标题长度不能超过 {max} 个字符")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@Schema(description = "内容")
|
||||||
|
@NotBlank(message = "内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "类型")
|
||||||
|
@NotNull(message = "类型非法")
|
||||||
|
private AnnouncementTypeEnum type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生效时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "生效时间")
|
||||||
|
private LocalDateTime effectiveTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "终止时间")
|
||||||
|
@Future(message = "终止时间必须是未来时间")
|
||||||
|
private LocalDateTime terminateTime;
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.model.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseDetailVO;
|
||||||
|
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告详情信息
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@Schema(description = "公告详情信息")
|
||||||
|
public class AnnouncementDetailVO extends BaseDetailVO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@Schema(description = "标题")
|
||||||
|
@ExcelProperty(value = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@Schema(description = "内容")
|
||||||
|
@ExcelProperty(value = "内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private AnnouncementTypeEnum type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生效时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "生效时间")
|
||||||
|
@ExcelProperty(value = "生效时间")
|
||||||
|
private LocalDateTime effectiveTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "终止时间")
|
||||||
|
@ExcelProperty(value = "终止时间")
|
||||||
|
private LocalDateTime terminateTime;
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.model.vo;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseVO;
|
||||||
|
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告信息
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "公告信息")
|
||||||
|
public class AnnouncementVO extends BaseVO {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@Schema(description = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private AnnouncementTypeEnum type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生效时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "生效时间")
|
||||||
|
private LocalDateTime effectiveTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "终止时间")
|
||||||
|
private LocalDateTime terminateTime;
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
int status = 1;
|
||||||
|
if (null != this.effectiveTime) {
|
||||||
|
if (this.effectiveTime.isAfter(LocalDateTime.now())) {
|
||||||
|
status = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null != this.terminateTime) {
|
||||||
|
if (this.terminateTime.isBefore(LocalDateTime.now())) {
|
||||||
|
status = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.service;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseService;
|
||||||
|
import top.charles7c.cnadmin.system.model.query.AnnouncementQuery;
|
||||||
|
import top.charles7c.cnadmin.system.model.request.AnnouncementRequest;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告业务接口
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
public interface AnnouncementService
|
||||||
|
extends BaseService<AnnouncementVO, AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> {}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.system.service.impl;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseServiceImpl;
|
||||||
|
import top.charles7c.cnadmin.system.mapper.AnnouncementMapper;
|
||||||
|
import top.charles7c.cnadmin.system.model.entity.AnnouncementDO;
|
||||||
|
import top.charles7c.cnadmin.system.model.query.AnnouncementQuery;
|
||||||
|
import top.charles7c.cnadmin.system.model.request.AnnouncementRequest;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
|
||||||
|
import top.charles7c.cnadmin.system.service.AnnouncementService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告业务实现
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AnnouncementServiceImpl extends BaseServiceImpl<AnnouncementMapper, AnnouncementDO, AnnouncementVO,
|
||||||
|
AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> implements AnnouncementService {}
|
@ -31,11 +31,13 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arco-design/web-vue": "^2.44.7",
|
"@arco-design/web-vue": "^2.44.7",
|
||||||
|
"@kangc/v-md-editor": "^2.3.17",
|
||||||
"@vueuse/core": "^9.13.0",
|
"@vueuse/core": "^9.13.0",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.4.2",
|
||||||
|
"highlight.js": "^11.8.0",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
|
1027
continew-admin-ui/pnpm-lock.yaml
generated
1027
continew-admin-ui/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
59
continew-admin-ui/src/api/system/announcement.ts
Normal file
59
continew-admin-ui/src/api/system/announcement.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import qs from 'query-string';
|
||||||
|
|
||||||
|
const BASE_URL = '/system/announcement';
|
||||||
|
|
||||||
|
export interface DataRecord {
|
||||||
|
id?: string;
|
||||||
|
title?: string;
|
||||||
|
content?: string;
|
||||||
|
status?: string;
|
||||||
|
type?: string;
|
||||||
|
effectiveTime?: string;
|
||||||
|
terminateTime?: string;
|
||||||
|
createUser?: string;
|
||||||
|
createTime?: string;
|
||||||
|
updateUser?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
createUserString?: string;
|
||||||
|
updateUserString?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListParam {
|
||||||
|
title?: string;
|
||||||
|
status?: string;
|
||||||
|
type?: string;
|
||||||
|
page?: number;
|
||||||
|
size?: number;
|
||||||
|
sort?: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListRes {
|
||||||
|
list: DataRecord[];
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function list(params: ListParam) {
|
||||||
|
return axios.get<ListRes>(`${BASE_URL}`, {
|
||||||
|
params,
|
||||||
|
paramsSerializer: (obj) => {
|
||||||
|
return qs.stringify(obj);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function get(id: string) {
|
||||||
|
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function add(req: DataRecord) {
|
||||||
|
return axios.post(BASE_URL, req);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(req: DataRecord, id: string) {
|
||||||
|
return axios.put(`${BASE_URL}/${id}`, req);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids: string | Array<string>) {
|
||||||
|
return axios.delete(`${BASE_URL}/${ids}`);
|
||||||
|
}
|
9
continew-admin-ui/src/env.d.ts
vendored
9
continew-admin-ui/src/env.d.ts
vendored
@ -9,3 +9,12 @@ declare module '*.vue' {
|
|||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_API_BASE_URL: string;
|
readonly VITE_API_BASE_URL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module '@kangc/v-md-editor';
|
||||||
|
declare module '@kangc/v-md-editor/lib/preview';
|
||||||
|
declare module '@kangc/v-md-editor/lib/theme/github.js';
|
||||||
|
declare module '@kangc/v-md-editor/lib/plugins/emoji/index';
|
||||||
|
declare module '@kangc/v-md-editor/lib/plugins/copy-code/index';
|
||||||
|
declare module '@kangc/v-md-editor/lib/plugins/todo-list/index';
|
||||||
|
declare module 'highlight.js';
|
||||||
|
declare module 'highlight.js/lib/languages/json';
|
||||||
|
@ -4,6 +4,7 @@ import localeUser from '@/views/system/user/locale/en-US';
|
|||||||
import localeRole from '@/views/system/role/locale/en-US';
|
import localeRole from '@/views/system/role/locale/en-US';
|
||||||
import localeMenu from '@/views/system/menu/locale/en-US';
|
import localeMenu from '@/views/system/menu/locale/en-US';
|
||||||
import localeDept from '@/views/system/dept/locale/en-US';
|
import localeDept from '@/views/system/dept/locale/en-US';
|
||||||
|
import localeAnnouncement from '@/views/system/announcement/locale/en-US';
|
||||||
|
|
||||||
import localeGenerator from '@/views/tool/generator/locale/en-US';
|
import localeGenerator from '@/views/tool/generator/locale/en-US';
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ export default {
|
|||||||
...localeRole,
|
...localeRole,
|
||||||
...localeMenu,
|
...localeMenu,
|
||||||
...localeDept,
|
...localeDept,
|
||||||
|
...localeAnnouncement,
|
||||||
|
|
||||||
...localeGenerator,
|
...localeGenerator,
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import localeUser from '@/views/system/user/locale/zh-CN';
|
|||||||
import localeRole from '@/views/system/role/locale/zh-CN';
|
import localeRole from '@/views/system/role/locale/zh-CN';
|
||||||
import localeMenu from '@/views/system/menu/locale/zh-CN';
|
import localeMenu from '@/views/system/menu/locale/zh-CN';
|
||||||
import localeDept from '@/views/system/dept/locale/zh-CN';
|
import localeDept from '@/views/system/dept/locale/zh-CN';
|
||||||
|
import localeAnnouncement from '@/views/system/announcement/locale/zh-CN';
|
||||||
|
|
||||||
import localeGenerator from '@/views/tool/generator/locale/zh-CN';
|
import localeGenerator from '@/views/tool/generator/locale/zh-CN';
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ export default {
|
|||||||
...localeRole,
|
...localeRole,
|
||||||
...localeMenu,
|
...localeMenu,
|
||||||
...localeDept,
|
...localeDept,
|
||||||
|
...localeAnnouncement,
|
||||||
|
|
||||||
...localeGenerator,
|
...localeGenerator,
|
||||||
|
|
||||||
|
@ -1,6 +1,25 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import ArcoVue from '@arco-design/web-vue';
|
import ArcoVue from '@arco-design/web-vue';
|
||||||
import ArcoVueIcon from '@arco-design/web-vue/es/icon';
|
import ArcoVueIcon from '@arco-design/web-vue/es/icon';
|
||||||
|
|
||||||
|
import VueMarkdownEditor from '@kangc/v-md-editor';
|
||||||
|
import '@kangc/v-md-editor/lib/style/base-editor.css';
|
||||||
|
import VMdPreview from '@kangc/v-md-editor/lib/preview';
|
||||||
|
import '@kangc/v-md-editor/lib/style/preview.css';
|
||||||
|
// eslint-disable-next-line import/extensions
|
||||||
|
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
|
||||||
|
import '@kangc/v-md-editor/lib/theme/style/github.css';
|
||||||
|
import createEmojiPlugin from '@kangc/v-md-editor/lib/plugins/emoji/index';
|
||||||
|
import '@kangc/v-md-editor/lib/plugins/emoji/emoji.css';
|
||||||
|
import createCopyCodePlugin from '@kangc/v-md-editor/lib/plugins/copy-code/index';
|
||||||
|
import '@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css';
|
||||||
|
import createTodoListPlugin from '@kangc/v-md-editor/lib/plugins/todo-list/index';
|
||||||
|
import '@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css';
|
||||||
|
import hljs from 'highlight.js';
|
||||||
|
// 按需引入语言包
|
||||||
|
import json from 'highlight.js/lib/languages/json';
|
||||||
|
import java from 'highlight.js/lib/languages/java';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unresolved
|
// eslint-disable-next-line import/no-unresolved
|
||||||
import 'virtual:svg-icons-register';
|
import 'virtual:svg-icons-register';
|
||||||
import globalComponents from '@/components';
|
import globalComponents from '@/components';
|
||||||
@ -17,18 +36,28 @@ import App from './App.vue';
|
|||||||
import '@/assets/style/global.less';
|
import '@/assets/style/global.less';
|
||||||
import '@/utils/request';
|
import '@/utils/request';
|
||||||
|
|
||||||
const app = createApp(App);
|
VueMarkdownEditor.use(createEmojiPlugin());
|
||||||
|
VueMarkdownEditor.use(createCopyCodePlugin());
|
||||||
|
VueMarkdownEditor.use(createTodoListPlugin());
|
||||||
|
hljs.registerLanguage('json', json);
|
||||||
|
hljs.registerLanguage('java', java);
|
||||||
|
VueMarkdownEditor.use(githubTheme, {
|
||||||
|
Hljs: hljs,
|
||||||
|
});
|
||||||
|
VMdPreview.use(githubTheme, {
|
||||||
|
Hljs: hljs,
|
||||||
|
});
|
||||||
|
|
||||||
|
const app = createApp(App);
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
app.config.globalProperties.useDict = useDict;
|
app.config.globalProperties.useDict = useDict;
|
||||||
|
|
||||||
app.use(ArcoVue, {});
|
app.use(ArcoVue, {});
|
||||||
app.use(ArcoVueIcon);
|
app.use(ArcoVueIcon);
|
||||||
|
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(store);
|
app.use(store);
|
||||||
app.use(i18n);
|
app.use(i18n);
|
||||||
app.use(globalComponents);
|
app.use(globalComponents);
|
||||||
app.use(directive);
|
app.use(directive);
|
||||||
|
app.use(VueMarkdownEditor);
|
||||||
|
app.use(VMdPreview);
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
@ -52,6 +52,16 @@ const System: AppRouteRecordRaw = {
|
|||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/system/announcement',
|
||||||
|
name: 'Announcement',
|
||||||
|
component: () => import('@/views/system/announcement/index.vue'),
|
||||||
|
meta: {
|
||||||
|
locale: 'menu.system.announcement.list',
|
||||||
|
requiresAuth: true,
|
||||||
|
roles: ['*'],
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
625
continew-admin-ui/src/views/system/announcement/index.vue
Normal file
625
continew-admin-ui/src/views/system/announcement/index.vue
Normal file
@ -0,0 +1,625 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<Breadcrumb :items="['menu.system', 'menu.system.announcement.list']" />
|
||||||
|
<a-card class="general-card" :title="$t('menu.system.announcement.list')">
|
||||||
|
<!-- 头部区域 -->
|
||||||
|
<div class="header">
|
||||||
|
<!-- 搜索栏 -->
|
||||||
|
<div v-if="showQuery" class="header-query">
|
||||||
|
<a-form ref="queryRef" :model="queryParams" layout="inline">
|
||||||
|
<a-form-item field="title" hide-label>
|
||||||
|
<a-input
|
||||||
|
v-model="queryParams.title"
|
||||||
|
placeholder="输入标题搜索"
|
||||||
|
allow-clear
|
||||||
|
style="width: 230px"
|
||||||
|
@press-enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="type" hide-label>
|
||||||
|
<a-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
:options="AnnouncementTypeEnum"
|
||||||
|
placeholder="类型搜索"
|
||||||
|
allow-clear
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item hide-label>
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" @click="handleQuery">
|
||||||
|
<template #icon><icon-search /></template>查询
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="resetQuery">
|
||||||
|
<template #icon><icon-refresh /></template>重置
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!-- 操作栏 -->
|
||||||
|
<div class="header-operation">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-space>
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:add']"
|
||||||
|
type="primary"
|
||||||
|
@click="toAdd"
|
||||||
|
>
|
||||||
|
<template #icon><icon-plus /></template>新增
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:update']"
|
||||||
|
type="primary"
|
||||||
|
status="success"
|
||||||
|
:disabled="single"
|
||||||
|
:title="single ? '请选择一条要修改的数据' : ''"
|
||||||
|
@click="toUpdate(ids[0])"
|
||||||
|
>
|
||||||
|
<template #icon><icon-edit /></template>修改
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:delete']"
|
||||||
|
type="primary"
|
||||||
|
status="danger"
|
||||||
|
:disabled="multiple"
|
||||||
|
:title="multiple ? '请选择要删除的数据' : ''"
|
||||||
|
@click="handleBatchDelete"
|
||||||
|
>
|
||||||
|
<template #icon><icon-delete /></template>删除
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
type="primary"
|
||||||
|
status="warning"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<template #icon><icon-download /></template>导出
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<right-toolbar
|
||||||
|
v-model:show-query="showQuery"
|
||||||
|
@refresh="getList"
|
||||||
|
/>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 列表区域 -->
|
||||||
|
<a-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="id"
|
||||||
|
:data="dataList"
|
||||||
|
:loading="loading"
|
||||||
|
:row-selection="{
|
||||||
|
type: 'checkbox',
|
||||||
|
showCheckedAll: true,
|
||||||
|
onlyCurrent: false,
|
||||||
|
}"
|
||||||
|
:pagination="{
|
||||||
|
showTotal: true,
|
||||||
|
showPageSize: true,
|
||||||
|
total: total,
|
||||||
|
current: queryParams.page,
|
||||||
|
}"
|
||||||
|
:bordered="false"
|
||||||
|
column-resizable
|
||||||
|
stripe
|
||||||
|
size="large"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
@page-size-change="handlePageSizeChange"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<template #columns>
|
||||||
|
<a-table-column title="序号">
|
||||||
|
<template #cell="{ rowIndex }">
|
||||||
|
{{ rowIndex + 1 + (queryParams.page - 1) * queryParams.size }}
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="标题">
|
||||||
|
<template #cell="{ record }">
|
||||||
|
<a-link @click="toDetail(record.id)">{{ record.title }}</a-link>
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="类型" align="center">
|
||||||
|
<template #cell="{ record }">
|
||||||
|
<a-tag v-if="record.type === 1" color="orangered">活动</a-tag>
|
||||||
|
<a-tag v-else-if="record.type === 2" color="cyan">消息</a-tag>
|
||||||
|
<a-tag v-else color="blue">通知</a-tag>
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="状态" align="center">
|
||||||
|
<template #cell="{ record }">
|
||||||
|
<a-tag v-if="record.status === 1" color="green">已发布</a-tag>
|
||||||
|
<a-tag v-else color="orangered">已过期</a-tag>
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="生效时间">
|
||||||
|
<template #cell="{ record }">
|
||||||
|
{{ record.effectiveTime ? record.effectiveTime : '无' }}
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="终止时间">
|
||||||
|
<template #cell="{ record }">
|
||||||
|
{{ record.terminateTime ? record.terminateTime : '无' }}
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
<a-table-column title="创建人" data-index="createUserString" />
|
||||||
|
<a-table-column title="创建时间" data-index="createTime" />
|
||||||
|
<a-table-column
|
||||||
|
v-if="
|
||||||
|
checkPermission([
|
||||||
|
'system:announcement:update',
|
||||||
|
'system:announcement:delete',
|
||||||
|
])
|
||||||
|
"
|
||||||
|
title="操作"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template #cell="{ record }">
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:update']"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
title="修改"
|
||||||
|
@click="toUpdate(record.id)"
|
||||||
|
>
|
||||||
|
<template #icon><icon-edit /></template>修改
|
||||||
|
</a-button>
|
||||||
|
<a-popconfirm
|
||||||
|
content="确定要删除当前选中的数据吗?"
|
||||||
|
type="warning"
|
||||||
|
@ok="handleDelete([record.id])"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
v-permission="['system:announcement:delete']"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
title="删除"
|
||||||
|
:disabled="record.disabled"
|
||||||
|
>
|
||||||
|
<template #icon><icon-delete /></template>删除
|
||||||
|
</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
|
</a-table-column>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<a-modal
|
||||||
|
:title="title"
|
||||||
|
:visible="visible"
|
||||||
|
width="80%"
|
||||||
|
:mask-closable="false"
|
||||||
|
:esc-to-close="false"
|
||||||
|
unmount-on-close
|
||||||
|
render-to-body
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
layout="vertical"
|
||||||
|
:label-col-style="{ width: '75px' }"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="标题" field="title">
|
||||||
|
<a-input
|
||||||
|
v-model="form.title"
|
||||||
|
placeholder="请输入标题"
|
||||||
|
max-length="255"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item
|
||||||
|
label="类型"
|
||||||
|
field="type"
|
||||||
|
tooltip="计划 v1.2.0 增加字典管理,用于维护此类信息"
|
||||||
|
>
|
||||||
|
<a-select
|
||||||
|
v-model="form.type"
|
||||||
|
:options="AnnouncementTypeEnum"
|
||||||
|
placeholder="请选择类型"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item
|
||||||
|
label="生效时间"
|
||||||
|
field="effectiveTime"
|
||||||
|
tooltip="默认立即生效"
|
||||||
|
>
|
||||||
|
<a-date-picker
|
||||||
|
v-model="form.effectiveTime"
|
||||||
|
placeholder="请选择生效时间"
|
||||||
|
show-time
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item
|
||||||
|
label="终止时间"
|
||||||
|
field="terminateTime"
|
||||||
|
tooltip="默认无终止"
|
||||||
|
>
|
||||||
|
<a-date-picker
|
||||||
|
v-model="form.terminateTime"
|
||||||
|
placeholder="请选择终止时间"
|
||||||
|
show-time
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="内容" field="content">
|
||||||
|
<v-md-editor
|
||||||
|
v-model="form.content"
|
||||||
|
height="400px"
|
||||||
|
left-toolbar="undo redo clear | h bold italic strikethrough quote | ul ol table hr | link image code"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 详情区域 -->
|
||||||
|
<a-modal
|
||||||
|
:visible="detailVisible"
|
||||||
|
modal-class="detail"
|
||||||
|
width="70%"
|
||||||
|
:footer="false"
|
||||||
|
unmount-on-close
|
||||||
|
render-to-body
|
||||||
|
@cancel="handleDetailCancel"
|
||||||
|
>
|
||||||
|
<a-spin
|
||||||
|
:loading="detailLoading"
|
||||||
|
tip="公告正在赶来..."
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<icon-sync />
|
||||||
|
</template>
|
||||||
|
<a-typography :style="{ marginTop: '-40px', textAlign: 'center' }">
|
||||||
|
<a-typography-title>
|
||||||
|
{{ detail.title }}
|
||||||
|
</a-typography-title>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
<div class="meta-data">
|
||||||
|
<a-space>
|
||||||
|
<span>
|
||||||
|
<icon-user class="icon" />
|
||||||
|
<span class="label">发布人:</span>
|
||||||
|
<span>{{ detail.createUserString }}</span>
|
||||||
|
</span>
|
||||||
|
<a-divider direction="vertical" />
|
||||||
|
<span>
|
||||||
|
<svg-icon icon-class="clock-circle" class="icon" />
|
||||||
|
<span class="label">发布时间:</span>
|
||||||
|
<span>{{ detail.effectiveTime ? detail.effectiveTime : detail.createTime }}</span>
|
||||||
|
</span>
|
||||||
|
</a-space>
|
||||||
|
</div>
|
||||||
|
</a-typography-paragraph>
|
||||||
|
</a-typography>
|
||||||
|
<a-divider />
|
||||||
|
<v-md-preview :text="detail.content"></v-md-preview>
|
||||||
|
<a-divider />
|
||||||
|
<div v-if="detail.updateTime" class="update-time-row">
|
||||||
|
<span>
|
||||||
|
<icon-schedule class="icon" />
|
||||||
|
<span>最后更新于:</span>
|
||||||
|
<span>{{ detail.updateTime }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
|
||||||
|
import {
|
||||||
|
DataRecord,
|
||||||
|
ListParam,
|
||||||
|
list,
|
||||||
|
get,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
del,
|
||||||
|
} from '@/api/system/announcement';
|
||||||
|
import checkPermission from '@/utils/permission';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as any;
|
||||||
|
const { AnnouncementTypeEnum } = proxy.useDict('AnnouncementTypeEnum');
|
||||||
|
|
||||||
|
const dataList = ref<DataRecord[]>([]);
|
||||||
|
const detail = ref<DataRecord>({
|
||||||
|
// TODO 待补充详情字段默认值
|
||||||
|
});
|
||||||
|
const total = ref(0);
|
||||||
|
const ids = ref<Array<string>>([]);
|
||||||
|
const title = ref('');
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const showQuery = ref(true);
|
||||||
|
const loading = ref(false);
|
||||||
|
const detailLoading = ref(false);
|
||||||
|
const exportLoading = ref(false);
|
||||||
|
const visible = ref(false);
|
||||||
|
const detailVisible = ref(false);
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
title: undefined,
|
||||||
|
status: undefined,
|
||||||
|
type: undefined,
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
sort: ['createTime,desc'],
|
||||||
|
},
|
||||||
|
// 表单数据
|
||||||
|
form: {} as DataRecord,
|
||||||
|
// 表单验证规则
|
||||||
|
rules: {
|
||||||
|
title: [{ required: true, message: '请输入标题' }],
|
||||||
|
content: [{ required: true, message: '请输入内容' }],
|
||||||
|
type: [{ required: true, message: '请选择类型' }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param params 查询参数
|
||||||
|
*/
|
||||||
|
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||||
|
loading.value = true;
|
||||||
|
list(params)
|
||||||
|
.then((res) => {
|
||||||
|
dataList.value = res.data.list;
|
||||||
|
total.value = res.data.total;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
getList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开新增对话框
|
||||||
|
*/
|
||||||
|
const toAdd = () => {
|
||||||
|
reset();
|
||||||
|
title.value = '新增公告';
|
||||||
|
visible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开修改对话框
|
||||||
|
*
|
||||||
|
* @param id ID
|
||||||
|
*/
|
||||||
|
const toUpdate = (id: string) => {
|
||||||
|
reset();
|
||||||
|
get(id).then((res) => {
|
||||||
|
form.value = res.data;
|
||||||
|
title.value = '修改公告';
|
||||||
|
visible.value = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单
|
||||||
|
*/
|
||||||
|
const reset = () => {
|
||||||
|
form.value = {
|
||||||
|
// TODO 待补充需要重置的字段默认值,详情请参考其他模块 index.vue
|
||||||
|
};
|
||||||
|
proxy.$refs.formRef?.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
const handleCancel = () => {
|
||||||
|
visible.value = false;
|
||||||
|
proxy.$refs.formRef.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
const handleOk = () => {
|
||||||
|
proxy.$refs.formRef.validate((valid: any) => {
|
||||||
|
if (!valid) {
|
||||||
|
if (form.value.id !== undefined) {
|
||||||
|
update(form.value, form.value.id).then((res) => {
|
||||||
|
handleCancel();
|
||||||
|
getList();
|
||||||
|
proxy.$message.success(res.msg);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
add(form.value).then((res) => {
|
||||||
|
handleCancel();
|
||||||
|
getList();
|
||||||
|
proxy.$message.success(res.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看详情
|
||||||
|
*
|
||||||
|
* @param id ID
|
||||||
|
*/
|
||||||
|
const toDetail = async (id: string) => {
|
||||||
|
if (detailLoading.value) return;
|
||||||
|
detailLoading.value = true;
|
||||||
|
detailVisible.value = true;
|
||||||
|
get(id)
|
||||||
|
.then((res) => {
|
||||||
|
detail.value = res.data;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
detailLoading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭详情
|
||||||
|
*/
|
||||||
|
const handleDetailCancel = () => {
|
||||||
|
detailVisible.value = false;
|
||||||
|
detail.value = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
const handleBatchDelete = () => {
|
||||||
|
if (ids.value.length === 0) {
|
||||||
|
proxy.$message.info('请选择要删除的数据');
|
||||||
|
} else {
|
||||||
|
proxy.$modal.warning({
|
||||||
|
title: '警告',
|
||||||
|
titleAlign: 'start',
|
||||||
|
content: '确定要删除当前选中的数据吗?',
|
||||||
|
hideCancel: false,
|
||||||
|
onOk: () => {
|
||||||
|
handleDelete(ids.value);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param ids ID 列表
|
||||||
|
*/
|
||||||
|
const handleDelete = (ids: Array<string>) => {
|
||||||
|
del(ids).then((res) => {
|
||||||
|
proxy.$message.success(res.msg);
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已选择的数据行发生改变时触发
|
||||||
|
*
|
||||||
|
* @param rowKeys ID 列表
|
||||||
|
*/
|
||||||
|
const handleSelectionChange = (rowKeys: Array<any>) => {
|
||||||
|
ids.value = rowKeys;
|
||||||
|
single.value = rowKeys.length !== 1;
|
||||||
|
multiple.value = !rowKeys.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
const handleExport = () => {
|
||||||
|
if (exportLoading.value) return;
|
||||||
|
exportLoading.value = true;
|
||||||
|
proxy
|
||||||
|
.download(
|
||||||
|
'/system/announcement/export',
|
||||||
|
{ ...queryParams.value },
|
||||||
|
'公告数据'
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
exportLoading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
const handleQuery = () => {
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
const resetQuery = () => {
|
||||||
|
proxy.$refs.queryRef.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换页码
|
||||||
|
*
|
||||||
|
* @param current 页码
|
||||||
|
*/
|
||||||
|
const handlePageChange = (current: number) => {
|
||||||
|
queryParams.value.page = current;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换每页条数
|
||||||
|
*
|
||||||
|
* @param pageSize 每页条数
|
||||||
|
*/
|
||||||
|
const handlePageSizeChange = (pageSize: number) => {
|
||||||
|
queryParams.value.size = pageSize;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'Announcement',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
:deep(.github-markdown-body) {
|
||||||
|
padding: 16px 32px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.arco-form-item-label-tooltip) {
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-data {
|
||||||
|
font-size: 15px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-time-row {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
'menu.system.announcement.list': 'Announcement management',
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
'menu.system.announcement.list': '公告管理',
|
||||||
|
};
|
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.cnadmin.webapi.controller.system;
|
||||||
|
|
||||||
|
import static top.charles7c.cnadmin.common.annotation.CrudRequestMapping.Api;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
|
||||||
|
import top.charles7c.cnadmin.common.annotation.CrudRequestMapping;
|
||||||
|
import top.charles7c.cnadmin.common.base.BaseController;
|
||||||
|
import top.charles7c.cnadmin.common.base.ValidateGroup;
|
||||||
|
import top.charles7c.cnadmin.common.model.vo.R;
|
||||||
|
import top.charles7c.cnadmin.common.util.validate.ValidationUtils;
|
||||||
|
import top.charles7c.cnadmin.system.model.query.AnnouncementQuery;
|
||||||
|
import top.charles7c.cnadmin.system.model.request.AnnouncementRequest;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO;
|
||||||
|
import top.charles7c.cnadmin.system.model.vo.AnnouncementVO;
|
||||||
|
import top.charles7c.cnadmin.system.service.AnnouncementService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告管理 API
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/8/20 10:55
|
||||||
|
*/
|
||||||
|
@Tag(name = "公告管理 API")
|
||||||
|
@RestController
|
||||||
|
@CrudRequestMapping(value = "/system/announcement",
|
||||||
|
api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT})
|
||||||
|
public class AnnouncementController extends
|
||||||
|
BaseController<AnnouncementService, AnnouncementVO, AnnouncementDetailVO, AnnouncementQuery, AnnouncementRequest> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SaCheckPermission("system:announcement:add")
|
||||||
|
public R<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AnnouncementRequest request) {
|
||||||
|
this.checkTime(request);
|
||||||
|
return super.add(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SaCheckPermission("system:announcement:update")
|
||||||
|
public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementRequest request,
|
||||||
|
@PathVariable Long id) {
|
||||||
|
this.checkTime(request);
|
||||||
|
return super.update(request, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查时间
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* 创建或修改信息
|
||||||
|
*/
|
||||||
|
private void checkTime(AnnouncementRequest request) {
|
||||||
|
LocalDateTime effectiveTime = request.getEffectiveTime();
|
||||||
|
LocalDateTime terminateTime = request.getTerminateTime();
|
||||||
|
if (null != effectiveTime && null != terminateTime) {
|
||||||
|
ValidationUtils.throwIf(terminateTime.isBefore(effectiveTime), "终止时间必须晚于生效时间");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,3 +31,20 @@ CREATE TABLE IF NOT EXISTS `gen_field_config` (
|
|||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
INDEX `idx_table_name`(`table_name`) USING BTREE
|
INDEX `idx_table_name`(`table_name`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字段配置表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字段配置表';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `sys_announcement` (
|
||||||
|
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
|
||||||
|
`title` varchar(255) NOT NULL COMMENT '标题',
|
||||||
|
`content` mediumtext NOT NULL COMMENT '内容',
|
||||||
|
`type` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '类型(1:活动,2:消息,3:通知)',
|
||||||
|
`effective_time` datetime DEFAULT NULL COMMENT '生效时间',
|
||||||
|
`terminate_time` datetime DEFAULT NULL COMMENT '终止时间',
|
||||||
|
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '排序',
|
||||||
|
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `idx_create_user`(`create_user`) USING BTREE,
|
||||||
|
INDEX `idx_update_user`(`update_user`) USING BTREE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告表';
|
Loading…
Reference in New Issue
Block a user