/** * UDK TypeScript Definitions * * 规范 - Spefication * * I. 命名规则 - Naming: * namespace - Xxxx * type - XxxxType * 接口定义 - Ixxxx * 数据结构 - XxxxData * 枚举 - XxxxEnum */ import { ConnectedApplicationModels, ModelProps } from './model' import { History, Location } from 'history' import { Dispatch } from 'redux' import { match } from 'dva/router' import { Field } from './utils' import { RuleItem } from './libs' export * from './apps' export * from './components' export * from './config' export * from './libs' export * from './model' export * from './utils' export * from './framework' export * from './mfe' export interface ModelHelperOptions { /** * dva */ namespace: string // 后台数据接口URL serviceUrl: string // 支持分页 pageable?: boolean // Model 加载时触发getAll操作 getAllOnload: boolean // 触发分页查询的URL triggerPageUrl: string // 触发FetchAll的URLs triggerAllUrls?: string[] subscriptions?: object effects?: object } export type EnvProfileUnoin = 'dev' | 'uat' | 'prd' | 'gla' export type RoleUnoin = 'ROLE_ADMIN' | 'ROLE_UAT' | 'ROLE_FT' | string export type NavigationType = 'browser' | 'frame' | 'mobile' export type ModalType = 'create' | 'update' | 'delete' | 'edit' export type CaptchaType = 'pic' | 'sms' export type DepartmentUnoin = | '信息技术部' | '总经理室' | '组合管理部' | '综合管理部' | '风险管理部' | '法律合规部' | '另类投资管理中心' | '集中交易室' | '营运部' | '量化投资部' | '研究部' | '财务部' | '信用评估部' | '市场部' | '固定收益部' | '产品管理部' | '权益投资部' export type AlertLevel = 'info' | 'warn' | 'error' | 'success' export type MoreOptionPopupSelection = | 'star' // 收藏 | 'home' // 返回主页 | 'share' // 分享 (暂未实现) | 'clear' // 清空(在有的列表页提供该功能,需注册回调方法onClear) | 'help' // 帮助(显示帮助向导,需注册回调方法onHelp) | 'refresh' // 刷新(显示刷新,需注册回调方法onRefresh) | 'setting' // 设置 | 'switchUser' // 切换用户 /** * 用户授权信息 */ export interface Authority { /** 用户名 */ user?: string /** 部门 */ dept?: DepartmentUnoin | string /** 被授予的角色 */ roles?: RoleUnoin[] /** 被授予的组 */ groups?: string[] } export interface RoutePermission extends Permission {} export interface ReduxProps { dispatch: Dispatch } export interface ReduxRouterProps extends ReduxProps { /** 导航历史 */ history?: History /** 当前导航信息 */ location?: Location match?: match } /** 页面通过Redux自动获得属性 */ export type PageProps = ReduxRouterProps & ConnectedApplicationModels /** 环境配置 */ export interface EnvProfile { /** 名称 */ profile: EnvProfileUnoin /** 描述 */ label: string /** 协议 */ protocol: 'http' | 'https' | 'ws' /** 后台IP */ ip: string /** 后台端口 */ port: number /** 后台HTTP上下文 */ context: string } /** 表单模式 */ export type FormMode = | 'create' // 新建表单 | 'edit' // 编辑表单 | 'update' // 更新表单 | 'view' // 浏览表单 | 'delete' // 删除表单 /** * 分页 */ export interface Pagination { /** 当前页 */ current: number /** 总页数 */ total: number /** 每页大小 */ size: number // showSizeChanger?: boolean // showQuickJumper?: boolean } /** * 分页(请求参数) */ export interface PagebleQueryParams { page: number size: number sort?: PagebleQuerySortInfo } /** * 查询(请求参数) */ /* export interface SearchQueryParams { q: string searchType: string searchFields: string[] } */ export type SpecificationType = | 'eq' | 'neq' | 'like' | 'isTrue' | 'isFalse' | 'isNull' | 'likeb' | 'likee' | 'gt' | 'lt' | 'ge' | 'le' | 'isTrue' | 'isFalse' export type SpecificationConjunctType = 'or' | 'and' export interface ListPagination { page: number size: number sortBy?: string direction?: 'ASC' | 'DESC' } export interface SearchQueryParams { pagination?: ListPagination searchSpecs?: SpecificationDto[] conjunct?: SpecificationConjunctType } export interface SpecificationDto { /** 查询值 */ value: any valueType: Field.MetaType /** 查询类型 */ type: SpecificationType /** 查询字段 */ field: string /** */ conjunct?: SpecificationConjunctType } /** * 返回数据里的分页信息 */ export interface PagebleQueryInfo { pageNumber: number pageSize: number sort?: PagebleQuerySortInfo } export interface PagebleQuerySortInfo { sorted: boolean unsorted: boolean } export interface UwpReponseStatusType { /** 错误代码 */ code: number /** 错误描述 */ desc: string } /** * 通用ResponseEntity */ export interface CommonResponseEntity { /** * 业务请求是否成功 */ success: boolean /** * 相应状态 */ responseStatus: UwpReponseStatusType /** * 是否加密 */ enc: boolean /** * 数据 */ data?: T /** 备选数据(兼容老的接口) */ content?: T } /** UDK types for common use */ export namespace Udk { export interface EnumData extends Partial { status?: 'Success' | 'Error' | 'Processing' | 'Warning' | 'Default' } } /** UWP types for common use */ export namespace Uwp { export interface ReponseStatusType { /** 错误代码 */ code: number /** 错误描述 */ desc: string } /** * 通用ResponseEntity */ export interface ResponseEntity { /** * 业务请求是否成功 */ success: boolean /** * 相应状态 */ responseStatus: ReponseStatusType /** * 是否加密 */ enc: boolean /** * 数据 */ data?: T } /** * 通用ResponseEntity */ export interface ResponseError { /** * 业务请求是否成功 */ success: boolean /** * 相应状态 */ responseStatus: ReponseStatusType opts?: any } } /** * 分页 */ export interface Pagination { showSizeChanger: boolean showQuickJumper: boolean /** 当前页 */ current: number /** 总页数 */ total: number /** 每页大小 */ size: number }