export type ComBoxOptionType = {
  value: string;
  label: string;
};
type DataType = {
  Value: string;
  Lable: string;
};
export interface ColumnFilterItemInter {
  prop?: string;
  type?: string;
  data?: DataType[];
  MatchCase?: string;
  options?: DataType[];
  defaultValue?: string | number | boolean;
  dataType?: string;
  mode?: string; //用于下拉选项设置是否多选
}

type TreeChildType = {
  value?: string | number;
  label?: string;
  key?: string | number;
  title?: string;
  children: TreeChildType[];
};

export interface TreeInter extends TreeChildType {
  children: TreeChildType[];
}

export type ItemType = {
  [key: string]: any;
  key?: string;
  Key?: string;
  label?: string;
  value: string | number;
  Value?: string | number;
  labelZH?: string;
  labelEN?: string;
  color?: string;
  bgColor?: string;
};

type TableBtnOptionType = {
  label: string;
  color: string;
  icon: string;
  divider: boolean;
  ifShow: boolean;
  tooltip: string;
  type: string;
  btnKey: string;
};

export interface ColInter {
  [key:string]:any;
  Field: string;
  NameZH: string;
  NameEN: string;
  Fix?: boolean;
  fixed?: boolean;
  Visible: boolean;
  Style: string;
  ifShow?: boolean;
  title?: string;
  dataIndex: string;
  width?: string | number;
  Option?: ItemType[];
  treeOption?: TreeInter[];
  btnOption?: TableBtnOptionType[];
  isEdit?: boolean;
  dataType?: string;
  isRequire?: boolean;
  ReadOnly?: boolean;
  isShowInForm?: boolean;
  maxlength?: number;
  ifshowInQueryForm?: boolean;
  Mode?: string;
  isShowLabelInTable?: boolean; //是否在表格中显示的时候，仅显示文本
  showTime?: boolean; //日期的时候，是否显示时间格式
  fieldNames?: fieldNames;
  treeData?: any[];
  inputType?: string;
  ifShowColor?: boolean;
  filterWidth?: string;
  filterDefault?: any[];
  filterDateBefore?: number;
  Span?: number;
  Relation?: any;
  BomRelation?: any;
  TreeOption?: TreeOptionType;
  tableParams?: TableParamsInter;
  tableWidth?: number;
  tableHeight?: number;
  bgColor?: string;
  treeWidth?: string;
  ifGetMoreDetail?:string;
  isModifyEdit?:boolean;
  defaultValue?:any;
  _valueLabelMap?: Map<string, string>; // 用于缓存树形数据的value-label映射
  _treeOptionVersion?: string; // 用于检测treeOption是否发生变化
}
type tableBtnOption = {
  label: string;
  color: string;
  icon: string;
  divider: boolean;
  ifShow: boolean;
  tooltip: string;
  type: string;
  btnKey: string;
};

export type ColStruct = {
  Field: string;
  NameZH: string;
  NameEN: string;
  Fix?: boolean;
  fixed?: boolean;
  Visible: boolean;
  Style: string;
  ifShow?: boolean;
  title?: string;
  dataIndex?: string;
  width?: string | number;
  Option?: ItemType[];
  treeOption?: TreeChildType[];
  btnOption?: tableBtnOption[];
  isEdit?: boolean;
  dataType?: string;
  isRequire?: boolean;
  ReadOnly?: boolean;
  isShowInForm?: boolean;
  maxlength?: number;
  ifshowInQueryForm?: boolean;
  Mode?: string;
  isShowLabelInTable?: boolean; //是否在表格中显示的时候，仅显示文本
  showTime?: boolean; //日期的时候，是否显示时间格式
  fieldNames?: fieldNames;
  treeData?: any[];
  inputType?: string;
  tableParams?: any;
};
type fieldNames = {
  key?: string;
  title?: string;
  label?: string;
  value?: string;
  children: string;
};
interface TreeOptionType {
  label: string;
  id: string;
  children: string;
  dataField: string;
  treeData: any[];
}
export interface OptionItemInter {
  [key: string]: any;
  Id: string;
  RunStatus: number;
  NodeType: string;
  ColorStyle: string;
  Description: string;
  Value: string;
}

export interface TableParamsInter {
  isShowTextOperate?: boolean; //显示操作列,
  isShowIconOperate?: boolean; //显示操作列,
  ifShowCheck?: boolean;
  url?: string;
  remoteQueryMode?: number;
  dataName?: string;
  pagination:
    | {
        pageSize: number;
        hideOnSinglePage: boolean;
      }
    | boolean;
  columns: ColInter[];
  columnFilter: ColumnFilterItemInter[];
  rowKey: string;
  showIndex: boolean;
  searchBox: boolean;
  selectedRowKeys?: string[];
  selectionData?: any[];
  saveUrl?: string;
  showToolBar?: boolean;
  operateBtnOption?: any;
  dataSource?: any[];
  queryParams?: any;
  customCanEdit?: any;
  dataFilter?: (data: any[]) => any[];
  selectTypeAfterload?: number;
  ifShowExpandedTable?: boolean;
  isInnerTable?: boolean;
  rowClassName?:any
}

export interface DlgFormParamsInter {
  formCols: ColInter[][];
  labelWidth?: number;
  dlgHeight?: string;
  dlgWidth?: string;
  dataStruct: any;
  rules: any;
}

export interface FormParamsInter {
  ifUseSpan: boolean;
  formCols?: ColInter[];
  spanFormCols?: ColInter[][];
  labelWidth?: number;
  dataStruct: any;
  rules: any;
  customEdit?: any;
}

export type FileType={
  cols:ColInter[],
  columnFilter:ColumnFilterItemInter[],
  detailCols:ColInter[],
  detailColumnFilter:ColumnFilterItemInter[],
  dlgWidth:string,
  dlgHeight:string,
  NotShowFields:string[],
  NotShowMainFields:string[],
  NotShowDetailFields:string[],
}

export type TimeLineType={
  color:string,
  statusDesc?:string,
  time?:string,
  title:string,
  key?:string,
  desc?:string,
}

export interface ImportParamsInter {
  uploadUrl: ColInter[][];
  analyseUrl: number;
  saveUrl: string;
  submitField: string;
  headField?: string;
  dlgWidth: string;
  dlgHeight: string;
  mainTableParams: TableParamsInter;
  detailTableParams?: TableParamsInter;
  ifShowDetail:boolean;
}