From b9edb5d4932eaacea31381477909846ef348bc11 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 30 Oct 2024 15:04:12 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/workflow/category/category-modal.vue | 11 +++++++++-- apps/web-antd/src/views/workflow/category/data.ts | 2 +- apps/web-antd/src/views/workflow/category/index.vue | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/web-antd/src/views/workflow/category/category-modal.vue b/apps/web-antd/src/views/workflow/category/category-modal.vue index 9cd33e69..a5ee0498 100644 --- a/apps/web-antd/src/views/workflow/category/category-modal.vue +++ b/apps/web-antd/src/views/workflow/category/category-modal.vue @@ -3,7 +3,7 @@ import { computed, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { cloneDeep, listToTree } from '@vben/utils'; +import { cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; import { useVbenForm } from '#/adapter/form'; import { @@ -59,6 +59,7 @@ async function setupCategorySelect() { treeLine: { showLeafIcon: false }, fieldNames: { label: 'categoryName', value: 'id' }, treeDefaultExpandAll: true, + getPopupContainer, }, }, ]); @@ -74,13 +75,19 @@ const [BasicModal, modalApi] = useVbenModal({ } modalApi.modalLoading(true); - const { id } = modalApi.getData() as { id?: number | string }; + const { id, parentId } = modalApi.getData() as { + id?: number | string; + parentId?: number | string; + }; isUpdate.value = !!id; if (isUpdate.value && id) { const record = await categoryInfo(id); await formApi.setValues(record); } + if (parentId) { + await formApi.setValues({ parentId }); + } await setupCategorySelect(); modalApi.modalLoading(false); diff --git a/apps/web-antd/src/views/workflow/category/data.ts b/apps/web-antd/src/views/workflow/category/data.ts index 7eefc02c..b9b757af 100644 --- a/apps/web-antd/src/views/workflow/category/data.ts +++ b/apps/web-antd/src/views/workflow/category/data.ts @@ -33,7 +33,7 @@ export const columns: VxeGridProps['columns'] = [ fixed: 'right', slots: { default: 'action' }, title: '操作', - width: 180, + width: 200, }, ]; diff --git a/apps/web-antd/src/views/workflow/category/index.vue b/apps/web-antd/src/views/workflow/category/index.vue index e457b3af..ab506024 100644 --- a/apps/web-antd/src/views/workflow/category/index.vue +++ b/apps/web-antd/src/views/workflow/category/index.vue @@ -70,8 +70,8 @@ const [CategoryModal, modalApi] = useVbenModal({ connectedComponent: categoryModal, }); -function handleAdd() { - modalApi.setData({}); +function handleAdd(row?: Recordable) { + modalApi.setData({ parentId: row?.id }); modalApi.open(); } @@ -122,6 +122,12 @@ function collapseAll() { > {{ $t('pages.common.edit') }} + + {{ $t('pages.common.add') }} +