feat(infra): 新增状态机管理功能模块

- 新增状态机模型和状态流转的完整 CRUD 功能
- 添加字典编码 OBJECT_STATUS_MODEL_OBJECT_TYPE_DICT_CODE 用于对象类型下拉选择
- 实现状态机列表页、搜索组件、操作对话框和状态流转管理
- 新增 infra API 接口封装和类型定义
- 遵循项目规范:使用 TableSearchFields 搜索组件、BusinessTableActionCell 操作列、统一的状态标签展示

涉及文件:
- src/constants/dict.ts: 新增对象类型字典编码
- src/service/api/infra.ts: 新增状态机和状态流转相关 API
- src/typings/api/infra.d.ts: 新增状态机相关类型定义
- src/views/infra/state-machine/: 新增状态机管理页面及子组件
This commit is contained in:
caozehui
2026-05-15 09:31:00 +08:00
parent 960fe805ec
commit 3a064eb09f
11 changed files with 1891 additions and 1 deletions

101
src/typings/api/infra.d.ts vendored Normal file
View File

@@ -0,0 +1,101 @@
declare namespace Api {
/**
* namespace Infra
*
* backend api module: "project/status/*"
*/
namespace Infra {
type CommonStatus = 0 | 1;
interface PageParams {
pageNo: number;
pageSize: number;
}
interface PageResult<T = any> {
total: number;
list: T[];
}
interface ObjectStatusModel {
id: string;
objectType: string;
statusCode: string;
statusName: string;
sort: number;
status: CommonStatus;
initialFlag: boolean;
terminalFlag: boolean;
allowEdit: boolean;
progressExcludedFlag: boolean;
allowCreateProject: boolean;
allowCreateRequirement: boolean;
remark?: string | null;
creator?: string | null;
createTime: string;
updater?: string | null;
updateTime: string;
}
type ObjectStatusModelSearchParams = CommonType.RecordNullable<
Pick<PageParams, 'pageNo' | 'pageSize'> &
Pick<ObjectStatusModel, 'objectType' | 'status' | 'initialFlag' | 'terminalFlag'> & {
keyword?: string;
}
>;
type SaveObjectStatusModelParams = Pick<
ObjectStatusModel,
| 'objectType'
| 'statusCode'
| 'statusName'
| 'sort'
| 'status'
| 'initialFlag'
| 'terminalFlag'
| 'allowEdit'
| 'progressExcludedFlag'
| 'allowCreateProject'
| 'allowCreateRequirement'
> & {
remark?: string | null;
};
type ObjectStatusModelList = PageResult<ObjectStatusModel>;
interface ObjectStatusTransition {
id: string;
objectType: string;
actionCode: string;
actionName: string;
fromStatusCode: string;
fromStatusName?: string | null;
toStatusCode: string;
toStatusName?: string | null;
needReason: boolean;
status: CommonStatus;
remark?: string | null;
creator?: string | null;
createTime: string;
updater?: string | null;
updateTime: string;
}
type ObjectStatusTransitionSearchParams = CommonType.RecordNullable<
Pick<PageParams, 'pageNo' | 'pageSize'> &
Pick<
ObjectStatusTransition,
'objectType' | 'fromStatusCode' | 'toStatusCode' | 'status' | 'actionCode' | 'actionName'
>
>;
type SaveObjectStatusTransitionParams = Pick<
ObjectStatusTransition,
'objectType' | 'actionCode' | 'actionName' | 'fromStatusCode' | 'toStatusCode' | 'needReason' | 'status'
> & {
remark?: string | null;
};
type ObjectStatusTransitionList = PageResult<ObjectStatusTransition>;
}
}