😎租户增加机构所属
This commit is contained in:
parent
5b967ec549
commit
d50eafa55b
@ -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; }
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -177,6 +177,14 @@ export interface AddTenantInput {
|
||||
*/
|
||||
expirationTime?: Date | null;
|
||||
|
||||
/**
|
||||
* 机构父Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof AddTenantInput
|
||||
*/
|
||||
orgPid?: number;
|
||||
|
||||
/**
|
||||
* 电子邮箱
|
||||
*
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -177,6 +177,14 @@ export interface TenantOutput {
|
||||
*/
|
||||
expirationTime?: Date | null;
|
||||
|
||||
/**
|
||||
* 机构父Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof TenantOutput
|
||||
*/
|
||||
orgPid?: number;
|
||||
|
||||
/**
|
||||
* 租户名称
|
||||
*
|
||||
|
||||
@ -177,6 +177,14 @@ export interface UpdateTenantInput {
|
||||
*/
|
||||
expirationTime?: Date | null;
|
||||
|
||||
/**
|
||||
* 机构父Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof UpdateTenantInput
|
||||
*/
|
||||
orgPid?: number;
|
||||
|
||||
/**
|
||||
* 电子邮箱
|
||||
*
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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' } },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user