chore: tenant

This commit is contained in:
dap 2024-10-06 10:28:33 +08:00
parent b01ac1bca4
commit 66c2d18a4e
3 changed files with 30 additions and 1 deletions

View File

@ -134,18 +134,30 @@ export const drawerSchema: FormSchemaGetter = () => [
renderComponentContent: () => ({
default: () => '管理员信息',
}),
dependencies: {
if: (values) => !values?.tenantId,
triggerFields: ['tenantId'],
},
},
{
component: 'Input',
fieldName: 'username',
label: '用户账号',
rules: 'required',
dependencies: {
if: (values) => !values?.tenantId,
triggerFields: ['tenantId'],
},
},
{
component: 'InputPassword',
fieldName: 'password',
label: '密码',
rules: 'required',
dependencies: {
if: (values) => !values?.tenantId,
triggerFields: ['tenantId'],
},
},
{
component: 'Divider',

View File

@ -17,6 +17,7 @@ import {
tenantStatusChange,
} from '#/api/system/tenant';
import { TableSwitch } from '#/components/table';
import { useTenantStore } from '#/store/tenant';
import { downloadExcel } from '#/utils/file/download';
import { columns, querySchema } from './data';
@ -106,9 +107,12 @@ async function handleEdit(record: Recordable<any>) {
drawerApi.open();
}
const tenantStore = useTenantStore();
async function handleDelete(row: Recordable<any>) {
await tenantRemove(row.id);
await tableApi.query();
//
tenantStore.initTenant();
}
function handleMultiDelete() {
@ -122,6 +126,8 @@ function handleMultiDelete() {
await tenantRemove(ids);
await tableApi.query();
checked.value = false;
//
tenantStore.initTenant();
},
});
}
@ -130,7 +136,6 @@ const { hasAccessByCodes } = useAccess();
<template>
<Page :auto-content-height="true">
todo 新增修改删除与store同步 修改不显示密码
<BasicTable>
<template #toolbar-actions>
<span class="pl-[7px] text-[16px]">租户列表 </span>

View File

@ -11,6 +11,7 @@ import { useVbenForm } from '#/adapter';
import { clientAdd, clientUpdate } from '#/api/system/client';
import { tenantInfo } from '#/api/system/tenant';
import { packageSelectList } from '#/api/system/tenant-package';
import { useTenantStore } from '#/store/tenant';
import { drawerSchema } from './data';
@ -70,10 +71,19 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
const record = await tenantInfo(id);
await formApi.setValues(record);
}
formApi.updateSchema([
{
fieldName: 'packageId',
componentProps: {
disabled: isUpdate.value,
},
},
]);
drawerApi.drawerLoading(false);
},
});
const tenantStore = useTenantStore();
async function handleConfirm() {
try {
drawerApi.drawerLoading(true);
@ -85,6 +95,8 @@ async function handleConfirm() {
await (isUpdate.value ? clientUpdate(data) : clientAdd(data));
emit('reload');
await handleCancel();
//
tenantStore.initTenant();
} catch (error) {
console.error(error);
} finally {