From 0050cccfc85f49893d4a61d7bf867729d8468a89 Mon Sep 17 00:00:00 2001
From: WangJunZzz <510423039@qq.com>
Date: Wed, 22 May 2024 22:03:30 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=9F=E6=88=B7=E8=BF=9E=E6=8E=A5?=
=?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/DeleteConnectionStringInput.cs | 5 ++
.../Tenants/VoloTenantAppService.cs | 11 ++---
vben28/src/services/ServiceProxies.ts | 10 ++++
.../views/tenants/EditConnectionString.vue | 46 +++++++++++++++++--
vben28/src/views/tenants/Tenant.ts | 11 ++++-
5 files changed, 72 insertions(+), 11 deletions(-)
diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Tenants/Dtos/DeleteConnectionStringInput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Tenants/Dtos/DeleteConnectionStringInput.cs
index b6aad3dc..06d0ef56 100644
--- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Tenants/Dtos/DeleteConnectionStringInput.cs
+++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Tenants/Dtos/DeleteConnectionStringInput.cs
@@ -6,4 +6,9 @@ public class DeleteConnectionStringInput
/// 连接字符串名称
///
public string Name { get; set; }
+
+ ///
+ /// 租户id
+ ///
+ public Guid TenantId { get; set; }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Tenants/VoloTenantAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Tenants/VoloTenantAppService.cs
index d8e3c226..1f269678 100644
--- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Tenants/VoloTenantAppService.cs
+++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Tenants/VoloTenantAppService.cs
@@ -122,18 +122,15 @@ namespace Lion.AbpPro.BasicManagement.Tenants
public async Task DeleteConnectionStringAsync(DeleteConnectionStringInput input)
{
- if (!CurrentTenant.Id.HasValue)
- {
- throw new BusinessException(BasicManagementErrorCodes.TenantNotExist);
- }
-
- var tenant = await _tenantRepository.FindAsync(CurrentTenant.Id.Value, true);
+
+ var tenant = await _tenantRepository.FindAsync(input.TenantId, true);
if (tenant == null)
{
throw new BusinessException(BasicManagementErrorCodes.TenantNotExist);
}
- var connectionString = tenant.ConnectionStrings.FirstOrDefault(e => e.Value == input.Name);
+
+ var connectionString = tenant.ConnectionStrings.FirstOrDefault(e => e.Name == input.Name);
if (connectionString != null)
{
tenant.RemoveConnectionString(input.Name);
diff --git a/vben28/src/services/ServiceProxies.ts b/vben28/src/services/ServiceProxies.ts
index f371086d..6fae1357 100644
--- a/vben28/src/services/ServiceProxies.ts
+++ b/vben28/src/services/ServiceProxies.ts
@@ -9299,6 +9299,8 @@ export interface IDateTimeFormatDto {
export class DeleteConnectionStringInput implements IDeleteConnectionStringInput {
/** 连接字符串名称 */
name!: string | undefined;
+ /** 租户id */
+ tenantId!: string;
constructor(data?: IDeleteConnectionStringInput) {
if (data) {
@@ -9312,6 +9314,7 @@ export class DeleteConnectionStringInput implements IDeleteConnectionStringInput
init(_data?: any) {
if (_data) {
this.name = _data["name"];
+ this.tenantId = _data["tenantId"];
}
}
@@ -9325,6 +9328,7 @@ export class DeleteConnectionStringInput implements IDeleteConnectionStringInput
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
+ data["tenantId"] = this.tenantId;
return data;
}
}
@@ -9332,6 +9336,8 @@ export class DeleteConnectionStringInput implements IDeleteConnectionStringInput
export interface IDeleteConnectionStringInput {
/** 连接字符串名称 */
name: string | undefined;
+ /** 租户id */
+ tenantId: string;
}
export class DeleteDataDictionaryDetailInput implements IDeleteDataDictionaryDetailInput {
@@ -11304,6 +11310,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
success!: boolean;
tenantId!: string | undefined;
name!: string | undefined;
+ normalizedName!: string | undefined;
isActive!: boolean;
constructor(data?: IFindTenantResultDto) {
@@ -11320,6 +11327,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
this.success = _data["success"];
this.tenantId = _data["tenantId"];
this.name = _data["name"];
+ this.normalizedName = _data["normalizedName"];
this.isActive = _data["isActive"];
}
}
@@ -11336,6 +11344,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
data["success"] = this.success;
data["tenantId"] = this.tenantId;
data["name"] = this.name;
+ data["normalizedName"] = this.normalizedName;
data["isActive"] = this.isActive;
return data;
}
@@ -11345,6 +11354,7 @@ export interface IFindTenantResultDto {
success: boolean;
tenantId: string | undefined;
name: string | undefined;
+ normalizedName: string | undefined;
isActive: boolean;
}
diff --git a/vben28/src/views/tenants/EditConnectionString.vue b/vben28/src/views/tenants/EditConnectionString.vue
index 81ed0149..76af6e39 100644
--- a/vben28/src/views/tenants/EditConnectionString.vue
+++ b/vben28/src/views/tenants/EditConnectionString.vue
@@ -9,6 +9,18 @@
{{ t('common.createOrUpdateText') }}
+
+
+
+
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
-import { updateConnectionStringFormSchema, editConnectionStringtableColumns, pageConnectionStringAsync } from '/@/views/tenants/Tenant';
+import { updateConnectionStringFormSchema, editConnectionStringtableColumns, pageConnectionStringAsync, deleteConnectionString } from '/@/views/tenants/Tenant';
import { useI18n } from '/@/hooks/web/useI18n';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import CreateConnectionString from './CreateConnectionString.vue';
import { useModal } from '/@/components/Modal';
+import { useMessage } from '/@/hooks/web/useMessage';
export default defineComponent({
name: 'EditTenant',
components: {
@@ -46,7 +59,16 @@ export default defineComponent({
showTableSetting: true,
bordered: true,
canResize: true,
- showIndexColumn: true
+ showIndexColumn: true,
+ actionColumn: {
+ title: t('common.action'),
+ dataIndex: 'action',
+ slots: {
+ customRender: 'action',
+ },
+ width: 350,
+ fixed: 'right',
+ },
});
@@ -68,6 +90,23 @@ export default defineComponent({
const submit = async () => {
closeModal();
};
+
+ const { createConfirm } = useMessage();
+ // 删除
+ const handleDelete = async (record: Recordable) => {
+ console.log(record);
+ console.log(getForm().getFieldsValue().id);
+ let msg = t('common.askDelete');
+ createConfirm({
+ iconType: 'warning',
+ title: t('common.tip'),
+ content: msg,
+ onOk: async () => {
+ await deleteConnectionString(getForm().getFieldsValue().id, record.name);
+ await reload();
+ },
+ });
+ };
return {
t,
registerTable,
@@ -75,7 +114,8 @@ export default defineComponent({
submit,
registerCreateConnectionStringModal,
reload,
- handlerOpenCreateConnectionStringModal
+ handlerOpenCreateConnectionStringModal,
+ handleDelete
};
},
});
diff --git a/vben28/src/views/tenants/Tenant.ts b/vben28/src/views/tenants/Tenant.ts
index 986addd4..4d94be2f 100644
--- a/vben28/src/views/tenants/Tenant.ts
+++ b/vben28/src/views/tenants/Tenant.ts
@@ -2,7 +2,7 @@ import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
-import { TenantsServiceProxy, PagingTenantInput, IdInput, PageTenantConnectionStringInput, FeaturesServiceProxy, GetFeatureListResultInput,UpdateFeatureInput,UpdateFeaturesDto, UpdateFeatureDto} from '/@/services/ServiceProxies';
+import { TenantsServiceProxy, PagingTenantInput, IdInput, PageTenantConnectionStringInput, FeaturesServiceProxy, GetFeatureListResultInput,UpdateFeatureInput,UpdateFeaturesDto, DeleteConnectionStringInput} from '/@/services/ServiceProxies';
export const searchFormSchema: FormSchema[] = [
{
field: 'filter',
@@ -191,3 +191,12 @@ export async function updateTenantFeatureListAsync(tenantId, params) {
request.updateFeaturesDto.features=params;
return await _featuresServiceProxy.update(request);
}
+
+export async function deleteConnectionString(id, name) {
+ const _tenantsServiceProxy = new TenantsServiceProxy();
+ const request = new DeleteConnectionStringInput();
+ request.name=name;
+ request.tenantId=id;
+ return await _tenantsServiceProxy.deleteConnectionString(request);
+}
+