init
This commit is contained in:
9
plus-ui/src/types/axios.d.ts
vendored
Normal file
9
plus-ui/src/types/axios.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export {};
|
||||
declare module 'axios' {
|
||||
interface AxiosResponse<T = any> {
|
||||
code: number;
|
||||
msg: string;
|
||||
rows: T;
|
||||
total: number;
|
||||
}
|
||||
}
|
35
plus-ui/src/types/element.d.ts
vendored
Normal file
35
plus-ui/src/types/element.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import type * as ep from 'element-plus';
|
||||
declare global {
|
||||
declare type ElTagType = 'primary' | 'success' | 'info' | 'warning' | 'danger';
|
||||
declare type ElFormInstance = ep.FormInstance;
|
||||
declare type ElTableInstance = ep.TableInstance;
|
||||
declare type ElUploadInstance = ep.UploadInstance;
|
||||
declare type ElScrollbarInstance = ep.ScrollbarInstance;
|
||||
declare type ElInputInstance = ep.InputInstance;
|
||||
declare type ElInputNumberInstance = ep.InputNumberInstance;
|
||||
declare type ElRadioInstance = ep.RadioInstance;
|
||||
declare type ElRadioGroupInstance = ep.RadioGroupInstance;
|
||||
declare type ElRadioButtonInstance = ep.RadioButtonInstance;
|
||||
declare type ElCheckboxInstance = ep.CheckboxInstance;
|
||||
declare type ElSwitchInstance = ep.SwitchInstance;
|
||||
declare type ElCascaderInstance = ep.CascaderInstance;
|
||||
declare type ElColorPickerInstance = ep.ColorPickerInstance;
|
||||
declare type ElRateInstance = ep.RateInstance;
|
||||
declare type ElSliderInstance = ep.SliderInstance;
|
||||
|
||||
declare type ElTreeInstance = InstanceType<typeof ep.ElTree>;
|
||||
declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>;
|
||||
declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>;
|
||||
declare type ElCardInstance = InstanceType<typeof ep.ElCard>;
|
||||
declare type ElDialogInstance = InstanceType<typeof ep.ElDialog>;
|
||||
declare type ElCheckboxGroupInstance = InstanceType<typeof ep.ElCheckboxGroup>;
|
||||
declare type ElDatePickerInstance = InstanceType<typeof ep.ElDatePicker>;
|
||||
declare type ElTimePickerInstance = InstanceType<typeof ep.ElTimePicker>;
|
||||
declare type ElTimeSelectInstance = InstanceType<typeof ep.ElTimeSelect>;
|
||||
|
||||
declare type TransferKey = ep.TransferKey;
|
||||
declare type CheckboxValueType = ep.CheckboxValueType;
|
||||
declare type ElFormRules = ep.FormRules;
|
||||
declare type DateModelType = ep.DateModelType;
|
||||
declare type UploadFile = ep.UploadFile;
|
||||
}
|
27
plus-ui/src/types/env.d.ts
vendored
Normal file
27
plus-ui/src/types/env.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue';
|
||||
const Component: DefineComponent<{}, {}, any>;
|
||||
export default Component;
|
||||
}
|
||||
|
||||
// 环境变量
|
||||
interface ImportMetaEnv {
|
||||
VITE_APP_TITLE: string;
|
||||
VITE_APP_PORT: number;
|
||||
VITE_APP_BASE_API: string;
|
||||
VITE_APP_BASE_URL: string;
|
||||
VITE_APP_CONTEXT_PATH: string;
|
||||
VITE_APP_MONITOR_ADMIN: string;
|
||||
VITE_APP_SNAILJOB_ADMIN: string;
|
||||
VITE_APP_ENV: string;
|
||||
VITE_APP_ENCRYPT: string;
|
||||
VITE_APP_RSA_PUBLIC_KEY: string;
|
||||
VITE_APP_RSA_PRIVATE_KEY: string;
|
||||
VITE_APP_CLIENT_ID: string;
|
||||
VITE_APP_WEBSOCKET: string;
|
||||
VITE_APP_SSE: string;
|
||||
}
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
// readonly glob: any;
|
||||
}
|
164
plus-ui/src/types/global.d.ts
vendored
Normal file
164
plus-ui/src/types/global.d.ts
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue';
|
||||
import { LanguageEnum } from '@/enums/LanguageEnum';
|
||||
|
||||
declare global {
|
||||
/** vue Instance */
|
||||
declare type ComponentInternalInstance = ComponentInstance;
|
||||
|
||||
/**
|
||||
* 界面字段隐藏属性
|
||||
*/
|
||||
declare interface FieldOption {
|
||||
key: number;
|
||||
label: string;
|
||||
visible: boolean;
|
||||
children?: Array<FieldOption>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗属性
|
||||
*/
|
||||
declare interface DialogOption {
|
||||
/**
|
||||
* 弹窗标题
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
declare interface UploadOption {
|
||||
/** 设置上传的请求头部 */
|
||||
headers: { [key: string]: any };
|
||||
|
||||
/** 上传的地址 */
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入属性
|
||||
*/
|
||||
declare interface ImportOption extends UploadOption {
|
||||
/** 是否显示弹出层 */
|
||||
open: boolean;
|
||||
/** 弹出层标题 */
|
||||
title: string;
|
||||
/** 是否禁用上传 */
|
||||
isUploading: boolean;
|
||||
|
||||
updateSupport: number;
|
||||
|
||||
/** 其他参数 */
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* 字典数据 数据配置
|
||||
*/
|
||||
declare interface DictDataOption {
|
||||
label: string;
|
||||
value: string;
|
||||
elTagType?: ElTagType;
|
||||
elTagClass?: string;
|
||||
}
|
||||
|
||||
declare interface BaseEntity {
|
||||
createBy?: any;
|
||||
createDept?: any;
|
||||
createTime?: string;
|
||||
updateBy?: any;
|
||||
updateTime?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
* T : 表单数据
|
||||
* D : 查询参数
|
||||
*/
|
||||
declare interface PageData<T, D> {
|
||||
form: T;
|
||||
queryParams: D;
|
||||
rules: ElFormRules;
|
||||
}
|
||||
/**
|
||||
* 分页查询参数
|
||||
*/
|
||||
declare interface PageQuery {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
}
|
||||
declare interface LayoutSetting {
|
||||
/**
|
||||
* 是否显示顶部导航
|
||||
*/
|
||||
topNav: boolean;
|
||||
|
||||
/**
|
||||
* 是否显示多标签导航
|
||||
*/
|
||||
tagsView: boolean;
|
||||
/**
|
||||
* 是否固定头部
|
||||
*/
|
||||
fixedHeader: boolean;
|
||||
/**
|
||||
* 是否显示侧边栏Logo
|
||||
*/
|
||||
sidebarLogo: boolean;
|
||||
/**
|
||||
* 是否显示动态标题
|
||||
*/
|
||||
dynamicTitle: boolean;
|
||||
/**
|
||||
* 侧边栏主题 theme-dark | theme-light
|
||||
*/
|
||||
sideTheme: string;
|
||||
/**
|
||||
* 主题模式
|
||||
*/
|
||||
theme: string;
|
||||
}
|
||||
|
||||
declare interface DefaultSettings extends LayoutSetting {
|
||||
/**
|
||||
* 网页标题
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* 是否显示系统布局设置
|
||||
*/
|
||||
showSettings: boolean;
|
||||
|
||||
/**
|
||||
* 导航栏布局
|
||||
*/
|
||||
layout: string;
|
||||
|
||||
/**
|
||||
* 布局大小
|
||||
*/
|
||||
size: 'large' | 'default' | 'small';
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
language: LanguageEnum;
|
||||
|
||||
/**
|
||||
* 是否启用动画效果
|
||||
*/
|
||||
animationEnable: boolean;
|
||||
/**
|
||||
* 是否启用暗黑模式
|
||||
*
|
||||
* true:暗黑模式
|
||||
* false: 明亮模式
|
||||
*/
|
||||
dark: boolean;
|
||||
|
||||
errorLog: string;
|
||||
}
|
||||
}
|
||||
export {};
|
51
plus-ui/src/types/module.d.ts
vendored
Normal file
51
plus-ui/src/types/module.d.ts
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
import modal from '@/plugins/modal';
|
||||
import tab from '@/plugins/tab';
|
||||
import download from '@/plugins/download';
|
||||
import auth from '@/plugins/auth';
|
||||
import cache from '@/plugins/cache';
|
||||
import animate from '@/animate';
|
||||
import { useDict } from '@/utils/dict';
|
||||
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
|
||||
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
|
||||
import { download as rd } from '@/utils/request';
|
||||
import type { LanguageType } from '@/lang';
|
||||
|
||||
export {};
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
interface ComponentCustomProperties {
|
||||
// 全局方法声明
|
||||
$modal: typeof modal;
|
||||
$tab: typeof tab;
|
||||
$download: typeof download;
|
||||
$auth: typeof auth;
|
||||
$cache: typeof cache;
|
||||
animate: typeof animate;
|
||||
/**
|
||||
* i18n $t方法支持ts类型提示
|
||||
* @param key i18n key
|
||||
*/
|
||||
$t(key: ObjKeysToUnion<LanguageType>): string;
|
||||
|
||||
useDict: typeof useDict;
|
||||
addDateRange: typeof addDateRange;
|
||||
download: typeof rd;
|
||||
handleTree: typeof handleTree;
|
||||
getConfigKey: typeof getConfigKey;
|
||||
updateConfigByKey: typeof updateConfigByKey;
|
||||
selectDictLabel: typeof selectDictLabel;
|
||||
selectDictLabels: typeof selectDictLabels;
|
||||
parseTime: typeof parseTime;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* { a: 1, b: { ba: { baa: 1, bab: 2 }, bb: 2} } ---> a | b.ba.baa | b.ba.bab | b.bb
|
||||
* https://juejin.cn/post/7280062870670606397
|
||||
*/
|
||||
export type ObjKeysToUnion<T, P extends string = ''> = T extends object
|
||||
? {
|
||||
[K in keyof T]: ObjKeysToUnion<T[K], P extends '' ? `${K & string}` : `${P}.${K & string}`>;
|
||||
}[keyof T]
|
||||
: P;
|
||||
|
38
plus-ui/src/types/router.d.ts
vendored
Normal file
38
plus-ui/src/types/router.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import { LocationQuery, type RouteMeta as VRouteMeta } from 'vue-router';
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends VRouteMeta {
|
||||
link?: string;
|
||||
title?: string;
|
||||
affix?: boolean;
|
||||
noCache?: boolean;
|
||||
activeMenu?: string;
|
||||
icon?: string;
|
||||
breadcrumb?: boolean;
|
||||
}
|
||||
|
||||
interface _RouteRecordBase {
|
||||
hidden?: boolean | string | number;
|
||||
permissions?: string[];
|
||||
roles?: string[];
|
||||
alwaysShow?: boolean;
|
||||
query?: string;
|
||||
parentPath?: string;
|
||||
}
|
||||
|
||||
interface _RouteLocationBase {
|
||||
children?: _RouteRecordBase[];
|
||||
path?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
interface TagView {
|
||||
fullPath?: string;
|
||||
name?: string;
|
||||
path?: string;
|
||||
title?: string;
|
||||
meta?: RouteMeta;
|
||||
query?: LocationQuery;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
Reference in New Issue
Block a user