From 7922e901358df9dc648f5a52bda24074d2302e23 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 10 Nov 2022 13:15:55 +0800 Subject: [PATCH 1/7] fix: vxe size --- .../src/config/axios/service.ts | 2 +- yudao-ui-admin-vue3/src/hooks/web/useCache.ts | 4 ++-- .../src/hooks/web/useVxeGrid.ts | 23 ++++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/yudao-ui-admin-vue3/src/config/axios/service.ts b/yudao-ui-admin-vue3/src/config/axios/service.ts index 52f5a8acd..2eff086f4 100644 --- a/yudao-ui-admin-vue3/src/config/axios/service.ts +++ b/yudao-ui-admin-vue3/src/config/axios/service.ts @@ -46,7 +46,7 @@ service.interceptors.request.use( ;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token } // 设置租户 - if (tenantEnable) { + if (tenantEnable && tenantEnable === 'true') { const tenantId = getTenantId() if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId } diff --git a/yudao-ui-admin-vue3/src/hooks/web/useCache.ts b/yudao-ui-admin-vue3/src/hooks/web/useCache.ts index b405ef3cd..97a7df68a 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useCache.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useCache.ts @@ -4,9 +4,9 @@ import WebStorageCache from 'web-storage-cache' -type CacheType = 'sessionStorage' | 'localStorage' +type CacheType = 'localStorage' | 'sessionStorage' -export const useCache = (type: CacheType = 'sessionStorage') => { +export const useCache = (type: CacheType = 'localStorage') => { const wsCache: WebStorageCache = new WebStorageCache({ storage: type }) diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts index 04b0df0b8..e27ed52be 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts @@ -1,5 +1,5 @@ import { computed, reactive } from 'vue' -import { VxeGridProps } from 'vxe-table' +import { SizeType, VxeGridProps } from 'vxe-table' import { useAppStore } from '@/store/modules/app' import { VxeAllSchemas } from './useVxeCrudSchemas' import { useI18n } from '@/hooks/web/useI18n' @@ -18,19 +18,26 @@ interface UseVxeGridConfig { const appStore = useAppStore() const currentSize = computed(() => { - if (appStore.getCurrentSize === 'small') { - return 'small' - } else if (appStore.getCurrentSize === 'large') { - return 'mini' - } else { - return 'medium' + let resSize: SizeType = 'small' + const appsize = appStore.getCurrentSize + switch (appsize) { + case 'large': + resSize = 'medium' + break + case 'default': + resSize = 'small' + break + case 'small': + resSize = 'mini' + break } + return resSize }) export const useVxeGrid = (config?: UseVxeGridConfig) => { const gridOptions = reactive({ loading: true, - size: currentSize.value, + size: currentSize as any, height: 800, rowConfig: { isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 From 8118de48912aeb50353527d43560db1974d204a9 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 10 Nov 2022 14:36:32 +0800 Subject: [PATCH 2/7] fix: axios error --- yudao-ui-admin-vue3/package.json | 2 +- yudao-ui-admin-vue3/pnpm-lock.yaml | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json index c2be68b1f..e90ef4070 100644 --- a/yudao-ui-admin-vue3/package.json +++ b/yudao-ui-admin-vue3/package.json @@ -31,7 +31,7 @@ "@wangeditor/editor-for-vue": "^5.1.10", "@zxcvbn-ts/core": "^2.1.0", "animate.css": "^4.1.1", - "axios": "^1.1.3", + "axios": "^0.27.2", "crypto-js": "^4.1.1", "dayjs": "^1.11.6", "echarts": "^5.4.0", diff --git a/yudao-ui-admin-vue3/pnpm-lock.yaml b/yudao-ui-admin-vue3/pnpm-lock.yaml index ef00db36f..3475dfc95 100644 --- a/yudao-ui-admin-vue3/pnpm-lock.yaml +++ b/yudao-ui-admin-vue3/pnpm-lock.yaml @@ -23,7 +23,7 @@ specifiers: '@zxcvbn-ts/core': ^2.1.0 animate.css: ^4.1.1 autoprefixer: ^10.4.13 - axios: ^1.1.3 + axios: ^0.27.2 crypto-js: ^4.1.1 dayjs: ^1.11.6 echarts: ^5.4.0 @@ -87,7 +87,7 @@ dependencies: '@wangeditor/editor-for-vue': 5.1.12_su3dw7bmszfjg67suaojchptby '@zxcvbn-ts/core': 2.1.0 animate.css: 4.1.1 - axios: 1.1.3 + axios: 0.27.2 crypto-js: 4.1.1 dayjs: 1.11.6 echarts: 5.4.0 @@ -2155,12 +2155,11 @@ packages: - debug dev: true - /axios/1.1.3: - resolution: {integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==} + /axios/0.27.2: + resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: follow-redirects: 1.15.2 form-data: 4.0.0 - proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: false @@ -5793,10 +5792,6 @@ packages: engines: {node: '>=6'} dev: false - /proxy-from-env/1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - /prr/1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} dev: true From d22620a7cefffc0253684e167eee8438fca70135 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 10 Nov 2022 14:36:45 +0800 Subject: [PATCH 3/7] fix: axios error --- yudao-ui-admin-vue3/src/config/axios/service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin-vue3/src/config/axios/service.ts b/yudao-ui-admin-vue3/src/config/axios/service.ts index 2eff086f4..7ef424c98 100644 --- a/yudao-ui-admin-vue3/src/config/axios/service.ts +++ b/yudao-ui-admin-vue3/src/config/axios/service.ts @@ -48,7 +48,7 @@ service.interceptors.request.use( // 设置租户 if (tenantEnable && tenantEnable === 'true') { const tenantId = getTenantId() - if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId + if (tenantId) (config as Recordable).headers.common['tenant-id'] = tenantId } const params = config.params || {} const data = config.data || false From d2a4eb92547c26388d233d0a1cb3b0c9b902e85c Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 10 Nov 2022 14:38:16 +0800 Subject: [PATCH 4/7] perf: dict --- .../src/hooks/web/useVxeCrudSchemas.ts | 6 +- .../src/hooks/web/useVxeGrid.ts | 10 +- .../src/plugins/vxeTable/index.ts | 3 - .../src/views/system/dict/index.vue | 301 +++++++++--------- .../src/views/system/post/index.vue | 4 +- .../src/views/system/post/post.data.ts | 2 +- 6 files changed, 161 insertions(+), 165 deletions(-) diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts index 57db7578f..4eafbcbdb 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts @@ -121,10 +121,10 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] => props: { placeholder: t('common.selectText') } } } - const searchSchemaItem = { // 默认为 input - span: 6, + span: 8, + folding: searchSchema.length > 2, itemRender: itemRender, ...schemaItem.search, field: schemaItem.field, @@ -140,7 +140,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] => const buttons: VxeFormItemProps = { span: 24, align: 'center', - collapseNode: true, + collapseNode: searchSchema.length > 3, itemRender: { name: '$buttons', children: [ diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts index e27ed52be..c13f0ffbb 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts @@ -38,7 +38,7 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { const gridOptions = reactive({ loading: true, size: currentSize as any, - height: 800, + height: 700, rowConfig: { isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 isHover: true // 当鼠标移到行时,是否要高亮当前行 @@ -97,9 +97,11 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { } }) const delList = (ids: string | number | string[] | number[]) => { - message.delConfirm().then(() => { - config?.delListApi && config?.delListApi(ids) - message.success(t('common.delSuccess')) + return new Promise(async () => { + message.delConfirm().then(() => { + config?.delListApi && config?.delListApi(ids) + message.success(t('common.delSuccess')) + }) }) } return { diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts b/yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts index 2b5157635..1da528f70 100644 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts @@ -7,7 +7,6 @@ import enUS from 'vxe-table/lib/locale/lang/en-US' import { // 全局对象 VXETable, - // 表格功能 Filter, Edit, @@ -15,7 +14,6 @@ import { Export, Keyboard, Validator, - // 可选组件 Icon, Column, @@ -42,7 +40,6 @@ import { Modal, List, Pulldown, - // 表格 Table } from 'vxe-table' diff --git a/yudao-ui-admin-vue3/src/views/system/dict/index.vue b/yudao-ui-admin-vue3/src/views/system/dict/index.vue index 26cc911a3..f9018d6e1 100644 --- a/yudao-ui-admin-vue3/src/views/system/dict/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dict/index.vue @@ -1,3 +1,152 @@ + - - diff --git a/yudao-ui-admin-vue3/src/views/system/post/index.vue b/yudao-ui-admin-vue3/src/views/system/post/index.vue index 0f447cbf9..f1f7a7df5 100644 --- a/yudao-ui-admin-vue3/src/views/system/post/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/post/index.vue @@ -60,9 +60,9 @@