😎租户增加机构所属

This commit is contained in:
zuohuaijun 2024-10-29 03:12:23 +08:00
parent 5b967ec549
commit d50eafa55b
10 changed files with 80 additions and 30 deletions

View File

@ -88,4 +88,10 @@ public partial class SysTenant : EntityBase
/// </summary>
[SugarColumn(ColumnDescription = "过期时间")]
public DateTime? ExpirationTime { get; set; }
/// <summary>
/// 机构父Id
/// </summary>
[SugarColumn(IsIgnore = true)]
public long OrgPid { get; set; }
}

View File

@ -71,11 +71,13 @@ public class SysTenantService : IDynamicApiController, ITransient
{
Id = u.Id,
OrgId = b.Id,
OrgPid = b.Pid,
Name = b.Name,
UserId = a.Id,
AdminAccount = a.Account,
Phone = a.Phone,
Email = a.Email,
ExpirationTime = u.ExpirationTime,
TenantType = u.TenantType,
DbType = u.DbType,
Connection = u.Connection,
@ -180,7 +182,7 @@ public class SysTenantService : IDynamicApiController, ITransient
{
Id = tenantId,
TenantId = tenantId,
Pid = 0,
Pid = tenant.OrgPid,
Name = tenantName,
Code = tenantName,
Remark = tenantName,
@ -336,7 +338,7 @@ public class SysTenantService : IDynamicApiController, ITransient
await _sysTenantRep.AsUpdateable(input.Adapt<TenantOutput>()).IgnoreColumns(true).ExecuteCommandAsync();
// 更新系统机构
await _sysOrgRep.UpdateAsync(u => new SysOrg() { Name = input.Name }, u => u.Id == input.OrgId);
await _sysOrgRep.UpdateAsync(u => new SysOrg() { Name = input.Name, Pid = input.OrgPid }, u => u.Id == input.OrgId);
// 更新系统用户
await _sysUserRep.UpdateAsync(u => new SysUser() { Account = input.AdminAccount, Phone = input.Phone, Email = input.Email }, u => u.Id == input.UserId);

View File

@ -177,6 +177,14 @@ export interface AddTenantInput {
*/
expirationTime?: Date | null;
/**
* Id
*
* @type {number}
* @memberof AddTenantInput
*/
orgPid?: number;
/**
*
*

View File

@ -85,6 +85,14 @@ export interface SysOAuthUser {
*/
isDelete?: boolean;
/**
*
*
* @type {string}
* @memberof SysOAuthUser
*/
email?: string | null;
/**
* Id
*
@ -147,14 +155,6 @@ export interface SysOAuthUser {
*/
avatar?: string | null;
/**
*
*
* @type {string}
* @memberof SysOAuthUser
*/
email?: string | null;
/**
*
*

View File

@ -29,14 +29,6 @@ export interface SysRegion {
*/
id?: number;
/**
*
*
* @type {string}
* @memberof SysRegion
*/
name: string;
/**
* Id
*
@ -45,6 +37,14 @@ export interface SysRegion {
*/
pid?: number;
/**
*
*
* @type {string}
* @memberof SysRegion
*/
name: string;
/**
*
*

View File

@ -93,14 +93,6 @@ export interface SysSchedule {
*/
tenantId?: number | null;
/**
*
*
* @type {string}
* @memberof SysSchedule
*/
content: string;
/**
* Id
*
@ -133,6 +125,14 @@ export interface SysSchedule {
*/
endTime?: string | null;
/**
*
*
* @type {string}
* @memberof SysSchedule
*/
content: string;
/**
* @type {FinishStatusEnum}
* @memberof SysSchedule

View File

@ -177,6 +177,14 @@ export interface TenantOutput {
*/
expirationTime?: Date | null;
/**
* Id
*
* @type {number}
* @memberof TenantOutput
*/
orgPid?: number;
/**
*
*

View File

@ -177,6 +177,14 @@ export interface UpdateTenantInput {
*/
expirationTime?: Date | null;
/**
* Id
*
* @type {number}
* @memberof UpdateTenantInput
*/
orgPid?: number;
/**
*
*

View File

@ -17,6 +17,16 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="所属机构">
<el-cascader :options="state.orgData" :props="cascaderProps" placeholder="所属机构" clearable filterable class="w100" v-model="state.ruleForm.orgPid">
<template #default="{ node, data }">
<span>{{ data.name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="租户名称" prop="name" :rules="[{ required: true, message: '租户名称不能为空', trigger: 'blur' }]">
<el-input v-model="state.ruleForm.name" placeholder="租户名称" clearable />
@ -140,8 +150,8 @@
import { reactive, ref } from 'vue';
import { getAPI } from '/@/utils/axios-utils';
import { SysTenantApi } from '/@/api-services/api';
import { UpdateTenantInput } from '/@/api-services/models';
import { SysOrgApi, SysTenantApi } from '/@/api-services/api';
import { SysOrg, UpdateTenantInput } from '/@/api-services/models';
const props = defineProps({
title: String,
@ -151,10 +161,17 @@ const ruleFormRef = ref();
const state = reactive({
isShowDialog: false,
ruleForm: {} as UpdateTenantInput,
orgData: [] as Array<SysOrg>,
});
//
const cascaderProps = { checkStrictly: true, emitPath: false, value: 'id', label: 'name', expandTrigger: 'hover' };
//
const openDialog = (row: any) => {
const openDialog = async (row: any) => {
//
var res = await getAPI(SysOrgApi).apiSysOrgListGet(0);
state.orgData = res.data.result ?? [];
state.ruleForm = JSON.parse(JSON.stringify(row));
state.isShowDialog = true;
ruleFormRef.value?.resetFields();

View File

@ -145,8 +145,9 @@ const options = useVxeTable<TenantOutput>(
{ field: 'name', title: '租户名称', minWidth: 160, showOverflow: 'tooltip' },
{ field: 'adminAccount', title: '租管账号', minWidth: 120, showOverflow: 'tooltip' },
{ field: 'phone', title: '电话', minWidth: 120, showOverflow: 'tooltip' },
{ field: 'host', title: '主机', showOverflow: 'tooltip' },
// { field: 'host', title: '', showOverflow: 'tooltip' },
{ field: 'email', title: '邮箱', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'expirationTime', title: '过期时间', minWidth: 150, showOverflow: 'tooltip' },
{ field: 'tenantType', title: '租户类型', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_tenantType' } },
{ field: 'status', title: '状态', minWidth: 100, slots: { default: 'row_status' } },
{ field: 'dbType', title: '数据库类型', minWidth: 120, showOverflow: 'tooltip', slots: { default: 'row_dbType' } },