From 68f3ac8c79763f7c9c9e810a697ac65ea4c45a2c Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 11:38:56 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=E9=9C=80=E8=A6=81=E6=8E=92?= =?UTF-8?q?=E9=99=A4menuIds=20menuIds=E4=B8=BAstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/system/tenantPackage/tenant-package-drawer.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/system/tenantPackage/tenant-package-drawer.vue b/apps/web-antd/src/views/system/tenantPackage/tenant-package-drawer.vue index f0136b3f..fd4edbb7 100644 --- a/apps/web-antd/src/views/system/tenantPackage/tenant-package-drawer.vue +++ b/apps/web-antd/src/views/system/tenantPackage/tenant-package-drawer.vue @@ -5,6 +5,8 @@ import { useVbenDrawer } from '@vben/common-ui'; import { $t } from '@vben/locales'; import { cloneDeep, eachTree, listToTree } from '@vben/utils'; +import { omit } from 'lodash-es'; + import { useVbenForm } from '#/adapter/form'; import { menuList, tenantPackageMenuTreeSelect } from '#/api/system/menu'; import { @@ -66,7 +68,9 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({ isUpdate.value = !!id; if (isUpdate.value && id) { const record = await packageInfo(id); - await formApi.setValues(record); + // 需要排除menuIds menuIds为string + // 通过setupMenuTreeSelect设置 + await formApi.setValues(omit(record, ['menuIds'])); } /** * 加载菜单树和已勾选菜单 From a38fc307d056c901d140117e5498ce2d94ec577f Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 13:46:23 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=E8=A7=92=E8=89=B2=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E8=8F=9C=E5=8D=95=E5=88=86=E9=85=8D=20=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=8B=AC=E7=AB=8B=E4=B8=8B=E7=9A=84=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E5=8F=8A=E6=8F=90=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + apps/web-antd/src/views/system/role/data.tsx | 9 + .../src/views/system/role/menu-select.vue | 162 ------------------ 3 files changed, 10 insertions(+), 162 deletions(-) delete mode 100644 apps/web-antd/src/views/system/role/menu-select.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index b72ea5cd..125dd6d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - VxeTable在开启/关闭查询表单时 需要使用不同的padding - VxeTable表格刷新 默认为reload 修改为在当前页刷新(query) - 岗位管理 部门参数错误 +- 角色管理 菜单分配 节点独立下的回显及提交问题 **OTHERS** diff --git a/apps/web-antd/src/views/system/role/data.tsx b/apps/web-antd/src/views/system/role/data.tsx index 64761ec1..9c00056e 100644 --- a/apps/web-antd/src/views/system/role/data.tsx +++ b/apps/web-antd/src/views/system/role/data.tsx @@ -138,6 +138,15 @@ export const drawerSchema: FormSchemaGetter = () => [ label: '角色状态', rules: 'required', }, + { + component: 'Radio', + dependencies: { + show: () => false, + triggerFields: [''], + }, + fieldName: 'menuCheckStrictly', + label: '菜单权限', + }, { component: 'Input', defaultValue: [], diff --git a/apps/web-antd/src/views/system/role/menu-select.vue b/apps/web-antd/src/views/system/role/menu-select.vue deleted file mode 100644 index ef44b28b..00000000 --- a/apps/web-antd/src/views/system/role/menu-select.vue +++ /dev/null @@ -1,162 +0,0 @@ - - - From 73acf6a3c689b0078cbc35d2af3d496346de73d6 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 13:53:04 +0800 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=E7=A7=9F=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E5=A5=97=E9=A4=90=E7=AE=A1=E7=90=86=20=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E6=97=B6=E5=80=99`=E5=B7=B2=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E8=8A=82=E7=82=B9`=E6=95=B0=E9=87=8F=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../components/tree/src/tree-select-panel.vue | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 125dd6d9..7ad1a62a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - VxeTable表格刷新 默认为reload 修改为在当前页刷新(query) - 岗位管理 部门参数错误 - 角色管理 菜单分配 节点独立下的回显及提交问题 +- 租户管理 套餐管理 回显时候`已选中节点`数量为0 **OTHERS** diff --git a/apps/web-antd/src/components/tree/src/tree-select-panel.vue b/apps/web-antd/src/components/tree/src/tree-select-panel.vue index 9e2e59e0..5c9a6a81 100644 --- a/apps/web-antd/src/components/tree/src/tree-select-panel.vue +++ b/apps/web-antd/src/components/tree/src/tree-select-panel.vue @@ -74,24 +74,27 @@ const checkedRealKeys = ref<(number | string)[]>([]); * 取第一次的menuTree id 设置到checkedMenuKeys * 主要为了解决没有任何修改 直接点击保存的情况 */ -const stop = watch( - () => props.treeData, - () => { - /** 节点关联情况下是不带父节点的 */ - if (props.checkStrictly) { - /** 找到父节点 添加上 */ - const parentIds = findGroupParentIds( - props.treeData, - checkedKeys.value as any, - ); - checkedRealKeys.value = [...parentIds, ...checkedKeys.value]; - } else { - /** 节点独立 这里是全部的节点 */ - checkedRealKeys.value = checkedKeys.value; - } +const stop = watch([checkedKeys, () => props.treeData], () => { + if ( + props.checkStrictly && + checkedKeys.value.length > 0 && + props.treeData.length > 0 + ) { + /** 找到父节点 添加上 */ + const parentIds = findGroupParentIds( + props.treeData, + checkedKeys.value as any, + { id: props.fieldNames.key }, + ); + checkedRealKeys.value = [...parentIds, ...checkedKeys.value]; stop(); - }, -); + } + if (!props.checkStrictly && checkedKeys.value.length > 0) { + /** 节点独立 这里是全部的节点 */ + checkedRealKeys.value = checkedKeys.value; + stop(); + } +}); /** * From 862bbd83441fa2bd7d7c933eedba127b95389bdc Mon Sep 17 00:00:00 2001 From: pingsanddoss <33388958+pingsanddoss@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:12:33 +0800 Subject: [PATCH 04/11] fix: fix the error of closing the default analysis page on the tab page (#4720) --- packages/stores/src/modules/tabbar.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stores/src/modules/tabbar.ts b/packages/stores/src/modules/tabbar.ts index e4799bfd..53a74feb 100644 --- a/packages/stores/src/modules/tabbar.ts +++ b/packages/stores/src/modules/tabbar.ts @@ -245,11 +245,11 @@ export const useTabbarStore = defineStore('core-tabbar', { // 下一个tab存在,跳转到下一个 if (after) { - this._close(currentRoute.value); + this._close(tab); await this._goToTab(after, router); // 上一个tab存在,跳转到上一个 } else if (before) { - this._close(currentRoute.value); + this._close(tab); await this._goToTab(before, router); } else { console.error('Failed to close the tab; only one tab remains open.'); From 478fe5a0698805c0434d334c3b85b8f909dbcc20 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 15:36:31 +0800 Subject: [PATCH 05/11] fix: getPopupContainer --- apps/web-antd/src/views/system/role/data.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web-antd/src/views/system/role/data.tsx b/apps/web-antd/src/views/system/role/data.tsx index 9c00056e..2b4165e1 100644 --- a/apps/web-antd/src/views/system/role/data.tsx +++ b/apps/web-antd/src/views/system/role/data.tsx @@ -131,6 +131,7 @@ export const drawerSchema: FormSchemaGetter = () => [ componentProps: { allowClear: false, options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), + getPopupContainer, }, defaultValue: '0', fieldName: 'status', From 390ec31162df20581e368a0f0152ffc0da4b6ee2 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 17:46:19 +0800 Subject: [PATCH 06/11] chore: getPopupContainer --- apps/web-antd/src/views/system/tenant/data.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web-antd/src/views/system/tenant/data.tsx b/apps/web-antd/src/views/system/tenant/data.tsx index 9909c802..7d8f7113 100644 --- a/apps/web-antd/src/views/system/tenant/data.tsx +++ b/apps/web-antd/src/views/system/tenant/data.tsx @@ -188,6 +188,7 @@ export const drawerSchema: FormSchemaGetter = () => [ format: 'YYYY-MM-DD HH:mm:ss', showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer, }, defaultValue: defaultExpireTime, fieldName: 'expireTime', From 39e41d05be59f44858d8892f6219127b9b904f0d Mon Sep 17 00:00:00 2001 From: afe1 <2279948211@qq.com> Date: Thu, 24 Oct 2024 22:43:49 +0800 Subject: [PATCH 07/11] fix: path '/auth' is blank page (#4731) --- apps/web-antd/src/router/routes/core.ts | 3 ++- apps/web-ele/src/router/routes/core.ts | 3 ++- apps/web-naive/src/router/routes/core.ts | 3 ++- playground/src/router/routes/core.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web-antd/src/router/routes/core.ts b/apps/web-antd/src/router/routes/core.ts index 059fca62..fe030a9a 100644 --- a/apps/web-antd/src/router/routes/core.ts +++ b/apps/web-antd/src/router/routes/core.ts @@ -1,6 +1,6 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH } from '@vben/constants'; +import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; import { AuthPageLayout } from '#/layouts'; import { $t } from '#/locales'; @@ -37,6 +37,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Authentication', path: '/auth', + redirect: LOGIN_PATH, children: [ { name: 'Login', diff --git a/apps/web-ele/src/router/routes/core.ts b/apps/web-ele/src/router/routes/core.ts index 059fca62..fe030a9a 100644 --- a/apps/web-ele/src/router/routes/core.ts +++ b/apps/web-ele/src/router/routes/core.ts @@ -1,6 +1,6 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH } from '@vben/constants'; +import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; import { AuthPageLayout } from '#/layouts'; import { $t } from '#/locales'; @@ -37,6 +37,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Authentication', path: '/auth', + redirect: LOGIN_PATH, children: [ { name: 'Login', diff --git a/apps/web-naive/src/router/routes/core.ts b/apps/web-naive/src/router/routes/core.ts index 059fca62..fe030a9a 100644 --- a/apps/web-naive/src/router/routes/core.ts +++ b/apps/web-naive/src/router/routes/core.ts @@ -1,6 +1,6 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH } from '@vben/constants'; +import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; import { AuthPageLayout } from '#/layouts'; import { $t } from '#/locales'; @@ -37,6 +37,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Authentication', path: '/auth', + redirect: LOGIN_PATH, children: [ { name: 'Login', diff --git a/playground/src/router/routes/core.ts b/playground/src/router/routes/core.ts index 059fca62..fe030a9a 100644 --- a/playground/src/router/routes/core.ts +++ b/playground/src/router/routes/core.ts @@ -1,6 +1,6 @@ import type { RouteRecordRaw } from 'vue-router'; -import { DEFAULT_HOME_PATH } from '@vben/constants'; +import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; import { AuthPageLayout } from '#/layouts'; import { $t } from '#/locales'; @@ -37,6 +37,7 @@ const coreRoutes: RouteRecordRaw[] = [ }, name: 'Authentication', path: '/auth', + redirect: LOGIN_PATH, children: [ { name: 'Login', From 6688a6b3c2d9a067ef6f50ffb7ddaa5a8f03da9d Mon Sep 17 00:00:00 2001 From: Vben Date: Thu, 24 Oct 2024 22:51:04 +0800 Subject: [PATCH 08/11] feat: table grid supports setting title and helpMessage (#4732) --- apps/web-antd/src/adapter/vxe-table.ts | 6 +- apps/web-ele/src/adapter/vxe-table.ts | 6 +- apps/web-naive/src/adapter/vxe-table.ts | 6 +- internal/node-utils/package.json | 3 - .../ui-kit/popup-ui/src/modal/modal-api.ts | 2 +- .../@core/ui-kit/popup-ui/src/modal/modal.vue | 8 +- .../effects/plugins/src/vxe-table/theme.css | 1 + .../effects/plugins/src/vxe-table/types.ts | 8 + .../plugins/src/vxe-table/use-vxe-grid.vue | 71 +- playground/src/adapter/vxe-table.ts | 6 +- .../src/views/examples/vxe-table/basic.vue | 6 +- .../src/views/examples/vxe-table/remote.vue | 2 +- .../src/views/examples/vxe-table/tree.vue | 2 +- pnpm-lock.yaml | 898 ++++++++++-------- pnpm-workspace.yaml | 25 +- 15 files changed, 611 insertions(+), 439 deletions(-) diff --git a/apps/web-antd/src/adapter/vxe-table.ts b/apps/web-antd/src/adapter/vxe-table.ts index 969ec750..e47f8938 100644 --- a/apps/web-antd/src/adapter/vxe-table.ts +++ b/apps/web-antd/src/adapter/vxe-table.ts @@ -11,7 +11,10 @@ setupVbenVxeTable({ vxeUI.setConfig({ grid: { align: 'center', - border: true, + border: false, + columnConfig: { + resizable: true, + }, minHeight: 180, proxyConfig: { autoLoad: true, @@ -24,6 +27,7 @@ setupVbenVxeTable({ showResponseMsg: false, }, round: true, + showOverflow: true, size: 'small', }, }); diff --git a/apps/web-ele/src/adapter/vxe-table.ts b/apps/web-ele/src/adapter/vxe-table.ts index 177408c4..fa1f3893 100644 --- a/apps/web-ele/src/adapter/vxe-table.ts +++ b/apps/web-ele/src/adapter/vxe-table.ts @@ -11,7 +11,10 @@ setupVbenVxeTable({ vxeUI.setConfig({ grid: { align: 'center', - border: true, + border: false, + columnConfig: { + resizable: true, + }, minHeight: 180, proxyConfig: { autoLoad: true, @@ -24,6 +27,7 @@ setupVbenVxeTable({ showResponseMsg: false, }, round: true, + showOverflow: true, size: 'small', }, }); diff --git a/apps/web-naive/src/adapter/vxe-table.ts b/apps/web-naive/src/adapter/vxe-table.ts index 23c74d71..8c521da8 100644 --- a/apps/web-naive/src/adapter/vxe-table.ts +++ b/apps/web-naive/src/adapter/vxe-table.ts @@ -11,7 +11,10 @@ setupVbenVxeTable({ vxeUI.setConfig({ grid: { align: 'center', - border: true, + border: false, + columnConfig: { + resizable: true, + }, minHeight: 180, proxyConfig: { autoLoad: true, @@ -24,6 +27,7 @@ setupVbenVxeTable({ showResponseMsg: false, }, round: true, + showOverflow: true, size: 'small', }, }); diff --git a/internal/node-utils/package.json b/internal/node-utils/package.json index 4903efb7..c89343f3 100644 --- a/internal/node-utils/package.json +++ b/internal/node-utils/package.json @@ -40,8 +40,5 @@ "pkg-types": "catalog:", "prettier": "catalog:", "rimraf": "catalog:" - }, - "devDependencies": { - "@types/chalk": "catalog:" } } diff --git a/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts b/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts index 10331660..932271d8 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts +++ b/packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts @@ -29,7 +29,7 @@ export class ModalApi { } = options; const defaultState: ModalState = { - bordered: false, + bordered: true, centered: false, class: '', closeOnClickModal: true, diff --git a/packages/@core/ui-kit/popup-ui/src/modal/modal.vue b/packages/@core/ui-kit/popup-ui/src/modal/modal.vue index 33e489e2..8915dd3d 100644 --- a/packages/@core/ui-kit/popup-ui/src/modal/modal.vue +++ b/packages/@core/ui-kit/popup-ui/src/modal/modal.vue @@ -258,7 +258,13 @@ function handleFocusOutside(e: Event) { v-if="showFooter" ref="footerRef" :class=" - cn('flex-row items-center justify-end border-t p-2', footerClass) + cn( + 'flex-row items-center justify-end p-2', + { + 'border-t': bordered, + }, + footerClass, + ) " > diff --git a/packages/effects/plugins/src/vxe-table/theme.css b/packages/effects/plugins/src/vxe-table/theme.css index bfb930f6..d49b670d 100644 --- a/packages/effects/plugins/src/vxe-table/theme.css +++ b/packages/effects/plugins/src/vxe-table/theme.css @@ -8,6 +8,7 @@ /* base */ --vxe-ui-base-popup-border-color: hsl(var(--border)); + --vxe-ui-input-disabled-color: hsl(var(--border) / 60%); /* --vxe-ui-base-popup-box-shadow: 0px 12px 30px 8px rgb(0 0 0 / 50%); */ diff --git a/packages/effects/plugins/src/vxe-table/types.ts b/packages/effects/plugins/src/vxe-table/types.ts index db151e7c..8c1132d3 100644 --- a/packages/effects/plugins/src/vxe-table/types.ts +++ b/packages/effects/plugins/src/vxe-table/types.ts @@ -19,6 +19,14 @@ export interface VxePaginationInfo { } export interface VxeGridProps { + /** + * 标题 + */ + tableTitle?: string; + /** + * 标题帮助 + */ + tableTitleHelp?: string; /** * 组件class */ diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index 323c483c..7fab3b33 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -22,7 +22,7 @@ import { EmptyIcon } from '@vben/icons'; import { $t } from '@vben/locales'; import { usePreferences } from '@vben/preferences'; import { cloneDeep, cn, mergeWithArrayOverride } from '@vben/utils'; -import { VbenLoading } from '@vben-core/shadcn-ui'; +import { VbenHelpTooltip, VbenLoading } from '@vben-core/shadcn-ui'; import { VxeGrid, VxeUI } from 'vxe-table'; @@ -51,6 +51,8 @@ const { gridClass, gridEvents, formOptions, + tableTitle, + tableTitleHelp, } = usePriorityValues(props, state); const { isMobile } = usePreferences(); @@ -79,31 +81,45 @@ const [Form, formApi] = useTableForm({ wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3', }); +const showTableTitle = computed(() => { + return !!slots.tableTitle?.() || tableTitle.value; +}); + const showToolbar = computed(() => { - return !!slots['toolbar-actions']?.() || !!slots['toolbar-tools']?.(); + return ( + !!slots['toolbar-actions']?.() || + !!slots['toolbar-tools']?.() || + showTableTitle.value + ); +}); + +const toolbarOptions = computed(() => { + const slotActions = slots['toolbar-actions']?.(); + const slotTools = slots['toolbar-tools']?.(); + if (!showToolbar.value) { + return {}; + } + // 强制使用固定的toolbar配置,不允许用户自定义 + // 减少配置的复杂度,以及后续维护的成本 + return { + toolbarConfig: { + slots: { + ...(slotActions || showTableTitle.value + ? { buttons: 'toolbar-actions' } + : {}), + ...(slotTools ? { tools: 'toolbar-tools' } : {}), + }, + }, + }; }); const options = computed(() => { - const slotActions = slots['toolbar-actions']?.(); - const slotTools = slots['toolbar-tools']?.(); - const globalGridConfig = VxeUI?.getConfig()?.grid ?? {}; - const forceUseToolbarOptions = showToolbar.value - ? { - toolbarConfig: { - slots: { - ...(slotActions ? { buttons: 'toolbar-actions' } : {}), - ...(slotTools ? { tools: 'toolbar-tools' } : {}), - }, - }, - } - : {}; - const mergedOptions: VxeTableGridProps = cloneDeep( mergeWithArrayOverride( {}, - forceUseToolbarOptions, + toolbarOptions.value, toRaw(gridOptions.value), globalGridConfig, ), @@ -164,7 +180,7 @@ const delegatedSlots = computed(() => { const resultSlots: string[] = []; for (const key of Object.keys(slots)) { - if (!['empty', 'form', 'loading'].includes(key)) { + if (!['empty', 'form', 'loading', 'toolbar-actions'].includes(key)) { resultSlots.push(key); } } @@ -209,6 +225,7 @@ async function init() { extendProxyOptions(props.api, defaultGridOptions, () => formApi.form.values); } +// formOptions支持响应式 watch( formOptions, () => { @@ -251,6 +268,20 @@ onMounted(() => { v-bind="options" v-on="events" > + + + + + + + +