diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..00ee2de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org +root = true + +# 表示所有文件适用 +[*] +charset = utf-8 # 设置文件字符集为 utf-8 +end_of_line = lf # 控制换行类型(lf | cr | crlf) +indent_style = space # 缩进风格(tab | space) +indent_size = 2 # 缩进大小 +insert_final_newline = true # 始终在文件末尾插入一个新行 + +# 表示仅 md 文件适用以下规则 +[*.md] +max_line_length = off # 关闭最大行长度限制 +trim_trailing_whitespace = false # 关闭末尾空格修剪 diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..ab5d31f --- /dev/null +++ b/.env.development @@ -0,0 +1,13 @@ +# 应用端口 +VITE_APP_PORT = 3000 + +# 代理前缀 +VITE_APP_BASE_API = '/dev-api' +VITE_APP_API_URL = http://vapi.youlai.tech +# 线上接口地址 +# VITE_APP_API_URL = http://62.234.3.186 +# 开发接口地址 +# VITE_APP_API_URL = http://localhost:8989 + +# 是否启用 Mock 服务 +VITE_MOCK_DEV_SERVER = false diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..8aca6a6 --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ +# 代理前缀 +VITE_APP_BASE_API = '/dev-api' + diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..43af40f --- /dev/null +++ b/.eslintignore @@ -0,0 +1,14 @@ +dist +node_modules +public +.husky +.vscode +.idea +*.sh +*.md + +src/assets + +.eslintrc.cjs +.prettierrc.cjs +.stylelintrc.cjs diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json new file mode 100644 index 0000000..f4738bf --- /dev/null +++ b/.eslintrc-auto-import.json @@ -0,0 +1,284 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "ElMessage": true, + "ElMessageBox": true, + "ElNotification": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "asyncComputed": true, + "autoResetRef": true, + "computed": true, + "computedAsync": true, + "computedEager": true, + "computedInject": true, + "computedWithControl": true, + "controlledComputed": true, + "controlledRef": true, + "createApp": true, + "createEventHook": true, + "createGlobalState": true, + "createInjectionState": true, + "createReactiveFn": true, + "createReusableTemplate": true, + "createSharedComposable": true, + "createTemplatePromise": true, + "createUnrefFn": true, + "customRef": true, + "debouncedRef": true, + "debouncedWatch": true, + "defineAsyncComponent": true, + "defineComponent": true, + "eagerComputed": true, + "effectScope": true, + "extendRef": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "ignorableWatch": true, + "inject": true, + "isDefined": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "makeDestructurable": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onClickOutside": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onKeyStroke": true, + "onLongPress": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onStartTyping": true, + "onUnmounted": true, + "onUpdated": true, + "pausableWatch": true, + "provide": true, + "reactify": true, + "reactifyObject": true, + "reactive": true, + "reactiveComputed": true, + "reactiveOmit": true, + "reactivePick": true, + "readonly": true, + "ref": true, + "refAutoReset": true, + "refDebounced": true, + "refDefault": true, + "refThrottled": true, + "refWithControl": true, + "resolveComponent": true, + "resolveRef": true, + "resolveUnref": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "syncRef": true, + "syncRefs": true, + "templateRef": true, + "throttledRef": true, + "throttledWatch": true, + "toRaw": true, + "toReactive": true, + "toRef": true, + "toRefs": true, + "toValue": true, + "triggerRef": true, + "tryOnBeforeMount": true, + "tryOnBeforeUnmount": true, + "tryOnMounted": true, + "tryOnScopeDispose": true, + "tryOnUnmounted": true, + "unref": true, + "unrefElement": true, + "until": true, + "useActiveElement": true, + "useAnimate": true, + "useArrayDifference": true, + "useArrayEvery": true, + "useArrayFilter": true, + "useArrayFind": true, + "useArrayFindIndex": true, + "useArrayFindLast": true, + "useArrayIncludes": true, + "useArrayJoin": true, + "useArrayMap": true, + "useArrayReduce": true, + "useArraySome": true, + "useArrayUnique": true, + "useAsyncQueue": true, + "useAsyncState": true, + "useAttrs": true, + "useBase64": true, + "useBattery": true, + "useBluetooth": true, + "useBreakpoints": true, + "useBroadcastChannel": true, + "useBrowserLocation": true, + "useCached": true, + "useClipboard": true, + "useCloned": true, + "useColorMode": true, + "useConfirmDialog": true, + "useCounter": true, + "useCssModule": true, + "useCssVar": true, + "useCssVars": true, + "useCurrentElement": true, + "useCycleList": true, + "useDark": true, + "useDateFormat": true, + "useDebounce": true, + "useDebounceFn": true, + "useDebouncedRefHistory": true, + "useDeviceMotion": true, + "useDeviceOrientation": true, + "useDevicePixelRatio": true, + "useDevicesList": true, + "useDisplayMedia": true, + "useDocumentVisibility": true, + "useDraggable": true, + "useDropZone": true, + "useElementBounding": true, + "useElementByPoint": true, + "useElementHover": true, + "useElementSize": true, + "useElementVisibility": true, + "useEventBus": true, + "useEventListener": true, + "useEventSource": true, + "useEyeDropper": true, + "useFavicon": true, + "useFetch": true, + "useFileDialog": true, + "useFileSystemAccess": true, + "useFocus": true, + "useFocusWithin": true, + "useFps": true, + "useFullscreen": true, + "useGamepad": true, + "useGeolocation": true, + "useIdle": true, + "useImage": true, + "useInfiniteScroll": true, + "useIntersectionObserver": true, + "useInterval": true, + "useIntervalFn": true, + "useKeyModifier": true, + "useLastChanged": true, + "useLocalStorage": true, + "useMagicKeys": true, + "useManualRefHistory": true, + "useMediaControls": true, + "useMediaQuery": true, + "useMemoize": true, + "useMemory": true, + "useMounted": true, + "useMouse": true, + "useMouseInElement": true, + "useMousePressed": true, + "useMutationObserver": true, + "useNavigatorLanguage": true, + "useNetwork": true, + "useNow": true, + "useObjectUrl": true, + "useOffsetPagination": true, + "useOnline": true, + "usePageLeave": true, + "useParallax": true, + "useParentElement": true, + "usePerformanceObserver": true, + "usePermission": true, + "usePointer": true, + "usePointerLock": true, + "usePointerSwipe": true, + "usePreferredColorScheme": true, + "usePreferredContrast": true, + "usePreferredDark": true, + "usePreferredLanguages": true, + "usePreferredReducedMotion": true, + "usePrevious": true, + "useRafFn": true, + "useRefHistory": true, + "useResizeObserver": true, + "useScreenOrientation": true, + "useScreenSafeArea": true, + "useScriptTag": true, + "useScroll": true, + "useScrollLock": true, + "useSessionStorage": true, + "useShare": true, + "useSlots": true, + "useSorted": true, + "useSpeechRecognition": true, + "useSpeechSynthesis": true, + "useStepper": true, + "useStorage": true, + "useStorageAsync": true, + "useStyleTag": true, + "useSupported": true, + "useSwipe": true, + "useTemplateRefsList": true, + "useTextDirection": true, + "useTextSelection": true, + "useTextareaAutosize": true, + "useThrottle": true, + "useThrottleFn": true, + "useThrottledRefHistory": true, + "useTimeAgo": true, + "useTimeout": true, + "useTimeoutFn": true, + "useTimeoutPoll": true, + "useTimestamp": true, + "useTitle": true, + "useToNumber": true, + "useToString": true, + "useToggle": true, + "useTransition": true, + "useUrlSearchParams": true, + "useUserMedia": true, + "useVModel": true, + "useVModels": true, + "useVibrate": true, + "useVirtualList": true, + "useWakeLock": true, + "useWebNotification": true, + "useWebSocket": true, + "useWebWorker": true, + "useWebWorkerFn": true, + "useWindowFocus": true, + "useWindowScroll": true, + "useWindowSize": true, + "watch": true, + "watchArray": true, + "watchAtMost": true, + "watchDebounced": true, + "watchDeep": true, + "watchEffect": true, + "watchIgnorable": true, + "watchImmediate": true, + "watchOnce": true, + "watchPausable": true, + "watchPostEffect": true, + "watchSyncEffect": true, + "watchThrottled": true, + "watchTriggerable": true, + "watchWithFilter": true, + "whenever": true + } +} diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..8ae169a --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,88 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + node: true, + }, + parser: "vue-eslint-parser", + extends: [ + // https://eslint.vuejs.org/user-guide/#usage + "plugin:vue/vue3-recommended", + "./.eslintrc-auto-import.json", + "prettier", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + ], + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + parser: "@typescript-eslint/parser", + project: "./tsconfig.*?.json", + createDefaultProgram: false, + extraFileExtensions: [".vue"], + }, + plugins: ["vue", "@typescript-eslint"], + rules: { + // https://eslint.vuejs.org/rules/#priority-a-essential-error-prevention + "vue/multi-word-component-names": "off", + "vue/no-v-model-argument": "off", + "vue/script-setup-uses-vars": "error", + "vue/no-reserved-component-names": "off", + "vue/custom-event-name-casing": "off", + "vue/attributes-order": "off", + "vue/one-component-per-file": "off", + "vue/html-closing-bracket-newline": "off", + "vue/max-attributes-per-line": "off", + "vue/multiline-html-element-content-newline": "off", + "vue/singleline-html-element-content-newline": "off", + "vue/attribute-hyphenation": "off", + "vue/require-default-prop": "off", + "vue/require-explicit-emits": "off", + "vue/html-self-closing": [ + "error", + { + html: { + void: "always", + normal: "never", + component: "always", + }, + svg: "always", + math: "always", + }, + ], + + "@typescript-eslint/no-empty-function": "off", // 关闭空方法检查 + "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告 + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-unused-vars": "off", + + "prettier/prettier": [ + "error", + { + useTabs: false, // 不使用制表符 + }, + ], + }, + // eslint不能对html文件生效 + overrides: [ + { + files: ["*.html"], + processor: "vue/.vue", + }, + ], + // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals + globals: { + OptionType: "readonly", + }, +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fee6999 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local +.history + +# Editor directories and files +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +package-lock.json +pnpm-lock.yaml +stats.html diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..f3e9850 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +dist +node_modules +public +.husky +.vscode +.idea +*.sh +*.md + +src/assets +stats.html diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..347fb32 --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,46 @@ +module.exports = { + // (x)=>{},单个参数箭头函数是否显示小括号。(always:始终显示;avoid:省略括号。默认:always) + arrowParens: "always", + // 开始标签的右尖括号是否跟随在最后一行属性末尾,默认false + bracketSameLine: false, + // 对象字面量的括号之间打印空格 (true - Example: { foo: bar } ; false - Example: {foo:bar}) + bracketSpacing: true, + // 是否格式化一些文件中被嵌入的代码片段的风格(auto|off;默认auto) + embeddedLanguageFormatting: "auto", + // 指定 HTML 文件的空格敏感度 (css|strict|ignore;默认css) + htmlWhitespaceSensitivity: "css", + // 当文件已经被 Prettier 格式化之后,是否会在文件顶部插入一个特殊的 @format 标记,默认false + insertPragma: false, + // 在 JSX 中使用单引号替代双引号,默认false + jsxSingleQuote: false, + // 每行最多字符数量,超出换行(默认80) + printWidth: 80, + // 超出打印宽度 (always | never | preserve ) + proseWrap: "preserve", + // 对象属性是否使用引号(as-needed | consistent | preserve;默认as-needed:对象的属性需要加引号才添加;) + quoteProps: "as-needed", + // 是否只格式化在文件顶部包含特定注释(@prettier| @format)的文件,默认false + requirePragma: false, + // 结尾添加分号 + semi: true, + // 使用单引号 (true:单引号;false:双引号) + singleQuote: false, + // 缩进空格数,默认2个空格 + tabWidth: 2, + // 元素末尾是否加逗号,默认es5: ES5中的 objects, arrays 等会添加逗号,TypeScript 中的 type 后不加逗号 + trailingComma: "es5", + // 指定缩进方式,空格或tab,默认false,即使用空格 + useTabs: false, + // vue 文件中是否缩进 + diff --git a/package.json b/package.json new file mode 100644 index 0000000..3b2514d --- /dev/null +++ b/package.json @@ -0,0 +1,125 @@ +{ + "name": "aimanage", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc --noEmit & vite build", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --noEmit", + "lint:eslint": "eslint --fix --ext .ts,.js,.vue ./src ", + "lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,tsx,css,less,scss,vue,html,md}\"", + "lint:stylelint": "stylelint \"**/*.{css,scss,vue}\" --fix", + "lint:lint-staged": "lint-staged", + "prepare": "husky", + "commit": "git-cz" + }, + "config": { + "commitizen": { + "path": "node_modules/cz-git" + } + }, + "lint-staged": { + "*.{js,ts}": [ + "eslint --fix", + "prettier --write" + ], + "*.{cjs,json}": [ + "prettier --write" + ], + "*.{vue,html}": [ + "eslint --fix", + "prettier --write", + "stylelint --fix" + ], + "*.{scss,css}": [ + "stylelint --fix", + "prettier --write" + ], + "*.md": [ + "prettier --write" + ] + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.1", + "@vueuse/core": "^10.9.0", + "@wangeditor/editor": "^5.1.23", + "@wangeditor/editor-for-vue": "5.1.10", + "animate.css": "^4.1.1", + "axios": "^1.6.8", + "color": "^4.2.3", + "echarts": "^5.5.0", + "element-plus": "^2.7.2", + "lodash-es": "^4.17.21", + "net": "^1.0.2", + "nprogress": "^0.2.0", + "path-browserify": "^1.0.1", + "path-to-regexp": "^6.2.2", + "pinia": "^2.1.7", + "sockjs-client": "1.6.1", + "sortablejs": "^1.15.2", + "stompjs": "^2.3.3", + "vue": "^3.4.26", + "vue-i18n": "9.9.1", + "vue-router": "^4.3.2", + "xlsx": "^0.18.5" + }, + "devDependencies": { + "@commitlint/cli": "^18.6.1", + "@commitlint/config-conventional": "^18.6.3", + "@iconify-json/ep": "^1.1.15", + "@types/color": "^3.0.6", + "@types/lodash": "^4.17.1", + "@types/node": "^20.12.8", + "@types/nprogress": "^0.2.3", + "@types/path-browserify": "^1.0.2", + "@types/sockjs-client": "^1.5.4", + "@types/sortablejs": "^1.15.8", + "@types/stompjs": "^2.3.9", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", + "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue-jsx": "^3.1.0", + "autoprefixer": "^10.4.19", + "commitizen": "^4.3.0", + "cz-git": "^1.9.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-vue": "^9.25.0", + "fast-glob": "^3.3.2", + "husky": "^9.0.11", + "lint-staged": "^15.2.2", + "postcss": "^8.4.38", + "postcss-html": "^1.6.0", + "postcss-scss": "^4.0.9", + "prettier": "^3.2.5", + "sass": "^1.76.0", + "stylelint": "^16.5.0", + "stylelint-config-html": "^1.1.0", + "stylelint-config-recess-order": "^4.6.0", + "stylelint-config-recommended-scss": "^14.0.0", + "stylelint-config-recommended-vue": "^1.5.0", + "stylelint-config-standard": "^36.0.0", + "terser": "^5.31.0", + "typescript": "^5.4.5", + "unocss": "^0.58.9", + "unplugin-auto-import": "^0.17.5", + "unplugin-icons": "^0.18.5", + "unplugin-vue-components": "^0.26.0", + "vite": "^5.2.11", + "vite-plugin-mock-dev-server": "^1.5.0", + "vite-plugin-svg-icons": "^2.0.1", + "vite-plugin-vue-devtools": "^7.1.3", + "vue-tsc": "^2.0.16" + }, + "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", + "author": "有来开源组织", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } +} diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..efe5137 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/api/auth/index.ts b/src/api/auth/index.ts new file mode 100644 index 0000000..b4e7a89 --- /dev/null +++ b/src/api/auth/index.ts @@ -0,0 +1,66 @@ +import request from "@/utils/request"; +import { CaptchaResult, LoginData, LoginResult } from "./model"; + +class AuthAPI { + /** + * 登录API + * + * @param data {LoginData} + * @returns + */ + static login(data: LoginData) { + /* + const formData = new FormData(); + formData.append("username", data.username); + formData.append("password", data.password); + formData.append("captchaKey", data.captchaKey || ""); + formData.append("captchaCode", data.captchaCode || ""); + return request({ + url: "/api/v1/auth/login", + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + });*/ + return new Promise((resolve,reject)=>{ + if(data.username!='admin' || data.password!='123456'){ + reject("用户名或密码错误"); + }else{ + resolve( { + "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJleHAiOjE3MTYyMjY0OTksInVzZXJJZCI6MiwiaWF0IjoxNzE2MjE5Mjk5LCJhdXRob3JpdGllcyI6WyJST0xFX0FETUlOIl0sImp0aSI6IjVmMWIwNTExNmZjZDQxZmE5YTVlNjU4ZjQ5YmRmNmEyIn0.BBCWh3-bffEtgT0zhxSQ0ncithh9iIGDtbg1DPN0TvA", + "tokenType": "Bearer", + "refreshToken": null, + "expires": null + }); + } + }); + } + + /** + * 注销API + */ + static logout() { + return new Promise(r=>{ + r({}); + }); + /* + return request({ + url: "/api/v1/auth/logout", + method: "delete", + }); + */ + } + + /** + * 获取验证码 + */ + static getCaptcha() { + return request({ + url: "/api/v1/auth/captcha", + method: "get", + }); + } +} + +export default AuthAPI; diff --git a/src/api/auth/model.ts b/src/api/auth/model.ts new file mode 100644 index 0000000..0da661e --- /dev/null +++ b/src/api/auth/model.ts @@ -0,0 +1,59 @@ +/** + * 登录请求参数 + */ +export interface LoginData { + /** + * 用户名 + */ + username: string; + /** + * 密码 + */ + password: string; + + /** + * 验证码缓存key + */ + captchaKey?: string; + + /** + * 验证码 + */ + captchaCode?: string; +} + +/** + * 登录响应 + */ +export interface LoginResult { + /** + * 访问token + */ + accessToken?: string; + /** + * 过期时间(单位:毫秒) + */ + expires?: number; + /** + * 刷新token + */ + refreshToken?: string; + /** + * token 类型 + */ + tokenType?: string; +} + +/** + * 验证码响应 + */ +export interface CaptchaResult { + /** + * 验证码缓存key + */ + captchaKey: string; + /** + * 验证码图片Base64字符串 + */ + captchaBase64: string; +} diff --git a/src/api/dept/index.ts b/src/api/dept/index.ts new file mode 100644 index 0000000..45f689a --- /dev/null +++ b/src/api/dept/index.ts @@ -0,0 +1,80 @@ +import request from "@/utils/request"; +import { DeptForm, DeptQuery, DeptVO } from "./model"; + +class DeptAPI { + /** + * 部门树形表格 + * + * @param queryParams + */ + static getList(queryParams?: DeptQuery) { + return request({ + url: "/api/v1/dept", + method: "get", + params: queryParams, + }); + } + + /** + * 部门下拉列表 + */ + static getOptions() { + return request({ + url: "/api/v1/dept/options", + method: "get", + }); + } + + /** + * 获取部门详情 + * + * @param id + */ + static getFormData(id: number) { + return request({ + url: "/api/v1/dept/" + id + "/form", + method: "get", + }); + } + + /** + * 新增部门 + * + * @param data + */ + static add(data: DeptForm) { + return request({ + url: "/api/v1/dept", + method: "post", + data: data, + }); + } + + /** + * 修改部门 + * + * @param id + * @param data + */ + static update(id: number, data: DeptForm) { + return request({ + url: "/api/v1/dept/" + id, + method: "put", + data: data, + }); + } + + /** + * 删除部门 + * + * @param ids + */ + static deleteByIds(ids: string) { + return request({ + url: "/api/v1/dept/" + ids, + method: "delete", + }); + } +} + +export default DeptAPI; diff --git a/src/api/dept/model.ts b/src/api/dept/model.ts new file mode 100644 index 0000000..408c39c --- /dev/null +++ b/src/api/dept/model.ts @@ -0,0 +1,71 @@ +/** + * 部门查询参数 + */ +export interface DeptQuery { + keywords?: string; + status?: number; +} + +/** + * 部门类型 + */ +export interface DeptVO { + /** + * 子部门 + */ + children?: DeptVO[]; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 部门ID + */ + id?: number; + /** + * 部门名称 + */ + name?: string; + /** + * 父部门ID + */ + parentId?: number; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 修改时间 + */ + updateTime?: Date; +} + +/** + * 部门表单类型 + */ +export interface DeptForm { + /** + * 部门ID(新增不填) + */ + id?: number; + /** + * 部门名称 + */ + name?: string; + /** + * 父部门ID + */ + parentId: number; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; +} diff --git a/src/api/dict/index.ts b/src/api/dict/index.ts new file mode 100644 index 0000000..adef210 --- /dev/null +++ b/src/api/dict/index.ts @@ -0,0 +1,149 @@ +import request from "@/utils/request"; +import { + DictTypeQuery, + DictTypePageResult, + DictTypeForm, + DictQuery, + DictForm, + DictPageResult, +} from "./model"; + +class DictAPI { + /** + * 字典类型分页列表 + * + * @param queryParams + */ + static getDictTypePage(queryParams: DictTypeQuery) { + return request({ + url: "/api/v1/dict/types/page", + method: "get", + params: queryParams, + }); + } + + /** + * 字典类型表单数据 + * + * @param id + */ + static getDictTypeForm(id: number) { + return request>({ + url: "/api/v1/dict/types/" + id + "/form", + method: "get", + }); + } + + /** + * 新增字典类型 + * + * @param data + */ + static addDictType(data: DictTypeForm) { + return request({ + url: "/api/v1/dict/types", + method: "post", + data: data, + }); + } + + /** + * 修改字典类型 + * + * @param id + * @param data + */ + static updateDictType(id: number, data: DictTypeForm) { + return request({ + url: "/api/v1/dict/types/" + id, + method: "put", + data: data, + }); + } + + /** + * 删除字典类型 + */ + static deleteDictTypes(ids: string) { + return request({ + url: "/api/v1/dict/types/" + ids, + method: "delete", + }); + } + + /** + * 获取字典类型的数据项 + * + * @param typeCode 字典类型编码 + */ + static getDictOptions(typeCode: string) { + return request({ + url: "/api/v1/dict/" + typeCode + "/options", + method: "get", + }); + } + + /** + * 字典分页列表 + */ + static getDictPage(queryParams: DictQuery) { + return request({ + url: "/api/v1/dict/page", + method: "get", + params: queryParams, + }); + } + + /** + * 获取字典表单数据 + * + * @param id + */ + static getDictFormData(id: number) { + return request({ + url: "/api/v1/dict/" + id + "/form", + method: "get", + }); + } + + /** + * 新增字典 + * + * @param data + */ + static addDict(data: DictForm) { + return request({ + url: "/api/v1/dict", + method: "post", + data: data, + }); + } + + /** + * 修改字典项 + * + * @param id + * @param data + */ + static updateDict(id: number, data: DictForm) { + return request({ + url: "/api/v1/dict/" + id, + method: "put", + data: data, + }); + } + + /** + * 删除字典 + * + * @param ids 字典项ID,多个以英文逗号(,)分割 + */ + static deleteDictByIds(ids: string) { + return request({ + url: "/api/v1/dict/" + ids, + method: "delete", + }); + } +} + +export default DictAPI; diff --git a/src/api/dict/model.ts b/src/api/dict/model.ts new file mode 100644 index 0000000..315da6d --- /dev/null +++ b/src/api/dict/model.ts @@ -0,0 +1,142 @@ +/** + * 字典类型查询参数 + */ +export interface DictTypeQuery extends PageQuery { + /** + * 关键字(字典类型名称/编码) + */ + keywords?: string; +} + +/** + * 字典类型分页对象 + */ +export interface DictTypePageVO { + /** + * 字典类型ID + */ + id: number; + /** + * 类型编码 + */ + code: string; + /** + * 类型名称 + */ + name: string; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 备注 + */ + remark?: string; +} + +/** + * 字典分页项类型声明 + */ +export type DictTypePageResult = PageResult; + +/** + * 字典表单类型声明 + */ +export interface DictTypeForm { + /** + * 字典类型ID + */ + id?: number; + /** + * 类型名称 + */ + name?: string; + /** + * 类型编码 + */ + code?: string; + /** + * 类型状态:1:启用;0:禁用 + */ + status: number; + /** + * 备注 + */ + remark?: string; +} + +/** + * 字典查询参数 + */ +export interface DictQuery extends PageQuery { + /** + * 字典项名称 + */ + name?: string; + /** + * 字典类型编码 + */ + typeCode?: string; +} + +/** + * 字典分页对象 + */ +export interface DictPageVO { + /** + * 字典ID + */ + id?: number; + /** + * 字典名称 + */ + name?: string; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 字典值 + */ + value?: string; +} + +/** + * 字典分页 + */ +export type DictPageResult = PageResult; + +/** + * 字典表单 + */ +export interface DictForm { + /** + * 字典ID + */ + id?: number; + /** + * 字典名称 + */ + name?: string; + /** + * 排序 + */ + sort?: number; + /** + * 状态(1:启用;0:禁用) + */ + status?: number; + /** + * 类型编码 + */ + typeCode?: string; + /** + * 值 + */ + value?: string; + + /** + * 备注 + */ + remark?: string; +} diff --git a/src/api/file/index.ts b/src/api/file/index.ts new file mode 100644 index 0000000..8236462 --- /dev/null +++ b/src/api/file/index.ts @@ -0,0 +1,37 @@ +import request from "@/utils/request"; +import { FileInfo } from "./model"; + +class FileAPI { + /** + * 上传文件 + * + * @param file + */ + static upload(file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: "/api/v1/files", + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + } + + /** + * 删除文件 + * + * @param filePath 文件完整路径 + */ + static deleteByPath(filePath?: string) { + return request({ + url: "/api/v1/files", + method: "delete", + params: { filePath: filePath }, + }); + } +} + +export default FileAPI; diff --git a/src/api/file/model.ts b/src/api/file/model.ts new file mode 100644 index 0000000..22b2be5 --- /dev/null +++ b/src/api/file/model.ts @@ -0,0 +1,7 @@ +/** + * 文件API类型声明 + */ +export interface FileInfo { + name: string; + url: string; +} diff --git a/src/api/menu/index.ts b/src/api/menu/index.ts new file mode 100644 index 0000000..3855860 --- /dev/null +++ b/src/api/menu/index.ts @@ -0,0 +1,382 @@ +import request from "@/utils/request"; +import { MenuQuery, MenuVO, MenuForm, RouteVO } from "./model"; + +class MenuAPI { + /** + * 获取路由列表 + */ + static getRoutes() { + return new Promise((resolve) => { + resolve([ + { + path: "/split", + component: "Layout", + redirect: "/split/index", + name: "/split", + meta: { + title: "算法分割", + icon: "project", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "算法分割1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "算法分割2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/internetProtocol", + component: "Layout", + redirect: "/internetProtocol/index", + name: "/internetProtocol", + meta: { + title: "互联协议", + icon: "api", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "互联协议1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "互联协议2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/simulationEvaluation", + component: "Layout", + redirect: "/simulationEvaluation/index", + name: "/simulationEvaluation", + meta: { + title: "仿真评估", + icon: "client", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "仿真评估1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "仿真评估2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/operatorLibrary", + component: "Layout", + redirect: "/operatorLibrary/index", + name: "/operatorLibrary", + meta: { + title: "算子库管理", + icon: "dict", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "算子库管理1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "算子库管理2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/dataMgr", + component: "Layout", + redirect: "/dataMgr/user", + name: "/dataMgr", + meta: { + title: "数据管理", + icon: "edit", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "数据管理1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "数据管理2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/tester", + component: "Layout", + redirect: "/tester/index", + name: "/tester", + meta: { + title: "算法测试仪管理", + icon: "link", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "算法测试仪管理1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "算法算法测试仪管理2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + { + path: "/system", + component: "Layout", + redirect: "/system/index", + name: "/system", + meta: { + title: "系统管理", + icon: "menu", + hidden: false, + roles: ["GUEST", "ADMIN", "ADMIN6"], + alwaysShow: false, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "系统管理1", + icon: "user", + hidden: false, + roles: ["ADMIN", "GUEST"], + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "系统管理2", + icon: "role", + hidden: false, + roles: ["ADMIN6", "GUEST", "ADMIN"], + keepAlive: true, + alwaysShow: false, + }, + }, + ], + }, + ]); + }); + /* + return request({ + url: "/api/v1/menus/routes", + method: "get", + });*/ + } + + /** + * 获取菜单树形列表 + * + * @param queryParams + */ + static getList(queryParams: MenuQuery) { + return request({ + url: "/api/v1/menus", + method: "get", + params: queryParams, + }); + } + + /** + * 获取菜单下拉数据源 + */ + static getOptions() { + return request({ + url: "/api/v1/menus/options", + method: "get", + }); + } + + /** + * 获取菜单表单数据 + * + * @param id + */ + static getFormData(id: number) { + return request({ + url: "/api/v1/menus/" + id + "/form", + method: "get", + }); + } + + /** + * 添加菜单 + * + * @param data + */ + static add(data: MenuForm) { + return request({ + url: "/api/v1/menus", + method: "post", + data: data, + }); + } + + /** + * 修改菜单 + * + * @param id + * @param data + */ + static update(id: string, data: MenuForm) { + return request({ + url: "/api/v1/menus/" + id, + method: "put", + data: data, + }); + } + + /** + * 删除菜单 + * + * @param id 菜单ID + */ + static deleteById(id: number) { + return request({ + url: "/api/v1/menus/" + id, + method: "delete", + }); + } +} + +export default MenuAPI; diff --git a/src/api/menu/model.ts b/src/api/menu/model.ts new file mode 100644 index 0000000..408a577 --- /dev/null +++ b/src/api/menu/model.ts @@ -0,0 +1,181 @@ +import { MenuTypeEnum } from "@/enums/MenuTypeEnum"; + +/** + * 菜单查询参数类型 + */ +export interface MenuQuery { + keywords?: string; +} + +/** + * 菜单视图对象类型 + */ +export interface MenuVO { + /** + * 子菜单 + */ + children?: MenuVO[]; + /** + * 组件路径 + */ + component?: string; + /** + * ICON + */ + icon?: string; + /** + * 菜单ID + */ + id?: number; + /** + * 菜单名称 + */ + name?: string; + /** + * 父菜单ID + */ + parentId?: number; + /** + * 按钮权限标识 + */ + perm?: string; + /** + * 跳转路径 + */ + redirect?: string; + /** + * 路由名称 + */ + routeName?: string; + /** + * 路由相对路径 + */ + routePath?: string; + /** + * 菜单排序(数字越小排名越靠前) + */ + sort?: number; + /** + * 菜单类型 + */ + type?: MenuTypeEnum; + /** + * 菜单是否可见(1:显示;0:隐藏) + */ + visible?: number; +} + +/** + * 菜单表单对象类型 + */ +export interface MenuForm { + /** + * 菜单ID + */ + id?: string; + /** + * 父菜单ID + */ + parentId?: number; + /** + * 菜单名称 + */ + name?: string; + /** + * 菜单是否可见(1:是;0:否;) + */ + visible: number; + icon?: string; + /** + * 排序 + */ + sort: number; + /** + * 组件路径 + */ + component?: string; + /** + * 路由路径 + */ + path?: string; + /** + * 跳转路由路径 + */ + redirect?: string; + + /** + * 菜单类型 + */ + type: MenuTypeEnum; + + /** + * 权限标识 + */ + perm?: string; + /** + * 【菜单】是否开启页面缓存 + */ + keepAlive?: number; + + /** + * 【目录】只有一个子路由是否始终显示 + */ + alwaysShow?: number; +} + +/** + * RouteVO,路由对象 + */ +export interface RouteVO { + /** + * 子路由列表 + */ + children: RouteVO[]; + /** + * 组件路径 + */ + component?: string; + meta?: Meta; + /** + * 路由名称 + */ + name?: string; + /** + * 路由路径 + */ + path?: string; + /** + * 跳转链接 + */ + redirect?: string; +} + +/** + * Meta,路由属性类型 + */ +export interface Meta { + /** + * 【目录】只有一个子路由是否始终显示 + */ + alwaysShow?: boolean; + /** + * 是否隐藏(true-是 false-否) + */ + hidden?: boolean; + /** + * ICON + */ + icon?: string; + /** + * 【菜单】是否开启页面缓存 + */ + keepAlive?: boolean; + /** + * 拥有路由权限的角色编码 + */ + roles?: string[]; + /** + * 路由title + */ + title?: string; +} diff --git a/src/api/role/index.ts b/src/api/role/index.ts new file mode 100644 index 0000000..148a251 --- /dev/null +++ b/src/api/role/index.ts @@ -0,0 +1,108 @@ +import request from "@/utils/request"; +import { RoleQuery, RolePageResult, RoleForm } from "./model"; + +class RoleAPI { + /** + * 获取角色分页数据 + * + * @param queryParams + */ + static getPage(queryParams?: RoleQuery) { + return request({ + url: "/api/v1/roles/page", + method: "get", + params: queryParams, + }); + } + + /** + * 获取角色下拉数据源 + * + * @param queryParams + */ + static getOptions(queryParams?: RoleQuery) { + return request({ + url: "/api/v1/roles/options", + method: "get", + params: queryParams, + }); + } + + /** + * 获取角色的菜单ID集合 + * + * @param queryParams + */ + static getRoleMenuIds(roleId: number) { + return request({ + url: "/api/v1/roles/" + roleId + "/menuIds", + method: "get", + }); + } + + /** + * 分配菜单权限给角色 + * + * @param queryParams + */ + static updateRoleMenus(roleId: number, data: number[]) { + return request({ + url: "/api/v1/roles/" + roleId + "/menus", + method: "put", + data: data, + }); + } + + /** + * 获取角色表单数据 + * + * @param id + */ + static getFormData(id: number) { + return request({ + url: "/api/v1/roles/" + id + "/form", + method: "get", + }); + } + + /** + * 添加角色 + * + * @param data + */ + static add(data: RoleForm) { + return request({ + url: "/api/v1/roles", + method: "post", + data: data, + }); + } + + /** + * 更新角色 + * + * @param id + * @param data + */ + static update(id: number, data: RoleForm) { + return request({ + url: "/api/v1/roles/" + id, + method: "put", + data: data, + }); + } + + /** + * 批量删除角色,多个以英文逗号(,)分割 + * + * @param ids + */ + static deleteByIds(ids: string) { + return request({ + url: "/api/v1/roles/" + ids, + method: "delete", + }); + } +} + +export default RoleAPI; diff --git a/src/api/role/model.ts b/src/api/role/model.ts new file mode 100644 index 0000000..2d259c7 --- /dev/null +++ b/src/api/role/model.ts @@ -0,0 +1,78 @@ +/** + * 角色查询参数 + */ +export interface RoleQuery extends PageQuery { + keywords?: string; +} + +/** + * 角色分页对象 + */ +export interface RolePageVO { + /** + * 角色编码 + */ + code?: string; + + /** + * 角色ID + */ + id?: number; + /** + * 角色名称 + */ + name?: string; + /** + * 排序 + */ + sort?: number; + /** + * 角色状态 + */ + status?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 修改时间 + */ + updateTime?: Date; +} + +/** + * 角色分页 + */ +export type RolePageResult = PageResult; + +/** + * 角色表单对象 + */ +export interface RoleForm { + /** + * 角色ID + */ + id?: number; + + /** + * 角色编码 + */ + code: string; + /** + * 数据权限 + */ + dataScope?: number; + + /** + * 角色名称 + */ + name: string; + /** + * 排序 + */ + sort?: number; + /** + * 角色状态(1-正常;0-停用) + */ + status?: number; +} diff --git a/src/api/user/index.ts b/src/api/user/index.ts new file mode 100644 index 0000000..783b2a6 --- /dev/null +++ b/src/api/user/index.ts @@ -0,0 +1,154 @@ +import request from "@/utils/request"; +import { UserForm, UserInfo, UserPageVO, UserQuery } from "./model"; + +class UserAPI { + /** + * 登录成功后获取用户信息(昵称、头像、权限集合和角色集合) + */ + static getInfo() { + return new Promise((resolve)=>{ + resolve({ + "userId": 2, + "username": "admin", + "nickname": "系统管理员", + "avatar": "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + "roles": [ + "ADMIN" + ], + "perms": [] + }) + }) + /* + return request({ + url: "/api/v1/users/me", + method: "get", + });*/ + } + + /** + * 获取用户分页列表 + * + * @param queryParams + */ + static getPage(queryParams: UserQuery) { + return request>({ + url: "/api/v1/users/page", + method: "get", + params: queryParams, + }); + } + + /** + * 获取用户表单详情 + * + * @param userId + */ + static getFormData(userId: number) { + return request({ + url: "/api/v1/users/" + userId + "/form", + method: "get", + }); + } + + /** + * 添加用户 + * + * @param data + */ + static add(data: UserForm) { + return request({ + url: "/api/v1/users", + method: "post", + data: data, + }); + } + + /** + * 修改用户 + * + * @param id + * @param data + */ + static update(id: number, data: UserForm) { + return request({ + url: "/api/v1/users/" + id, + method: "put", + data: data, + }); + } + + /** + * 修改用户密码 + * + * @param id + * @param password + */ + static updatePassword(id: number, password: string) { + return request({ + url: "/api/v1/users/" + id + "/password", + method: "patch", + params: { password: password }, + }); + } + + /** + * 删除用户 + * + * @param ids + */ + static deleteByIds(ids: string) { + return request({ + url: "/api/v1/users/" + ids, + method: "delete", + }); + } + + /** + * 下载用户导入模板 + * + * @returns + */ + static downloadTemplate() { + return request({ + url: "/api/v1/users/template", + method: "get", + responseType: "arraybuffer", + }); + } + + /** + * 导出用户 + * + * @param queryParams + * @returns + */ + static export(queryParams: UserQuery) { + return request({ + url: "/api/v1/users/export", + method: "get", + params: queryParams, + responseType: "arraybuffer", + }); + } + + /** + * 导入用户 + * + * @param file + */ + static import(deptId: number, file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: "/api/v1/users/import", + method: "post", + params: { deptId: deptId }, + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + } +} + +export default UserAPI; diff --git a/src/api/user/model.ts b/src/api/user/model.ts new file mode 100644 index 0000000..c0060f2 --- /dev/null +++ b/src/api/user/model.ts @@ -0,0 +1,115 @@ +/** + * 登录用户信息 + */ +export interface UserInfo { + userId?: number; + username?: string; + nickname?: string; + avatar?: string; + roles: string[]; + perms: string[]; +} + +/** + * 用户查询对象类型 + */ +export interface UserQuery extends PageQuery { + keywords?: string; + status?: number; + deptId?: number; + startTime?: string; + endTime?: string; +} + +/** + * 用户分页对象 + */ +export interface UserPageVO { + /** + * 用户头像地址 + */ + avatar?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 部门名称 + */ + deptName?: string; + /** + * 用户邮箱 + */ + email?: string; + /** + * 性别 + */ + genderLabel?: string; + /** + * 用户ID + */ + id?: number; + /** + * 手机号 + */ + mobile?: string; + /** + * 用户昵称 + */ + nickname?: string; + /** + * 角色名称,多个使用英文逗号(,)分割 + */ + roleNames?: string; + /** + * 用户状态(1:启用;0:禁用) + */ + status?: number; + /** + * 用户名 + */ + username?: string; +} + +/** + * 用户表单类型 + */ +export interface UserForm { + /** + * 用户头像 + */ + avatar?: string; + /** + * 部门ID + */ + deptId?: number; + /** + * 邮箱 + */ + email?: string; + /** + * 性别 + */ + gender?: number; + /** + * 用户ID + */ + id?: number; + mobile?: string; + /** + * 昵称 + */ + nickname?: string; + /** + * 角色ID集合 + */ + roleIds?: number[]; + /** + * 用户状态(1:正常;0:禁用) + */ + status?: number; + /** + * 用户名 + */ + username?: string; +} diff --git a/src/assets/icons/api.svg b/src/assets/icons/api.svg new file mode 100644 index 0000000..0181bdd --- /dev/null +++ b/src/assets/icons/api.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/captcha.svg b/src/assets/icons/captcha.svg new file mode 100644 index 0000000..8b1da30 --- /dev/null +++ b/src/assets/icons/captcha.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/cascader.svg b/src/assets/icons/cascader.svg new file mode 100644 index 0000000..57209bf --- /dev/null +++ b/src/assets/icons/cascader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/client.svg b/src/assets/icons/client.svg new file mode 100644 index 0000000..7373b3d --- /dev/null +++ b/src/assets/icons/client.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svg new file mode 100644 index 0000000..e99c978 --- /dev/null +++ b/src/assets/icons/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_all.svg b/src/assets/icons/close_all.svg new file mode 100644 index 0000000..2005198 --- /dev/null +++ b/src/assets/icons/close_all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_left.svg b/src/assets/icons/close_left.svg new file mode 100644 index 0000000..fc5cf71 --- /dev/null +++ b/src/assets/icons/close_left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_other.svg b/src/assets/icons/close_other.svg new file mode 100644 index 0000000..27ffc32 --- /dev/null +++ b/src/assets/icons/close_other.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_right.svg b/src/assets/icons/close_right.svg new file mode 100644 index 0000000..b96dc1c --- /dev/null +++ b/src/assets/icons/close_right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/dict.svg b/src/assets/icons/dict.svg new file mode 100644 index 0000000..db60220 --- /dev/null +++ b/src/assets/icons/dict.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/document.svg b/src/assets/icons/document.svg new file mode 100644 index 0000000..aaa0574 --- /dev/null +++ b/src/assets/icons/document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/download.svg b/src/assets/icons/download.svg new file mode 100644 index 0000000..a8077dc --- /dev/null +++ b/src/assets/icons/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/edit.svg b/src/assets/icons/edit.svg new file mode 100644 index 0000000..82152b5 --- /dev/null +++ b/src/assets/icons/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/eye-open.svg b/src/assets/icons/eye-open.svg new file mode 100644 index 0000000..b80fd2b --- /dev/null +++ b/src/assets/icons/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/eye.svg b/src/assets/icons/eye.svg new file mode 100644 index 0000000..16ed2d8 --- /dev/null +++ b/src/assets/icons/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/fullscreen-exit.svg b/src/assets/icons/fullscreen-exit.svg new file mode 100644 index 0000000..2452f2b --- /dev/null +++ b/src/assets/icons/fullscreen-exit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/fullscreen.svg b/src/assets/icons/fullscreen.svg new file mode 100644 index 0000000..4b6ee11 --- /dev/null +++ b/src/assets/icons/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/github.svg b/src/assets/icons/github.svg new file mode 100644 index 0000000..1adfa4e --- /dev/null +++ b/src/assets/icons/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/homepage.svg b/src/assets/icons/homepage.svg new file mode 100644 index 0000000..1e1feab --- /dev/null +++ b/src/assets/icons/homepage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/indent-decrease.svg b/src/assets/icons/indent-decrease.svg new file mode 100644 index 0000000..1507568 --- /dev/null +++ b/src/assets/icons/indent-decrease.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/ip.svg b/src/assets/icons/ip.svg new file mode 100644 index 0000000..a50d9bb --- /dev/null +++ b/src/assets/icons/ip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/language.svg b/src/assets/icons/language.svg new file mode 100644 index 0000000..e754062 --- /dev/null +++ b/src/assets/icons/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/link.svg b/src/assets/icons/link.svg new file mode 100644 index 0000000..15a5c62 --- /dev/null +++ b/src/assets/icons/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/lock.svg b/src/assets/icons/lock.svg new file mode 100644 index 0000000..470d48c --- /dev/null +++ b/src/assets/icons/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/menu.svg b/src/assets/icons/menu.svg new file mode 100644 index 0000000..f5875d3 --- /dev/null +++ b/src/assets/icons/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/message.svg b/src/assets/icons/message.svg new file mode 100644 index 0000000..c83af99 --- /dev/null +++ b/src/assets/icons/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/money.svg b/src/assets/icons/money.svg new file mode 100644 index 0000000..db7a2b4 --- /dev/null +++ b/src/assets/icons/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/monitor.svg b/src/assets/icons/monitor.svg new file mode 100644 index 0000000..f153b9c --- /dev/null +++ b/src/assets/icons/monitor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/moon.svg b/src/assets/icons/moon.svg new file mode 100644 index 0000000..1b66489 --- /dev/null +++ b/src/assets/icons/moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/order.svg b/src/assets/icons/order.svg new file mode 100644 index 0000000..7ba029e --- /dev/null +++ b/src/assets/icons/order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/peoples.svg b/src/assets/icons/peoples.svg new file mode 100644 index 0000000..5b21639 --- /dev/null +++ b/src/assets/icons/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/project.svg b/src/assets/icons/project.svg new file mode 100644 index 0000000..e74a210 --- /dev/null +++ b/src/assets/icons/project.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/publish.svg b/src/assets/icons/publish.svg new file mode 100644 index 0000000..d41061f --- /dev/null +++ b/src/assets/icons/publish.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/refresh.svg b/src/assets/icons/refresh.svg new file mode 100644 index 0000000..e598ed1 --- /dev/null +++ b/src/assets/icons/refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/role.svg b/src/assets/icons/role.svg new file mode 100644 index 0000000..5d25278 --- /dev/null +++ b/src/assets/icons/role.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/security.svg b/src/assets/icons/security.svg new file mode 100644 index 0000000..0e64336 --- /dev/null +++ b/src/assets/icons/security.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/setting.svg b/src/assets/icons/setting.svg new file mode 100644 index 0000000..fbc4945 --- /dev/null +++ b/src/assets/icons/setting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/size.svg b/src/assets/icons/size.svg new file mode 100644 index 0000000..f92f852 --- /dev/null +++ b/src/assets/icons/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/sunny.svg b/src/assets/icons/sunny.svg new file mode 100644 index 0000000..655a72e --- /dev/null +++ b/src/assets/icons/sunny.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/system.svg b/src/assets/icons/system.svg new file mode 100644 index 0000000..2e6045b --- /dev/null +++ b/src/assets/icons/system.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/table.svg b/src/assets/icons/table.svg new file mode 100644 index 0000000..1a16abb --- /dev/null +++ b/src/assets/icons/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/todolist.svg b/src/assets/icons/todolist.svg new file mode 100644 index 0000000..cd55ade --- /dev/null +++ b/src/assets/icons/todolist.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/tree.svg b/src/assets/icons/tree.svg new file mode 100644 index 0000000..51aea8f --- /dev/null +++ b/src/assets/icons/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/user.svg b/src/assets/icons/user.svg new file mode 100644 index 0000000..0015cc4 --- /dev/null +++ b/src/assets/icons/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/visit.svg b/src/assets/icons/visit.svg new file mode 100644 index 0000000..997f690 --- /dev/null +++ b/src/assets/icons/visit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/401.gif b/src/assets/images/401.gif new file mode 100644 index 0000000..4c930e7 Binary files /dev/null and b/src/assets/images/401.gif differ diff --git a/src/assets/images/404.png b/src/assets/images/404.png new file mode 100644 index 0000000..4e09829 Binary files /dev/null and b/src/assets/images/404.png differ diff --git a/src/assets/images/404_cloud.png b/src/assets/images/404_cloud.png new file mode 100644 index 0000000..a81d8da Binary files /dev/null and b/src/assets/images/404_cloud.png differ diff --git a/src/assets/images/login-bg-dark.jpg b/src/assets/images/login-bg-dark.jpg new file mode 100644 index 0000000..50dc817 Binary files /dev/null and b/src/assets/images/login-bg-dark.jpg differ diff --git a/src/assets/images/login-bg.jpg b/src/assets/images/login-bg.jpg new file mode 100644 index 0000000..993b958 Binary files /dev/null and b/src/assets/images/login-bg.jpg differ diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..a42ce95 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/assets/logo2.png b/src/assets/logo2.png new file mode 100644 index 0000000..cd1a7b7 Binary files /dev/null and b/src/assets/logo2.png differ diff --git a/src/components/AppLink/index.vue b/src/components/AppLink/index.vue new file mode 100644 index 0000000..c863d44 --- /dev/null +++ b/src/components/AppLink/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..ea2b1af --- /dev/null +++ b/src/components/Breadcrumb/index.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/components/Dictionary/index.vue b/src/components/Dictionary/index.vue new file mode 100644 index 0000000..a3804ff --- /dev/null +++ b/src/components/Dictionary/index.vue @@ -0,0 +1,73 @@ + + + diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue new file mode 100644 index 0000000..4b0bba9 --- /dev/null +++ b/src/components/GithubCorner/index.vue @@ -0,0 +1,62 @@ + + + diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue new file mode 100644 index 0000000..e544db7 --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,39 @@ + + + + diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue new file mode 100644 index 0000000..7e38308 --- /dev/null +++ b/src/components/IconSelect/index.vue @@ -0,0 +1,208 @@ + + + + + diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue new file mode 100644 index 0000000..2f35582 --- /dev/null +++ b/src/components/LangSelect/index.vue @@ -0,0 +1,47 @@ + + + diff --git a/src/components/PageContent/index.vue b/src/components/PageContent/index.vue new file mode 100644 index 0000000..9617293 --- /dev/null +++ b/src/components/PageContent/index.vue @@ -0,0 +1,548 @@ + + + + + diff --git a/src/components/PageModal/Form.vue b/src/components/PageModal/Form.vue new file mode 100644 index 0000000..50623ed --- /dev/null +++ b/src/components/PageModal/Form.vue @@ -0,0 +1,169 @@ + + + diff --git a/src/components/PageModal/index.vue b/src/components/PageModal/index.vue new file mode 100644 index 0000000..998304c --- /dev/null +++ b/src/components/PageModal/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/src/components/PageModal/types.ts b/src/components/PageModal/types.ts new file mode 100644 index 0000000..dd25fe7 --- /dev/null +++ b/src/components/PageModal/types.ts @@ -0,0 +1,62 @@ +import type { + DialogProps, + DrawerProps, + FormProps, + FormItemRule, +} from "element-plus"; + +// dialog组件属性 +export type IDialog = Partial>; + +// drawer组件属性 +export type IDrawer = Partial>; + +// form组件属性 +export type IForm = Partial>; + +// 对象类型 +export type IObject = Record; + +// 表单项 +export type IFormItems = Array<{ + // 组件类型(如input,select,radio,custom等,默认input) + type?: + | "input" + | "select" + | "radio" + | "checkbox" + | "tree-select" + | "date-picker" + | "input-number" + | "text" + | "custom"; + // 组件属性 + attrs?: IObject; + // 组件可选项(适用于select,radio,checkbox组件) + options?: Array<{ + label: string; + value: any; + disabled?: boolean; + [key: string]: any; + }>; + // 插槽名(适用于组件类型为custom) + slotName?: string; + // 标签文本 + label: string; + // 标签提示 + tips?: string; + // 键名 + prop: string; + // 验证规则 + rules?: FormItemRule[]; + // 初始值 + initialValue?: any; + // 是否隐藏 + hidden?: boolean; + // 监听函数 + watch?: (newValue: any, oldValue: any, data: T) => void; + // 计算属性函数 + computed?: (data: T) => any; + // 监听收集函数 + watchEffect?: (data: T) => void; +}>; diff --git a/src/components/PageSearch/index.vue b/src/components/PageSearch/index.vue new file mode 100644 index 0000000..3354552 --- /dev/null +++ b/src/components/PageSearch/index.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..c080e60 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue new file mode 100644 index 0000000..d3e83fe --- /dev/null +++ b/src/components/SizeSelect/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..07b65e8 --- /dev/null +++ b/src/components/SvgIcon/index.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue new file mode 100644 index 0000000..28ad4b6 --- /dev/null +++ b/src/components/TableSelect/index.vue @@ -0,0 +1,371 @@ + + + + + diff --git a/src/components/Upload/MultiUpload.vue b/src/components/Upload/MultiUpload.vue new file mode 100644 index 0000000..01b9078 --- /dev/null +++ b/src/components/Upload/MultiUpload.vue @@ -0,0 +1,134 @@ + + + + diff --git a/src/components/Upload/SingleUpload.vue b/src/components/Upload/SingleUpload.vue new file mode 100644 index 0000000..5da8039 --- /dev/null +++ b/src/components/Upload/SingleUpload.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue new file mode 100644 index 0000000..bdc4cc8 --- /dev/null +++ b/src/components/WangEditor/index.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/directive/index.ts b/src/directive/index.ts new file mode 100644 index 0000000..9c22eb6 --- /dev/null +++ b/src/directive/index.ts @@ -0,0 +1,9 @@ +import type { App } from "vue"; + +import { hasPerm } from "./permission"; + +// 全局注册 directive +export function setupDirective(app: App) { + // 使 v-hasPerm 在所有组件中都可用 + app.directive("hasPerm", hasPerm); +} diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts new file mode 100644 index 0000000..7a080e3 --- /dev/null +++ b/src/directive/permission/index.ts @@ -0,0 +1,38 @@ +import { hasAuth } from "@/plugins/permission"; +import { Directive, DirectiveBinding } from "vue"; + +/** + * 按钮权限 + */ +export const hasPerm: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + // DOM绑定需要的按钮权限标识 + const { value: requiredPerms } = binding; + if (requiredPerms) { + if (!hasAuth(requiredPerms)) { + el.parentNode && el.parentNode.removeChild(el); + } + } else { + throw new Error( + "need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\"" + ); + } + }, +}; + +/** + * 角色权限 + */ +export const hasRole: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + // DOM绑定需要的角色编码 + const { value: requiredRoles } = binding; + if (requiredRoles) { + if (!hasAuth(requiredRoles, "role")) { + el.parentNode && el.parentNode.removeChild(el); + } + } else { + throw new Error("need roles! Like v-has-role=\"['admin','test']\""); + } + }, +}; diff --git a/src/enums/CacheEnum.ts b/src/enums/CacheEnum.ts new file mode 100644 index 0000000..f3c434b --- /dev/null +++ b/src/enums/CacheEnum.ts @@ -0,0 +1,4 @@ +/** + * 令牌缓存Key + */ +export const TOKEN_KEY = "accessToken"; diff --git a/src/enums/DeviceEnum.ts b/src/enums/DeviceEnum.ts new file mode 100644 index 0000000..709bcb3 --- /dev/null +++ b/src/enums/DeviceEnum.ts @@ -0,0 +1,14 @@ +/** + * 设备枚举 + */ +export const enum DeviceEnum { + /** + * 宽屏设备 + */ + DESKTOP = "desktop", + + /** + * 窄屏设备 + */ + MOBILE = "mobile", +} diff --git a/src/enums/LanguageEnum.ts b/src/enums/LanguageEnum.ts new file mode 100644 index 0000000..a50b655 --- /dev/null +++ b/src/enums/LanguageEnum.ts @@ -0,0 +1,14 @@ +/** + * 语言枚举 + */ +export const enum LanguageEnum { + /** + * 中文 + */ + ZH_CN = "zh-cn", + + /** + * 英文 + */ + EN = "en", +} diff --git a/src/enums/LayoutEnum.ts b/src/enums/LayoutEnum.ts new file mode 100644 index 0000000..68be72e --- /dev/null +++ b/src/enums/LayoutEnum.ts @@ -0,0 +1,18 @@ +/** + * 菜单布局枚举 + */ +export const enum LayoutEnum { + /** + * 左侧菜单布局 + */ + LEFT = "left", + /** + * 顶部菜单布局 + */ + TOP = "top", + + /** + * 混合菜单布局 + */ + MIX = "mix", +} diff --git a/src/enums/MenuTypeEnum.ts b/src/enums/MenuTypeEnum.ts new file mode 100644 index 0000000..b69942f --- /dev/null +++ b/src/enums/MenuTypeEnum.ts @@ -0,0 +1,22 @@ +/** + * 菜单类型枚举 + */ +export const enum MenuTypeEnum { + /** + * 目录 + */ + CATALOG = "CATALOG", + /** + * 菜单 + */ + MENU = "MENU", + + /** + * 按钮 + */ + BUTTON = "BUTTON", + /** + * 外链 + */ + EXTLINK = "EXTLINK", +} diff --git a/src/enums/ResultEnum.ts b/src/enums/ResultEnum.ts new file mode 100644 index 0000000..2dff7c9 --- /dev/null +++ b/src/enums/ResultEnum.ts @@ -0,0 +1,18 @@ +/** + * 响应码枚举 + */ +export const enum ResultEnum { + /** + * 成功 + */ + SUCCESS = "00000", + /** + * 错误 + */ + ERROR = "B0001", + + /** + * 令牌无效或过期 + */ + TOKEN_INVALID = "A0230", +} diff --git a/src/enums/SidebarStatusEnum.ts b/src/enums/SidebarStatusEnum.ts new file mode 100644 index 0000000..a0d877a --- /dev/null +++ b/src/enums/SidebarStatusEnum.ts @@ -0,0 +1,14 @@ +/** + * 侧边栏状态枚举 + */ +export const enum SidebarStatusEnum { + /** + * 展开 + */ + OPENED = "opened", + + /** + * 关闭 + */ + CLOSED = "closed", +} diff --git a/src/enums/SizeEnum.ts b/src/enums/SizeEnum.ts new file mode 100644 index 0000000..e91e913 --- /dev/null +++ b/src/enums/SizeEnum.ts @@ -0,0 +1,19 @@ +/** + * 布局大小枚举 + */ +export const enum SizeEnum { + /** + * 默认 + */ + DEFAULT = "default", + + /** + * 大型 + */ + LARGE = "large", + + /** + * 小型 + */ + SMALL = "small", +} diff --git a/src/enums/ThemeEnum.ts b/src/enums/ThemeEnum.ts new file mode 100644 index 0000000..91458e1 --- /dev/null +++ b/src/enums/ThemeEnum.ts @@ -0,0 +1,18 @@ +/** + * 主题枚举 + */ +export const enum ThemeEnum { + /** + * 明亮主题 + */ + LIGHT = "light", + /** + * 暗黑主题 + */ + DARK = "dark", + + /** + * 系统自动 + */ + AUTO = "auto", +} diff --git a/src/hooks/usePage.ts b/src/hooks/usePage.ts new file mode 100644 index 0000000..7c3ab85 --- /dev/null +++ b/src/hooks/usePage.ts @@ -0,0 +1,63 @@ +import { ref } from "vue"; +import type PageSearch from "@/components/PageSearch/index.vue"; +import type PageContent from "@/components/PageContent/index.vue"; +import type PageModal from "@/components/PageModal/index.vue"; +import type { IOperatData, IObject } from "@/components/PageContent/index.vue"; +export type { IOperatData, IObject }; + +function usePage() { + const searchRef = ref>(); + const contentRef = ref>(); + const addModalRef = ref>(); + const editModalRef = ref>(); + + // 搜索 + function handleQueryClick(queryParams: IObject) { + contentRef.value?.fetchPageData(queryParams, true); + } + // 重置 + function handleResetClick() { + contentRef.value?.fetchPageData({}, true); + } + // 新增 + function handleAddClick() { + //显示添加表单 + addModalRef.value?.setModalVisible(); + } + // 编辑 + function handleEditClick(row: IObject) { + //显示编辑表单 根据数据进行填充 + editModalRef.value?.setModalVisible(row); + } + // 表单提交 + function handleSubmitClick() { + //刷新列表数据 + contentRef.value?.fetchPageData({}, true); + } + // 导出 + function handleExportClick() { + // 根据检索条件导出数据 + const queryParams = searchRef.value?.getQueryParams(); + contentRef.value?.exportPageData(queryParams); + } + // 搜索显隐 + function handleSearchClick() { + searchRef.value?.toggleVisible(); + } + + return { + searchRef, + contentRef, + addModalRef, + editModalRef, + handleQueryClick, + handleResetClick, + handleAddClick, + handleEditClick, + handleSubmitClick, + handleExportClick, + handleSearchClick, + }; +} + +export default usePage; diff --git a/src/lang/index.ts b/src/lang/index.ts new file mode 100644 index 0000000..dad4395 --- /dev/null +++ b/src/lang/index.ts @@ -0,0 +1,25 @@ +import { createI18n } from "vue-i18n"; +import { useAppStoreHook } from "@/store/modules/app"; +// 本地语言包 +import enLocale from "./package/en"; +import zhCnLocale from "./package/zh-cn"; + +const appStore = useAppStoreHook(); + +const messages = { + "zh-cn": { + ...zhCnLocale, + }, + en: { + ...enLocale, + }, +}; + +const i18n = createI18n({ + legacy: false, + locale: appStore.language, + messages: messages, + globalInjection: true, +}); + +export default i18n; diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts new file mode 100644 index 0000000..09b4e85 --- /dev/null +++ b/src/lang/package/en.ts @@ -0,0 +1,59 @@ +export default { + // 路由国际化 + route: { + dashboard: "Dashboard", + document: "Document", + }, + // 登录页面国际化 + login: { + username: "Username", + password: "Password", + login: "Login", + captchaCode: "Verify Code", + capsLock: "Caps Lock is On", + message: { + username: { + required: "Please enter Username", + }, + password: { + required: "Please enter Password", + min: "The password can not be less than 6 digits", + }, + captchaCode: { + required: "Please enter Verify Code", + }, + }, + }, + // 导航栏国际化 + navbar: { + dashboard: "Dashboard", + logout: "Logout", + document: "Document", + gitee: "Gitee", + }, + sizeSelect: { + tooltip: "Layout Size", + default: "Default", + large: "Large", + small: "Small", + message: { + success: "Switch Layout Size Successful!", + }, + }, + langSelect: { + message: { + success: "Switch Language Successful!", + }, + }, + settings: { + project: "Project Settings", + theme: "Theme", + interface: "Interface", + navigation: "Navigation", + themeColor: "Theme Color", + tagsView: "Tags View", + fixedHeader: "Fixed Header", + sidebarLogo: "Sidebar Logo", + watermark: "Watermark", + }, +}; diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts new file mode 100644 index 0000000..9ec9e60 --- /dev/null +++ b/src/lang/package/zh-cn.ts @@ -0,0 +1,59 @@ +export default { + // 路由国际化 + route: { + dashboard: "数据总览", + document: "项目文档", + }, + // 登录页面国际化 + login: { + username: "用户名", + password: "密码", + login: "登 录", + captchaCode: "验证码", + capsLock: "大写锁定已打开", + message: { + username: { + required: "请输入用户名", + }, + password: { + required: "请输入密码", + min: "密码不能少于6位", + }, + captchaCode: { + required: "请输入验证码", + }, + }, + }, + // 导航栏国际化 + navbar: { + dashboard: "数据总览", + logout: "注销登出", + document: "项目文档", + gitee: "项目地址", + }, + sizeSelect: { + tooltip: "布局大小", + default: "默认", + large: "大型", + small: "小型", + message: { + success: "切换布局大小成功!", + }, + }, + langSelect: { + message: { + success: "切换语言成功!", + }, + }, + settings: { + project: "项目配置", + theme: "主题设置", + interface: "界面设置", + navigation: "导航设置", + themeColor: "主题颜色", + tagsView: "开启 Tags-View", + fixedHeader: "固定 Header", + sidebarLogo: "侧边栏 Logo", + watermark: "开启水印", + }, +}; diff --git a/src/layout/components/AppMain/index.vue b/src/layout/components/AppMain/index.vue new file mode 100644 index 0000000..c8017b2 --- /dev/null +++ b/src/layout/components/AppMain/index.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/layout/components/NavBar/components/NavbarLeft.vue b/src/layout/components/NavBar/components/NavbarLeft.vue new file mode 100644 index 0000000..937391f --- /dev/null +++ b/src/layout/components/NavBar/components/NavbarLeft.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/layout/components/NavBar/components/NavbarRight.vue b/src/layout/components/NavBar/components/NavbarRight.vue new file mode 100644 index 0000000..8661cec --- /dev/null +++ b/src/layout/components/NavBar/components/NavbarRight.vue @@ -0,0 +1,128 @@ + + + diff --git a/src/layout/components/NavBar/index.vue b/src/layout/components/NavBar/index.vue new file mode 100644 index 0000000..084fdc4 --- /dev/null +++ b/src/layout/components/NavBar/index.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/layout/components/Settings/components/LayoutSelect.vue b/src/layout/components/Settings/components/LayoutSelect.vue new file mode 100644 index 0000000..0b880c1 --- /dev/null +++ b/src/layout/components/Settings/components/LayoutSelect.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/layout/components/Settings/components/ThemeColorPicker.vue b/src/layout/components/Settings/components/ThemeColorPicker.vue new file mode 100644 index 0000000..5a0d59c --- /dev/null +++ b/src/layout/components/Settings/components/ThemeColorPicker.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue new file mode 100644 index 0000000..d7f670a --- /dev/null +++ b/src/layout/components/Settings/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarLogo.vue b/src/layout/components/Sidebar/components/SidebarLogo.vue new file mode 100644 index 0000000..d72e746 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarLogo.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenu.vue b/src/layout/components/Sidebar/components/SidebarMenu.vue new file mode 100644 index 0000000..444fa0d --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenu.vue @@ -0,0 +1,64 @@ + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenuItem.vue b/src/layout/components/Sidebar/components/SidebarMenuItem.vue new file mode 100644 index 0000000..cba90fc --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenuItem.vue @@ -0,0 +1,195 @@ + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue b/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue new file mode 100644 index 0000000..4fec81f --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue new file mode 100644 index 0000000..383aa74 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue @@ -0,0 +1,83 @@ + + + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..ffe7f18 --- /dev/null +++ b/src/layout/components/Sidebar/index.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue new file mode 100644 index 0000000..4255fa6 --- /dev/null +++ b/src/layout/components/TagsView/index.vue @@ -0,0 +1,466 @@ + + + + + diff --git a/src/layout/index.vue b/src/layout/index.vue new file mode 100644 index 0000000..3155f1a --- /dev/null +++ b/src/layout/index.vue @@ -0,0 +1,346 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..405fcb3 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,28 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import router from "@/router"; +import { setupStore } from "@/store"; +import { setupDirective } from "@/directive"; +import { setupElIcons, setupI18n, setupPermission } from "@/plugins"; + +// 本地SVG图标 +import "virtual:svg-icons-register"; + +// 样式 +import "element-plus/theme-chalk/dark/css-vars.css"; +import "@/styles/index.scss"; +import "uno.css"; +import "animate.css"; + +const app = createApp(App); +// 全局注册 自定义指令(directive) +setupDirective(app); +// 全局注册 状态管理(store) +setupStore(app); +// 全局注册Element-plus图标 +setupElIcons(app); +// 国际化 +setupI18n(app); +// 注册动态路由 +setupPermission(); +app.use(router).mount("#app"); diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts new file mode 100644 index 0000000..16915cc --- /dev/null +++ b/src/plugins/i18n.ts @@ -0,0 +1,7 @@ +// 国际化 +import i18n from "@/lang/index"; +import type { App } from "vue"; + +export function setupI18n(app: App) { + app.use(i18n); +} diff --git a/src/plugins/icons.ts b/src/plugins/icons.ts new file mode 100644 index 0000000..fa85ba1 --- /dev/null +++ b/src/plugins/icons.ts @@ -0,0 +1,9 @@ +import type { App } from "vue"; +import * as ElementPlusIconsVue from "@element-plus/icons-vue"; + +// 注册所有图标 +export function setupElIcons(app: App) { + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component); + } +} diff --git a/src/plugins/index.ts b/src/plugins/index.ts new file mode 100644 index 0000000..b54ee18 --- /dev/null +++ b/src/plugins/index.ts @@ -0,0 +1,3 @@ +export * from "./icons"; +export * from "./i18n"; +export * from "./permission"; diff --git a/src/plugins/permission.ts b/src/plugins/permission.ts new file mode 100644 index 0000000..663f781 --- /dev/null +++ b/src/plugins/permission.ts @@ -0,0 +1,80 @@ +import router from "@/router"; +import { useUserStore, usePermissionStore } from "@/store"; +import NProgress from "@/utils/nprogress"; +import { RouteRecordRaw } from "vue-router"; +import { TOKEN_KEY } from "@/enums/CacheEnum"; + +// 是否有权限 +export function hasAuth( + value: string | string[], + type: "button" | "role" = "button" +) { + const { roles, perms } = useUserStore().user; + //「超级管理员」拥有所有的按钮权限 + if (type === "button" && roles.includes("ROOT")) { + return true; + } + const auths = type === "button" ? perms : roles; + return typeof value === "string" + ? auths.includes(value) + : auths.some((perm) => { + return value.includes(perm); + }); +} + +export function setupPermission() { + + // 白名单路由 + const whiteList = ["/login"]; + + router.beforeEach(async (to, from, next) => { + NProgress.start(); + const hasToken =localStorage.getItem(TOKEN_KEY); + if (hasToken) { + if (to.path === "/login") { + // 如果已登录,跳转首页 + next({ path: "/" }); + NProgress.done(); + } else { + const userStore = useUserStore(); + const hasRoles = + userStore.user.roles && userStore.user.roles.length > 0; + if (hasRoles) { + // 未匹配到任何路由,跳转404 + if (to.matched.length === 0) { + from.name ? next({ name: from.name }) : next("/404"); + } else { + next(); + } + } else { + const permissionStore = usePermissionStore(); + try { + const { roles } = await userStore.getUserInfo(); + const accessRoutes = await permissionStore.generateRoutes(roles); + accessRoutes.forEach((route: RouteRecordRaw) => { + router.addRoute(route); + }); + next({ ...to, replace: true }); + } catch (error) { + // 移除 token 并跳转登录页 + await userStore.resetToken(); + next(`/login?redirect=${to.path}`); + NProgress.done(); + } + } + } + } else { + // 未登录可以访问白名单页面 + if (whiteList.indexOf(to.path) !== -1) { + next(); + } else { + next(`/login?redirect=${to.path}`); + NProgress.done(); + } + } + }); + + router.afterEach(() => { + NProgress.done(); + }); +} diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..b67fdf5 --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,127 @@ +import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"; + +export const Layout = () => import("@/layout/index.vue"); + +// 静态路由 +export const constantRoutes: RouteRecordRaw[] = [ + { + path: "/redirect", + component: Layout, + meta: { hidden: true }, + children: [ + { + path: "/redirect/:path(.*)", + component: () => import("@/views/redirect/index.vue"), + }, + ], + }, + + { + path: "/login", + component: () => import("@/views/login/index.vue"), + meta: { hidden: true }, + }, + + { + path: "/", + name: "/", + component: Layout, + redirect: "/dashboard", + children: [ + { + path: "dashboard", + component: () => import("@/views/dashboard/index.vue"), + name: "Dashboard", // 用于 keep-alive, 必须与SFC自动推导或者显示声明的组件name一致 + // https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude + meta: { + title: "dashboard", + icon: "homepage", + affix: true, + keepAlive: true, + alwaysShow: false, + }, + }, + { + path: "401", + component: () => import("@/views/error-page/401.vue"), + meta: { hidden: true }, + }, + { + path: "404", + component: () => import("@/views/error-page/404.vue"), + meta: { hidden: true }, + }, + ], + }, + + // 外部链接 + // { + // path: "/external-link", + // component: Layout, + // children: [ { + // component: () => import("@/views/external-link/index.vue"), + // path: "https://www.cnblogs.com/haoxianrui/", + // meta: { title: "外部链接", icon: "link" }, + // }, + // ], + // }, + // 多级嵌套路由 + /* { + path: '/nested', + component: Layout, + redirect: '/nested/level1/level2', + name: 'Nested', + meta: {title: '多级菜单', icon: 'nested'}, + children: [ + { + path: 'level1', + component: () => import('@/views/nested/level1/index.vue'), + name: 'Level1', + meta: {title: '菜单一级'}, + redirect: '/nested/level1/level2', + children: [ + { + path: 'level2', + component: () => import('@/views/nested/level1/level2/index.vue'), + name: 'Level2', + meta: {title: '菜单二级'}, + redirect: '/nested/level1/level2/level3', + children: [ + { + path: 'level3-1', + component: () => import('@/views/nested/level1/level2/level3/index1.vue'), + name: 'Level3-1', + meta: {title: '菜单三级-1'} + }, + { + path: 'level3-2', + component: () => import('@/views/nested/level1/level2/level3/index2.vue'), + name: 'Level3-2', + meta: {title: '菜单三级-2'} + } + ] + } + ] + }, + ] + }*/ +]; + +/** + * 创建路由 + */ +const router = createRouter({ + history: createWebHashHistory(), + routes: constantRoutes, + // 刷新时,滚动条位置还原 + scrollBehavior: () => ({ left: 0, top: 0 }), +}); + +/** + * 重置路由 + */ +export function resetRouter() { + router.replace({ path: "/login" }); +} + +export default router; diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..a9a2f6a --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,24 @@ +import { SizeEnum } from "./enums/SizeEnum"; +import { LayoutEnum } from "./enums/LayoutEnum"; +import { ThemeEnum } from "./enums/ThemeEnum"; +import { LanguageEnum } from "./enums/LanguageEnum"; + +const { pkg } = __APP_INFO__; + +const defaultSettings: AppSettings = { + title: pkg.name, + version: pkg.version, + showSettings: true, + tagsView: true, + fixedHeader: true, + sidebarLogo: true, + layout: LayoutEnum.LEFT, + theme: ThemeEnum.LIGHT, + size: SizeEnum.DEFAULT, + language: LanguageEnum.ZH_CN, + themeColor: "#409EFF", + watermarkEnabled: false, + watermarkContent: pkg.name, +}; + +export default defaultSettings; diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 0000000..8dd6ea9 --- /dev/null +++ b/src/store/index.ts @@ -0,0 +1,16 @@ +import type { App } from "vue"; +import { createPinia } from "pinia"; + +const store = createPinia(); + +// 全局注册 store +export function setupStore(app: App) { + app.use(store); +} + +export * from "./modules/app"; +export * from "./modules/permission"; +export * from "./modules/settings"; +export * from "./modules/tagsView"; +export * from "./modules/user"; +export { store }; diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts new file mode 100644 index 0000000..747f994 --- /dev/null +++ b/src/store/modules/app.ts @@ -0,0 +1,94 @@ +import defaultSettings from "@/settings"; + +// 导入 Element Plus 中英文语言包 +import zhCn from "element-plus/es/locale/lang/zh-cn"; +import en from "element-plus/es/locale/lang/en"; +import { store } from "@/store"; +import { DeviceEnum } from "@/enums/DeviceEnum"; +import { SidebarStatusEnum } from "@/enums/SidebarStatusEnum"; + +// setup +export const useAppStore = defineStore("app", () => { + // state + const device = useStorage("device", DeviceEnum.DESKTOP); + const size = useStorage("size", defaultSettings.size); + const language = useStorage("language", defaultSettings.language); + const sidebarStatus = useStorage("sidebarStatus", SidebarStatusEnum.CLOSED); + + const sidebar = reactive({ + opened: sidebarStatus.value === SidebarStatusEnum.OPENED, + withoutAnimation: false, + }); + const activeTopMenuPath = useStorage("activeTopMenuPath", ""); + /** + * 根据语言标识读取对应的语言包 + */ + const locale = computed(() => { + if (language?.value == "en") { + return en; + } else { + return zhCn; + } + }); + + // actions + function toggleSidebar() { + sidebar.opened = !sidebar.opened; + sidebarStatus.value = sidebar.opened + ? SidebarStatusEnum.OPENED + : SidebarStatusEnum.CLOSED; + } + + function closeSideBar() { + sidebar.opened = false; + sidebarStatus.value = SidebarStatusEnum.CLOSED; + } + + function openSideBar() { + sidebar.opened = true; + sidebarStatus.value = SidebarStatusEnum.OPENED; + } + + function toggleDevice(val: string) { + device.value = val; + } + + function changeSize(val: string) { + size.value = val; + } + /** + * 切换语言 + * + * @param val + */ + function changeLanguage(val: string) { + language.value = val; + } + /** + * 混合模式顶部切换 + */ + function activeTopMenu(val: string) { + activeTopMenuPath.value = val; + } + return { + device, + sidebar, + language, + locale, + size, + activeTopMenu, + toggleDevice, + changeSize, + changeLanguage, + toggleSidebar, + closeSideBar, + openSideBar, + activeTopMenuPath, + }; +}); + +// 手动提供给 useStore() 函数 pinia 实例 +// https://pinia.vuejs.org/zh/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component +export function useAppStoreHook() { + return useAppStore(store); +} diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts new file mode 100644 index 0000000..00bf223 --- /dev/null +++ b/src/store/modules/permission.ts @@ -0,0 +1,121 @@ +import { RouteRecordRaw } from "vue-router"; +import { constantRoutes } from "@/router"; +import { store } from "@/store"; +import MenuAPI from "@/api/menu"; +import { RouteVO } from "@/api/menu/model"; + +const modules = import.meta.glob("../../views/**/**.vue"); +const Layout = () => import("@/layout/index.vue"); + +/** + * Use meta.role to determine if the current user has permission + * + * @param roles 用户角色集合 + * @param route 路由 + * @returns + */ +const hasPermission = (roles: string[], route: RouteRecordRaw) => { + if (route.meta && route.meta.roles) { + // 角色【超级管理员】拥有所有权限,忽略校验 + if (roles.includes("ROOT")) { + return true; + } + return roles.some((role) => { + if (route.meta?.roles) { + return route.meta.roles.includes(role); + } + }); + } + return false; +}; + +/** + * 递归过滤有权限的动态路由 + * + * @param routes 接口返回所有的动态路由 + * @param roles 用户角色集合 + * @returns 返回用户有权限的动态路由 + */ +const filterAsyncRoutes = (routes: RouteVO[], roles: string[]) => { + const asyncRoutes: RouteRecordRaw[] = []; + routes.forEach((route) => { + const tmpRoute = { ...route } as RouteRecordRaw; // 深拷贝 route 对象 避免污染 + if (hasPermission(roles, tmpRoute)) { + // 如果是顶级目录,替换为 Layout 组件 + if (tmpRoute.component?.toString() == "Layout") { + tmpRoute.component = Layout; + } else { + // 如果是子目录,动态加载组件 + const component = modules[`../../views/${tmpRoute.component}.vue`]; + if (component) { + tmpRoute.component = component; + } else { + tmpRoute.component = modules[`../../views/error-page/404.vue`]; + } + } + + if (tmpRoute.children) { + tmpRoute.children = filterAsyncRoutes(route.children, roles); + } + + asyncRoutes.push(tmpRoute); + } + }); + + return asyncRoutes; +}; +// setup +export const usePermissionStore = defineStore("permission", () => { + // state + const routes = ref([]); + + // actions + function setRoutes(newRoutes: RouteRecordRaw[]) { + routes.value = constantRoutes.concat(newRoutes); + } + + /** + * 生成动态路由 + * + * @param roles 用户角色集合 + * @returns + */ + function generateRoutes(roles: string[]) { + return new Promise((resolve, reject) => { + // 接口获取所有路由 + MenuAPI.getRoutes() + .then((data:any) => { + // 过滤有权限的动态路由 + const accessedRoutes = filterAsyncRoutes(data, roles); + setRoutes(accessedRoutes); + resolve(accessedRoutes); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 获取与激活的顶部菜单项相关的混合模式左侧菜单集合 + */ + const mixLeftMenus = ref([]); + function setMixLeftMenus(topMenuPath: string) { + const matchedItem = routes.value.find((item) => item.path === topMenuPath); + if (matchedItem && matchedItem.children) { + mixLeftMenus.value = matchedItem.children; + } + } + return { + routes, + setRoutes, + generateRoutes, + mixLeftMenus, + setMixLeftMenus, + }; +}); + +// 非setup +export function usePermissionStoreHook() { + return usePermissionStore(store); +} diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts new file mode 100644 index 0000000..a581e90 --- /dev/null +++ b/src/store/modules/settings.ts @@ -0,0 +1,125 @@ +import defaultSettings from "@/settings"; +import { ThemeEnum } from "@/enums/ThemeEnum"; +import Color from "color"; + +type SettingsValue = boolean | string; + +export const useSettingsStore = defineStore("setting", () => { + // 是否显示设置 + const settingsVisible = ref(false); + // 是否显示标签视图 + const tagsView = useStorage("tagsView", defaultSettings.tagsView); + // 是否显示侧边栏logo + const sidebarLogo = useStorage( + "sidebarLogo", + defaultSettings.sidebarLogo + ); + // 是否固定头部 + const fixedHeader = useStorage( + "fixedHeader", + defaultSettings.fixedHeader + ); + // 布局模式:left-左侧模式(默认) top-顶部模式 mix-混合模式 + const layout = useStorage("layout", defaultSettings.layout); + // 主题颜色 + const themeColor = useStorage( + "themeColor", + defaultSettings.themeColor + ); + // 主题:light-亮色(默认) dark-暗色 + const theme = useStorage("theme", defaultSettings.theme); + // 是否开启水印 + const watermarkEnabled = useStorage( + "watermarkEnabled", + defaultSettings.watermarkEnabled + ); + + watch( + [theme, themeColor], + ([newTheme, newThemeColor], [oldTheme, oldThemeColor]) => { + if (newTheme !== oldTheme) { + if (newTheme === ThemeEnum.DARK) { + document.documentElement.classList.add("dark"); + } else { + document.documentElement.classList.remove("dark"); + } + } + + if (newThemeColor !== oldThemeColor) { + const rootStyle = document.documentElement.style; + rootStyle.setProperty(`--el-color-primary`, newThemeColor); + rootStyle.setProperty(`--el-color-primary-dark-2`, newThemeColor); + + for (let i = 1; i < 10; i++) { + rootStyle.setProperty( + `--el-color-primary-light-${i}`, + `${Color(newThemeColor).alpha(1 - i * 0.1)}` + ); + } + } + }, + { + immediate: true, // 立即执行,确保在侦听器创建时执行一次 + } + ); + + const settingsMap: Record> = { + fixedHeader, + tagsView, + sidebarLogo, + layout, + watermarkEnabled, + }; + + function changeSetting({ + key, + value, + }: { + key: string; + value: SettingsValue; + }) { + const setting = settingsMap[key]; + if (setting) { + setting.value = value; + } + } + + /** + * 切换主题 + */ + function changeTheme(val: string) { + theme.value = val; + } + + /** + * 切换主题颜色 + * + * @param color 主题颜色 + * + */ + function changeThemeColor(color: string) { + themeColor.value = color; + } + + /** + * 切换布局 + */ + function changeLayout(val: string) { + layout.value = val; + } + + return { + settingsVisible, + tagsView, + fixedHeader, + sidebarLogo, + layout, + themeColor, + theme, + watermarkEnabled, + changeSetting, + changeTheme, + changeThemeColor, + changeLayout, + }; +}); diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts new file mode 100644 index 0000000..9e66c10 --- /dev/null +++ b/src/store/modules/tagsView.ts @@ -0,0 +1,211 @@ +export const useTagsViewStore = defineStore("tagsView", () => { + const visitedViews = ref([]); + const cachedViews = ref([]); + + /** + * 添加已访问视图到已访问视图列表中 + */ + function addVisitedView(view: TagView) { + // 如果已经存在于已访问的视图列表中,则不再添加 + if (visitedViews.value.some((v) => v.path === view.path)) { + return; + } + // 如果视图是固定的(affix),则在已访问的视图列表的开头添加 + if (view.affix) { + visitedViews.value.unshift(view); + } else { + // 如果视图不是固定的,则在已访问的视图列表的末尾添加 + visitedViews.value.push(view); + } + } + + /** + * 添加缓存视图到缓存视图列表中 + */ + function addCachedView(view: TagView) { + const viewName = view.name; + // 如果缓存视图名称已经存在于缓存视图列表中,则不再添加 + if (cachedViews.value.includes(viewName)) { + return; + } + + // 如果视图需要缓存(keepAlive),则将其路由名称添加到缓存视图列表中 + if (view.keepAlive) { + cachedViews.value.push(viewName); + } + } + + /** + * 从已访问视图列表中删除指定的视图 + */ + function delVisitedView(view: TagView) { + return new Promise((resolve) => { + for (const [i, v] of visitedViews.value.entries()) { + // 找到与指定视图路径匹配的视图,在已访问视图列表中删除该视图 + if (v.path === view.path) { + visitedViews.value.splice(i, 1); + break; + } + } + resolve([...visitedViews.value]); + }); + } + + function delCachedView(view: TagView) { + const viewName = view.name; + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + index > -1 && cachedViews.value.splice(index, 1); + resolve([...cachedViews.value]); + }); + } + + function delOtherVisitedViews(view: TagView) { + return new Promise((resolve) => { + visitedViews.value = visitedViews.value.filter((v) => { + return v?.affix || v.path === view.path; + }); + resolve([...visitedViews.value]); + }); + } + + function delOtherCachedViews(view: TagView) { + const viewName = view.name as string; + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + if (index > -1) { + cachedViews.value = cachedViews.value.slice(index, index + 1); + } else { + // if index = -1, there is no cached tags + cachedViews.value = []; + } + resolve([...cachedViews.value]); + }); + } + + function updateVisitedView(view: TagView) { + for (let v of visitedViews.value) { + if (v.path === view.path) { + v = Object.assign(v, view); + break; + } + } + } + + function addView(view: TagView) { + addVisitedView(view); + addCachedView(view); + } + + function delView(view: TagView) { + return new Promise((resolve) => { + delVisitedView(view); + delCachedView(view); + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delOtherViews(view: TagView) { + return new Promise((resolve) => { + delOtherVisitedViews(view); + delOtherCachedViews(view); + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delLeftViews(view: TagView) { + return new Promise((resolve) => { + const currIndex = visitedViews.value.findIndex( + (v) => v.path === view.path + ); + if (currIndex === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item, index) => { + if (index >= currIndex || item?.affix) { + return true; + } + + const cacheIndex = cachedViews.value.indexOf(item.name); + if (cacheIndex > -1) { + cachedViews.value.splice(cacheIndex, 1); + } + return false; + }); + resolve({ + visitedViews: [...visitedViews.value], + }); + }); + } + function delRightViews(view: TagView) { + return new Promise((resolve) => { + const currIndex = visitedViews.value.findIndex( + (v) => v.path === view.path + ); + if (currIndex === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item, index) => { + if (index <= currIndex || item?.affix) { + return true; + } + }); + resolve({ + visitedViews: [...visitedViews.value], + }); + }); + } + + function delAllViews() { + return new Promise((resolve) => { + const affixTags = visitedViews.value.filter((tag) => tag?.affix); + visitedViews.value = affixTags; + cachedViews.value = []; + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delAllVisitedViews() { + return new Promise((resolve) => { + const affixTags = visitedViews.value.filter((tag) => tag?.affix); + visitedViews.value = affixTags; + resolve([...visitedViews.value]); + }); + } + + function delAllCachedViews() { + return new Promise((resolve) => { + cachedViews.value = []; + resolve([...cachedViews.value]); + }); + } + + return { + visitedViews, + cachedViews, + addVisitedView, + addCachedView, + delVisitedView, + delCachedView, + delOtherVisitedViews, + delOtherCachedViews, + updateVisitedView, + addView, + delView, + delOtherViews, + delLeftViews, + delRightViews, + delAllViews, + delAllVisitedViews, + delAllCachedViews, + }; +}); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts new file mode 100644 index 0000000..b782a1b --- /dev/null +++ b/src/store/modules/user.ts @@ -0,0 +1,96 @@ +import AuthAPI from "@/api/auth"; +import UserAPI from "@/api/user"; +import { resetRouter } from "@/router"; +import { store } from "@/store"; + +import { LoginData } from "@/api/auth/model"; +import { UserInfo } from "@/api/user/model"; +import { TOKEN_KEY } from "@/enums/CacheEnum"; + +export const useUserStore = defineStore("user", () => { + const user = ref({ + roles: [], + perms: [], + }); + + /** + * 登录 + * + * @param {LoginData} + * @returns + */ + function login(loginData: LoginData) { + return new Promise((resolve, reject) => { + AuthAPI.login(loginData) + .then((data) => { + debugger + const { tokenType, accessToken } = data; + localStorage.setItem(TOKEN_KEY, tokenType + " " + accessToken); // Bearer eyJhbGciOiJIUzI1NiJ9.xxx.xxx + resolve(); + }) + .catch((error) => { + reject(error); + }); + }); + } + + // 获取信息(用户昵称、头像、角色集合、权限集合) + function getUserInfo() { + return new Promise((resolve, reject) => { + UserAPI.getInfo() + .then((data) => { + if (!data) { + reject("Verification failed, please Login again."); + return; + } + if (!data.roles || data.roles.length <= 0) { + reject("getUserInfo: roles must be a non-null array!"); + return; + } + Object.assign(user.value, { ...data }); + resolve(data); + }) + .catch((error) => { + reject(error); + }); + }); + } + + // user logout + function logout() { + return new Promise((resolve, reject) => { + AuthAPI.logout() + .then(() => { + localStorage.setItem(TOKEN_KEY, ""); + location.reload(); // 清空路由 + resolve(); + }) + .catch((error) => { + reject(error); + }); + }); + } + + // remove token + function resetToken() { + console.log("resetToken"); + return new Promise((resolve) => { + localStorage.setItem(TOKEN_KEY, ""); + resetRouter(); + resolve(); + }); + } + + return { + user, + login, + getUserInfo, + logout, + resetToken, + }; +}); + +// 非setup +export function useUserStoreHook() { + return useUserStore(store); +} diff --git a/src/styles/index.scss b/src/styles/index.scss new file mode 100644 index 0000000..83ff872 --- /dev/null +++ b/src/styles/index.scss @@ -0,0 +1,28 @@ +@use "./reset"; + +.app-container { + padding: 10px; +} + +.search-container { + padding: 18px 0 0 10px; + margin-bottom: 10px; + background-color: var(--el-bg-color-overlay); + border: 1px solid var(--el-border-color-light); + border-radius: 4px; + box-shadow: var(--el-box-shadow-light); +} + +.table-container > .el-card__header { + padding: calc(var(--el-card-padding) - 8px) var(--el-card-padding); +} + +.link-type, +.link-type:focus { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32 160 255); + } +} diff --git a/src/styles/reset.scss b/src/styles/reset.scss new file mode 100644 index 0000000..a20f04a --- /dev/null +++ b/src/styles/reset.scss @@ -0,0 +1,76 @@ +*, +::before, +::after { + box-sizing: border-box; + border-color: currentcolor; + border-style: solid; + border-width: 0; +} + +#app { + width: 100%; + height: 100%; +} + +html { + box-sizing: border-box; + width: 100%; + height: 100%; + line-height: 1.5; + tab-size: 4; + text-size-adjust: 100%; +} + +body { + width: 100%; + height: 100%; + margin: 0; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", + "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + line-height: inherit; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizelegibility; +} + +a { + color: inherit; + text-decoration: inherit; +} + +img, +svg { + display: inline-block; +} + +svg { + // 因icon大小被设置为和字体大小一致,而span等标签的下边缘会和字体的基线对齐,故需设置一个往下的偏移比例,来纠正视觉上的未对齐效果 + vertical-align: -0.15em; +} + +ul, +li { + padding: 0; + margin: 0; + list-style: none; +} + +*, +*::before, +*::after { + box-sizing: inherit; +} + +a, +a:focus, +a:hover { + color: inherit; + text-decoration: none; + cursor: pointer; +} + +a:focus, +a:active, +div:focus { + outline: none; +} diff --git a/src/styles/variables.module.scss b/src/styles/variables.module.scss new file mode 100644 index 0000000..70aa10b --- /dev/null +++ b/src/styles/variables.module.scss @@ -0,0 +1,10 @@ +/* stylelint-disable property-no-unknown */ +:export { + sidebar-width: $sidebar-width; + navbar-height: $navbar-height; + menu-background: $menu-background; + menu-text: $menu-text; + menu-active-text: $menu-active-text; + menu-hover: $menu-hover; +} +/* stylelint-enable property-no-unknown */ diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000..7b9b3eb --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,29 @@ +/** 全局SCSS变量 */ + +:root { + --menu-background: #304156; + --menu-text: #bfcbd9; + --menu-active-text: var(--el-menu-active-color); + --menu-hover: #263445; + --sidebar-logo-background: #2d3748; +} + +/** 暗黑主题 */ +html.dark { + --menu-background: var(--el-bg-color-overlay); + --menu-text: #fff; + --menu-active-text: var(--el-menu-active-color); + --menu-hover: rgb(0 0 0 / 20%); + --sidebar-logo-background: rgb(0 0 0 / 20%); +} + +$menu-background: var(--menu-background); // 菜单背景色 +$menu-text: var(--menu-text); // 菜单文字颜色 +$menu-active-text: var(--menu-active-text); // 菜单激活文字颜色 +$menu-hover: var(--menu-hover); // 菜单悬停背景色 +$sidebar-logo-background: var(--sidebar-logo-background); // 侧边栏 Logo 背景色 + +$sidebar-width: 210px; // 侧边栏宽度 +$sidebar-width-collapsed: 54px; // 侧边栏收缩宽度 +$navbar-height: 50px; // 导航栏高度 +$tags-view-height: 34px; // TagsView 高度 diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts new file mode 100644 index 0000000..5f6d3a9 --- /dev/null +++ b/src/typings/auto-imports.d.ts @@ -0,0 +1,1779 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: (typeof import("vue"))["EffectScope"]; + const ElForm: (typeof import("element-plus/es"))["ElForm"]; + const ElMessage: (typeof import("element-plus/es"))["ElMessage"]; + const ElMessageBox: (typeof import("element-plus/es"))["ElMessageBox"]; + const ElTree: (typeof import("element-plus/es"))["ElTree"]; + const acceptHMRUpdate: (typeof import("pinia"))["acceptHMRUpdate"]; + const asyncComputed: (typeof import("@vueuse/core"))["asyncComputed"]; + const autoResetRef: (typeof import("@vueuse/core"))["autoResetRef"]; + const computed: (typeof import("vue"))["computed"]; + const computedAsync: (typeof import("@vueuse/core"))["computedAsync"]; + const computedEager: (typeof import("@vueuse/core"))["computedEager"]; + const computedInject: (typeof import("@vueuse/core"))["computedInject"]; + const computedWithControl: (typeof import("@vueuse/core"))["computedWithControl"]; + const controlledComputed: (typeof import("@vueuse/core"))["controlledComputed"]; + const controlledRef: (typeof import("@vueuse/core"))["controlledRef"]; + const createApp: (typeof import("vue"))["createApp"]; + const createEventHook: (typeof import("@vueuse/core"))["createEventHook"]; + const createGlobalState: (typeof import("@vueuse/core"))["createGlobalState"]; + const createInjectionState: (typeof import("@vueuse/core"))["createInjectionState"]; + const createPinia: (typeof import("pinia"))["createPinia"]; + const createReactiveFn: (typeof import("@vueuse/core"))["createReactiveFn"]; + const createReusableTemplate: (typeof import("@vueuse/core"))["createReusableTemplate"]; + const createSharedComposable: (typeof import("@vueuse/core"))["createSharedComposable"]; + const createTemplatePromise: (typeof import("@vueuse/core"))["createTemplatePromise"]; + const createUnrefFn: (typeof import("@vueuse/core"))["createUnrefFn"]; + const customRef: (typeof import("vue"))["customRef"]; + const debouncedRef: (typeof import("@vueuse/core"))["debouncedRef"]; + const debouncedWatch: (typeof import("@vueuse/core"))["debouncedWatch"]; + const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"]; + const defineComponent: (typeof import("vue"))["defineComponent"]; + const defineStore: (typeof import("pinia"))["defineStore"]; + const eagerComputed: (typeof import("@vueuse/core"))["eagerComputed"]; + const effectScope: (typeof import("vue"))["effectScope"]; + const extendRef: (typeof import("@vueuse/core"))["extendRef"]; + const getActivePinia: (typeof import("pinia"))["getActivePinia"]; + const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"]; + const getCurrentScope: (typeof import("vue"))["getCurrentScope"]; + const h: (typeof import("vue"))["h"]; + const ignorableWatch: (typeof import("@vueuse/core"))["ignorableWatch"]; + const inject: (typeof import("vue"))["inject"]; + const injectLocal: (typeof import("@vueuse/core"))["injectLocal"]; + const isDefined: (typeof import("@vueuse/core"))["isDefined"]; + const isProxy: (typeof import("vue"))["isProxy"]; + const isReactive: (typeof import("vue"))["isReactive"]; + const isReadonly: (typeof import("vue"))["isReadonly"]; + const isRef: (typeof import("vue"))["isRef"]; + const makeDestructurable: (typeof import("@vueuse/core"))["makeDestructurable"]; + const mapActions: (typeof import("pinia"))["mapActions"]; + const mapGetters: (typeof import("pinia"))["mapGetters"]; + const mapState: (typeof import("pinia"))["mapState"]; + const mapStores: (typeof import("pinia"))["mapStores"]; + const mapWritableState: (typeof import("pinia"))["mapWritableState"]; + const markRaw: (typeof import("vue"))["markRaw"]; + const nextTick: (typeof import("vue"))["nextTick"]; + const onActivated: (typeof import("vue"))["onActivated"]; + const onBeforeMount: (typeof import("vue"))["onBeforeMount"]; + const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]; + const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]; + const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"]; + const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"]; + const onClickOutside: (typeof import("@vueuse/core"))["onClickOutside"]; + const onDeactivated: (typeof import("vue"))["onDeactivated"]; + const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"]; + const onKeyStroke: (typeof import("@vueuse/core"))["onKeyStroke"]; + const onLongPress: (typeof import("@vueuse/core"))["onLongPress"]; + const onMounted: (typeof import("vue"))["onMounted"]; + const onRenderTracked: (typeof import("vue"))["onRenderTracked"]; + const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"]; + const onScopeDispose: (typeof import("vue"))["onScopeDispose"]; + const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"]; + const onStartTyping: (typeof import("@vueuse/core"))["onStartTyping"]; + const onUnmounted: (typeof import("vue"))["onUnmounted"]; + const onUpdated: (typeof import("vue"))["onUpdated"]; + const pausableWatch: (typeof import("@vueuse/core"))["pausableWatch"]; + const provide: (typeof import("vue"))["provide"]; + const provideLocal: (typeof import("@vueuse/core"))["provideLocal"]; + const reactify: (typeof import("@vueuse/core"))["reactify"]; + const reactifyObject: (typeof import("@vueuse/core"))["reactifyObject"]; + const reactive: (typeof import("vue"))["reactive"]; + const reactiveComputed: (typeof import("@vueuse/core"))["reactiveComputed"]; + const reactiveOmit: (typeof import("@vueuse/core"))["reactiveOmit"]; + const reactivePick: (typeof import("@vueuse/core"))["reactivePick"]; + const readonly: (typeof import("vue"))["readonly"]; + const ref: (typeof import("vue"))["ref"]; + const refAutoReset: (typeof import("@vueuse/core"))["refAutoReset"]; + const refDebounced: (typeof import("@vueuse/core"))["refDebounced"]; + const refDefault: (typeof import("@vueuse/core"))["refDefault"]; + const refThrottled: (typeof import("@vueuse/core"))["refThrottled"]; + const refWithControl: (typeof import("@vueuse/core"))["refWithControl"]; + const resolveComponent: (typeof import("vue"))["resolveComponent"]; + const resolveRef: (typeof import("@vueuse/core"))["resolveRef"]; + const resolveUnref: (typeof import("@vueuse/core"))["resolveUnref"]; + const setActivePinia: (typeof import("pinia"))["setActivePinia"]; + const setMapStoreSuffix: (typeof import("pinia"))["setMapStoreSuffix"]; + const shallowReactive: (typeof import("vue"))["shallowReactive"]; + const shallowReadonly: (typeof import("vue"))["shallowReadonly"]; + const shallowRef: (typeof import("vue"))["shallowRef"]; + const storeToRefs: (typeof import("pinia"))["storeToRefs"]; + const syncRef: (typeof import("@vueuse/core"))["syncRef"]; + const syncRefs: (typeof import("@vueuse/core"))["syncRefs"]; + const templateRef: (typeof import("@vueuse/core"))["templateRef"]; + const throttledRef: (typeof import("@vueuse/core"))["throttledRef"]; + const throttledWatch: (typeof import("@vueuse/core"))["throttledWatch"]; + const toRaw: (typeof import("vue"))["toRaw"]; + const toReactive: (typeof import("@vueuse/core"))["toReactive"]; + const toRef: (typeof import("vue"))["toRef"]; + const toRefs: (typeof import("vue"))["toRefs"]; + const toValue: (typeof import("vue"))["toValue"]; + const triggerRef: (typeof import("vue"))["triggerRef"]; + const tryOnBeforeMount: (typeof import("@vueuse/core"))["tryOnBeforeMount"]; + const tryOnBeforeUnmount: (typeof import("@vueuse/core"))["tryOnBeforeUnmount"]; + const tryOnMounted: (typeof import("@vueuse/core"))["tryOnMounted"]; + const tryOnScopeDispose: (typeof import("@vueuse/core"))["tryOnScopeDispose"]; + const tryOnUnmounted: (typeof import("@vueuse/core"))["tryOnUnmounted"]; + const unref: (typeof import("vue"))["unref"]; + const unrefElement: (typeof import("@vueuse/core"))["unrefElement"]; + const until: (typeof import("@vueuse/core"))["until"]; + const useActiveElement: (typeof import("@vueuse/core"))["useActiveElement"]; + const useAnimate: (typeof import("@vueuse/core"))["useAnimate"]; + const useArrayDifference: (typeof import("@vueuse/core"))["useArrayDifference"]; + const useArrayEvery: (typeof import("@vueuse/core"))["useArrayEvery"]; + const useArrayFilter: (typeof import("@vueuse/core"))["useArrayFilter"]; + const useArrayFind: (typeof import("@vueuse/core"))["useArrayFind"]; + const useArrayFindIndex: (typeof import("@vueuse/core"))["useArrayFindIndex"]; + const useArrayFindLast: (typeof import("@vueuse/core"))["useArrayFindLast"]; + const useArrayIncludes: (typeof import("@vueuse/core"))["useArrayIncludes"]; + const useArrayJoin: (typeof import("@vueuse/core"))["useArrayJoin"]; + const useArrayMap: (typeof import("@vueuse/core"))["useArrayMap"]; + const useArrayReduce: (typeof import("@vueuse/core"))["useArrayReduce"]; + const useArraySome: (typeof import("@vueuse/core"))["useArraySome"]; + const useArrayUnique: (typeof import("@vueuse/core"))["useArrayUnique"]; + const useAsyncQueue: (typeof import("@vueuse/core"))["useAsyncQueue"]; + const useAsyncState: (typeof import("@vueuse/core"))["useAsyncState"]; + const useAttrs: (typeof import("vue"))["useAttrs"]; + const useBase64: (typeof import("@vueuse/core"))["useBase64"]; + const useBattery: (typeof import("@vueuse/core"))["useBattery"]; + const useBluetooth: (typeof import("@vueuse/core"))["useBluetooth"]; + const useBreakpoints: (typeof import("@vueuse/core"))["useBreakpoints"]; + const useBroadcastChannel: (typeof import("@vueuse/core"))["useBroadcastChannel"]; + const useBrowserLocation: (typeof import("@vueuse/core"))["useBrowserLocation"]; + const useCached: (typeof import("@vueuse/core"))["useCached"]; + const useClipboard: (typeof import("@vueuse/core"))["useClipboard"]; + const useClipboardItems: (typeof import("@vueuse/core"))["useClipboardItems"]; + const useCloned: (typeof import("@vueuse/core"))["useCloned"]; + const useColorMode: (typeof import("@vueuse/core"))["useColorMode"]; + const useConfirmDialog: (typeof import("@vueuse/core"))["useConfirmDialog"]; + const useCounter: (typeof import("@vueuse/core"))["useCounter"]; + const useCssModule: (typeof import("vue"))["useCssModule"]; + const useCssVar: (typeof import("@vueuse/core"))["useCssVar"]; + const useCssVars: (typeof import("vue"))["useCssVars"]; + const useCurrentElement: (typeof import("@vueuse/core"))["useCurrentElement"]; + const useCycleList: (typeof import("@vueuse/core"))["useCycleList"]; + const useDark: (typeof import("@vueuse/core"))["useDark"]; + const useDateFormat: (typeof import("@vueuse/core"))["useDateFormat"]; + const useDebounce: (typeof import("@vueuse/core"))["useDebounce"]; + const useDebounceFn: (typeof import("@vueuse/core"))["useDebounceFn"]; + const useDebouncedRefHistory: (typeof import("@vueuse/core"))["useDebouncedRefHistory"]; + const useDeviceMotion: (typeof import("@vueuse/core"))["useDeviceMotion"]; + const useDeviceOrientation: (typeof import("@vueuse/core"))["useDeviceOrientation"]; + const useDevicePixelRatio: (typeof import("@vueuse/core"))["useDevicePixelRatio"]; + const useDevicesList: (typeof import("@vueuse/core"))["useDevicesList"]; + const useDisplayMedia: (typeof import("@vueuse/core"))["useDisplayMedia"]; + const useDocumentVisibility: (typeof import("@vueuse/core"))["useDocumentVisibility"]; + const useDraggable: (typeof import("@vueuse/core"))["useDraggable"]; + const useDropZone: (typeof import("@vueuse/core"))["useDropZone"]; + const useElementBounding: (typeof import("@vueuse/core"))["useElementBounding"]; + const useElementByPoint: (typeof import("@vueuse/core"))["useElementByPoint"]; + const useElementHover: (typeof import("@vueuse/core"))["useElementHover"]; + const useElementSize: (typeof import("@vueuse/core"))["useElementSize"]; + const useElementVisibility: (typeof import("@vueuse/core"))["useElementVisibility"]; + const useEventBus: (typeof import("@vueuse/core"))["useEventBus"]; + const useEventListener: (typeof import("@vueuse/core"))["useEventListener"]; + const useEventSource: (typeof import("@vueuse/core"))["useEventSource"]; + const useEyeDropper: (typeof import("@vueuse/core"))["useEyeDropper"]; + const useFavicon: (typeof import("@vueuse/core"))["useFavicon"]; + const useFetch: (typeof import("@vueuse/core"))["useFetch"]; + const useFileDialog: (typeof import("@vueuse/core"))["useFileDialog"]; + const useFileSystemAccess: (typeof import("@vueuse/core"))["useFileSystemAccess"]; + const useFocus: (typeof import("@vueuse/core"))["useFocus"]; + const useFocusWithin: (typeof import("@vueuse/core"))["useFocusWithin"]; + const useFps: (typeof import("@vueuse/core"))["useFps"]; + const useFullscreen: (typeof import("@vueuse/core"))["useFullscreen"]; + const useGamepad: (typeof import("@vueuse/core"))["useGamepad"]; + const useGeolocation: (typeof import("@vueuse/core"))["useGeolocation"]; + const useI18n: (typeof import("vue-i18n"))["useI18n"]; + const useIdle: (typeof import("@vueuse/core"))["useIdle"]; + const useImage: (typeof import("@vueuse/core"))["useImage"]; + const useInfiniteScroll: (typeof import("@vueuse/core"))["useInfiniteScroll"]; + const useIntersectionObserver: (typeof import("@vueuse/core"))["useIntersectionObserver"]; + const useInterval: (typeof import("@vueuse/core"))["useInterval"]; + const useIntervalFn: (typeof import("@vueuse/core"))["useIntervalFn"]; + const useKeyModifier: (typeof import("@vueuse/core"))["useKeyModifier"]; + const useLastChanged: (typeof import("@vueuse/core"))["useLastChanged"]; + const useLink: (typeof import("vue-router"))["useLink"]; + const useLocalStorage: (typeof import("@vueuse/core"))["useLocalStorage"]; + const useMagicKeys: (typeof import("@vueuse/core"))["useMagicKeys"]; + const useManualRefHistory: (typeof import("@vueuse/core"))["useManualRefHistory"]; + const useMediaControls: (typeof import("@vueuse/core"))["useMediaControls"]; + const useMediaQuery: (typeof import("@vueuse/core"))["useMediaQuery"]; + const useMemoize: (typeof import("@vueuse/core"))["useMemoize"]; + const useMemory: (typeof import("@vueuse/core"))["useMemory"]; + const useMounted: (typeof import("@vueuse/core"))["useMounted"]; + const useMouse: (typeof import("@vueuse/core"))["useMouse"]; + const useMouseInElement: (typeof import("@vueuse/core"))["useMouseInElement"]; + const useMousePressed: (typeof import("@vueuse/core"))["useMousePressed"]; + const useMutationObserver: (typeof import("@vueuse/core"))["useMutationObserver"]; + const useNavigatorLanguage: (typeof import("@vueuse/core"))["useNavigatorLanguage"]; + const useNetwork: (typeof import("@vueuse/core"))["useNetwork"]; + const useNow: (typeof import("@vueuse/core"))["useNow"]; + const useObjectUrl: (typeof import("@vueuse/core"))["useObjectUrl"]; + const useOffsetPagination: (typeof import("@vueuse/core"))["useOffsetPagination"]; + const useOnline: (typeof import("@vueuse/core"))["useOnline"]; + const usePageLeave: (typeof import("@vueuse/core"))["usePageLeave"]; + const useParallax: (typeof import("@vueuse/core"))["useParallax"]; + const useParentElement: (typeof import("@vueuse/core"))["useParentElement"]; + const usePerformanceObserver: (typeof import("@vueuse/core"))["usePerformanceObserver"]; + const usePermission: (typeof import("@vueuse/core"))["usePermission"]; + const usePointer: (typeof import("@vueuse/core"))["usePointer"]; + const usePointerLock: (typeof import("@vueuse/core"))["usePointerLock"]; + const usePointerSwipe: (typeof import("@vueuse/core"))["usePointerSwipe"]; + const usePreferredColorScheme: (typeof import("@vueuse/core"))["usePreferredColorScheme"]; + const usePreferredContrast: (typeof import("@vueuse/core"))["usePreferredContrast"]; + const usePreferredDark: (typeof import("@vueuse/core"))["usePreferredDark"]; + const usePreferredLanguages: (typeof import("@vueuse/core"))["usePreferredLanguages"]; + const usePreferredReducedMotion: (typeof import("@vueuse/core"))["usePreferredReducedMotion"]; + const usePrevious: (typeof import("@vueuse/core"))["usePrevious"]; + const useRafFn: (typeof import("@vueuse/core"))["useRafFn"]; + const useRefHistory: (typeof import("@vueuse/core"))["useRefHistory"]; + const useResizeObserver: (typeof import("@vueuse/core"))["useResizeObserver"]; + const useRoute: (typeof import("vue-router"))["useRoute"]; + const useRouter: (typeof import("vue-router"))["useRouter"]; + const useScreenOrientation: (typeof import("@vueuse/core"))["useScreenOrientation"]; + const useScreenSafeArea: (typeof import("@vueuse/core"))["useScreenSafeArea"]; + const useScriptTag: (typeof import("@vueuse/core"))["useScriptTag"]; + const useScroll: (typeof import("@vueuse/core"))["useScroll"]; + const useScrollLock: (typeof import("@vueuse/core"))["useScrollLock"]; + const useSessionStorage: (typeof import("@vueuse/core"))["useSessionStorage"]; + const useShare: (typeof import("@vueuse/core"))["useShare"]; + const useSlots: (typeof import("vue"))["useSlots"]; + const useSorted: (typeof import("@vueuse/core"))["useSorted"]; + const useSpeechRecognition: (typeof import("@vueuse/core"))["useSpeechRecognition"]; + const useSpeechSynthesis: (typeof import("@vueuse/core"))["useSpeechSynthesis"]; + const useStepper: (typeof import("@vueuse/core"))["useStepper"]; + const useStorage: (typeof import("@vueuse/core"))["useStorage"]; + const useStorageAsync: (typeof import("@vueuse/core"))["useStorageAsync"]; + const useStyleTag: (typeof import("@vueuse/core"))["useStyleTag"]; + const useSupported: (typeof import("@vueuse/core"))["useSupported"]; + const useSwipe: (typeof import("@vueuse/core"))["useSwipe"]; + const useTemplateRefsList: (typeof import("@vueuse/core"))["useTemplateRefsList"]; + const useTextDirection: (typeof import("@vueuse/core"))["useTextDirection"]; + const useTextSelection: (typeof import("@vueuse/core"))["useTextSelection"]; + const useTextareaAutosize: (typeof import("@vueuse/core"))["useTextareaAutosize"]; + const useThrottle: (typeof import("@vueuse/core"))["useThrottle"]; + const useThrottleFn: (typeof import("@vueuse/core"))["useThrottleFn"]; + const useThrottledRefHistory: (typeof import("@vueuse/core"))["useThrottledRefHistory"]; + const useTimeAgo: (typeof import("@vueuse/core"))["useTimeAgo"]; + const useTimeout: (typeof import("@vueuse/core"))["useTimeout"]; + const useTimeoutFn: (typeof import("@vueuse/core"))["useTimeoutFn"]; + const useTimeoutPoll: (typeof import("@vueuse/core"))["useTimeoutPoll"]; + const useTimestamp: (typeof import("@vueuse/core"))["useTimestamp"]; + const useTitle: (typeof import("@vueuse/core"))["useTitle"]; + const useToNumber: (typeof import("@vueuse/core"))["useToNumber"]; + const useToString: (typeof import("@vueuse/core"))["useToString"]; + const useToggle: (typeof import("@vueuse/core"))["useToggle"]; + const useTransition: (typeof import("@vueuse/core"))["useTransition"]; + const useUrlSearchParams: (typeof import("@vueuse/core"))["useUrlSearchParams"]; + const useUserMedia: (typeof import("@vueuse/core"))["useUserMedia"]; + const useVModel: (typeof import("@vueuse/core"))["useVModel"]; + const useVModels: (typeof import("@vueuse/core"))["useVModels"]; + const useVibrate: (typeof import("@vueuse/core"))["useVibrate"]; + const useVirtualList: (typeof import("@vueuse/core"))["useVirtualList"]; + const useWakeLock: (typeof import("@vueuse/core"))["useWakeLock"]; + const useWebNotification: (typeof import("@vueuse/core"))["useWebNotification"]; + const useWebSocket: (typeof import("@vueuse/core"))["useWebSocket"]; + const useWebWorker: (typeof import("@vueuse/core"))["useWebWorker"]; + const useWebWorkerFn: (typeof import("@vueuse/core"))["useWebWorkerFn"]; + const useWindowFocus: (typeof import("@vueuse/core"))["useWindowFocus"]; + const useWindowScroll: (typeof import("@vueuse/core"))["useWindowScroll"]; + const useWindowSize: (typeof import("@vueuse/core"))["useWindowSize"]; + const watch: (typeof import("vue"))["watch"]; + const watchArray: (typeof import("@vueuse/core"))["watchArray"]; + const watchAtMost: (typeof import("@vueuse/core"))["watchAtMost"]; + const watchDebounced: (typeof import("@vueuse/core"))["watchDebounced"]; + const watchDeep: (typeof import("@vueuse/core"))["watchDeep"]; + const watchEffect: (typeof import("vue"))["watchEffect"]; + const watchIgnorable: (typeof import("@vueuse/core"))["watchIgnorable"]; + const watchImmediate: (typeof import("@vueuse/core"))["watchImmediate"]; + const watchOnce: (typeof import("@vueuse/core"))["watchOnce"]; + const watchPausable: (typeof import("@vueuse/core"))["watchPausable"]; + const watchPostEffect: (typeof import("vue"))["watchPostEffect"]; + const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"]; + const watchThrottled: (typeof import("@vueuse/core"))["watchThrottled"]; + const watchTriggerable: (typeof import("@vueuse/core"))["watchTriggerable"]; + const watchWithFilter: (typeof import("@vueuse/core"))["watchWithFilter"]; + const whenever: (typeof import("@vueuse/core"))["whenever"]; +} +// for type re-export +declare global { + // @ts-ignore + export type { + Component, + ComponentPublicInstance, + ComputedRef, + ExtractDefaultPropTypes, + ExtractPropTypes, + ExtractPublicPropTypes, + InjectionKey, + PropType, + Ref, + VNode, + WritableComputedRef, + } from "vue"; + import("vue"); +} +// for vue template auto import +import { UnwrapRef } from "vue"; +declare module "vue" { + interface GlobalComponents {} + interface ComponentCustomProperties { + readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>; + readonly ElMessage: UnwrapRef< + (typeof import("element-plus/es"))["ElMessage"] + >; + readonly ElMessageBox: UnwrapRef< + (typeof import("element-plus/es"))["ElMessageBox"] + >; + readonly acceptHMRUpdate: UnwrapRef< + (typeof import("pinia"))["acceptHMRUpdate"] + >; + readonly asyncComputed: UnwrapRef< + (typeof import("@vueuse/core"))["asyncComputed"] + >; + readonly autoResetRef: UnwrapRef< + (typeof import("@vueuse/core"))["autoResetRef"] + >; + readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>; + readonly computedAsync: UnwrapRef< + (typeof import("@vueuse/core"))["computedAsync"] + >; + readonly computedEager: UnwrapRef< + (typeof import("@vueuse/core"))["computedEager"] + >; + readonly computedInject: UnwrapRef< + (typeof import("@vueuse/core"))["computedInject"] + >; + readonly computedWithControl: UnwrapRef< + (typeof import("@vueuse/core"))["computedWithControl"] + >; + readonly controlledComputed: UnwrapRef< + (typeof import("@vueuse/core"))["controlledComputed"] + >; + readonly controlledRef: UnwrapRef< + (typeof import("@vueuse/core"))["controlledRef"] + >; + readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>; + readonly createEventHook: UnwrapRef< + (typeof import("@vueuse/core"))["createEventHook"] + >; + readonly createGlobalState: UnwrapRef< + (typeof import("@vueuse/core"))["createGlobalState"] + >; + readonly createInjectionState: UnwrapRef< + (typeof import("@vueuse/core"))["createInjectionState"] + >; + readonly createPinia: UnwrapRef<(typeof import("pinia"))["createPinia"]>; + readonly createReactiveFn: UnwrapRef< + (typeof import("@vueuse/core"))["createReactiveFn"] + >; + readonly createReusableTemplate: UnwrapRef< + (typeof import("@vueuse/core"))["createReusableTemplate"] + >; + readonly createSharedComposable: UnwrapRef< + (typeof import("@vueuse/core"))["createSharedComposable"] + >; + readonly createTemplatePromise: UnwrapRef< + (typeof import("@vueuse/core"))["createTemplatePromise"] + >; + readonly createUnrefFn: UnwrapRef< + (typeof import("@vueuse/core"))["createUnrefFn"] + >; + readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>; + readonly debouncedRef: UnwrapRef< + (typeof import("@vueuse/core"))["debouncedRef"] + >; + readonly debouncedWatch: UnwrapRef< + (typeof import("@vueuse/core"))["debouncedWatch"] + >; + readonly defineAsyncComponent: UnwrapRef< + (typeof import("vue"))["defineAsyncComponent"] + >; + readonly defineComponent: UnwrapRef< + (typeof import("vue"))["defineComponent"] + >; + readonly defineStore: UnwrapRef<(typeof import("pinia"))["defineStore"]>; + readonly eagerComputed: UnwrapRef< + (typeof import("@vueuse/core"))["eagerComputed"] + >; + readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>; + readonly extendRef: UnwrapRef<(typeof import("@vueuse/core"))["extendRef"]>; + readonly getActivePinia: UnwrapRef< + (typeof import("pinia"))["getActivePinia"] + >; + readonly getCurrentInstance: UnwrapRef< + (typeof import("vue"))["getCurrentInstance"] + >; + readonly getCurrentScope: UnwrapRef< + (typeof import("vue"))["getCurrentScope"] + >; + readonly h: UnwrapRef<(typeof import("vue"))["h"]>; + readonly ignorableWatch: UnwrapRef< + (typeof import("@vueuse/core"))["ignorableWatch"] + >; + readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>; + readonly injectLocal: UnwrapRef< + (typeof import("@vueuse/core"))["injectLocal"] + >; + readonly isDefined: UnwrapRef<(typeof import("@vueuse/core"))["isDefined"]>; + readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>; + readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>; + readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>; + readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>; + readonly makeDestructurable: UnwrapRef< + (typeof import("@vueuse/core"))["makeDestructurable"] + >; + readonly mapActions: UnwrapRef<(typeof import("pinia"))["mapActions"]>; + readonly mapGetters: UnwrapRef<(typeof import("pinia"))["mapGetters"]>; + readonly mapState: UnwrapRef<(typeof import("pinia"))["mapState"]>; + readonly mapStores: UnwrapRef<(typeof import("pinia"))["mapStores"]>; + readonly mapWritableState: UnwrapRef< + (typeof import("pinia"))["mapWritableState"] + >; + readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>; + readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>; + readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>; + readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>; + readonly onBeforeRouteLeave: UnwrapRef< + (typeof import("vue-router"))["onBeforeRouteLeave"] + >; + readonly onBeforeRouteUpdate: UnwrapRef< + (typeof import("vue-router"))["onBeforeRouteUpdate"] + >; + readonly onBeforeUnmount: UnwrapRef< + (typeof import("vue"))["onBeforeUnmount"] + >; + readonly onBeforeUpdate: UnwrapRef< + (typeof import("vue"))["onBeforeUpdate"] + >; + readonly onClickOutside: UnwrapRef< + (typeof import("@vueuse/core"))["onClickOutside"] + >; + readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>; + readonly onErrorCaptured: UnwrapRef< + (typeof import("vue"))["onErrorCaptured"] + >; + readonly onKeyStroke: UnwrapRef< + (typeof import("@vueuse/core"))["onKeyStroke"] + >; + readonly onLongPress: UnwrapRef< + (typeof import("@vueuse/core"))["onLongPress"] + >; + readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>; + readonly onRenderTracked: UnwrapRef< + (typeof import("vue"))["onRenderTracked"] + >; + readonly onRenderTriggered: UnwrapRef< + (typeof import("vue"))["onRenderTriggered"] + >; + readonly onScopeDispose: UnwrapRef< + (typeof import("vue"))["onScopeDispose"] + >; + readonly onServerPrefetch: UnwrapRef< + (typeof import("vue"))["onServerPrefetch"] + >; + readonly onStartTyping: UnwrapRef< + (typeof import("@vueuse/core"))["onStartTyping"] + >; + readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>; + readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>; + readonly pausableWatch: UnwrapRef< + (typeof import("@vueuse/core"))["pausableWatch"] + >; + readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>; + readonly provideLocal: UnwrapRef< + (typeof import("@vueuse/core"))["provideLocal"] + >; + readonly reactify: UnwrapRef<(typeof import("@vueuse/core"))["reactify"]>; + readonly reactifyObject: UnwrapRef< + (typeof import("@vueuse/core"))["reactifyObject"] + >; + readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>; + readonly reactiveComputed: UnwrapRef< + (typeof import("@vueuse/core"))["reactiveComputed"] + >; + readonly reactiveOmit: UnwrapRef< + (typeof import("@vueuse/core"))["reactiveOmit"] + >; + readonly reactivePick: UnwrapRef< + (typeof import("@vueuse/core"))["reactivePick"] + >; + readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>; + readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>; + readonly refAutoReset: UnwrapRef< + (typeof import("@vueuse/core"))["refAutoReset"] + >; + readonly refDebounced: UnwrapRef< + (typeof import("@vueuse/core"))["refDebounced"] + >; + readonly refDefault: UnwrapRef< + (typeof import("@vueuse/core"))["refDefault"] + >; + readonly refThrottled: UnwrapRef< + (typeof import("@vueuse/core"))["refThrottled"] + >; + readonly refWithControl: UnwrapRef< + (typeof import("@vueuse/core"))["refWithControl"] + >; + readonly resolveComponent: UnwrapRef< + (typeof import("vue"))["resolveComponent"] + >; + readonly resolveRef: UnwrapRef< + (typeof import("@vueuse/core"))["resolveRef"] + >; + readonly resolveUnref: UnwrapRef< + (typeof import("@vueuse/core"))["resolveUnref"] + >; + readonly setActivePinia: UnwrapRef< + (typeof import("pinia"))["setActivePinia"] + >; + readonly setMapStoreSuffix: UnwrapRef< + (typeof import("pinia"))["setMapStoreSuffix"] + >; + readonly shallowReactive: UnwrapRef< + (typeof import("vue"))["shallowReactive"] + >; + readonly shallowReadonly: UnwrapRef< + (typeof import("vue"))["shallowReadonly"] + >; + readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>; + readonly storeToRefs: UnwrapRef<(typeof import("pinia"))["storeToRefs"]>; + readonly syncRef: UnwrapRef<(typeof import("@vueuse/core"))["syncRef"]>; + readonly syncRefs: UnwrapRef<(typeof import("@vueuse/core"))["syncRefs"]>; + readonly templateRef: UnwrapRef< + (typeof import("@vueuse/core"))["templateRef"] + >; + readonly throttledRef: UnwrapRef< + (typeof import("@vueuse/core"))["throttledRef"] + >; + readonly throttledWatch: UnwrapRef< + (typeof import("@vueuse/core"))["throttledWatch"] + >; + readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>; + readonly toReactive: UnwrapRef< + (typeof import("@vueuse/core"))["toReactive"] + >; + readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>; + readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>; + readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>; + readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>; + readonly tryOnBeforeMount: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnBeforeMount"] + >; + readonly tryOnBeforeUnmount: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnBeforeUnmount"] + >; + readonly tryOnMounted: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnMounted"] + >; + readonly tryOnScopeDispose: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnScopeDispose"] + >; + readonly tryOnUnmounted: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnUnmounted"] + >; + readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>; + readonly unrefElement: UnwrapRef< + (typeof import("@vueuse/core"))["unrefElement"] + >; + readonly until: UnwrapRef<(typeof import("@vueuse/core"))["until"]>; + readonly useActiveElement: UnwrapRef< + (typeof import("@vueuse/core"))["useActiveElement"] + >; + readonly useAnimate: UnwrapRef< + (typeof import("@vueuse/core"))["useAnimate"] + >; + readonly useArrayDifference: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayDifference"] + >; + readonly useArrayEvery: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayEvery"] + >; + readonly useArrayFilter: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFilter"] + >; + readonly useArrayFind: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFind"] + >; + readonly useArrayFindIndex: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFindIndex"] + >; + readonly useArrayFindLast: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFindLast"] + >; + readonly useArrayIncludes: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayIncludes"] + >; + readonly useArrayJoin: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayJoin"] + >; + readonly useArrayMap: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayMap"] + >; + readonly useArrayReduce: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayReduce"] + >; + readonly useArraySome: UnwrapRef< + (typeof import("@vueuse/core"))["useArraySome"] + >; + readonly useArrayUnique: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayUnique"] + >; + readonly useAsyncQueue: UnwrapRef< + (typeof import("@vueuse/core"))["useAsyncQueue"] + >; + readonly useAsyncState: UnwrapRef< + (typeof import("@vueuse/core"))["useAsyncState"] + >; + readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>; + readonly useBase64: UnwrapRef<(typeof import("@vueuse/core"))["useBase64"]>; + readonly useBattery: UnwrapRef< + (typeof import("@vueuse/core"))["useBattery"] + >; + readonly useBluetooth: UnwrapRef< + (typeof import("@vueuse/core"))["useBluetooth"] + >; + readonly useBreakpoints: UnwrapRef< + (typeof import("@vueuse/core"))["useBreakpoints"] + >; + readonly useBroadcastChannel: UnwrapRef< + (typeof import("@vueuse/core"))["useBroadcastChannel"] + >; + readonly useBrowserLocation: UnwrapRef< + (typeof import("@vueuse/core"))["useBrowserLocation"] + >; + readonly useCached: UnwrapRef<(typeof import("@vueuse/core"))["useCached"]>; + readonly useClipboard: UnwrapRef< + (typeof import("@vueuse/core"))["useClipboard"] + >; + readonly useClipboardItems: UnwrapRef< + (typeof import("@vueuse/core"))["useClipboardItems"] + >; + readonly useCloned: UnwrapRef<(typeof import("@vueuse/core"))["useCloned"]>; + readonly useColorMode: UnwrapRef< + (typeof import("@vueuse/core"))["useColorMode"] + >; + readonly useConfirmDialog: UnwrapRef< + (typeof import("@vueuse/core"))["useConfirmDialog"] + >; + readonly useCounter: UnwrapRef< + (typeof import("@vueuse/core"))["useCounter"] + >; + readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>; + readonly useCssVar: UnwrapRef<(typeof import("@vueuse/core"))["useCssVar"]>; + readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>; + readonly useCurrentElement: UnwrapRef< + (typeof import("@vueuse/core"))["useCurrentElement"] + >; + readonly useCycleList: UnwrapRef< + (typeof import("@vueuse/core"))["useCycleList"] + >; + readonly useDark: UnwrapRef<(typeof import("@vueuse/core"))["useDark"]>; + readonly useDateFormat: UnwrapRef< + (typeof import("@vueuse/core"))["useDateFormat"] + >; + readonly useDebounce: UnwrapRef< + (typeof import("@vueuse/core"))["useDebounce"] + >; + readonly useDebounceFn: UnwrapRef< + (typeof import("@vueuse/core"))["useDebounceFn"] + >; + readonly useDebouncedRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useDebouncedRefHistory"] + >; + readonly useDeviceMotion: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceMotion"] + >; + readonly useDeviceOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceOrientation"] + >; + readonly useDevicePixelRatio: UnwrapRef< + (typeof import("@vueuse/core"))["useDevicePixelRatio"] + >; + readonly useDevicesList: UnwrapRef< + (typeof import("@vueuse/core"))["useDevicesList"] + >; + readonly useDisplayMedia: UnwrapRef< + (typeof import("@vueuse/core"))["useDisplayMedia"] + >; + readonly useDocumentVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useDocumentVisibility"] + >; + readonly useDraggable: UnwrapRef< + (typeof import("@vueuse/core"))["useDraggable"] + >; + readonly useDropZone: UnwrapRef< + (typeof import("@vueuse/core"))["useDropZone"] + >; + readonly useElementBounding: UnwrapRef< + (typeof import("@vueuse/core"))["useElementBounding"] + >; + readonly useElementByPoint: UnwrapRef< + (typeof import("@vueuse/core"))["useElementByPoint"] + >; + readonly useElementHover: UnwrapRef< + (typeof import("@vueuse/core"))["useElementHover"] + >; + readonly useElementSize: UnwrapRef< + (typeof import("@vueuse/core"))["useElementSize"] + >; + readonly useElementVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useElementVisibility"] + >; + readonly useEventBus: UnwrapRef< + (typeof import("@vueuse/core"))["useEventBus"] + >; + readonly useEventListener: UnwrapRef< + (typeof import("@vueuse/core"))["useEventListener"] + >; + readonly useEventSource: UnwrapRef< + (typeof import("@vueuse/core"))["useEventSource"] + >; + readonly useEyeDropper: UnwrapRef< + (typeof import("@vueuse/core"))["useEyeDropper"] + >; + readonly useFavicon: UnwrapRef< + (typeof import("@vueuse/core"))["useFavicon"] + >; + readonly useFetch: UnwrapRef<(typeof import("@vueuse/core"))["useFetch"]>; + readonly useFileDialog: UnwrapRef< + (typeof import("@vueuse/core"))["useFileDialog"] + >; + readonly useFileSystemAccess: UnwrapRef< + (typeof import("@vueuse/core"))["useFileSystemAccess"] + >; + readonly useFocus: UnwrapRef<(typeof import("@vueuse/core"))["useFocus"]>; + readonly useFocusWithin: UnwrapRef< + (typeof import("@vueuse/core"))["useFocusWithin"] + >; + readonly useFps: UnwrapRef<(typeof import("@vueuse/core"))["useFps"]>; + readonly useFullscreen: UnwrapRef< + (typeof import("@vueuse/core"))["useFullscreen"] + >; + readonly useGamepad: UnwrapRef< + (typeof import("@vueuse/core"))["useGamepad"] + >; + readonly useGeolocation: UnwrapRef< + (typeof import("@vueuse/core"))["useGeolocation"] + >; + readonly useI18n: UnwrapRef<(typeof import("vue-i18n"))["useI18n"]>; + readonly useIdle: UnwrapRef<(typeof import("@vueuse/core"))["useIdle"]>; + readonly useImage: UnwrapRef<(typeof import("@vueuse/core"))["useImage"]>; + readonly useInfiniteScroll: UnwrapRef< + (typeof import("@vueuse/core"))["useInfiniteScroll"] + >; + readonly useIntersectionObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useIntersectionObserver"] + >; + readonly useInterval: UnwrapRef< + (typeof import("@vueuse/core"))["useInterval"] + >; + readonly useIntervalFn: UnwrapRef< + (typeof import("@vueuse/core"))["useIntervalFn"] + >; + readonly useKeyModifier: UnwrapRef< + (typeof import("@vueuse/core"))["useKeyModifier"] + >; + readonly useLastChanged: UnwrapRef< + (typeof import("@vueuse/core"))["useLastChanged"] + >; + readonly useLink: UnwrapRef<(typeof import("vue-router"))["useLink"]>; + readonly useLocalStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useLocalStorage"] + >; + readonly useMagicKeys: UnwrapRef< + (typeof import("@vueuse/core"))["useMagicKeys"] + >; + readonly useManualRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useManualRefHistory"] + >; + readonly useMediaControls: UnwrapRef< + (typeof import("@vueuse/core"))["useMediaControls"] + >; + readonly useMediaQuery: UnwrapRef< + (typeof import("@vueuse/core"))["useMediaQuery"] + >; + readonly useMemoize: UnwrapRef< + (typeof import("@vueuse/core"))["useMemoize"] + >; + readonly useMemory: UnwrapRef<(typeof import("@vueuse/core"))["useMemory"]>; + readonly useMounted: UnwrapRef< + (typeof import("@vueuse/core"))["useMounted"] + >; + readonly useMouse: UnwrapRef<(typeof import("@vueuse/core"))["useMouse"]>; + readonly useMouseInElement: UnwrapRef< + (typeof import("@vueuse/core"))["useMouseInElement"] + >; + readonly useMousePressed: UnwrapRef< + (typeof import("@vueuse/core"))["useMousePressed"] + >; + readonly useMutationObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useMutationObserver"] + >; + readonly useNavigatorLanguage: UnwrapRef< + (typeof import("@vueuse/core"))["useNavigatorLanguage"] + >; + readonly useNetwork: UnwrapRef< + (typeof import("@vueuse/core"))["useNetwork"] + >; + readonly useNow: UnwrapRef<(typeof import("@vueuse/core"))["useNow"]>; + readonly useObjectUrl: UnwrapRef< + (typeof import("@vueuse/core"))["useObjectUrl"] + >; + readonly useOffsetPagination: UnwrapRef< + (typeof import("@vueuse/core"))["useOffsetPagination"] + >; + readonly useOnline: UnwrapRef<(typeof import("@vueuse/core"))["useOnline"]>; + readonly usePageLeave: UnwrapRef< + (typeof import("@vueuse/core"))["usePageLeave"] + >; + readonly useParallax: UnwrapRef< + (typeof import("@vueuse/core"))["useParallax"] + >; + readonly useParentElement: UnwrapRef< + (typeof import("@vueuse/core"))["useParentElement"] + >; + readonly usePerformanceObserver: UnwrapRef< + (typeof import("@vueuse/core"))["usePerformanceObserver"] + >; + readonly usePermission: UnwrapRef< + (typeof import("@vueuse/core"))["usePermission"] + >; + readonly usePointer: UnwrapRef< + (typeof import("@vueuse/core"))["usePointer"] + >; + readonly usePointerLock: UnwrapRef< + (typeof import("@vueuse/core"))["usePointerLock"] + >; + readonly usePointerSwipe: UnwrapRef< + (typeof import("@vueuse/core"))["usePointerSwipe"] + >; + readonly usePreferredColorScheme: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredColorScheme"] + >; + readonly usePreferredContrast: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredContrast"] + >; + readonly usePreferredDark: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredDark"] + >; + readonly usePreferredLanguages: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredLanguages"] + >; + readonly usePreferredReducedMotion: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredReducedMotion"] + >; + readonly usePrevious: UnwrapRef< + (typeof import("@vueuse/core"))["usePrevious"] + >; + readonly useRafFn: UnwrapRef<(typeof import("@vueuse/core"))["useRafFn"]>; + readonly useRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useRefHistory"] + >; + readonly useResizeObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useResizeObserver"] + >; + readonly useRoute: UnwrapRef<(typeof import("vue-router"))["useRoute"]>; + readonly useRouter: UnwrapRef<(typeof import("vue-router"))["useRouter"]>; + readonly useScreenOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenOrientation"] + >; + readonly useScreenSafeArea: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenSafeArea"] + >; + readonly useScriptTag: UnwrapRef< + (typeof import("@vueuse/core"))["useScriptTag"] + >; + readonly useScroll: UnwrapRef<(typeof import("@vueuse/core"))["useScroll"]>; + readonly useScrollLock: UnwrapRef< + (typeof import("@vueuse/core"))["useScrollLock"] + >; + readonly useSessionStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useSessionStorage"] + >; + readonly useShare: UnwrapRef<(typeof import("@vueuse/core"))["useShare"]>; + readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>; + readonly useSorted: UnwrapRef<(typeof import("@vueuse/core"))["useSorted"]>; + readonly useSpeechRecognition: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechRecognition"] + >; + readonly useSpeechSynthesis: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechSynthesis"] + >; + readonly useStepper: UnwrapRef< + (typeof import("@vueuse/core"))["useStepper"] + >; + readonly useStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useStorage"] + >; + readonly useStorageAsync: UnwrapRef< + (typeof import("@vueuse/core"))["useStorageAsync"] + >; + readonly useStyleTag: UnwrapRef< + (typeof import("@vueuse/core"))["useStyleTag"] + >; + readonly useSupported: UnwrapRef< + (typeof import("@vueuse/core"))["useSupported"] + >; + readonly useSwipe: UnwrapRef<(typeof import("@vueuse/core"))["useSwipe"]>; + readonly useTemplateRefsList: UnwrapRef< + (typeof import("@vueuse/core"))["useTemplateRefsList"] + >; + readonly useTextDirection: UnwrapRef< + (typeof import("@vueuse/core"))["useTextDirection"] + >; + readonly useTextSelection: UnwrapRef< + (typeof import("@vueuse/core"))["useTextSelection"] + >; + readonly useTextareaAutosize: UnwrapRef< + (typeof import("@vueuse/core"))["useTextareaAutosize"] + >; + readonly useThrottle: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottle"] + >; + readonly useThrottleFn: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottleFn"] + >; + readonly useThrottledRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottledRefHistory"] + >; + readonly useTimeAgo: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeAgo"] + >; + readonly useTimeout: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeout"] + >; + readonly useTimeoutFn: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeoutFn"] + >; + readonly useTimeoutPoll: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeoutPoll"] + >; + readonly useTimestamp: UnwrapRef< + (typeof import("@vueuse/core"))["useTimestamp"] + >; + readonly useTitle: UnwrapRef<(typeof import("@vueuse/core"))["useTitle"]>; + readonly useToNumber: UnwrapRef< + (typeof import("@vueuse/core"))["useToNumber"] + >; + readonly useToString: UnwrapRef< + (typeof import("@vueuse/core"))["useToString"] + >; + readonly useToggle: UnwrapRef<(typeof import("@vueuse/core"))["useToggle"]>; + readonly useTransition: UnwrapRef< + (typeof import("@vueuse/core"))["useTransition"] + >; + readonly useUrlSearchParams: UnwrapRef< + (typeof import("@vueuse/core"))["useUrlSearchParams"] + >; + readonly useUserMedia: UnwrapRef< + (typeof import("@vueuse/core"))["useUserMedia"] + >; + readonly useVModel: UnwrapRef<(typeof import("@vueuse/core"))["useVModel"]>; + readonly useVModels: UnwrapRef< + (typeof import("@vueuse/core"))["useVModels"] + >; + readonly useVibrate: UnwrapRef< + (typeof import("@vueuse/core"))["useVibrate"] + >; + readonly useVirtualList: UnwrapRef< + (typeof import("@vueuse/core"))["useVirtualList"] + >; + readonly useWakeLock: UnwrapRef< + (typeof import("@vueuse/core"))["useWakeLock"] + >; + readonly useWebNotification: UnwrapRef< + (typeof import("@vueuse/core"))["useWebNotification"] + >; + readonly useWebSocket: UnwrapRef< + (typeof import("@vueuse/core"))["useWebSocket"] + >; + readonly useWebWorker: UnwrapRef< + (typeof import("@vueuse/core"))["useWebWorker"] + >; + readonly useWebWorkerFn: UnwrapRef< + (typeof import("@vueuse/core"))["useWebWorkerFn"] + >; + readonly useWindowFocus: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowFocus"] + >; + readonly useWindowScroll: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowScroll"] + >; + readonly useWindowSize: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowSize"] + >; + readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>; + readonly watchArray: UnwrapRef< + (typeof import("@vueuse/core"))["watchArray"] + >; + readonly watchAtMost: UnwrapRef< + (typeof import("@vueuse/core"))["watchAtMost"] + >; + readonly watchDebounced: UnwrapRef< + (typeof import("@vueuse/core"))["watchDebounced"] + >; + readonly watchDeep: UnwrapRef<(typeof import("@vueuse/core"))["watchDeep"]>; + readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>; + readonly watchIgnorable: UnwrapRef< + (typeof import("@vueuse/core"))["watchIgnorable"] + >; + readonly watchImmediate: UnwrapRef< + (typeof import("@vueuse/core"))["watchImmediate"] + >; + readonly watchOnce: UnwrapRef<(typeof import("@vueuse/core"))["watchOnce"]>; + readonly watchPausable: UnwrapRef< + (typeof import("@vueuse/core"))["watchPausable"] + >; + readonly watchPostEffect: UnwrapRef< + (typeof import("vue"))["watchPostEffect"] + >; + readonly watchSyncEffect: UnwrapRef< + (typeof import("vue"))["watchSyncEffect"] + >; + readonly watchThrottled: UnwrapRef< + (typeof import("@vueuse/core"))["watchThrottled"] + >; + readonly watchTriggerable: UnwrapRef< + (typeof import("@vueuse/core"))["watchTriggerable"] + >; + readonly watchWithFilter: UnwrapRef< + (typeof import("@vueuse/core"))["watchWithFilter"] + >; + readonly whenever: UnwrapRef<(typeof import("@vueuse/core"))["whenever"]>; + } +} +declare module "@vue/runtime-core" { + interface GlobalComponents {} + interface ComponentCustomProperties { + readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>; + readonly ElMessage: UnwrapRef< + (typeof import("element-plus/es"))["ElMessage"] + >; + readonly ElMessageBox: UnwrapRef< + (typeof import("element-plus/es"))["ElMessageBox"] + >; + readonly acceptHMRUpdate: UnwrapRef< + (typeof import("pinia"))["acceptHMRUpdate"] + >; + readonly asyncComputed: UnwrapRef< + (typeof import("@vueuse/core"))["asyncComputed"] + >; + readonly autoResetRef: UnwrapRef< + (typeof import("@vueuse/core"))["autoResetRef"] + >; + readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>; + readonly computedAsync: UnwrapRef< + (typeof import("@vueuse/core"))["computedAsync"] + >; + readonly computedEager: UnwrapRef< + (typeof import("@vueuse/core"))["computedEager"] + >; + readonly computedInject: UnwrapRef< + (typeof import("@vueuse/core"))["computedInject"] + >; + readonly computedWithControl: UnwrapRef< + (typeof import("@vueuse/core"))["computedWithControl"] + >; + readonly controlledComputed: UnwrapRef< + (typeof import("@vueuse/core"))["controlledComputed"] + >; + readonly controlledRef: UnwrapRef< + (typeof import("@vueuse/core"))["controlledRef"] + >; + readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>; + readonly createEventHook: UnwrapRef< + (typeof import("@vueuse/core"))["createEventHook"] + >; + readonly createGlobalState: UnwrapRef< + (typeof import("@vueuse/core"))["createGlobalState"] + >; + readonly createInjectionState: UnwrapRef< + (typeof import("@vueuse/core"))["createInjectionState"] + >; + readonly createPinia: UnwrapRef<(typeof import("pinia"))["createPinia"]>; + readonly createReactiveFn: UnwrapRef< + (typeof import("@vueuse/core"))["createReactiveFn"] + >; + readonly createReusableTemplate: UnwrapRef< + (typeof import("@vueuse/core"))["createReusableTemplate"] + >; + readonly createSharedComposable: UnwrapRef< + (typeof import("@vueuse/core"))["createSharedComposable"] + >; + readonly createTemplatePromise: UnwrapRef< + (typeof import("@vueuse/core"))["createTemplatePromise"] + >; + readonly createUnrefFn: UnwrapRef< + (typeof import("@vueuse/core"))["createUnrefFn"] + >; + readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>; + readonly debouncedRef: UnwrapRef< + (typeof import("@vueuse/core"))["debouncedRef"] + >; + readonly debouncedWatch: UnwrapRef< + (typeof import("@vueuse/core"))["debouncedWatch"] + >; + readonly defineAsyncComponent: UnwrapRef< + (typeof import("vue"))["defineAsyncComponent"] + >; + readonly defineComponent: UnwrapRef< + (typeof import("vue"))["defineComponent"] + >; + readonly defineStore: UnwrapRef<(typeof import("pinia"))["defineStore"]>; + readonly eagerComputed: UnwrapRef< + (typeof import("@vueuse/core"))["eagerComputed"] + >; + readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>; + readonly extendRef: UnwrapRef<(typeof import("@vueuse/core"))["extendRef"]>; + readonly getActivePinia: UnwrapRef< + (typeof import("pinia"))["getActivePinia"] + >; + readonly getCurrentInstance: UnwrapRef< + (typeof import("vue"))["getCurrentInstance"] + >; + readonly getCurrentScope: UnwrapRef< + (typeof import("vue"))["getCurrentScope"] + >; + readonly h: UnwrapRef<(typeof import("vue"))["h"]>; + readonly ignorableWatch: UnwrapRef< + (typeof import("@vueuse/core"))["ignorableWatch"] + >; + readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>; + readonly injectLocal: UnwrapRef< + (typeof import("@vueuse/core"))["injectLocal"] + >; + readonly isDefined: UnwrapRef<(typeof import("@vueuse/core"))["isDefined"]>; + readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>; + readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>; + readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>; + readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>; + readonly makeDestructurable: UnwrapRef< + (typeof import("@vueuse/core"))["makeDestructurable"] + >; + readonly mapActions: UnwrapRef<(typeof import("pinia"))["mapActions"]>; + readonly mapGetters: UnwrapRef<(typeof import("pinia"))["mapGetters"]>; + readonly mapState: UnwrapRef<(typeof import("pinia"))["mapState"]>; + readonly mapStores: UnwrapRef<(typeof import("pinia"))["mapStores"]>; + readonly mapWritableState: UnwrapRef< + (typeof import("pinia"))["mapWritableState"] + >; + readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>; + readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>; + readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>; + readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>; + readonly onBeforeRouteLeave: UnwrapRef< + (typeof import("vue-router"))["onBeforeRouteLeave"] + >; + readonly onBeforeRouteUpdate: UnwrapRef< + (typeof import("vue-router"))["onBeforeRouteUpdate"] + >; + readonly onBeforeUnmount: UnwrapRef< + (typeof import("vue"))["onBeforeUnmount"] + >; + readonly onBeforeUpdate: UnwrapRef< + (typeof import("vue"))["onBeforeUpdate"] + >; + readonly onClickOutside: UnwrapRef< + (typeof import("@vueuse/core"))["onClickOutside"] + >; + readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>; + readonly onErrorCaptured: UnwrapRef< + (typeof import("vue"))["onErrorCaptured"] + >; + readonly onKeyStroke: UnwrapRef< + (typeof import("@vueuse/core"))["onKeyStroke"] + >; + readonly onLongPress: UnwrapRef< + (typeof import("@vueuse/core"))["onLongPress"] + >; + readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>; + readonly onRenderTracked: UnwrapRef< + (typeof import("vue"))["onRenderTracked"] + >; + readonly onRenderTriggered: UnwrapRef< + (typeof import("vue"))["onRenderTriggered"] + >; + readonly onScopeDispose: UnwrapRef< + (typeof import("vue"))["onScopeDispose"] + >; + readonly onServerPrefetch: UnwrapRef< + (typeof import("vue"))["onServerPrefetch"] + >; + readonly onStartTyping: UnwrapRef< + (typeof import("@vueuse/core"))["onStartTyping"] + >; + readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>; + readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>; + readonly pausableWatch: UnwrapRef< + (typeof import("@vueuse/core"))["pausableWatch"] + >; + readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>; + readonly provideLocal: UnwrapRef< + (typeof import("@vueuse/core"))["provideLocal"] + >; + readonly reactify: UnwrapRef<(typeof import("@vueuse/core"))["reactify"]>; + readonly reactifyObject: UnwrapRef< + (typeof import("@vueuse/core"))["reactifyObject"] + >; + readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>; + readonly reactiveComputed: UnwrapRef< + (typeof import("@vueuse/core"))["reactiveComputed"] + >; + readonly reactiveOmit: UnwrapRef< + (typeof import("@vueuse/core"))["reactiveOmit"] + >; + readonly reactivePick: UnwrapRef< + (typeof import("@vueuse/core"))["reactivePick"] + >; + readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>; + readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>; + readonly refAutoReset: UnwrapRef< + (typeof import("@vueuse/core"))["refAutoReset"] + >; + readonly refDebounced: UnwrapRef< + (typeof import("@vueuse/core"))["refDebounced"] + >; + readonly refDefault: UnwrapRef< + (typeof import("@vueuse/core"))["refDefault"] + >; + readonly refThrottled: UnwrapRef< + (typeof import("@vueuse/core"))["refThrottled"] + >; + readonly refWithControl: UnwrapRef< + (typeof import("@vueuse/core"))["refWithControl"] + >; + readonly resolveComponent: UnwrapRef< + (typeof import("vue"))["resolveComponent"] + >; + readonly resolveRef: UnwrapRef< + (typeof import("@vueuse/core"))["resolveRef"] + >; + readonly resolveUnref: UnwrapRef< + (typeof import("@vueuse/core"))["resolveUnref"] + >; + readonly setActivePinia: UnwrapRef< + (typeof import("pinia"))["setActivePinia"] + >; + readonly setMapStoreSuffix: UnwrapRef< + (typeof import("pinia"))["setMapStoreSuffix"] + >; + readonly shallowReactive: UnwrapRef< + (typeof import("vue"))["shallowReactive"] + >; + readonly shallowReadonly: UnwrapRef< + (typeof import("vue"))["shallowReadonly"] + >; + readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>; + readonly storeToRefs: UnwrapRef<(typeof import("pinia"))["storeToRefs"]>; + readonly syncRef: UnwrapRef<(typeof import("@vueuse/core"))["syncRef"]>; + readonly syncRefs: UnwrapRef<(typeof import("@vueuse/core"))["syncRefs"]>; + readonly templateRef: UnwrapRef< + (typeof import("@vueuse/core"))["templateRef"] + >; + readonly throttledRef: UnwrapRef< + (typeof import("@vueuse/core"))["throttledRef"] + >; + readonly throttledWatch: UnwrapRef< + (typeof import("@vueuse/core"))["throttledWatch"] + >; + readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>; + readonly toReactive: UnwrapRef< + (typeof import("@vueuse/core"))["toReactive"] + >; + readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>; + readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>; + readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>; + readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>; + readonly tryOnBeforeMount: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnBeforeMount"] + >; + readonly tryOnBeforeUnmount: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnBeforeUnmount"] + >; + readonly tryOnMounted: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnMounted"] + >; + readonly tryOnScopeDispose: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnScopeDispose"] + >; + readonly tryOnUnmounted: UnwrapRef< + (typeof import("@vueuse/core"))["tryOnUnmounted"] + >; + readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>; + readonly unrefElement: UnwrapRef< + (typeof import("@vueuse/core"))["unrefElement"] + >; + readonly until: UnwrapRef<(typeof import("@vueuse/core"))["until"]>; + readonly useActiveElement: UnwrapRef< + (typeof import("@vueuse/core"))["useActiveElement"] + >; + readonly useAnimate: UnwrapRef< + (typeof import("@vueuse/core"))["useAnimate"] + >; + readonly useArrayDifference: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayDifference"] + >; + readonly useArrayEvery: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayEvery"] + >; + readonly useArrayFilter: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFilter"] + >; + readonly useArrayFind: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFind"] + >; + readonly useArrayFindIndex: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFindIndex"] + >; + readonly useArrayFindLast: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayFindLast"] + >; + readonly useArrayIncludes: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayIncludes"] + >; + readonly useArrayJoin: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayJoin"] + >; + readonly useArrayMap: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayMap"] + >; + readonly useArrayReduce: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayReduce"] + >; + readonly useArraySome: UnwrapRef< + (typeof import("@vueuse/core"))["useArraySome"] + >; + readonly useArrayUnique: UnwrapRef< + (typeof import("@vueuse/core"))["useArrayUnique"] + >; + readonly useAsyncQueue: UnwrapRef< + (typeof import("@vueuse/core"))["useAsyncQueue"] + >; + readonly useAsyncState: UnwrapRef< + (typeof import("@vueuse/core"))["useAsyncState"] + >; + readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>; + readonly useBase64: UnwrapRef<(typeof import("@vueuse/core"))["useBase64"]>; + readonly useBattery: UnwrapRef< + (typeof import("@vueuse/core"))["useBattery"] + >; + readonly useBluetooth: UnwrapRef< + (typeof import("@vueuse/core"))["useBluetooth"] + >; + readonly useBreakpoints: UnwrapRef< + (typeof import("@vueuse/core"))["useBreakpoints"] + >; + readonly useBroadcastChannel: UnwrapRef< + (typeof import("@vueuse/core"))["useBroadcastChannel"] + >; + readonly useBrowserLocation: UnwrapRef< + (typeof import("@vueuse/core"))["useBrowserLocation"] + >; + readonly useCached: UnwrapRef<(typeof import("@vueuse/core"))["useCached"]>; + readonly useClipboard: UnwrapRef< + (typeof import("@vueuse/core"))["useClipboard"] + >; + readonly useClipboardItems: UnwrapRef< + (typeof import("@vueuse/core"))["useClipboardItems"] + >; + readonly useCloned: UnwrapRef<(typeof import("@vueuse/core"))["useCloned"]>; + readonly useColorMode: UnwrapRef< + (typeof import("@vueuse/core"))["useColorMode"] + >; + readonly useConfirmDialog: UnwrapRef< + (typeof import("@vueuse/core"))["useConfirmDialog"] + >; + readonly useCounter: UnwrapRef< + (typeof import("@vueuse/core"))["useCounter"] + >; + readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>; + readonly useCssVar: UnwrapRef<(typeof import("@vueuse/core"))["useCssVar"]>; + readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>; + readonly useCurrentElement: UnwrapRef< + (typeof import("@vueuse/core"))["useCurrentElement"] + >; + readonly useCycleList: UnwrapRef< + (typeof import("@vueuse/core"))["useCycleList"] + >; + readonly useDark: UnwrapRef<(typeof import("@vueuse/core"))["useDark"]>; + readonly useDateFormat: UnwrapRef< + (typeof import("@vueuse/core"))["useDateFormat"] + >; + readonly useDebounce: UnwrapRef< + (typeof import("@vueuse/core"))["useDebounce"] + >; + readonly useDebounceFn: UnwrapRef< + (typeof import("@vueuse/core"))["useDebounceFn"] + >; + readonly useDebouncedRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useDebouncedRefHistory"] + >; + readonly useDeviceMotion: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceMotion"] + >; + readonly useDeviceOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceOrientation"] + >; + readonly useDevicePixelRatio: UnwrapRef< + (typeof import("@vueuse/core"))["useDevicePixelRatio"] + >; + readonly useDevicesList: UnwrapRef< + (typeof import("@vueuse/core"))["useDevicesList"] + >; + readonly useDisplayMedia: UnwrapRef< + (typeof import("@vueuse/core"))["useDisplayMedia"] + >; + readonly useDocumentVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useDocumentVisibility"] + >; + readonly useDraggable: UnwrapRef< + (typeof import("@vueuse/core"))["useDraggable"] + >; + readonly useDropZone: UnwrapRef< + (typeof import("@vueuse/core"))["useDropZone"] + >; + readonly useElementBounding: UnwrapRef< + (typeof import("@vueuse/core"))["useElementBounding"] + >; + readonly useElementByPoint: UnwrapRef< + (typeof import("@vueuse/core"))["useElementByPoint"] + >; + readonly useElementHover: UnwrapRef< + (typeof import("@vueuse/core"))["useElementHover"] + >; + readonly useElementSize: UnwrapRef< + (typeof import("@vueuse/core"))["useElementSize"] + >; + readonly useElementVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useElementVisibility"] + >; + readonly useEventBus: UnwrapRef< + (typeof import("@vueuse/core"))["useEventBus"] + >; + readonly useEventListener: UnwrapRef< + (typeof import("@vueuse/core"))["useEventListener"] + >; + readonly useEventSource: UnwrapRef< + (typeof import("@vueuse/core"))["useEventSource"] + >; + readonly useEyeDropper: UnwrapRef< + (typeof import("@vueuse/core"))["useEyeDropper"] + >; + readonly useFavicon: UnwrapRef< + (typeof import("@vueuse/core"))["useFavicon"] + >; + readonly useFetch: UnwrapRef<(typeof import("@vueuse/core"))["useFetch"]>; + readonly useFileDialog: UnwrapRef< + (typeof import("@vueuse/core"))["useFileDialog"] + >; + readonly useFileSystemAccess: UnwrapRef< + (typeof import("@vueuse/core"))["useFileSystemAccess"] + >; + readonly useFocus: UnwrapRef<(typeof import("@vueuse/core"))["useFocus"]>; + readonly useFocusWithin: UnwrapRef< + (typeof import("@vueuse/core"))["useFocusWithin"] + >; + readonly useFps: UnwrapRef<(typeof import("@vueuse/core"))["useFps"]>; + readonly useFullscreen: UnwrapRef< + (typeof import("@vueuse/core"))["useFullscreen"] + >; + readonly useGamepad: UnwrapRef< + (typeof import("@vueuse/core"))["useGamepad"] + >; + readonly useGeolocation: UnwrapRef< + (typeof import("@vueuse/core"))["useGeolocation"] + >; + readonly useI18n: UnwrapRef<(typeof import("vue-i18n"))["useI18n"]>; + readonly useIdle: UnwrapRef<(typeof import("@vueuse/core"))["useIdle"]>; + readonly useImage: UnwrapRef<(typeof import("@vueuse/core"))["useImage"]>; + readonly useInfiniteScroll: UnwrapRef< + (typeof import("@vueuse/core"))["useInfiniteScroll"] + >; + readonly useIntersectionObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useIntersectionObserver"] + >; + readonly useInterval: UnwrapRef< + (typeof import("@vueuse/core"))["useInterval"] + >; + readonly useIntervalFn: UnwrapRef< + (typeof import("@vueuse/core"))["useIntervalFn"] + >; + readonly useKeyModifier: UnwrapRef< + (typeof import("@vueuse/core"))["useKeyModifier"] + >; + readonly useLastChanged: UnwrapRef< + (typeof import("@vueuse/core"))["useLastChanged"] + >; + readonly useLink: UnwrapRef<(typeof import("vue-router"))["useLink"]>; + readonly useLocalStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useLocalStorage"] + >; + readonly useMagicKeys: UnwrapRef< + (typeof import("@vueuse/core"))["useMagicKeys"] + >; + readonly useManualRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useManualRefHistory"] + >; + readonly useMediaControls: UnwrapRef< + (typeof import("@vueuse/core"))["useMediaControls"] + >; + readonly useMediaQuery: UnwrapRef< + (typeof import("@vueuse/core"))["useMediaQuery"] + >; + readonly useMemoize: UnwrapRef< + (typeof import("@vueuse/core"))["useMemoize"] + >; + readonly useMemory: UnwrapRef<(typeof import("@vueuse/core"))["useMemory"]>; + readonly useMounted: UnwrapRef< + (typeof import("@vueuse/core"))["useMounted"] + >; + readonly useMouse: UnwrapRef<(typeof import("@vueuse/core"))["useMouse"]>; + readonly useMouseInElement: UnwrapRef< + (typeof import("@vueuse/core"))["useMouseInElement"] + >; + readonly useMousePressed: UnwrapRef< + (typeof import("@vueuse/core"))["useMousePressed"] + >; + readonly useMutationObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useMutationObserver"] + >; + readonly useNavigatorLanguage: UnwrapRef< + (typeof import("@vueuse/core"))["useNavigatorLanguage"] + >; + readonly useNetwork: UnwrapRef< + (typeof import("@vueuse/core"))["useNetwork"] + >; + readonly useNow: UnwrapRef<(typeof import("@vueuse/core"))["useNow"]>; + readonly useObjectUrl: UnwrapRef< + (typeof import("@vueuse/core"))["useObjectUrl"] + >; + readonly useOffsetPagination: UnwrapRef< + (typeof import("@vueuse/core"))["useOffsetPagination"] + >; + readonly useOnline: UnwrapRef<(typeof import("@vueuse/core"))["useOnline"]>; + readonly usePageLeave: UnwrapRef< + (typeof import("@vueuse/core"))["usePageLeave"] + >; + readonly useParallax: UnwrapRef< + (typeof import("@vueuse/core"))["useParallax"] + >; + readonly useParentElement: UnwrapRef< + (typeof import("@vueuse/core"))["useParentElement"] + >; + readonly usePerformanceObserver: UnwrapRef< + (typeof import("@vueuse/core"))["usePerformanceObserver"] + >; + readonly usePermission: UnwrapRef< + (typeof import("@vueuse/core"))["usePermission"] + >; + readonly usePointer: UnwrapRef< + (typeof import("@vueuse/core"))["usePointer"] + >; + readonly usePointerLock: UnwrapRef< + (typeof import("@vueuse/core"))["usePointerLock"] + >; + readonly usePointerSwipe: UnwrapRef< + (typeof import("@vueuse/core"))["usePointerSwipe"] + >; + readonly usePreferredColorScheme: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredColorScheme"] + >; + readonly usePreferredContrast: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredContrast"] + >; + readonly usePreferredDark: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredDark"] + >; + readonly usePreferredLanguages: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredLanguages"] + >; + readonly usePreferredReducedMotion: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredReducedMotion"] + >; + readonly usePrevious: UnwrapRef< + (typeof import("@vueuse/core"))["usePrevious"] + >; + readonly useRafFn: UnwrapRef<(typeof import("@vueuse/core"))["useRafFn"]>; + readonly useRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useRefHistory"] + >; + readonly useResizeObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useResizeObserver"] + >; + readonly useRoute: UnwrapRef<(typeof import("vue-router"))["useRoute"]>; + readonly useRouter: UnwrapRef<(typeof import("vue-router"))["useRouter"]>; + readonly useScreenOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenOrientation"] + >; + readonly useScreenSafeArea: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenSafeArea"] + >; + readonly useScriptTag: UnwrapRef< + (typeof import("@vueuse/core"))["useScriptTag"] + >; + readonly useScroll: UnwrapRef<(typeof import("@vueuse/core"))["useScroll"]>; + readonly useScrollLock: UnwrapRef< + (typeof import("@vueuse/core"))["useScrollLock"] + >; + readonly useSessionStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useSessionStorage"] + >; + readonly useShare: UnwrapRef<(typeof import("@vueuse/core"))["useShare"]>; + readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>; + readonly useSorted: UnwrapRef<(typeof import("@vueuse/core"))["useSorted"]>; + readonly useSpeechRecognition: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechRecognition"] + >; + readonly useSpeechSynthesis: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechSynthesis"] + >; + readonly useStepper: UnwrapRef< + (typeof import("@vueuse/core"))["useStepper"] + >; + readonly useStorage: UnwrapRef< + (typeof import("@vueuse/core"))["useStorage"] + >; + readonly useStorageAsync: UnwrapRef< + (typeof import("@vueuse/core"))["useStorageAsync"] + >; + readonly useStyleTag: UnwrapRef< + (typeof import("@vueuse/core"))["useStyleTag"] + >; + readonly useSupported: UnwrapRef< + (typeof import("@vueuse/core"))["useSupported"] + >; + readonly useSwipe: UnwrapRef<(typeof import("@vueuse/core"))["useSwipe"]>; + readonly useTemplateRefsList: UnwrapRef< + (typeof import("@vueuse/core"))["useTemplateRefsList"] + >; + readonly useTextDirection: UnwrapRef< + (typeof import("@vueuse/core"))["useTextDirection"] + >; + readonly useTextSelection: UnwrapRef< + (typeof import("@vueuse/core"))["useTextSelection"] + >; + readonly useTextareaAutosize: UnwrapRef< + (typeof import("@vueuse/core"))["useTextareaAutosize"] + >; + readonly useThrottle: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottle"] + >; + readonly useThrottleFn: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottleFn"] + >; + readonly useThrottledRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottledRefHistory"] + >; + readonly useTimeAgo: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeAgo"] + >; + readonly useTimeout: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeout"] + >; + readonly useTimeoutFn: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeoutFn"] + >; + readonly useTimeoutPoll: UnwrapRef< + (typeof import("@vueuse/core"))["useTimeoutPoll"] + >; + readonly useTimestamp: UnwrapRef< + (typeof import("@vueuse/core"))["useTimestamp"] + >; + readonly useTitle: UnwrapRef<(typeof import("@vueuse/core"))["useTitle"]>; + readonly useToNumber: UnwrapRef< + (typeof import("@vueuse/core"))["useToNumber"] + >; + readonly useToString: UnwrapRef< + (typeof import("@vueuse/core"))["useToString"] + >; + readonly useToggle: UnwrapRef<(typeof import("@vueuse/core"))["useToggle"]>; + readonly useTransition: UnwrapRef< + (typeof import("@vueuse/core"))["useTransition"] + >; + readonly useUrlSearchParams: UnwrapRef< + (typeof import("@vueuse/core"))["useUrlSearchParams"] + >; + readonly useUserMedia: UnwrapRef< + (typeof import("@vueuse/core"))["useUserMedia"] + >; + readonly useVModel: UnwrapRef<(typeof import("@vueuse/core"))["useVModel"]>; + readonly useVModels: UnwrapRef< + (typeof import("@vueuse/core"))["useVModels"] + >; + readonly useVibrate: UnwrapRef< + (typeof import("@vueuse/core"))["useVibrate"] + >; + readonly useVirtualList: UnwrapRef< + (typeof import("@vueuse/core"))["useVirtualList"] + >; + readonly useWakeLock: UnwrapRef< + (typeof import("@vueuse/core"))["useWakeLock"] + >; + readonly useWebNotification: UnwrapRef< + (typeof import("@vueuse/core"))["useWebNotification"] + >; + readonly useWebSocket: UnwrapRef< + (typeof import("@vueuse/core"))["useWebSocket"] + >; + readonly useWebWorker: UnwrapRef< + (typeof import("@vueuse/core"))["useWebWorker"] + >; + readonly useWebWorkerFn: UnwrapRef< + (typeof import("@vueuse/core"))["useWebWorkerFn"] + >; + readonly useWindowFocus: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowFocus"] + >; + readonly useWindowScroll: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowScroll"] + >; + readonly useWindowSize: UnwrapRef< + (typeof import("@vueuse/core"))["useWindowSize"] + >; + readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>; + readonly watchArray: UnwrapRef< + (typeof import("@vueuse/core"))["watchArray"] + >; + readonly watchAtMost: UnwrapRef< + (typeof import("@vueuse/core"))["watchAtMost"] + >; + readonly watchDebounced: UnwrapRef< + (typeof import("@vueuse/core"))["watchDebounced"] + >; + readonly watchDeep: UnwrapRef<(typeof import("@vueuse/core"))["watchDeep"]>; + readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>; + readonly watchIgnorable: UnwrapRef< + (typeof import("@vueuse/core"))["watchIgnorable"] + >; + readonly watchImmediate: UnwrapRef< + (typeof import("@vueuse/core"))["watchImmediate"] + >; + readonly watchOnce: UnwrapRef<(typeof import("@vueuse/core"))["watchOnce"]>; + readonly watchPausable: UnwrapRef< + (typeof import("@vueuse/core"))["watchPausable"] + >; + readonly watchPostEffect: UnwrapRef< + (typeof import("vue"))["watchPostEffect"] + >; + readonly watchSyncEffect: UnwrapRef< + (typeof import("vue"))["watchSyncEffect"] + >; + readonly watchThrottled: UnwrapRef< + (typeof import("@vueuse/core"))["watchThrottled"] + >; + readonly watchTriggerable: UnwrapRef< + (typeof import("@vueuse/core"))["watchTriggerable"] + >; + readonly watchWithFilter: UnwrapRef< + (typeof import("@vueuse/core"))["watchWithFilter"] + >; + readonly whenever: UnwrapRef<(typeof import("@vueuse/core"))["whenever"]>; + } +} diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts new file mode 100644 index 0000000..6ce6c15 --- /dev/null +++ b/src/typings/components.d.ts @@ -0,0 +1,110 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module "vue" { + export interface GlobalComponents { + AppLink: (typeof import("./../components/AppLink/index.vue"))["default"]; + AppMain: (typeof import("./../layout/components/AppMain/index.vue"))["default"]; + BarChart: (typeof import("./../views/dashboard/components/BarChart.vue"))["default"]; + Breadcrumb: (typeof import("./../components/Breadcrumb/index.vue"))["default"]; + DeptTree: (typeof import("./../views/system/user/components/dept-tree.vue"))["default"]; + Dictionary: (typeof import("./../components/Dictionary/index.vue"))["default"]; + DictItem: (typeof import("./../views/system/dict/components/dict-item.vue"))["default"]; + ElBreadcrumb: (typeof import("element-plus/es"))["ElBreadcrumb"]; + ElBreadcrumbItem: (typeof import("element-plus/es"))["ElBreadcrumbItem"]; + ElButton: (typeof import("element-plus/es"))["ElButton"]; + ElCard: (typeof import("element-plus/es"))["ElCard"]; + ElCheckbox: (typeof import("element-plus/es"))["ElCheckbox"]; + ElCheckboxGroup: (typeof import("element-plus/es"))["ElCheckboxGroup"]; + ElCol: (typeof import("element-plus/es"))["ElCol"]; + ElColorPicker: (typeof import("element-plus/es"))["ElColorPicker"]; + ElConfigProvider: (typeof import("element-plus/es"))["ElConfigProvider"]; + ElDatePicker: (typeof import("element-plus/es"))["ElDatePicker"]; + ElDialog: (typeof import("element-plus/es"))["ElDialog"]; + ElDivider: (typeof import("element-plus/es"))["ElDivider"]; + ElDrawer: (typeof import("element-plus/es"))["ElDrawer"]; + ElDropdown: (typeof import("element-plus/es"))["ElDropdown"]; + ElDropdownItem: (typeof import("element-plus/es"))["ElDropdownItem"]; + ElDropdownMenu: (typeof import("element-plus/es"))["ElDropdownMenu"]; + ElForm: (typeof import("element-plus/es"))["ElForm"]; + ElFormItem: (typeof import("element-plus/es"))["ElFormItem"]; + ElIcon: (typeof import("element-plus/es"))["ElIcon"]; + ElImage: (typeof import("element-plus/es"))["ElImage"]; + ElInput: (typeof import("element-plus/es"))["ElInput"]; + ElInputNumber: (typeof import("element-plus/es"))["ElInputNumber"]; + ElLink: (typeof import("element-plus/es"))["ElLink"]; + ElMenu: (typeof import("element-plus/es"))["ElMenu"]; + ElMenuItem: (typeof import("element-plus/es"))["ElMenuItem"]; + ElOption: (typeof import("element-plus/es"))["ElOption"]; + ElPagination: (typeof import("element-plus/es"))["ElPagination"]; + ElPopover: (typeof import("element-plus/es"))["ElPopover"]; + ElRadio: (typeof import("element-plus/es"))["ElRadio"]; + ElRadioGroup: (typeof import("element-plus/es"))["ElRadioGroup"]; + ElRow: (typeof import("element-plus/es"))["ElRow"]; + ElScrollbar: (typeof import("element-plus/es"))["ElScrollbar"]; + ElSelect: (typeof import("element-plus/es"))["ElSelect"]; + ElStatistic: (typeof import("element-plus/es"))["ElStatistic"]; + ElSubMenu: (typeof import("element-plus/es"))["ElSubMenu"]; + ElSwitch: (typeof import("element-plus/es"))["ElSwitch"]; + ElTable: (typeof import("element-plus/es"))["ElTable"]; + ElTableColumn: (typeof import("element-plus/es"))["ElTableColumn"]; + ElTag: (typeof import("element-plus/es"))["ElTag"]; + ElTooltip: (typeof import("element-plus/es"))["ElTooltip"]; + ElTree: (typeof import("element-plus/es"))["ElTree"]; + ElTreeSelect: (typeof import("element-plus/es"))["ElTreeSelect"]; + ElUpload: (typeof import("element-plus/es"))["ElUpload"]; + ElWatermark: (typeof import("element-plus/es"))["ElWatermark"]; + FunnelChart: (typeof import("./../views/dashboard/components/FunnelChart.vue"))["default"]; + GithubCorner: (typeof import("./../components/GithubCorner/index.vue"))["default"]; + Hamburger: (typeof import("./../components/Hamburger/index.vue"))["default"]; + IconSelect: (typeof import("./../components/IconSelect/index.vue"))["default"]; + IEpArrowDown: (typeof import("~icons/ep/arrow-down"))["default"]; + IEpArrowUp: (typeof import("~icons/ep/arrow-up"))["default"]; + IEpClose: (typeof import("~icons/ep/close"))["default"]; + IEpDelete: (typeof import("~icons/ep/delete"))["default"]; + IEpDownload: (typeof import("~icons/ep/download"))["default"]; + IEpEdit: (typeof import("~icons/ep/edit"))["default"]; + IEpPlus: (typeof import("~icons/ep/plus"))["default"]; + IEpRefresh: (typeof import("~icons/ep/refresh"))["default"]; + IEpRefreshLeft: (typeof import("~icons/ep/refresh-left"))["default"]; + IEpSearch: (typeof import("~icons/ep/search"))["default"]; + IEpSetting: (typeof import("~icons/ep/setting"))["default"]; + IEpTop: (typeof import("~icons/ep/top"))["default"]; + IEpUploadFilled: (typeof import("~icons/ep/upload-filled"))["default"]; + LangSelect: (typeof import("./../components/LangSelect/index.vue"))["default"]; + LayoutSelect: (typeof import("./../layout/components/Settings/components/LayoutSelect.vue"))["default"]; + MultiUpload: (typeof import("./../components/Upload/MultiUpload.vue"))["default"]; + NavBar: (typeof import("./../layout/components/NavBar/index.vue"))["default"]; + NavbarLeft: (typeof import("./../layout/components/NavBar/components/NavbarLeft.vue"))["default"]; + NavbarRight: (typeof import("./../layout/components/NavBar/components/NavbarRight.vue"))["default"]; + PageContent: (typeof import("./../components/PageContent/index.vue"))["default"]; + PageModal: (typeof import("./../components/PageModal/index.vue"))["default"]; + PageSearch: (typeof import("./../components/PageSearch/index.vue"))["default"]; + Pagination: (typeof import("./../components/Pagination/index.vue"))["default"]; + PieChart: (typeof import("./../views/dashboard/components/PieChart.vue"))["default"]; + RadarChart: (typeof import("./../views/dashboard/components/RadarChart.vue"))["default"]; + RouterLink: (typeof import("vue-router"))["RouterLink"]; + RouterView: (typeof import("vue-router"))["RouterView"]; + Settings: (typeof import("./../layout/components/Settings/index.vue"))["default"]; + Sidebar: (typeof import("./../layout/components/Sidebar/index.vue"))["default"]; + SidebarLogo: (typeof import("./../layout/components/Sidebar/components/SidebarLogo.vue"))["default"]; + SidebarMenu: (typeof import("./../layout/components/Sidebar/components/SidebarMenu.vue"))["default"]; + SidebarMenuItem: (typeof import("./../layout/components/Sidebar/components/SidebarMenuItem.vue"))["default"]; + SidebarMenuItemTitle: (typeof import("./../layout/components/Sidebar/components/SidebarMenuItemTitle.vue"))["default"]; + SidebarMixTopMenu: (typeof import("./../layout/components/Sidebar/components/SidebarMixTopMenu.vue"))["default"]; + SingleUpload: (typeof import("./../components/Upload/SingleUpload.vue"))["default"]; + SizeSelect: (typeof import("./../components/SizeSelect/index.vue"))["default"]; + SvgIcon: (typeof import("./../components/SvgIcon/index.vue"))["default"]; + TableSelect: (typeof import("./../components/TableSelect/index.vue"))["default"]; + TagsView: (typeof import("./../layout/components/TagsView/index.vue"))["default"]; + ThemeColorPicker: (typeof import("./../layout/components/Settings/components/ThemeColorPicker.vue"))["default"]; + WangEditor: (typeof import("./../components/WangEditor/index.vue"))["default"]; + } + export interface ComponentCustomProperties { + vLoading: (typeof import("element-plus/es"))["ElLoadingDirective"]; + } +} diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts new file mode 100644 index 0000000..7ed1377 --- /dev/null +++ b/src/typings/env.d.ts @@ -0,0 +1,40 @@ +// https://cn.vitejs.dev/guide/env-and-mode + +declare module "*.vue" { + import { DefineComponent } from "vue"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types + const component: DefineComponent<{}, {}, any>; + export default component; +} + +// TypeScript 类型提示都为 string: https://github.com/vitejs/vite/issues/6930 +interface ImportMetaEnv { + /** 应用端口 */ + VITE_APP_PORT: number; + /** API 基础路径(代理前缀) */ + VITE_APP_BASE_API: string; + /** API 地址 */ + VITE_APP_API_URL: string; + /** 是否开启 Mock 服务 */ + VITE_MOCK_DEV_SERVER: boolean; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} + +/** + * 平台的名称、版本、运行所需的`node`版本、依赖、构建时间的类型提示 + */ +declare const __APP_INFO__: { + pkg: { + name: string; + version: string; + engines: { + node: string; + }; + dependencies: Record; + devDependencies: Record; + }; + buildTimestamp: number; +}; diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts new file mode 100644 index 0000000..146d5bf --- /dev/null +++ b/src/typings/global.d.ts @@ -0,0 +1,95 @@ +declare global { + /** + * 响应数据 + */ + interface ResponseData { + code: string; + data: T; + msg: string; + } + + /** + * 分页查询参数 + */ + interface PageQuery { + pageNum: number; + pageSize: number; + } + + /** + * 分页响应对象 + */ + interface PageResult { + /** 数据列表 */ + list: T; + /** 总数 */ + total: number; + } + + /** + * 页签对象 + */ + interface TagView { + /** 页签名称 */ + name: string; + /** 页签标题 */ + title: string; + /** 页签路由路径 */ + path: string; + /** 页签路由完整路径 */ + fullPath: string; + /** 页签图标 */ + icon?: string; + /** 是否固定页签 */ + affix?: boolean; + /** 是否开启缓存 */ + keepAlive?: boolean; + /** 路由查询参数 */ + query?: any; + } + + /** + * 系统设置 + */ + interface AppSettings { + /** 系统标题 */ + title: string; + /** 系统版本 */ + version: string; + /** 是否显示设置 */ + showSettings: boolean; + /** 是否固定头部 */ + fixedHeader: boolean; + /** 是否显示多标签导航 */ + tagsView: boolean; + /** 是否显示侧边栏Logo */ + sidebarLogo: boolean; + /** 导航栏布局(left|top|mix) */ + layout: string; + /** 主题颜色 */ + themeColor: string; + /** 主题模式(dark|light) */ + theme: string; + /** 布局大小(default |large |small) */ + size: string; + /** 语言( zh-cn| en) */ + language: string; + /** 是否开启水印 */ + watermarkEnabled: boolean; + /** 水印内容 */ + watermarkContent: string; + } + + /** + * 组件数据源 + */ + interface OptionType { + /** 值 */ + value: string | number; + /** 文本 */ + label: string; + /** 子列表 */ + children?: OptionType[]; + } +} +export {}; diff --git a/src/typings/router.d.ts b/src/typings/router.d.ts new file mode 100644 index 0000000..f0ddb39 --- /dev/null +++ b/src/typings/router.d.ts @@ -0,0 +1,24 @@ +import "vue-router"; + +declare module "vue-router" { + // https://router.vuejs.org/zh/guide/advanced/meta.html#typescript + // 可以通过扩展 RouteMeta 接口来输入 meta 字段 + interface RouteMeta { + /** 菜单名称 */ + title?: string; + /** 菜单图标 */ + icon?: string; + /** 菜单是否隐藏 */ + hidden?: boolean; + /** 只有一个子路由是否始终显示 */ + alwaysShow?: boolean; + /** 是否固定页签 */ + affix?: boolean; + /** 是否缓存页面 */ + keepAlive?: boolean; + /** 是否在面包屑上隐藏 */ + breadcrumb?: boolean; + /** 拥有菜单权限的角色编码集合 */ + roles?: string[]; + } +} diff --git a/src/typings/shims-vue.d.ts b/src/typings/shims-vue.d.ts new file mode 100644 index 0000000..abbc931 --- /dev/null +++ b/src/typings/shims-vue.d.ts @@ -0,0 +1 @@ +declare module "xlsx/xlsx.mjs"; diff --git a/src/typings/socket.d.ts b/src/typings/socket.d.ts new file mode 100644 index 0000000..15a8ed7 --- /dev/null +++ b/src/typings/socket.d.ts @@ -0,0 +1,6 @@ +// https://github.com/sockjs/sockjs-client/issues/565 + +declare module "sockjs-client/dist/sockjs.min.js" { + import Client from "sockjs-client"; + export default Client; +} diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts new file mode 100644 index 0000000..17ed904 --- /dev/null +++ b/src/utils/i18n.ts @@ -0,0 +1,12 @@ +// translate router.meta.title, be used in breadcrumb sidebar tagsview +import i18n from "@/lang/index"; + +export function translateRouteTitle(title: any) { + // 判断是否存在国际化配置,如果没有原生返回 + const hasKey = i18n.global.te("route." + title); + if (hasKey) { + const translatedTitle = i18n.global.t("route." + title); + return translatedTitle; + } + return title; +} diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..44bb588 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,41 @@ +/** + * Check if an element has a class + * @param {HTMLElement} ele + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele: HTMLElement, cls: string) { + return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); +} + +/** + * Add class to element + * @param {HTMLElement} ele + * @param {string} cls + */ +export function addClass(ele: HTMLElement, cls: string) { + if (!hasClass(ele, cls)) ele.className += " " + cls; +} + +/** + * Remove class from element + * @param {HTMLElement} ele + * @param {string} cls + */ +export function removeClass(ele: HTMLElement, cls: string) { + if (hasClass(ele, cls)) { + const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)"); + ele.className = ele.className.replace(reg, " "); + } +} + +/** + * 判断是否是外部链接 + * + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path: string) { + const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path); + return isExternal; +} diff --git a/src/utils/nprogress.ts b/src/utils/nprogress.ts new file mode 100644 index 0000000..c1d5f23 --- /dev/null +++ b/src/utils/nprogress.ts @@ -0,0 +1,18 @@ +import NProgress from "nprogress"; +import "nprogress/nprogress.css"; + +// 进度条 +NProgress.configure({ + // 动画方式 + easing: "ease", + // 递增进度条的速度 + speed: 500, + // 是否显示加载ico + showSpinner: false, + // 自动递增间隔 + trickleSpeed: 200, + // 初始化时的最小百分比 + minimum: 0.3, +}); + +export default NProgress; diff --git a/src/utils/request.ts b/src/utils/request.ts new file mode 100644 index 0000000..9b37d50 --- /dev/null +++ b/src/utils/request.ts @@ -0,0 +1,70 @@ +import axios, { InternalAxiosRequestConfig, AxiosResponse } from "axios"; +import { useUserStoreHook } from "@/store/modules/user"; +import { ResultEnum } from "@/enums/ResultEnum"; +import { TOKEN_KEY } from "@/enums/CacheEnum"; + +// 创建 axios 实例 +const service = axios.create({ + baseURL: import.meta.env.VITE_APP_BASE_API, + timeout: 50000, + headers: { "Content-Type": "application/json;charset=utf-8" }, +}); + +// 请求拦截器 +service.interceptors.request.use( + (config: InternalAxiosRequestConfig) => { + const accessToken = localStorage.getItem(TOKEN_KEY); + if (accessToken) { + config.headers.Authorization = accessToken; + } + return config; + }, + (error: any) => { + return Promise.reject(error); + } +); + +// 响应拦截器 +service.interceptors.response.use( + (response: AxiosResponse) => { + // 检查配置的响应类型是否为二进制类型('blob' 或 'arraybuffer'), 如果是,直接返回响应对象 + if ( + response.config.responseType === "blob" || + response.config.responseType === "arraybuffer" + ) { + return response; + } + + const { code, data, msg } = response.data; + if (code === ResultEnum.SUCCESS) { + return data; + } + + ElMessage.error(msg || "系统出错"); + return Promise.reject(new Error(msg || "Error")); + }, + (error: any) => { + // 异常处理 + if (error.response.data) { + const { code, msg } = error.response.data; + if (code === ResultEnum.TOKEN_INVALID) { + ElMessageBox.confirm("当前页面已失效,请重新登录", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }).then(() => { + const userStore = useUserStoreHook(); + userStore.resetToken().then(() => { + location.reload(); + }); + }); + } else { + ElMessage.error(msg || "系统出错"); + } + } + return Promise.reject(error.message); + } +); + +// 导出 axios 实例 +export default service; diff --git a/src/views/dashboard/components/BarChart.vue b/src/views/dashboard/components/BarChart.vue new file mode 100644 index 0000000..9e1b67d --- /dev/null +++ b/src/views/dashboard/components/BarChart.vue @@ -0,0 +1,202 @@ + + + + + diff --git a/src/views/dashboard/components/FunnelChart.vue b/src/views/dashboard/components/FunnelChart.vue new file mode 100644 index 0000000..d29293c --- /dev/null +++ b/src/views/dashboard/components/FunnelChart.vue @@ -0,0 +1,115 @@ + + + + diff --git a/src/views/dashboard/components/PieChart.vue b/src/views/dashboard/components/PieChart.vue new file mode 100644 index 0000000..ac011fb --- /dev/null +++ b/src/views/dashboard/components/PieChart.vue @@ -0,0 +1,89 @@ + + + + diff --git a/src/views/dashboard/components/RadarChart.vue b/src/views/dashboard/components/RadarChart.vue new file mode 100644 index 0000000..aca9ac8 --- /dev/null +++ b/src/views/dashboard/components/RadarChart.vue @@ -0,0 +1,109 @@ + + + + diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue new file mode 100644 index 0000000..194b622 --- /dev/null +++ b/src/views/dashboard/index.vue @@ -0,0 +1,178 @@ + + + + + + diff --git a/src/views/demo/api/apifox.vue b/src/views/demo/api/apifox.vue new file mode 100644 index 0000000..e625213 --- /dev/null +++ b/src/views/demo/api/apifox.vue @@ -0,0 +1,27 @@ + + + + diff --git a/src/views/demo/api/knife4j.vue b/src/views/demo/api/knife4j.vue new file mode 100644 index 0000000..4929cc6 --- /dev/null +++ b/src/views/demo/api/knife4j.vue @@ -0,0 +1,27 @@ + + + + diff --git a/src/views/demo/api/swagger.vue b/src/views/demo/api/swagger.vue new file mode 100644 index 0000000..dd6dc9d --- /dev/null +++ b/src/views/demo/api/swagger.vue @@ -0,0 +1,27 @@ + + + + diff --git a/src/views/demo/curd/config/add.ts b/src/views/demo/curd/config/add.ts new file mode 100644 index 0000000..45be0c4 --- /dev/null +++ b/src/views/demo/curd/config/add.ts @@ -0,0 +1,146 @@ +import UserAPI from "@/api/user"; +import type { UserForm } from "@/api/user/model"; +import type { IModalConfig } from "@/components/PageModal/index.vue"; + +const modalConfig: IModalConfig = { + pageName: "sys:user", + dialog: { + title: "新增用户", + width: 800, + draggable: true, + }, + form: { + labelWidth: 100, + }, + formAction: UserAPI.add, + beforeSubmit(data) { + console.log("提交之前处理", data); + }, + formItems: [ + { + label: "用户名", + prop: "username", + rules: [{ required: true, message: "用户名不能为空", trigger: "blur" }], + type: "input", + attrs: { + placeholder: "请输入用户名", + }, + }, + { + label: "用户昵称", + prop: "nickname", + rules: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], + type: "input", + attrs: { + placeholder: "请输入用户昵称", + }, + }, + { + label: "所属部门", + prop: "deptId", + rules: [{ required: true, message: "所属部门不能为空", trigger: "blur" }], + type: "tree-select", + attrs: { + placeholder: "请选择所属部门", + data: [ + { + value: 1, + label: "研筑科技", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + filterable: true, + "check-strictly": true, + "render-after-expand": false, + }, + }, + { + type: "select", + label: "性别", + prop: "gender", + attrs: { + placeholder: "请选择", + }, + options: [ + { label: "男", value: 1 }, + { label: "女", value: 2 }, + { label: "未知", value: 0 }, + ], + }, + { + label: "角色", + prop: "roleIds", + rules: [{ required: true, message: "用户角色不能为空", trigger: "blur" }], + type: "select", + attrs: { + placeholder: "请选择", + multiple: true, + }, + options: [ + { label: "系统管理员", value: 2 }, + { label: "系统管理员1", value: 4 }, + { label: "系统管理员2", value: 5 }, + { label: "系统管理员3", value: 6 }, + { label: "系统管理员4", value: 7 }, + { label: "系统管理员5", value: 8 }, + { label: "系统管理员6", value: 9 }, + { label: "系统管理员7", value: 10 }, + { label: "系统管理员8", value: 11 }, + { label: "访问游客", value: 3 }, + ], + }, + { + type: "input", + label: "手机号码", + prop: "mobile", + rules: [ + { + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, + message: "请输入正确的手机号码", + trigger: "blur", + }, + ], + attrs: { + placeholder: "请输入手机号码", + maxlength: 11, + }, + }, + { + label: "邮箱", + prop: "email", + rules: [ + { + pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/, + message: "请输入正确的邮箱地址", + trigger: "blur", + }, + ], + type: "input", + attrs: { + placeholder: "请输入邮箱", + maxlength: 50, + }, + }, + { + label: "状态", + prop: "status", + type: "radio", + options: [ + { label: "正常", value: 1 }, + { label: "禁用", value: 0 }, + ], + initialValue: 1, + }, + ], +}; + +export default modalConfig; diff --git a/src/views/demo/curd/config/content.ts b/src/views/demo/curd/config/content.ts new file mode 100644 index 0000000..ddbb51d --- /dev/null +++ b/src/views/demo/curd/config/content.ts @@ -0,0 +1,70 @@ +import UserAPI from "@/api/user"; +import type { UserQuery } from "@/api/user/model"; +import type { IContentConfig } from "@/components/PageContent/index.vue"; + +const contentConfig: IContentConfig = { + pageName: "sys:user", + table: { + border: true, + highlightCurrentRow: true, + }, + indexAction: function (params) { + if ("createAt" in params) { + const createAt = params.createAt as string[]; + params.startTime = createAt[0]; + params.endTime = createAt[1]; + delete params.createAt; + } + return UserAPI.getPage(params); + }, + deleteAction: UserAPI.deleteByIds, + exportAction: UserAPI.export, + pk: "id", + toolbar: [ + "add", + "delete", + "export", + { + name: "import", + icon: "upload", + text: "导入", + auth: "import", + }, + ], + cols: [ + { type: "selection", width: 50, align: "center" }, + { label: "编号", align: "center", prop: "id", width: 100, show: false }, + { label: "用户名", align: "center", prop: "username" }, + { label: "头像", align: "center", prop: "avatar", templet: "image" }, + { label: "用户昵称", align: "center", prop: "nickname", width: 120 }, + { label: "性别", align: "center", prop: "genderLabel", width: 100 }, + { label: "部门", align: "center", prop: "deptName", width: 120 }, + { label: "手机号码", align: "center", prop: "mobile", width: 120 }, + { + label: "状态", + align: "center", + prop: "status", + templet: "custom", + slotName: "status", + }, + { label: "创建时间", align: "center", prop: "createTime", width: 180 }, + { + label: "操作", + fixed: "right", + width: 220, + templet: "tool", + operat: [ + { + name: "reset_pwd", + auth: "password:reset", + icon: "refresh-left", + text: "重置密码", + }, + "edit", + "delete", + ], + }, + ], +}; + +export default contentConfig; diff --git a/src/views/demo/curd/config/content2.ts b/src/views/demo/curd/config/content2.ts new file mode 100644 index 0000000..b4b02c7 --- /dev/null +++ b/src/views/demo/curd/config/content2.ts @@ -0,0 +1,111 @@ +import type { IContentConfig } from "@/components/PageContent/index.vue"; + +const contentConfig: IContentConfig = { + pageName: "sys:user", + table: { + showOverflowTooltip: true, + }, + indexAction: function (params) { + // console.log("indexAction:", params); + return Promise.resolve({ + total: 2, + list: [ + { + id: 1, + username: "tom", + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + percent: 99, + price: 10, + url: "https://www.baidu.com", + icon: "el-icon-setting", + gender: 1, + status: 1, + status2: 1, + createTime: 1715647982437, + }, + { + id: 2, + username: "jerry", + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + percent: 88, + price: 999, + url: "https://www.google.com", + icon: "el-icon-user", + gender: 0, + status: 0, + status2: 0, + createTime: 1715648977426, + }, + ], + }); + }, + modifyAction(data) { + // console.log("modifyAction:", data); + return Promise.resolve(null); + }, + cols: [ + { type: "selection", width: 50, align: "center" }, + { label: "ID", align: "center", prop: "id", show: false }, + { label: "用户名", align: "center", prop: "username" }, + { label: "图片", align: "center", prop: "avatar", templet: "image" }, + { + label: "百分比", + align: "center", + prop: "percent", + templet: "percent", + }, + { + label: "价格", + align: "center", + prop: "price", + templet: "price", + priceFormat: "$", + }, + { label: "链接", align: "center", prop: "url", width: 180, templet: "url" }, + { label: "图标", align: "center", prop: "icon", templet: "icon" }, + { + label: "列表值", + align: "center", + prop: "gender", + templet: "list", + selectList: { 0: "女", 1: "男" }, + }, + { + label: "自定义", + align: "center", + prop: "status", + templet: "custom", + slotName: "status", + }, + { + label: "状态", + align: "center", + prop: "status2", + templet: "switch", + activeValue: 1, + inactiveValue: 0, + activeText: "启用", + inactiveText: "禁用", + }, + { + label: "创建时间", + align: "center", + prop: "createTime", + minWidth: 120, + templet: "date", + dateFormat: "YYYY/MM/DD HH:mm:ss", + }, + { + label: "操作", + align: "center", + fixed: "right", + width: 150, + templet: "tool", + operat: ["edit", "delete"], + }, + ], +}; + +export default contentConfig; diff --git a/src/views/demo/curd/config/edit.ts b/src/views/demo/curd/config/edit.ts new file mode 100644 index 0000000..c5e7204 --- /dev/null +++ b/src/views/demo/curd/config/edit.ts @@ -0,0 +1,146 @@ +import UserAPI from "@/api/user"; +import type { UserForm } from "@/api/user/model"; +import type { IModalConfig } from "@/components/PageModal/index.vue"; + +const modalConfig: IModalConfig = { + pageName: "sys:user", + pk: "id", + component: "drawer", + drawer: { + title: "修改用户", + size: 300, + }, + formAction: function (data) { + return UserAPI.update(data.id as number, data); + }, + beforeSubmit(data) { + console.log("提交之前处理", data); + }, + formItems: [ + { + label: "用户名", + prop: "username", + rules: [{ required: true, message: "用户名不能为空", trigger: "blur" }], + type: "input", + attrs: { + placeholder: "请输入用户名", + readonly: true, + }, + }, + { + label: "用户昵称", + prop: "nickname", + rules: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], + type: "input", + attrs: { + placeholder: "请输入用户昵称", + }, + }, + { + label: "所属部门", + prop: "deptId", + rules: [{ required: true, message: "所属部门不能为空", trigger: "blur" }], + type: "tree-select", + attrs: { + placeholder: "请选择所属部门", + data: [ + { + value: 1, + label: "研筑科技", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + filterable: true, + "check-strictly": true, + "render-after-expand": false, + }, + }, + { + type: "select", + label: "性别", + prop: "gender", + attrs: { + placeholder: "请选择", + }, + options: [ + { label: "男", value: 1 }, + { label: "女", value: 2 }, + { label: "未知", value: 0 }, + ], + }, + { + label: "角色", + prop: "roleIds", + rules: [{ required: true, message: "用户角色不能为空", trigger: "blur" }], + type: "select", + attrs: { + placeholder: "请选择", + multiple: true, + }, + options: [ + { label: "系统管理员", value: 2 }, + { label: "系统管理员1", value: 4 }, + { label: "系统管理员2", value: 5 }, + { label: "系统管理员3", value: 6 }, + { label: "系统管理员4", value: 7 }, + { label: "系统管理员5", value: 8 }, + { label: "系统管理员6", value: 9 }, + { label: "系统管理员7", value: 10 }, + { label: "系统管理员8", value: 11 }, + { label: "访问游客", value: 3 }, + ], + }, + { + type: "input", + label: "手机号码", + prop: "mobile", + rules: [ + { + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, + message: "请输入正确的手机号码", + trigger: "blur", + }, + ], + attrs: { + placeholder: "请输入手机号码", + maxlength: 11, + }, + }, + { + label: "邮箱", + prop: "email", + rules: [ + { + pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/, + message: "请输入正确的邮箱地址", + trigger: "blur", + }, + ], + type: "input", + attrs: { + placeholder: "请输入邮箱", + maxlength: 50, + }, + }, + { + label: "状态", + prop: "status", + type: "radio", + options: [ + { label: "正常", value: 1 }, + { label: "禁用", value: 0 }, + ], + }, + ], +}; + +export default modalConfig; diff --git a/src/views/demo/curd/config/search.ts b/src/views/demo/curd/config/search.ts new file mode 100644 index 0000000..f018454 --- /dev/null +++ b/src/views/demo/curd/config/search.ts @@ -0,0 +1,83 @@ +import type { ISearchConfig } from "@/components/PageSearch/index.vue"; + +const searchConfig: ISearchConfig = { + pageName: "sys:user", + formItems: [ + { + type: "input", + label: "关键字", + prop: "keywords", + attrs: { + placeholder: "用户名/昵称/手机号", + clearable: true, + style: { + width: "200px", + }, + }, + }, + { + type: "tree-select", + label: "部门", + prop: "deptId", + attrs: { + placeholder: "请选择", + data: [ + { + value: 1, + label: "研筑科技", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + filterable: true, + "check-strictly": true, + "render-after-expand": false, + clearable: true, + style: { + width: "150px", + }, + }, + }, + { + type: "select", + label: "状态", + prop: "status", + attrs: { + placeholder: "全部", + clearable: true, + style: { + width: "100px", + }, + }, + options: [ + { label: "启用", value: 1 }, + { label: "禁用", value: 0 }, + ], + }, + { + type: "date-picker", + label: "创建时间", + prop: "createAt", + attrs: { + type: "daterange", + "range-separator": "~", + "start-placeholder": "开始时间", + "end-placeholder": "截止时间", + "value-format": "YYYY-MM-DD", + style: { + width: "240px", + }, + }, + }, + ], +}; + +export default searchConfig; diff --git a/src/views/demo/curd/index.vue b/src/views/demo/curd/index.vue new file mode 100644 index 0000000..e5cea7d --- /dev/null +++ b/src/views/demo/curd/index.vue @@ -0,0 +1,111 @@ + + + diff --git a/src/views/demo/dict.vue b/src/views/demo/dict.vue new file mode 100644 index 0000000..fcb6e06 --- /dev/null +++ b/src/views/demo/dict.vue @@ -0,0 +1,32 @@ + + + + diff --git a/src/views/demo/icon-selector.vue b/src/views/demo/icon-selector.vue new file mode 100644 index 0000000..6a419e2 --- /dev/null +++ b/src/views/demo/icon-selector.vue @@ -0,0 +1,17 @@ + + + + diff --git a/src/views/demo/icons.vue b/src/views/demo/icons.vue new file mode 100644 index 0000000..5fd397f --- /dev/null +++ b/src/views/demo/icons.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/src/views/demo/internal-doc.vue b/src/views/demo/internal-doc.vue new file mode 100644 index 0000000..df51bac --- /dev/null +++ b/src/views/demo/internal-doc.vue @@ -0,0 +1,28 @@ + + diff --git a/src/views/demo/multi-level/children/children/level3-1.vue b/src/views/demo/multi-level/children/children/level3-1.vue new file mode 100644 index 0000000..888f58e --- /dev/null +++ b/src/views/demo/multi-level/children/children/level3-1.vue @@ -0,0 +1,5 @@ + diff --git a/src/views/demo/multi-level/children/children/level3-2.vue b/src/views/demo/multi-level/children/children/level3-2.vue new file mode 100644 index 0000000..a99c98e --- /dev/null +++ b/src/views/demo/multi-level/children/children/level3-2.vue @@ -0,0 +1,5 @@ + diff --git a/src/views/demo/multi-level/children/level2.vue b/src/views/demo/multi-level/children/level2.vue new file mode 100644 index 0000000..abcc3a7 --- /dev/null +++ b/src/views/demo/multi-level/children/level2.vue @@ -0,0 +1,7 @@ + diff --git a/src/views/demo/multi-level/level1.vue b/src/views/demo/multi-level/level1.vue new file mode 100644 index 0000000..b26146d --- /dev/null +++ b/src/views/demo/multi-level/level1.vue @@ -0,0 +1,15 @@ + diff --git a/src/views/demo/signature.vue b/src/views/demo/signature.vue new file mode 100644 index 0000000..ce5fb4a --- /dev/null +++ b/src/views/demo/signature.vue @@ -0,0 +1,186 @@ + + + diff --git a/src/views/demo/table-select/config/select.ts b/src/views/demo/table-select/config/select.ts new file mode 100644 index 0000000..4ef66b5 --- /dev/null +++ b/src/views/demo/table-select/config/select.ts @@ -0,0 +1,112 @@ +import UserAPI from "@/api/user"; +import type { ISelectConfig } from "@/components/TableSelect/index.vue"; + +const selectConfig: ISelectConfig = { + pk: "id", + width: "70%", + placeholder: "请选择用户", + formItems: [ + { + type: "input", + label: "关键字", + prop: "keywords", + attrs: { + placeholder: "用户名/昵称/手机号", + clearable: true, + style: { + width: "200px", + }, + }, + }, + { + type: "tree-select", + label: "部门", + prop: "deptId", + attrs: { + placeholder: "请选择", + data: [ + { + value: 1, + label: "研筑科技", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + filterable: true, + "check-strictly": true, + "render-after-expand": false, + clearable: true, + style: { + width: "150px", + }, + }, + }, + { + type: "select", + label: "状态", + prop: "status", + attrs: { + placeholder: "全部", + clearable: true, + style: { + width: "100px", + }, + }, + options: [ + { label: "启用", value: 1 }, + { label: "禁用", value: 0 }, + ], + }, + { + type: "date-picker", + label: "创建时间", + prop: "createAt", + attrs: { + type: "daterange", + "range-separator": "~", + "start-placeholder": "开始时间", + "end-placeholder": "截止时间", + "value-format": "YYYY-MM-DD", + style: { + width: "240px", + }, + }, + }, + ], + indexAction: function (params) { + if ("createAt" in params) { + const createAt = params.createAt as string[]; + params.startTime = createAt[0]; + params.endTime = createAt[1]; + delete params.createAt; + } + return UserAPI.getPage(params); + }, + tableColumns: [ + { type: "selection", width: 50, align: "center" }, + { label: "编号", align: "center", prop: "id", width: 100 }, + { label: "用户名", align: "center", prop: "username" }, + { label: "用户昵称", align: "center", prop: "nickname", width: 120 }, + { label: "性别", align: "center", prop: "genderLabel", width: 100 }, + { label: "部门", align: "center", prop: "deptName", width: 120 }, + { label: "手机号码", align: "center", prop: "mobile", width: 120 }, + { + label: "状态", + align: "center", + prop: "status", + templet: "custom", + slotName: "status", + }, + { label: "创建时间", align: "center", prop: "createTime", width: 180 }, + ], +}; + +export default selectConfig; diff --git a/src/views/demo/table-select/index.vue b/src/views/demo/table-select/index.vue new file mode 100644 index 0000000..f3d6275 --- /dev/null +++ b/src/views/demo/table-select/index.vue @@ -0,0 +1,51 @@ + + + + diff --git a/src/views/demo/upload.vue b/src/views/demo/upload.vue new file mode 100644 index 0000000..7c8051a --- /dev/null +++ b/src/views/demo/upload.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/views/demo/wang-editor.vue b/src/views/demo/wang-editor.vue new file mode 100644 index 0000000..d7ff4bb --- /dev/null +++ b/src/views/demo/wang-editor.vue @@ -0,0 +1,19 @@ + + + + diff --git a/src/views/demo/websocket.vue b/src/views/demo/websocket.vue new file mode 100644 index 0000000..74eb67b --- /dev/null +++ b/src/views/demo/websocket.vue @@ -0,0 +1,268 @@ + + + + + + diff --git a/src/views/error-page/401.vue b/src/views/error-page/401.vue new file mode 100644 index 0000000..79b11aa --- /dev/null +++ b/src/views/error-page/401.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/src/views/error-page/404.vue b/src/views/error-page/404.vue new file mode 100644 index 0000000..4e68995 --- /dev/null +++ b/src/views/error-page/404.vue @@ -0,0 +1,276 @@ + + + + + + + + diff --git a/src/views/login/index.vue b/src/views/login/index.vue new file mode 100644 index 0000000..55a047c --- /dev/null +++ b/src/views/login/index.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue new file mode 100644 index 0000000..4215bf6 --- /dev/null +++ b/src/views/redirect/index.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue new file mode 100644 index 0000000..c8ed1e4 --- /dev/null +++ b/src/views/system/dept/index.vue @@ -0,0 +1,310 @@ + + + diff --git a/src/views/system/dict/components/dict-item.vue b/src/views/system/dict/components/dict-item.vue new file mode 100644 index 0000000..365de8a --- /dev/null +++ b/src/views/system/dict/components/dict-item.vue @@ -0,0 +1,308 @@ + + + + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue new file mode 100644 index 0000000..3a3b344 --- /dev/null +++ b/src/views/system/dict/index.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue new file mode 100644 index 0000000..db6e07f --- /dev/null +++ b/src/views/system/menu/index.vue @@ -0,0 +1,498 @@ + + + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue new file mode 100644 index 0000000..9439b69 --- /dev/null +++ b/src/views/system/role/index.vue @@ -0,0 +1,393 @@ + + + diff --git a/src/views/system/user/components/dept-tree.vue b/src/views/system/user/components/dept-tree.vue new file mode 100644 index 0000000..2f38606 --- /dev/null +++ b/src/views/system/user/components/dept-tree.vue @@ -0,0 +1,68 @@ + + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue new file mode 100644 index 0000000..8b20249 --- /dev/null +++ b/src/views/system/user/index.vue @@ -0,0 +1,652 @@ + + + + diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6d1e993 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "target": "esnext", + "useDefineForClassFields": true, + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "noLib": false, + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": ["esnext", "dom"], + "baseUrl": ".", + "allowJs": true, + "paths": { + "@/*": ["src/*"] + }, + "types": ["vite/client", "unplugin-icons/types/vue", "element-plus/global"], + "skipLibCheck": true /* Skip type checking all .d.ts files. */, + "allowSyntheticDefaultImports": true /* 允许默认导入 */, + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + "jsx": "preserve", + "jsxFactory": "h", + "jsxFragmentFactory": "Fragment" + }, + "include": [ + "src/**/*.ts", + "src/**/*.vue", + "src/typings/**/*.d.ts", + "mock/**/*.ts", + "vite.config.ts" + ], + "exclude": ["node_modules", "dist", "**/*.js"] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..97ede7e --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["vite.config.ts"] +} diff --git a/uno.config.ts b/uno.config.ts new file mode 100644 index 0000000..b952fe4 --- /dev/null +++ b/uno.config.ts @@ -0,0 +1,43 @@ +// uno.config.ts +import { + defineConfig, + presetAttributify, + presetIcons, + presetTypography, + presetUno, + presetWebFonts, + transformerDirectives, + transformerVariantGroup, +} from "unocss"; + +export default defineConfig({ + shortcuts: { + "flex-center": "flex justify-center items-center", + "flex-x-center": "flex justify-center", + "flex-y-center": "flex items-center", + "wh-full": "w-full h-full", + "flex-x-between": "flex items-center justify-between", + "flex-x-end": "flex items-center justify-end", + "absolute-lt": "absolute left-0 top-0", + "absolute-rt": "absolute right-0 top-0 ", + "fixed-lt": "fixed left-0 top-0", + }, + theme: { + colors: { + primary: "var(--el-color-primary)", + primary_dark: "var(--el-color-primary-light-5)", + }, + }, + presets: [ + presetUno(), + presetAttributify(), + presetIcons(), + presetTypography(), + presetWebFonts({ + fonts: { + // ... + }, + }), + ], + transformers: [transformerDirectives(), transformerVariantGroup()], +}); diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..1d66d28 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,251 @@ +import vue from "@vitejs/plugin-vue"; +import vueJsx from "@vitejs/plugin-vue-jsx"; +import { UserConfig, ConfigEnv, loadEnv, defineConfig } from "vite"; + +import AutoImport from "unplugin-auto-import/vite"; +import Components from "unplugin-vue-components/vite"; +import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; +import Icons from "unplugin-icons/vite"; +import IconsResolver from "unplugin-icons/resolver"; + +import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; +import mockDevServerPlugin from "vite-plugin-mock-dev-server"; + +import UnoCSS from "unocss/vite"; +import { resolve } from "path"; +import { + name, + version, + engines, + dependencies, + devDependencies, +} from "./package.json"; + +// https://devtools-next.vuejs.org/ +import VueDevTools from "vite-plugin-vue-devtools"; + +/** 平台的名称、版本、运行所需的`node`版本、依赖、构建时间的类型提示 */ +const __APP_INFO__ = { + pkg: { name, version, engines, dependencies, devDependencies }, + buildTimestamp: Date.now(), +}; + +const pathSrc = resolve(__dirname, "src"); +// https://cn.vitejs.dev/config +export default defineConfig(({ mode }: ConfigEnv): UserConfig => { + const env = loadEnv(mode, process.cwd()); + return { + resolve: { + alias: { + "@": pathSrc, + }, + }, + base: "/ai/", + css: { + // CSS 预处理器 + preprocessorOptions: { + // 定义全局 SCSS 变量 + scss: { + javascriptEnabled: true, + additionalData: ` + @use "@/styles/variables.scss" as *; + `, + }, + }, + }, + server: { + // 允许IP访问 + host: "0.0.0.0", + // 应用端口 (默认:3000) + port: Number(env.VITE_APP_PORT), + // 运行是否自动打开浏览器 + open: true, + proxy: { + /** 代理前缀为 /dev-api 的请求 */ + [env.VITE_APP_BASE_API]: { + changeOrigin: true, + // 接口地址 + target: env.VITE_APP_API_URL, + rewrite: (path) => + path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), + }, + }, + }, + plugins: [ + vue(), + // jsx、tsx语法支持 + vueJsx(), + // MOCK 服务 + env.VITE_MOCK_DEV_SERVER === "true" ? mockDevServerPlugin() : null, + UnoCSS({ + hmrTopLevelAwait: false, + }), + // 自动导入参考: https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts + AutoImport({ + // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等 + imports: ["vue", "@vueuse/core", "pinia", "vue-router", "vue-i18n"], + resolvers: [ + // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式) + ElementPlusResolver(), + // 自动导入图标组件 + IconsResolver({}), + ], + eslintrc: { + // 是否自动生成 eslint 规则,建议生成之后设置 false + enabled: false, + // 指定自动导入函数 eslint 规则的文件 + filepath: "./.eslintrc-auto-import.json", + globalsPropValue: true, + }, + // 是否在 vue 模板中自动导入 + vueTemplate: true, + // 指定自动导入函数TS类型声明文件路径 (false:关闭自动生成) + dts: false, + // dts: "src/typings/auto-imports.d.ts", + }), + Components({ + resolvers: [ + // 自动导入 Element Plus 组件 + ElementPlusResolver(), + // 自动注册图标组件 + IconsResolver({ + // element-plus图标库,其他图标库 https://icon-sets.iconify.design/ + enabledCollections: ["ep"], + }), + ], + // 指定自定义组件位置(默认:src/components) + dirs: ["src/components", "src/**/components"], + // 指定自动导入组件TS类型声明文件路径 (false:关闭自动生成) + dts: false, + // dts: "src/typings/components.d.ts", + }), + Icons({ + // 自动安装图标库 + autoInstall: true, + }), + createSvgIconsPlugin({ + // 指定需要缓存的图标文件夹 + iconDirs: [resolve(pathSrc, "assets/icons")], + // 指定symbolId格式 + symbolId: "icon-[dir]-[name]", + }), + VueDevTools({ + openInEditorHost: `http://localhost:${env.VITE_APP_PORT}`, + }), + ], + // 预加载项目必需的组件 + optimizeDeps: { + include: [ + "vue", + "vue-router", + "pinia", + "axios", + "@vueuse/core", + "sortablejs", + "path-to-regexp", + "echarts", + "@wangeditor/editor", + "@wangeditor/editor-for-vue", + "vue-i18n", + "path-browserify", + "element-plus/es/components/form/style/css", + "element-plus/es/components/form-item/style/css", + "element-plus/es/components/button/style/css", + "element-plus/es/components/input/style/css", + "element-plus/es/components/input-number/style/css", + "element-plus/es/components/switch/style/css", + "element-plus/es/components/upload/style/css", + "element-plus/es/components/menu/style/css", + "element-plus/es/components/col/style/css", + "element-plus/es/components/icon/style/css", + "element-plus/es/components/row/style/css", + "element-plus/es/components/tag/style/css", + "element-plus/es/components/dialog/style/css", + "element-plus/es/components/loading/style/css", + "element-plus/es/components/radio/style/css", + "element-plus/es/components/radio-group/style/css", + "element-plus/es/components/popover/style/css", + "element-plus/es/components/scrollbar/style/css", + "element-plus/es/components/tooltip/style/css", + "element-plus/es/components/dropdown/style/css", + "element-plus/es/components/dropdown-menu/style/css", + "element-plus/es/components/dropdown-item/style/css", + "element-plus/es/components/sub-menu/style/css", + "element-plus/es/components/menu-item/style/css", + "element-plus/es/components/divider/style/css", + "element-plus/es/components/card/style/css", + "element-plus/es/components/link/style/css", + "element-plus/es/components/breadcrumb/style/css", + "element-plus/es/components/breadcrumb-item/style/css", + "element-plus/es/components/table/style/css", + "element-plus/es/components/tree-select/style/css", + "element-plus/es/components/table-column/style/css", + "element-plus/es/components/select/style/css", + "element-plus/es/components/option/style/css", + "element-plus/es/components/pagination/style/css", + "element-plus/es/components/tree/style/css", + "element-plus/es/components/alert/style/css", + "element-plus/es/components/radio-button/style/css", + "element-plus/es/components/checkbox-group/style/css", + "element-plus/es/components/checkbox/style/css", + "element-plus/es/components/tabs/style/css", + "element-plus/es/components/tab-pane/style/css", + "element-plus/es/components/rate/style/css", + "element-plus/es/components/date-picker/style/css", + "element-plus/es/components/notification/style/css", + "element-plus/es/components/image/style/css", + "element-plus/es/components/statistic/style/css", + "element-plus/es/components/watermark/style/css", + "element-plus/es/components/config-provider/style/css", + "element-plus/es/components/text/style/css", + "element-plus/es/components/drawer/style/css", + "element-plus/es/components/color-picker/style/css", + ], + }, + // 构建配置 + build: { + chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 + minify: "terser", // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 + terserOptions: { + compress: { + keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 + drop_console: true, // 生产环境去除 console + drop_debugger: true, // 生产环境去除 debugger + }, + format: { + comments: false, // 删除注释 + }, + }, + rollupOptions: { + output: { + // manualChunks: { + // "vue-i18n": ["vue-i18n"], + // }, + // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值 + entryFileNames: "js/[name].[hash].js", + // 用于命名代码拆分时创建的共享块的输出命名 + chunkFileNames: "js/[name].[hash].js", + // 用于输出静态资源的命名,[ext]表示文件扩展名 + assetFileNames: (assetInfo: any) => { + const info = assetInfo.name.split("."); + let extType = info[info.length - 1]; + // console.log('文件信息', assetInfo.name) + if ( + /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i.test(assetInfo.name) + ) { + extType = "media"; + } else if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(assetInfo.name)) { + extType = "img"; + } else if (/\.(woff2?|eot|ttf|otf)(\?.*)?$/i.test(assetInfo.name)) { + extType = "fonts"; + } + return `${extType}/[name].[hash].[ext]`; + }, + }, + }, + }, + define: { + __APP_INFO__: JSON.stringify(__APP_INFO__), + }, + }; +});