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); +} +