perf: remove useless code
| | |
| | | # Delete console |
| | | VITE_DROP_CONSOLE = true |
| | | |
| | | # Whether to enable gizp or brotli compression |
| | | # Whether to enable gzip or brotli compression |
| | | # Optional: gzip | brotli | none |
| | | # If you need multiple forms, you can use `,` to separate |
| | | VITE_BUILD_COMPRESS = 'none' |
| | |
| | | setup() { |
| | | // support Multi-language |
| | | const { antConfigLocale, setLocale } = useLocale(); |
| | | |
| | | setLocale(); |
| | | |
| | | // Initialize vuex internal system configuration |
| | | initAppConfigStore(); |
| | | |
| | | // Create a lock screen monitor |
| | | const lockEvent = useLockPage(); |
| | | |
| | |
| | | import { unref, toRaw } from 'vue'; |
| | | |
| | | import { isArray, isFunction, isObject, isString } from '/@/utils/is'; |
| | | import { deepMerge, unique } from '/@/utils'; |
| | | import { deepMerge } from '/@/utils'; |
| | | import { dateItemType, handleInputNumberValue } from '../helper'; |
| | | import { dateUtil } from '/@/utils/dateUtil'; |
| | | import { cloneDeep } from 'lodash-es'; |
| | | import { cloneDeep, uniqBy } from 'lodash-es'; |
| | | import { error } from '/@/utils/log'; |
| | | |
| | | interface UseFormActionContext { |
| | |
| | | } |
| | | }); |
| | | }); |
| | | schemaRef.value = unique(schema, 'field'); |
| | | schemaRef.value = uniqBy(schema, 'field'); |
| | | } |
| | | |
| | | function getFieldsValue(): Recordable { |
| | |
| | | import { computed, Ref, toRaw } from 'vue'; |
| | | |
| | | import { unref } from 'vue'; |
| | | import { es6Unique } from '/@/utils'; |
| | | import { uniq } from 'lodash-es'; |
| | | import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; |
| | | import { getAllParentPath } from '/@/router/helper/menuHelper'; |
| | | import { useTimeoutFn } from '/@/hooks/core/useTimeout'; |
| | |
| | | return; |
| | | } |
| | | if (!unref(accordion)) { |
| | | menuState.openKeys = es6Unique([ |
| | | ...menuState.openKeys, |
| | | ...getAllParentPath(menuList, path), |
| | | ]); |
| | | menuState.openKeys = uniq([...menuState.openKeys, ...getAllParentPath(menuList, path)]); |
| | | } else { |
| | | menuState.openKeys = getAllParentPath(menuList, path); |
| | | } |
| | |
| | | import { computed, Ref, toRaw } from 'vue'; |
| | | |
| | | import { unref } from 'vue'; |
| | | import { es6Unique } from '/@/utils'; |
| | | import { uniq } from 'lodash-es'; |
| | | import { getAllParentPath } from '/@/router/helper/menuHelper'; |
| | | |
| | | import { useTimeoutFn } from '/@/hooks/core/useTimeout'; |
| | | |
| | | export function useOpenKeys( |
| | |
| | | } |
| | | const keys = getAllParentPath(menuList, path); |
| | | if (!unref(accordion)) { |
| | | menuState.openNames = es6Unique([...menuState.openNames, ...keys]); |
| | | menuState.openNames = uniq([...menuState.openNames, ...keys]); |
| | | } else { |
| | | menuState.openNames = keys; |
| | | } |
| | |
| | | } from 'vue'; |
| | | import { useEventListener } from '/@/hooks/event/useEventListener'; |
| | | |
| | | import { convertToUnit } from '/@/components/util'; |
| | | import { props as basicProps } from './props'; |
| | | import { getSlot } from '/@/utils/helper/tsxHelper'; |
| | | import './index.less'; |
| | | |
| | | const prefixCls = 'virtual-scroll'; |
| | | |
| | | function convertToUnit(str: string | number | null | undefined, unit = 'px'): string | undefined { |
| | | if (str == null || str === '') { |
| | | return undefined; |
| | | } else if (isNaN(+str!)) { |
| | | return String(str); |
| | | } else { |
| | | return `${Number(str)}${unit}`; |
| | | } |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'VirtualScroll', |
| | | props: basicProps, |
| | |
| | | import { |
| | | // Need |
| | | Button as AntButton, |
| | | |
| | | // Optional |
| | | // Select, |
| | | // Alert, |
| | | // Checkbox, |
| | | // DatePicker, |
| | | // Radio, |
| | | // Switch, |
| | | // Card, |
| | | // List, |
| | | // Tabs, |
| | | // Descriptions, |
| | | // Tree, |
| | | // Table, |
| | | // Divider, |
| | | // Modal, |
| | | // Drawer, |
| | | // Dropdown, |
| | | // Tag, |
| | | // Tooltip, |
| | | // Badge, |
| | | // Popover, |
| | | // Upload, |
| | | // Transfer, |
| | | // Steps, |
| | | // PageHeader, |
| | | // Result, |
| | | // Empty, |
| | | // Avatar, |
| | | // Menu, |
| | | // Breadcrumb, |
| | | // Form, |
| | | // Input, |
| | | // Row, |
| | | // Col, |
| | | // Spin, |
| | | } from 'ant-design-vue'; |
| | | |
| | | import { App } from 'vue'; |
| | |
| | | |
| | | export function registerGlobComp(app: App) { |
| | | compList.forEach((comp: any) => { |
| | | app.component(comp.name, comp); |
| | | app.component(comp.name || comp.displayName, comp); |
| | | }); |
| | | |
| | | // Optional |
| | | // If you need to customize global components, you can write here |
| | | // If you don’t need it, you can delete it |
| | | // app |
| | | // .use(Select) |
| | | // .use(Alert) |
| | | // .use(Breadcrumb) |
| | | // .use(Checkbox) |
| | | // .use(DatePicker) |
| | | // .use(Radio) |
| | | // .use(Switch) |
| | | // .use(Card) |
| | | // .use(List) |
| | | // .use(Descriptions) |
| | | // .use(Tree) |
| | | // .use(Table) |
| | | // .use(Divider) |
| | | // .use(Modal) |
| | | // .use(Drawer) |
| | | // .use(Dropdown) |
| | | // .use(Tag) |
| | | // .use(Tooltip) |
| | | // .use(Badge) |
| | | // .use(Popover) |
| | | // .use(Upload) |
| | | // .use(Transfer) |
| | | // .use(Steps) |
| | | // .use(PageHeader) |
| | | // .use(Result) |
| | | // .use(Empty) |
| | | // .use(Avatar) |
| | | // .use(Menu) |
| | | // .use(Tabs) |
| | | // .use(Form) |
| | | // .use(Input) |
| | | // .use(Row) |
| | | // .use(Col) |
| | | // .use(Spin); |
| | | } |
| | |
| | | setup() { |
| | | const { getFramePages, hasRenderFrame, showIframe } = useFrameKeepAlive(); |
| | | |
| | | const showFrame = computed(() => { |
| | | return unref(getFramePages).length > 0; |
| | | }); |
| | | const showFrame = computed(() => unref(getFramePages).length > 0); |
| | | |
| | | return { getFramePages, hasRenderFrame, showIframe, showFrame }; |
| | | }, |
| | |
| | | |
| | | import { tabStore } from '/@/store/modules/tab'; |
| | | |
| | | import { unique } from '/@/utils'; |
| | | import { uniqBy } from 'lodash-es'; |
| | | |
| | | import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; |
| | | |
| | |
| | | res.push(...getAllFramePages(children)); |
| | | } |
| | | } |
| | | res = unique(res, 'name'); |
| | | res = uniqBy(res, 'name'); |
| | | return res; |
| | | } |
| | | |
| | |
| | | import { permissionStore } from '/@/store/modules/permission'; |
| | | |
| | | import { PageEnum } from '/@/enums/pageEnum'; |
| | | import { getToken } from '/@/utils/auth'; |
| | | import { userStore } from '/@/store/modules/user'; |
| | | |
| | | import { PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | const token = getToken(); |
| | | const token = userStore.getTokenState; |
| | | |
| | | // token does not exist |
| | | if (!token) { |
| | |
| | | import type { RouteRecordRaw } from 'vue-router'; |
| | | import { RoleEnum } from '/@/enums/roleEnum'; |
| | | |
| | | import type { Component } from '/@/components/types'; |
| | | import { defineComponent } from 'vue'; |
| | | |
| | | export type Component<T extends any = any> = |
| | | | ReturnType<typeof defineComponent> |
| | | | (() => Promise<typeof import('*.vue')>) |
| | | | (() => Promise<T>); |
| | | |
| | | export interface RouteMeta { |
| | | // title |
| | |
| | | } |
| | | } |
| | | /** |
| | | * 获取当前元素的left、top偏移 |
| | | * left:元素最左侧距离文档左侧的距离 |
| | | * top:元素最顶端距离文档顶端的距离 |
| | | * right:元素最右侧距离文档右侧的距离 |
| | | * bottom:元素最底端距离文档底端的距离 |
| | | * rightIncludeBody:元素最左侧距离文档右侧的距离 |
| | | * bottomIncludeBody:元素最底端距离文档最底部的距离 |
| | | * Get the left and top offset of the current element |
| | | * left: the distance between the leftmost element and the left side of the document |
| | | * top: the distance from the top of the element to the top of the document |
| | | * right: the distance from the far right of the element to the right of the document |
| | | * bottom: the distance from the bottom of the element to the bottom of the document |
| | | * rightIncludeBody: the distance between the leftmost element and the right side of the document |
| | | * bottomIncludeBody: the distance from the bottom of the element to the bottom of the document |
| | | * |
| | | * @description: |
| | | */ |
| | |
| | | this.iv = CryptoES.enc.Utf8.parse(iv); |
| | | } |
| | | |
| | | get getOpt(): CryptoES.lib.CipherCfg { |
| | | get getOptions(): CryptoES.lib.CipherCfg { |
| | | return { |
| | | mode: CryptoES.mode.CBC as any, |
| | | padding: CryptoES.pad.Pkcs7, |
| | |
| | | } |
| | | |
| | | encryptByAES(str: string) { |
| | | const encrypted = CryptoES.AES.encrypt(str, this.key, this.getOpt); |
| | | return encrypted.toString(); |
| | | return CryptoES.AES.encrypt(str, this.key, this.getOptions).toString(); |
| | | } |
| | | |
| | | decryptByAES(str: string) { |
| | | const decrypted = CryptoES.AES.decrypt(str, this.key, this.getOpt); |
| | | return decrypted.toString(CryptoES.enc.Utf8); |
| | | return CryptoES.AES.decrypt(str, this.key, this.getOptions).toString(CryptoES.enc.Utf8); |
| | | } |
| | | } |
| | | export default Encryption; |
| | |
| | | import type { AxiosResponse } from 'axios'; |
| | | import type { CreateAxiosOptions, RequestOptions, Result } from './types'; |
| | | import { VAxios } from './Axios'; |
| | | import { getToken } from '/@/utils/auth'; |
| | | import { AxiosTransform } from './axiosTransform'; |
| | | |
| | | import { checkStatus } from './checkStatus'; |
| | |
| | | import { errorResult } from './const'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { createNow, formatRequestDate } from './helper'; |
| | | import { userStore } from '/@/store/modules/user'; |
| | | |
| | | const globSetting = useGlobSetting(); |
| | | const prefix = globSetting.urlPrefix; |
| | |
| | | */ |
| | | requestInterceptors: (config) => { |
| | | // 请求之前处理config |
| | | const token = getToken(); |
| | | const token = userStore.getTokenState; |
| | | if (token) { |
| | | // jwt token |
| | | config.headers.Authorization = token; |
| | |
| | | return src; |
| | | } |
| | | |
| | | /** |
| | | * @description: Deduplication according to the value of an object in the array |
| | | */ |
| | | export function unique<T = any>(arr: T[], key: string): T[] { |
| | | const map = new Map(); |
| | | return arr.filter((item) => { |
| | | const _item = item as any; |
| | | return !map.has(_item[key]) && map.set(_item[key], 1); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * @description: es6 array to repeat |
| | | */ |
| | | export function es6Unique<T>(arr: T[]): T[] { |
| | | return Array.from(new Set(arr)); |
| | | } |
| | | |
| | | export function openWindow( |
| | | url: string, |
| | | opt?: { target?: TargetContext | string; noopener?: boolean; noreferrer?: boolean } |
| | |
| | | }); |
| | | |
| | | return ret as Partial<U>; |
| | | } |
| | | |
| | | export function getLastItem<T extends any>(list: T) { |
| | | if (Array.isArray(list)) { |
| | | return list.slice(-1)[0]; |
| | | } |
| | | |
| | | if (list instanceof Set) { |
| | | return Array.from(list).slice(-1)[0]; |
| | | } |
| | | |
| | | if (list instanceof Map) { |
| | | return Array.from(list.values()).slice(-1)[0]; |
| | | } |
| | | } |
| | | |
| | | /** |