diff --git a/src/types/element.d.ts b/src/types/element.d.ts index 8632484..fdc6578 100644 --- a/src/types/element.d.ts +++ b/src/types/element.d.ts @@ -1 +1,32 @@ -declare type ElTagType = '' | 'success' | 'warning' | 'info' | 'danger' | 'default' | 'primary'; +import type * as ep from 'element-plus'; +declare global { + declare type ElTagType = '' | 'success' | 'warning' | 'info' | 'danger' | 'default' | 'primary'; + declare type ElFormInstance = InstanceType; + declare type ElTableInstance = InstanceType; + declare type ElTreeInstance = InstanceType; + declare type ElTreeSelectInstance = InstanceType; + declare type ElSelectInstance = InstanceType; + declare type ElUploadInstance = InstanceType; + declare type ElCardInstance = InstanceType; + declare type ElDialogInstance = InstanceType; + declare type ElInputInstance = InstanceType; + declare type ElInputNumberInstance = InstanceType; + declare type ElRadioInstance = InstanceType; + declare type ElRadioGroupInstance = InstanceType; + declare type ElRadioButtonInstance = InstanceType; + declare type ElCheckboxInstance = InstanceType; + declare type ElCheckboxGroupInstance = InstanceType; + declare type ElSwitchInstance = InstanceType; + declare type ElDatePickerInstance = InstanceType; + declare type ElTimePickerInstance = InstanceType; + declare type ElTimeSelectInstance = InstanceType; + declare type ElCascaderInstance = InstanceType; + declare type ElColorPickerInstance = InstanceType; + declare type ElRateInstance = InstanceType; + declare type ElSliderInstance = InstanceType; + declare type ElUploadInstance = InstanceType; + + declare type ElFormRules = ep.FormRules; + declare type DateModelType = ep.DateModelType; + declare type UploadFile = typeof ep.UploadFile; +} diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 5a972a3..b9bc5f4 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -1,9 +1,15 @@ -import { FormRules } from 'element-plus'; +import type { ComponentInternalInstance as ComponentInstance, PropType as VuePropType } from 'vue'; + declare global { + /** vue Instance */ + declare type ComponentInternalInstance = ComponentInstance; + /**vue */ + declare type PropType = VuePropType; + /** * 界面字段隐藏属性 */ - interface FieldOption { + declare interface FieldOption { key: number; label: string; visible: boolean; @@ -12,7 +18,7 @@ declare global { /** * 弹窗属性 */ - interface DialogOption { + declare interface DialogOption { /** * 弹窗标题 */ @@ -23,7 +29,7 @@ declare global { visible: boolean; } - interface UploadOption { + declare interface UploadOption { /** 设置上传的请求头部 */ headers: { [key: string]: any }; @@ -34,7 +40,7 @@ declare global { /** * 导入属性 */ - interface ImportOption extends UploadOption { + declare interface ImportOption extends UploadOption { /** 是否显示弹出层 */ open: boolean; /** 弹出层标题 */ @@ -48,14 +54,14 @@ declare global { /** * 字典数据 数据配置 */ - interface DictDataOption { + declare interface DictDataOption { label: string; value: string; elTagType?: ElTagType; elTagClass?: string; } - interface BaseEntity { + declare interface BaseEntity { createBy?: any; createDept?: any; createTime?: string; @@ -68,15 +74,15 @@ declare global { * T : 表单数据 * D : 查询参数 */ - interface PageData { + declare interface PageData { form: T; queryParams: D; - rules: FormRules; + rules: ElFormRules; } /** * 分页查询参数 */ - interface PageQuery { + declare interface PageQuery { pageNum: number; pageSize: number; }