types.ts 1.38 KB
// 与后端 SceneSchemaService 输出对应的类型(宽松定义,随模型演进自动兼容)

export interface FieldBind {
  bindAggregateId: string
  bindSourceType: 'aggregate_root' | 'aggregate_entity'
  domainEntityName?: string
  domainFieldName: string
  formLabel?: string
  placeholder?: string
  required?: boolean
  maskField?: boolean
  fieldType?: string
  masked?: boolean
  optionsSource?: {
    aggregateId: string
    endpoint: string
    valueField: string
    labelField: string
  }
}

export interface DragComponent {
  compId: string
  compType: 'input' | 'number_input' | 'date_picker' | 'switch' | 'table' | 'card' | 'text_area' | 'select'
  width?: string
  span?: number
  fieldBind?: FieldBind
  childComponents?: DragComponent[]
}

export interface SceneSchema {
  sceneId: string
  sceneName: string
  aggregateScope: string[]
  permissionBind: string[]
  command?: any
  commandApi?: string
  template?: {
    templateId: string
    templateName: string
    templateType: string
    renderMode: string
    masterAggregate: string
    detailAggregates: string[]
    rootComponents: DragComponent[]
  }
  rules?: Array<{ ruleId: string; ruleName: string; effect: string; message: string; matchCondition: string }>
  ruleGlobalParams?: Record<string, any>
  sourceLayers?: Record<string, string>
}

export type OptionItem = { value: any; label: any; data: Record<string, any> }