From 942c4ef389e1ced80f82002e700d1f5e1d21f748 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 6 Sep 2025 20:46:33 +0800 Subject: [PATCH] =?UTF-8?q?reactor=EF=BC=9A=E3=80=90system=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=AE=A1=E7=90=86=E3=80=91tenant=20=E8=BF=9B=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E7=BB=9F=E4=B8=80=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/system/tenant/data.ts | 20 ++++- .../src/views/system/tenant/index.vue | 53 ++++++----- .../src/views/system/tenant/modules/form.vue | 24 +---- apps/web-ele/src/views/system/tenant/data.ts | 47 +++------- .../web-ele/src/views/system/tenant/index.vue | 89 +++++++++++-------- .../src/views/system/tenant/modules/form.vue | 25 +----- 6 files changed, 112 insertions(+), 146 deletions(-) diff --git a/apps/web-antd/src/views/system/tenant/data.ts b/apps/web-antd/src/views/system/tenant/data.ts index 208092c11..2ef061026 100644 --- a/apps/web-antd/src/views/system/tenant/data.ts +++ b/apps/web-antd/src/views/system/tenant/data.ts @@ -89,10 +89,10 @@ export function useFormSchema(): VbenFormSchema[] { { label: '绑定域名', fieldName: 'websites', - component: 'Textarea', + component: 'Select', componentProps: { - placeholder: '请输入绑定域名,多个域名请换行分隔', - rows: 3, + placeholder: '请输入绑定域名', + mode: 'tags', allowClear: true, }, }, @@ -118,6 +118,7 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '租户名', component: 'Input', componentProps: { + placeholder: '请输入租户名', allowClear: true, }, }, @@ -126,6 +127,7 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '联系人', component: 'Input', componentProps: { + placeholder: '请输入联系人', allowClear: true, }, }, @@ -134,6 +136,7 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '联系手机', component: 'Input', componentProps: { + placeholder: '请输入联系手机', allowClear: true, }, }, @@ -142,6 +145,7 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '状态', component: 'Select', componentProps: { + placeholder: '请选择状态', allowClear: true, options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), }, @@ -167,14 +171,17 @@ export function useGridColumns( { field: 'id', title: '租户编号', + minWidth: 100, }, { field: 'name', title: '租户名', + minWidth: 180, }, { field: 'packageId', title: '租户套餐', + minWidth: 180, formatter: (row: { cellValue: number }) => { return getPackageName?.(row.cellValue) || '-'; }, @@ -182,27 +189,33 @@ export function useGridColumns( { field: 'contactName', title: '联系人', + minWidth: 100, }, { field: 'contactMobile', title: '联系手机', + minWidth: 180, }, { field: 'accountCount', title: '账号额度', + minWidth: 100, }, { field: 'expireTime', title: '过期时间', + minWidth: 180, formatter: 'formatDateTime', }, { field: 'websites', title: '绑定域名', + minWidth: 180, }, { field: 'status', title: '租户状态', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -211,6 +224,7 @@ export function useGridColumns( { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { diff --git a/apps/web-antd/src/views/system/tenant/index.vue b/apps/web-antd/src/views/system/tenant/index.vue index f7c3e4de8..cee574ac9 100644 --- a/apps/web-antd/src/views/system/tenant/index.vue +++ b/apps/web-antd/src/views/system/tenant/index.vue @@ -5,7 +5,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package'; import { onMounted, ref } from 'vue'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { message } from 'ant-design-vue'; @@ -39,7 +39,7 @@ const [FormModal, formModalApi] = useVbenModal({ }); /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } @@ -63,15 +63,29 @@ function handleEdit(row: SystemTenantApi.Tenant) { async function handleDelete(row: SystemTenantApi.Tenant) { const hideLoading = message.loading({ content: $t('ui.actionMessage.deleting', [row.name]), - key: 'action_key_msg', + duration: 0, }); try { await deleteTenant(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - key: 'action_key_msg', - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); + } finally { + hideLoading(); + } +} + +/** 批量删除租户 */ +async function handleDeleteBatch() { + await confirm($t('ui.actionMessage.deleteBatchConfirm')); + const hideLoading = message.loading({ + content: $t('ui.actionMessage.deletingBatch'), + duration: 0, + }); + try { + await deleteTenantList(checkedIds.value); + checkedIds.value = []; + message.success($t('ui.actionMessage.deleteSuccess')); + handleRefresh(); } finally { hideLoading(); } @@ -86,23 +100,6 @@ function handleRowCheckboxChange({ checkedIds.value = records.map((item) => item.id!); } -/** 批量删除租户 */ -async function handleDeleteBatch() { - const hideLoading = message.loading({ - content: $t('ui.actionMessage.deleting'), - duration: 0, - key: 'action_process_msg', - }); - try { - await deleteTenantList(checkedIds.value); - checkedIds.value = []; - message.success($t('ui.actionMessage.deleteSuccess')); - onRefresh(); - } finally { - hideLoading(); - } -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -148,7 +145,7 @@ onMounted(async () => { - +