Files
NoticeFront/src/types/notice.ts
T

345 lines
10 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 通知公告前端类型契约(P1-7)
*
* 与后端 VO/DTO 一一对齐:
* - NoticeVo → 后端 model/notice/NoticeVo.java(Jackson 默认驼峰序列化)
* - NoticeDetailVo → 后端 model/notice/NoticeDetailVo.java(@JsonProperty 保留旧字段名)
* - BasePageResult → 后端 model/BasePageResult.java
* - NoticePageResult extends BasePageResult → 后端 model/notice/NoticePageResult.java
* - UpFileResultVo → 后端 model/notice/UpFileResultVo.java(@JsonProperty)
* - UpFileVo → 后端 model/notice/UpFileVo.java
* - InitializeRedVo → 后端 model/notice/InitializeRedVo.java(@JsonProperty)
* - NoticeStatisticsVo → 后端 model/notice/NoticeStatisticsVo.java
* - NoticeRequest → 后端 model/notice/NoticeRequest.java
* - NoticeQuery → 后端 model/notice/NoticeQuery.java + BasePageQuery.java
*/
// ============================ 分页外壳 ============================
/** 统一分页响应外壳(对齐 BasePageResult.java) */
export interface BasePageResult<T> {
total: number;
content: T[];
pageIndex: number;
pageSize: number;
totalPages: number;
hasNext: boolean;
}
/** 通知分页结果(对齐 NoticePageResult.java,扩展 unreadCount) */
export interface NoticePageResult<T> extends BasePageResult<T> {
/** 当前用户未读通知总数 */
unreadCount: number;
}
// ============================ 通知列表项 ============================
/** 通知视图对象(对齐 NoticeVo.java,Jackson 默认驼峰序列化) */
export interface NoticeVo {
id: number;
title: string;
content: string;
type: number;
typeDesc: string;
publisherAccount: string;
publisherName: string;
deptId: string;
deptName: string;
status: number;
statusDesc: string;
topmost: number;
/** 已读人数 */
readCount: number;
/** 应读人数 */
allowCount: number;
/** 当前用户是否已读 */
read: boolean;
/** 是否撤回:0 否 / 1 是 */
isPulled: number;
/** 定时发送时间 */
timingSendTime: string | null;
/** 父通知ID(转发时关联原通知) */
parentId: number | null;
/** 短信发送标记 */
smsFlag: number;
/** 接收人列表(JSON) */
receiveList: string | null;
createBy: string | null;
createTime: string | null;
updateBy: string | null;
updateTime: string | null;
/** 绑定的审核流程 GUID(null=直发未接流程中心) */
flowGuid?: string | null;
/** 审核状态:0 待提交 / 10 审批中 / 20 已通过 / 30 已驳回 / 40 已撤回(null=未绑流程) */
auditStatus?: number | null;
/** 审核状态文案 */
auditStatusDesc?: string | null;
/** 流程中心办件 id */
flowInstanceId?: number | null;
}
// ============================ 先审后发(流程中心) ============================
/** 审核流程下拉选项(对齐 FlowModels.FlowSummaryVo) */
export interface FlowOption {
flowGuid: string;
name: string;
version: number;
nodeSummary: string | null;
}
/** 应用级流程绑定视图(GET /api/notice/flow/Binding;应用设置 > 流程绑定 + 发通知页按钮显隐) */
export interface FlowBindingVo {
/** 本校是否已绑定审核流程(false=全部直发,现有功能不变) */
bound: boolean;
flowGuid: string | null;
flowName: string | null;
/** 流程中心是否接入(false 时设置页隐藏绑定入口) */
flowEnabled: boolean;
/** 当前用户是否可维护绑定(本校管理员;false 时设置页只读展示) */
canEdit?: boolean;
}
/** 审批进度(GET /api/notice/flow/Trace) */
export interface FlowTraceVo {
bound: boolean;
flowGuid: string | null;
flowInstanceId: number | null;
auditStatus: number | null;
auditStatusDesc: string | null;
status: number | null;
flowResult?: { result?: string; opinion?: string; rejectNode?: string } | null;
instanceStatus?: number | null;
version?: number | null;
nodeSummary?: string | null;
currentNodes?: string | null;
assigneeIds?: number[] | null;
submitTime?: string | null;
finishTime?: string | null;
/** 办理轨迹(traceJson 解析后的数组) */
trace?: any[] | null;
/** 结构化步骤(2026-09-17 接入:steps[0] 固定"发起申请",同节点多任务每人一行) */
steps?: FlowProgressStepVo[] | null;
}
/** 流程步骤(SDK FlowProgressStep 同构:后端 /flow/Trace 的 steps 元素) */
export interface FlowProgressStepVo {
nodeId: string;
nodeName: string | null;
label: string | null;
active: boolean;
assignees?: {
userName?: string | null;
status?: number | null;
statusLabel?: string | null;
opinion?: string | null;
handleTime?: string | null;
}[] | null;
}
// ============================ 通知详情 ============================
/** 通知详情视图对象(对齐 NoticeDetailVo.java,@JsonProperty 保留旧字段名) */
export interface NoticeDetailVo {
serid: number;
title: string;
flowGuid?: string | null;
auditStatus?: number | null;
auditStatusDesc?: string | null;
flowInstanceId?: number | null;
flowResult?: { result?: string; opinion?: string; rejectNode?: string } | null;
/** 通知内容(旧字段名 Contents) */
Contents: string;
/** 发布部门ID(旧字段名 DeptID) */
DeptID: string;
/** 发布部门名称(旧字段名 DeptName) */
DeptName: string;
/** 发布人姓名(旧字段名 TeaName) */
TeaName: string;
/** 发布时间(旧字段名 EditDate,已格式化为字符串) */
EditDate: string;
/** 应读人数 */
numcount: number;
/** 已读人数 */
readnumcount: number;
/** 接收人列表 */
ReceiveList: string | null;
/** 定时发送时间(旧字段名 DsfsTime,已格式化) */
DsfsTime: string | null;
/** 是否定时发送 */
isDsfs: boolean;
/** 附件列表(旧字段名 ChaoSend) */
ChaoSend: NoticeDetailFileItem[];
/** 接收人列表:"all" 或账号数组 */
tlist: string | string[];
}
/** 通知详情附件项(对齐 NoticeDetailVo.FileItem) */
export interface NoticeDetailFileItem {
id: number;
name: string;
size: number;
fileid: number;
filename: string;
}
// ============================ 文件上传 ============================
/** 文件上传结果(对齐 UpFileResultVo.java,@JsonProperty) */
export interface UpFileResultVo {
fileid: number;
name: string;
fileurl: string;
host: string;
type: string;
size: number;
}
/** 附件视图对象(对齐 UpFileVo.java) */
export interface UpFileVo {
id: number;
fileTrueName: string;
fileName: string;
fileSize: number;
fileType: string;
topicId: number;
topicType: string;
}
// ============================ 一键已读 ============================
/** 一键已读结果(对齐 InitializeRedVo.java,@JsonProperty) */
export interface InitializeRedVo {
count: number;
}
// ============================ 上一篇/下一篇 ============================
/** 上一篇/下一篇通知ID */
export interface NextPrevVo {
prevId: number;
nextId: number;
}
// ============================ 阅读情况 ============================
/** 阅读情况分组项(后端 Map 返回,字段名固定) */
export interface ReadGroup {
GroupName: string;
teaslist: ReadGroupUser[];
}
/** 阅读情况用户项(后端 Map 返回) */
export interface ReadGroupUser {
account: string;
teaname: string;
states: 'read' | 'unread';
}
// ============================ 统计 ============================
/** 通知统计视图(对齐 NoticeStatisticsVo.java) */
export interface NoticeStatisticsVo {
total: number;
publishedCount: number;
totalReadRecords: number;
unreadForCurrentUser: number;
byPublisher: { publisherName: string; count: number }[];
byMonth: { year: number; month: number; count: number }[];
}
// ============================ 请求入参 ============================
/** 通知发布/编辑入参(对齐 NoticeRequest.java) */
export interface NoticeRequest {
title: string;
content?: string;
type?: number;
deptId: string;
deptName?: string;
topmost?: number;
receiveList?: string;
/** 附件文件ID列表(逗号分隔串) */
fileIds?: string;
timingSendTime?: string;
/** 短信发送标记 */
smsFlag?: number;
/** 转发源通知ID */
sourceId?: number;
// 审核流程不由前端指定:绑定在「应用设置 > 流程绑定」,后端按「已绑定 + 通知对象=全部用户」判定
}
/** 通知列表查询参数(对齐 NoticeQuery.java + BasePageQuery.java) */
export interface NoticeQuery {
pageIndex?: number;
pageSize?: number;
keyword?: string;
status?: number;
/**
* 审核状态筛选(列表「状态」下拉):0 待提交 / 10 审批中 / 20 已通过 / 30 已驳回 / 40 已撤回;
* -1 = 无需审核(直发通知);不传不过滤
*/
auditStatus?: number;
type?: number;
/** 列表范围(管理端):"user" 只看自己发布的,不传=全部 */
scope?: string;
deptId?: string;
publisherAccount?: string;
/** 开始时间(yyyy-MM-dd 短日期) */
startTime?: string;
/** 结束时间(yyyy-MM-dd 短日期) */
endTime?: string;
/** 阅读状态过滤(仅用户端):0 全部 / 1 未读 / 2 已读 */
readType?: number;
/** 排序:1 时间倒序 / 2 时间正序 */
orderByTime?: string;
}
// ============================ 字典/联系组 ============================
/** 系统字典下拉项 */
export interface DictOption {
k: number | string;
v: string | null;
[key: string]: any;
}
/** 发文部门管理列表项 */
export interface DeptManageItem {
SerID: number;
CodeID: string;
Name: string;
Enable: number;
}
/** 联系组列表项 */
export interface ContactGroupItem {
serid: number;
GroupName: string;
}
/** 联系组分页结果 */
export interface ContactGroupPage {
list: ContactGroupItem[];
total: number;
}
/** 联系组用户项 */
export interface ContactUser {
account: string;
name: string;
userId?: number;
id?: number;
}
/** 联系组用户分页结果 */
export interface ContactUserPage {
list: ContactUser[];
total: number;
}
/** 组织树节点(基础平台返回) */
export interface SchoolTreeNode {
[key: string]: any;
}