Merge pull request 'aq982' (#250) from aq982 into v2
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/250
This commit is contained in:
commit
ee5a4dc1e8
@ -130,6 +130,12 @@ public partial class SysCodeGenConfig : EntityBase
|
|||||||
[MaxLength(8)]
|
[MaxLength(8)]
|
||||||
public string? WhetherSortable { get; set; }
|
public string? WhetherSortable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是统计字段
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "是否是统计字段", Length = 8)]
|
||||||
|
[MaxLength(8)]
|
||||||
|
public string? Statistical { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否是查询条件
|
/// 是否是查询条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -97,7 +97,16 @@ public static class StringExtension
|
|||||||
|
|
||||||
return char.ToLower(input[0]) + input[1..];
|
return char.ToLower(input[0]) + input[1..];
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 转首字母大写
|
||||||
|
/// </summary>
|
||||||
|
public static string ToFirstLetterUpperCase(this string input)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(input)) return input;
|
||||||
|
if (input.Length == 1) return input.ToUpper(); // 处理单字符字符串
|
||||||
|
|
||||||
|
return char.ToUpper(input[0]) + input[1..];
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 渲染字符串,替换占位符
|
/// 渲染字符串,替换占位符
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -118,6 +118,11 @@ public class CodeGenConfig
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string WhetherSortable { get; set; }
|
public string WhetherSortable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是统计字段
|
||||||
|
/// </summary>
|
||||||
|
public string Statistical { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否是查询条件
|
/// 是否是查询条件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using System.Management.Automation.Language;
|
||||||
|
|
||||||
namespace Admin.NET.Core.Service;
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -13,20 +15,200 @@ namespace Admin.NET.Core.Service;
|
|||||||
public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly CodeGenOptions _codeGenOptions;
|
||||||
|
private readonly DbConnectionOptions _dbConnectionOptions;
|
||||||
|
private readonly SysDatabaseService _databaseService;
|
||||||
|
|
||||||
public SysCodeGenConfigService(ISqlSugarClient db)
|
public SysCodeGenConfigService(ISqlSugarClient db,
|
||||||
|
SysDatabaseService databaseService,
|
||||||
|
IOptions<DbConnectionOptions> dbConnectionOptions,
|
||||||
|
IOptions<CodeGenOptions> codeGenOptions)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
|
_dbConnectionOptions = dbConnectionOptions.Value;
|
||||||
|
_codeGenOptions = codeGenOptions.Value;
|
||||||
|
_databaseService = databaseService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数据表列(实体属性)集合
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ColumnOuput> GetColumnList([FromQuery] AddCodeGenInput input)
|
||||||
|
{
|
||||||
|
return GetColumnList(input.TableName, input.ConfigId);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数据表列(实体属性)集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="EntityName"></param>
|
||||||
|
/// <param name="ConfigId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ColumnOuput> GetColumnList(string EntityName, string ConfigId)
|
||||||
|
{
|
||||||
|
var entityType = GetEntityInfos().GetAwaiter().GetResult().FirstOrDefault(u => u.EntityName == EntityName);
|
||||||
|
|
||||||
|
if (entityType == null)
|
||||||
|
return null;
|
||||||
|
var config = _dbConnectionOptions.ConnectionConfigs.FirstOrDefault(u => u.ConfigId.ToString() == ConfigId);
|
||||||
|
var dbTableName = config!.DbSettings.EnableUnderLine ? UtilMethods.ToUnderLine(entityType.DbTableName) : entityType.DbTableName;
|
||||||
|
|
||||||
|
int bracketIndex = dbTableName.IndexOf('{');
|
||||||
|
if (bracketIndex != -1)
|
||||||
|
{
|
||||||
|
dbTableName = dbTableName.Substring(0, bracketIndex);
|
||||||
|
var dbTableInfos = _db.AsTenant().GetConnectionScope(ConfigId).DbMaintenance.GetTableInfoList(false);
|
||||||
|
var table = dbTableInfos.FirstOrDefault(x => x.Name.StartsWith(config.DbSettings.EnableUnderLine ? UtilMethods.ToUnderLine(dbTableName) : dbTableName, StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
if (table != null)
|
||||||
|
dbTableName = table.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切库---多库代码生成用
|
||||||
|
var provider = _db.AsTenant().GetConnectionScope(!string.IsNullOrEmpty(ConfigId) ? ConfigId : SqlSugarConst.MainConfigId);
|
||||||
|
|
||||||
|
var entityBasePropertyNames = _codeGenOptions.EntityBaseColumn[nameof(EntityTenant)];
|
||||||
|
var columnInfos = provider.DbMaintenance.GetColumnInfosByTableName(dbTableName, false);
|
||||||
|
var result = columnInfos.Select(u => new ColumnOuput
|
||||||
|
{
|
||||||
|
// 转下划线后的列名需要再转回来(暂时不转)
|
||||||
|
//ColumnName = config.DbSettings.EnableUnderLine ? CodeGenUtil.CamelColumnName(u.DbColumnName, entityBasePropertyNames) : u.DbColumnName,
|
||||||
|
ColumnName = u.DbColumnName,
|
||||||
|
ColumnLength = u.Length,
|
||||||
|
IsPrimarykey = u.IsPrimarykey,
|
||||||
|
IsNullable = u.IsNullable,
|
||||||
|
ColumnKey = u.IsPrimarykey.ToString(),
|
||||||
|
NetType = CodeGenUtil.ConvertDataType(u, provider.CurrentConnectionConfig.DbType),
|
||||||
|
DataType = u.DataType,
|
||||||
|
ColumnComment = string.IsNullOrWhiteSpace(u.ColumnDescription) ? u.DbColumnName : u.ColumnDescription,
|
||||||
|
DefaultValue = u.DefaultValue,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// 获取实体的属性信息,赋值给PropertyName属性(CodeFirst模式应以PropertyName为实际使用名称)
|
||||||
|
var entityProperties = entityType.Type.GetProperties();
|
||||||
|
|
||||||
|
for (int i = result.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var columnOutput = result[i];
|
||||||
|
// 先找自定义字段名的,如果找不到就再找自动生成字段名的(并且过滤掉没有SugarColumn的属性)
|
||||||
|
var propertyInfo = entityProperties.FirstOrDefault(u => (u.GetCustomAttribute<SugarColumn>()?.ColumnName ?? "").ToLower() == columnOutput.ColumnName.ToLower()) ??
|
||||||
|
entityProperties.FirstOrDefault(u => u.GetCustomAttribute<SugarColumn>() != null && u.Name.ToLower() == (config.DbSettings.EnableUnderLine
|
||||||
|
? CodeGenUtil.CamelColumnName(columnOutput.ColumnName, entityBasePropertyNames).ToLower()
|
||||||
|
: columnOutput.ColumnName.ToLower()));
|
||||||
|
if (propertyInfo != null)
|
||||||
|
{
|
||||||
|
columnOutput.PropertyName = propertyInfo.Name;
|
||||||
|
columnOutput.ColumnComment = propertyInfo.GetCustomAttribute<SugarColumn>()!.ColumnDescription;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.RemoveAt(i); // 移除没有定义此属性的字段
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取库表信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="excludeSysTable">是否排除带SysTable属性的表</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<EntityInfo>> GetEntityInfos(bool excludeSysTable = false)
|
||||||
|
{
|
||||||
|
var types = new List<Type>();
|
||||||
|
if (_codeGenOptions.EntityAssemblyNames != null)
|
||||||
|
{
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
foreach (var assembly in assemblies)
|
||||||
|
{
|
||||||
|
var assemblyName = assembly.GetName().Name!;
|
||||||
|
if (_codeGenOptions.EntityAssemblyNames.Contains(assemblyName) || _codeGenOptions.EntityAssemblyNames.Any(name => assemblyName.Contains(name)))
|
||||||
|
{
|
||||||
|
Assembly asm = Assembly.Load(assemblyName);
|
||||||
|
types.AddRange(asm.GetExportedTypes().ToList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var sugarTableType = typeof(SugarTable);
|
||||||
|
bool IsMyAttribute(Attribute[] o)
|
||||||
|
{
|
||||||
|
foreach (Attribute a in o)
|
||||||
|
{
|
||||||
|
if (a.GetType() == sugarTableType)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Type[] cosType = types.Where(u => IsMyAttribute(Attribute.GetCustomAttributes(u, false))).ToArray();
|
||||||
|
|
||||||
|
var entityInfos = new List<EntityInfo>();
|
||||||
|
foreach (var ct in cosType)
|
||||||
|
{
|
||||||
|
// 若实体贴[SysTable]特性,则禁止显示系统自带的
|
||||||
|
if (excludeSysTable && ct.IsDefined(typeof(SysTableAttribute), false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var des = ct.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||||
|
var description = des.Length > 0 ? ((DescriptionAttribute)des[0]).Description : "";
|
||||||
|
|
||||||
|
var sugarAttribute = ct.GetCustomAttributes(sugarTableType, true).FirstOrDefault();
|
||||||
|
|
||||||
|
entityInfos.Add(new EntityInfo()
|
||||||
|
{
|
||||||
|
EntityName = ct.Name,
|
||||||
|
DbTableName = sugarAttribute == null ? ct.Name : ((SugarTable)sugarAttribute).TableName,
|
||||||
|
TableDescription = sugarAttribute == null ? description : ((SugarTable)sugarAttribute).TableDescription,
|
||||||
|
Type = ct
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return await Task.FromResult(entityInfos);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取代码生成配置列表 🔖
|
/// 获取代码生成配置列表 🔖
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
|
/// <param name="EntityName"></param>
|
||||||
|
/// <param name="ConfigId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("获取代码生成配置列表")]
|
[DisplayName("获取代码生成配置列表")]
|
||||||
public async Task<List<CodeGenConfig>> GetList([FromQuery] CodeGenConfig input)
|
public async Task<List<CodeGenConfig>> GetList([FromQuery] CodeGenConfig input)
|
||||||
{
|
{
|
||||||
|
//获取主表
|
||||||
|
var CodeGen = _db.Queryable<SysCodeGen>().Single(it => it.Id == input.CodeGenId); //根据ID查询
|
||||||
|
//先获取已经存储的配置字段
|
||||||
|
var list = await _db.Queryable<SysCodeGenConfig>()
|
||||||
|
.Where(u => u.CodeGenId == input.CodeGenId).ToListAsync();
|
||||||
|
|
||||||
|
//找出实体字段
|
||||||
|
var ColumnList = GetColumnList(CodeGen.TableName, CodeGen.ConfigId);
|
||||||
|
//找出新增的字段
|
||||||
|
var addColumnList = ColumnList.Where(t => !list.Select(d => d.ColumnName).Contains(t.ColumnName)).ToList();
|
||||||
|
//找出已经删除的字段
|
||||||
|
var delColumnList = list.Where(t => !ColumnList.Select(d => d.ColumnName).Contains(t.ColumnName)).ToList();
|
||||||
|
//找出更新的
|
||||||
|
var updateColumnList =new List<SysCodeGenConfig>();
|
||||||
|
foreach (var column in list)
|
||||||
|
{
|
||||||
|
//找出没有增减的
|
||||||
|
if (ColumnList.Any(it => it.ColumnName == column.ColumnName))
|
||||||
|
{
|
||||||
|
var nmd = ColumnList.Single(it => it.ColumnName == column.ColumnName);
|
||||||
|
//如果数据库类型或者长度改变
|
||||||
|
if (nmd.NetType != column.NetType || nmd.ColumnLength != column.ColumnLength || nmd.ColumnComment != column.ColumnComment)
|
||||||
|
{
|
||||||
|
column.NetType = nmd.NetType;
|
||||||
|
column.ColumnLength = nmd.ColumnLength;
|
||||||
|
column.ColumnComment = nmd.ColumnComment;
|
||||||
|
updateColumnList.Add(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//增加新增
|
||||||
|
if(addColumnList.Count>0) AddList(addColumnList, CodeGen);
|
||||||
|
//删除没有的
|
||||||
|
if (delColumnList.Count > 0) await _db.Deleteable(delColumnList).ExecuteCommandAsync();
|
||||||
|
//更新
|
||||||
|
if (updateColumnList.Count > 0) await _db.Updateable(updateColumnList).ExecuteCommandAsync();
|
||||||
|
//重新获取
|
||||||
return await _db.Queryable<SysCodeGenConfig>()
|
return await _db.Queryable<SysCodeGenConfig>()
|
||||||
.Where(u => u.CodeGenId == input.CodeGenId)
|
.Where(u => u.CodeGenId == input.CodeGenId)
|
||||||
.Select<CodeGenConfig>()
|
.Select<CodeGenConfig>()
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
.ExecuteReturnEntityAsync();
|
.ExecuteReturnEntityAsync();
|
||||||
|
|
||||||
// 增加配置表
|
// 增加配置表
|
||||||
_codeGenConfigService.AddList(GetColumnList(input), newCodeGen);
|
_codeGenConfigService.AddList(_codeGenConfigService.GetColumnList(input), newCodeGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -108,9 +108,10 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("更新代码生成")]
|
[DisplayName("更新代码生成")]
|
||||||
public async Task UpdateCodeGen(UpdateCodeGenInput input)
|
public async Task UpdateCodeGen(UpdateCodeGenInput input)
|
||||||
{
|
{
|
||||||
var isExist = await _db.Queryable<SysCodeGen>().AnyAsync(u => u.TableName == input.TableName && u.Id != input.Id);
|
//开发阶段不断生成调整
|
||||||
if (isExist)
|
//var isExist = await _db.Queryable<SysCodeGen>().AnyAsync(u => u.TableName == input.TableName && u.Id != input.Id);
|
||||||
throw Oops.Oh(ErrorCodeEnum.D1400);
|
//if (isExist)
|
||||||
|
// throw Oops.Oh(ErrorCodeEnum.D1400);
|
||||||
|
|
||||||
var codeGen = input.Adapt<SysCodeGen>();
|
var codeGen = input.Adapt<SysCodeGen>();
|
||||||
var templateRelations = GetCodeGenTemplateRelation(codeGen.Id, input.CodeGenTemplateIds);
|
var templateRelations = GetCodeGenTemplateRelation(codeGen.Id, input.CodeGenTemplateIds);
|
||||||
@ -121,7 +122,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
// 更新配置表
|
// 更新配置表
|
||||||
_codeGenConfigService.AddList(GetColumnList(input.Adapt<AddCodeGenInput>()), codeGen);
|
_codeGenConfigService.AddList(_codeGenConfigService.GetColumnList(input.Adapt<AddCodeGenInput>()), codeGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -183,7 +184,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
var config = _dbConnectionOptions.ConnectionConfigs.FirstOrDefault(u => configId.Equals(u.ConfigId));
|
var config = _dbConnectionOptions.ConnectionConfigs.FirstOrDefault(u => configId.Equals(u.ConfigId));
|
||||||
|
|
||||||
IEnumerable<EntityInfo> entityInfos = await GetEntityInfos(); // 获取所有实体定义
|
IEnumerable<EntityInfo> entityInfos = await _codeGenConfigService.GetEntityInfos(); // 获取所有实体定义
|
||||||
entityInfos = entityInfos.OrderBy(u => u.EntityName.StartsWith("Sys") ? 1 : 0).ThenBy(u => u.EntityName);
|
entityInfos = entityInfos.OrderBy(u => u.EntityName.StartsWith("Sys") ? 1 : 0).ThenBy(u => u.EntityName);
|
||||||
|
|
||||||
var tableOutputList = new List<TableOutput>();
|
var tableOutputList = new List<TableOutput>();
|
||||||
@ -228,7 +229,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
var entityBasePropertyNames = _codeGenOptions.EntityBaseColumn[nameof(EntityTenant)];
|
var entityBasePropertyNames = _codeGenOptions.EntityBaseColumn[nameof(EntityTenant)];
|
||||||
|
|
||||||
tableName = GetRealTableName(tableName);
|
tableName = GetRealTableName(tableName);
|
||||||
var properties = GetEntityInfos().Result.First(u => GetRealTableName(u.DbTableName).EqualIgnoreCase(tableName)).Type.GetProperties()
|
var properties = _codeGenConfigService.GetEntityInfos().Result.First(u => GetRealTableName(u.DbTableName).EqualIgnoreCase(tableName)).Type.GetProperties()
|
||||||
.Where(u => u.GetCustomAttribute<SugarColumn>()?.IsIgnore == false).Select(u => new
|
.Where(u => u.GetCustomAttribute<SugarColumn>()?.IsIgnore == false).Select(u => new
|
||||||
{
|
{
|
||||||
PropertyName = u.Name,
|
PropertyName = u.Name,
|
||||||
@ -269,128 +270,6 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取数据表列(实体属性)集合
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
private List<ColumnOuput> GetColumnList([FromQuery] AddCodeGenInput input)
|
|
||||||
{
|
|
||||||
var entityType = GetEntityInfos().GetAwaiter().GetResult().FirstOrDefault(u => u.EntityName == input.TableName);
|
|
||||||
if (entityType == null)
|
|
||||||
return null;
|
|
||||||
var config = _dbConnectionOptions.ConnectionConfigs.FirstOrDefault(u => u.ConfigId.ToString() == input.ConfigId);
|
|
||||||
var dbTableName = config!.DbSettings.EnableUnderLine ? UtilMethods.ToUnderLine(entityType.DbTableName) : entityType.DbTableName;
|
|
||||||
|
|
||||||
int bracketIndex = dbTableName.IndexOf('{');
|
|
||||||
if (bracketIndex != -1)
|
|
||||||
{
|
|
||||||
dbTableName = dbTableName.Substring(0, bracketIndex);
|
|
||||||
var dbTableInfos = _db.AsTenant().GetConnectionScope(input.ConfigId).DbMaintenance.GetTableInfoList(false);
|
|
||||||
var table = dbTableInfos.FirstOrDefault(x => x.Name.StartsWith(config.DbSettings.EnableUnderLine ? UtilMethods.ToUnderLine(dbTableName) : dbTableName, StringComparison.CurrentCultureIgnoreCase));
|
|
||||||
if (table != null)
|
|
||||||
dbTableName = table.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 切库---多库代码生成用
|
|
||||||
var provider = _db.AsTenant().GetConnectionScope(!string.IsNullOrEmpty(input.ConfigId) ? input.ConfigId : SqlSugarConst.MainConfigId);
|
|
||||||
|
|
||||||
var entityBasePropertyNames = _codeGenOptions.EntityBaseColumn[nameof(EntityTenant)];
|
|
||||||
var columnInfos = provider.DbMaintenance.GetColumnInfosByTableName(dbTableName, false);
|
|
||||||
var result = columnInfos.Select(u => new ColumnOuput
|
|
||||||
{
|
|
||||||
// 转下划线后的列名需要再转回来(暂时不转)
|
|
||||||
//ColumnName = config.DbSettings.EnableUnderLine ? CodeGenUtil.CamelColumnName(u.DbColumnName, entityBasePropertyNames) : u.DbColumnName,
|
|
||||||
ColumnName = u.DbColumnName,
|
|
||||||
ColumnLength = u.Length,
|
|
||||||
IsPrimarykey = u.IsPrimarykey,
|
|
||||||
IsNullable = u.IsNullable,
|
|
||||||
ColumnKey = u.IsPrimarykey.ToString(),
|
|
||||||
NetType = CodeGenUtil.ConvertDataType(u, provider.CurrentConnectionConfig.DbType),
|
|
||||||
DataType = u.DataType,
|
|
||||||
ColumnComment = string.IsNullOrWhiteSpace(u.ColumnDescription) ? u.DbColumnName : u.ColumnDescription,
|
|
||||||
DefaultValue = u.DefaultValue,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
// 获取实体的属性信息,赋值给PropertyName属性(CodeFirst模式应以PropertyName为实际使用名称)
|
|
||||||
var entityProperties = entityType.Type.GetProperties();
|
|
||||||
|
|
||||||
for (int i = result.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
var columnOutput = result[i];
|
|
||||||
// 先找自定义字段名的,如果找不到就再找自动生成字段名的(并且过滤掉没有SugarColumn的属性)
|
|
||||||
var propertyInfo = entityProperties.FirstOrDefault(u => (u.GetCustomAttribute<SugarColumn>()?.ColumnName ?? "").ToLower() == columnOutput.ColumnName.ToLower()) ??
|
|
||||||
entityProperties.FirstOrDefault(u => u.GetCustomAttribute<SugarColumn>() != null && u.Name.ToLower() == (config.DbSettings.EnableUnderLine
|
|
||||||
? CodeGenUtil.CamelColumnName(columnOutput.ColumnName, entityBasePropertyNames).ToLower()
|
|
||||||
: columnOutput.ColumnName.ToLower()));
|
|
||||||
if (propertyInfo != null)
|
|
||||||
{
|
|
||||||
columnOutput.PropertyName = propertyInfo.Name;
|
|
||||||
columnOutput.ColumnComment = propertyInfo.GetCustomAttribute<SugarColumn>()!.ColumnDescription;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.RemoveAt(i); // 移除没有定义此属性的字段
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取库表信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="excludeSysTable">是否排除带SysTable属性的表</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<IEnumerable<EntityInfo>> GetEntityInfos(bool excludeSysTable = false)
|
|
||||||
{
|
|
||||||
var types = new List<Type>();
|
|
||||||
if (_codeGenOptions.EntityAssemblyNames != null)
|
|
||||||
{
|
|
||||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
||||||
foreach (var assembly in assemblies)
|
|
||||||
{
|
|
||||||
var assemblyName = assembly.GetName().Name!;
|
|
||||||
if (_codeGenOptions.EntityAssemblyNames.Contains(assemblyName) || _codeGenOptions.EntityAssemblyNames.Any(name => assemblyName.Contains(name)))
|
|
||||||
{
|
|
||||||
Assembly asm = Assembly.Load(assemblyName);
|
|
||||||
types.AddRange(asm.GetExportedTypes().ToList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var sugarTableType = typeof(SugarTable);
|
|
||||||
bool IsMyAttribute(Attribute[] o)
|
|
||||||
{
|
|
||||||
foreach (Attribute a in o)
|
|
||||||
{
|
|
||||||
if (a.GetType() == sugarTableType)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Type[] cosType = types.Where(u => IsMyAttribute(Attribute.GetCustomAttributes(u, false))).ToArray();
|
|
||||||
|
|
||||||
var entityInfos = new List<EntityInfo>();
|
|
||||||
foreach (var ct in cosType)
|
|
||||||
{
|
|
||||||
// 若实体贴[SysTable]特性,则禁止显示系统自带的
|
|
||||||
if (excludeSysTable && ct.IsDefined(typeof(SysTableAttribute), false))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var des = ct.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
|
||||||
var description = des.Length > 0 ? ((DescriptionAttribute)des[0]).Description : "";
|
|
||||||
|
|
||||||
var sugarAttribute = ct.GetCustomAttributes(sugarTableType, true).FirstOrDefault();
|
|
||||||
|
|
||||||
entityInfos.Add(new EntityInfo()
|
|
||||||
{
|
|
||||||
EntityName = ct.Name,
|
|
||||||
DbTableName = sugarAttribute == null ? ct.Name : ((SugarTable)sugarAttribute).TableName,
|
|
||||||
TableDescription = sugarAttribute == null ? description : ((SugarTable)sugarAttribute).TableDescription,
|
|
||||||
Type = ct
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return await Task.FromResult(entityInfos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取程序保存位置 🔖
|
/// 获取程序保存位置 🔖
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -442,6 +321,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
.Replace("{TableNameLower}", input.TableName?.ToFirstLetterLowerCase() ?? "");
|
.Replace("{TableNameLower}", input.TableName?.ToFirstLetterLowerCase() ?? "");
|
||||||
|
|
||||||
string tmpPath;
|
string tmpPath;
|
||||||
|
|
||||||
if (!input.GenerateType.StartsWith('1'))
|
if (!input.GenerateType.StartsWith('1'))
|
||||||
{
|
{
|
||||||
if (templateList[i].Type == CodeGenTypeEnum.Frontend)
|
if (templateList[i].Type == CodeGenTypeEnum.Frontend)
|
||||||
@ -599,7 +479,8 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
if (filename == "web_views_index.vue.vm")
|
if (filename == "web_views_index.vue.vm")
|
||||||
{
|
{
|
||||||
filename = string.IsNullOrEmpty(input.LeftTab) ? filename : "web_views_LeftTree.vue.vm"; // 左树右列表
|
filename = string.IsNullOrEmpty(input.LeftTab) ? filename : "web_views_LeftTree.vue.vm"; // 左树右列表
|
||||||
filename = string.IsNullOrEmpty(input.BottomTab) ? filename : "web_views_BottomIndx.vue.vm"; // 左数右上列表下列表属性
|
filename = (!string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_BottomIndx.vue.vm" : filename; // 左树右上列表下列表属性
|
||||||
|
filename = (string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_UDIndx.vue.vm" : filename; // 右上列表下列表属性
|
||||||
}
|
}
|
||||||
var templateFilePath = Path.Combine(templatePath, filename);
|
var templateFilePath = Path.Combine(templatePath, filename);
|
||||||
if (!File.Exists(templateFilePath)) return null;
|
if (!File.Exists(templateFilePath)) return null;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
using Admin.NET.Core;
|
||||||
|
|
||||||
namespace Admin.NET.Core.Service;
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
@ -271,6 +272,36 @@ public class SysDatabaseService : IDynamicApiController, ITransient
|
|||||||
[ApiDescriptionSettings(Name = "CreateEntity"), HttpPost]
|
[ApiDescriptionSettings(Name = "CreateEntity"), HttpPost]
|
||||||
[DisplayName("创建实体")]
|
[DisplayName("创建实体")]
|
||||||
public void CreateEntity(CreateEntityInput input)
|
public void CreateEntity(CreateEntityInput input)
|
||||||
|
{
|
||||||
|
var tResult = GenerateEntity(input);
|
||||||
|
var targetPath = GetEntityTargetPath(input);
|
||||||
|
File.WriteAllText(targetPath, tResult, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建实体文件内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ConfigId"></param>
|
||||||
|
/// <param name="TableName"></param>
|
||||||
|
/// <param name="Position"></param>
|
||||||
|
/// <param name="BaseClassName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GenerateEntity(string ConfigId, string TableName, string Position, string BaseClassName)
|
||||||
|
{
|
||||||
|
var input = new CreateEntityInput();
|
||||||
|
input.TableName = TableName;
|
||||||
|
input.EntityName = TableName.ToFirstLetterUpperCase();
|
||||||
|
input.ConfigId = ConfigId;
|
||||||
|
input.Position = string.IsNullOrWhiteSpace(Position) ? "Admin.NET.Application" : Position;
|
||||||
|
input.BaseClassName = string.IsNullOrWhiteSpace(BaseClassName) ? "EntityBaseId" : BaseClassName;
|
||||||
|
return GenerateEntity(input);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 创建实体文件内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GenerateEntity(CreateEntityInput input)
|
||||||
{
|
{
|
||||||
var config = App.GetOptions<DbConnectionOptions>().ConnectionConfigs.FirstOrDefault(u => u.ConfigId.ToString() == input.ConfigId);
|
var config = App.GetOptions<DbConnectionOptions>().ConnectionConfigs.FirstOrDefault(u => u.ConfigId.ToString() == input.ConfigId);
|
||||||
input.Position = string.IsNullOrWhiteSpace(input.Position) ? "Admin.NET.Application" : input.Position;
|
input.Position = string.IsNullOrWhiteSpace(input.Position) ? "Admin.NET.Application" : input.Position;
|
||||||
@ -307,8 +338,8 @@ public class SysDatabaseService : IDynamicApiController, ITransient
|
|||||||
Description = string.IsNullOrWhiteSpace(dbTableInfo.Description) ? input.EntityName + "业务表" : dbTableInfo.Description,
|
Description = string.IsNullOrWhiteSpace(dbTableInfo.Description) ? input.EntityName + "业务表" : dbTableInfo.Description,
|
||||||
TableField = dbColumnInfos
|
TableField = dbColumnInfos
|
||||||
});
|
});
|
||||||
var targetPath = GetEntityTargetPath(input);
|
|
||||||
File.WriteAllText(targetPath, tResult, Encoding.UTF8);
|
return tResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -0,0 +1,91 @@
|
|||||||
|
@{
|
||||||
|
string LowerFirstLetter(string text)
|
||||||
|
{
|
||||||
|
return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
|
||||||
|
}
|
||||||
|
var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();
|
||||||
|
string pkFieldName = null;
|
||||||
|
if(pkField != null && !string.IsNullOrEmpty(pkField.PropertyName))
|
||||||
|
{
|
||||||
|
pkFieldName = LowerFirstLetter(pkField.PropertyName);
|
||||||
|
}
|
||||||
|
Dictionary<string, int> definedObjects = new Dictionary<string, int>();
|
||||||
|
bool haveLikeCdt = false;
|
||||||
|
foreach (var column in Model.TableField){
|
||||||
|
if (column.QueryWhether == "Y" && column.QueryType == "like"){
|
||||||
|
haveLikeCdt = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<template>
|
||||||
|
<div class="@(@Model.LowerClassName)-container">
|
||||||
|
|
||||||
|
<splitpanes horizontal class="default-theme">
|
||||||
|
<pane size="60" style="display: flex;flex-direction: column;">
|
||||||
|
<IndexList ref="indexListRef" @@list-click="handleIndexChange" />
|
||||||
|
</pane>
|
||||||
|
<pane size="40" style="display: flex; flex-direction: column;">
|
||||||
|
|
||||||
|
<el-tabs v-model="activeName" type="border-card"
|
||||||
|
style="height: 100%; padding: 0px; margin-bottom: 0px; position: relative">
|
||||||
|
<el-tab-pane label="属性1" name="1" style="height: 100%; margin-bottom: 0px; position: relative">
|
||||||
|
<@(@Model.BottomTab)Bottom ref="@(@Model.LowerBottomTab)BottomRef" @@list-click="handleBottomChange" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="属性2" name="2" style="height: 100%; margin-bottom: 0px; position: relative">
|
||||||
|
<div></div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</pane>
|
||||||
|
</splitpanes>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="@(@Model.LowerClassName)">
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
|
import { Splitpanes, Pane } from 'splitpanes';
|
||||||
|
import 'splitpanes/dist/splitpanes.css';
|
||||||
|
|
||||||
|
import IndexList from '/@@/views/@(@Model.PagePath)/@(@Model.LowerClassName)/component/@(@Model.LowerClassName)List.vue';
|
||||||
|
import @(@Model.BottomTab)Bottom from '/@@/views/@(@Model.PagePath)/@(@Model.LowerBottomTab)/component/@(@Model.LowerBottomTab)List.vue';
|
||||||
|
const indexListRef = ref<InstanceType<typeof IndexList>>();
|
||||||
|
const @(@Model.LowerBottomTab)BottomRef = ref<InstanceType<typeof @(@Model.BottomTab)Bottom>>();
|
||||||
|
const activeName = ref('1');
|
||||||
|
// 变量
|
||||||
|
const state = reactive({
|
||||||
|
queryParams: {
|
||||||
|
searchKey: undefined,
|
||||||
|
@if(Model.QueryWhetherList.Count > 0) {
|
||||||
|
@foreach (var column in Model.QueryWhetherList) {
|
||||||
|
@:@(@column.LowerPropertyName): undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// 页面初始化
|
||||||
|
onMounted(() => {
|
||||||
|
indexListRef.value?.listhandleQuery(state.queryParams);//列表控件初始化不请求数据,这里要请求一下
|
||||||
|
});
|
||||||
|
|
||||||
|
// 主表List组件点击
|
||||||
|
const handleIndexChange = async (row: any,column: any) => {
|
||||||
|
console.log('handleIndexChange--', JSON.stringify(row));
|
||||||
|
state.queryParams.@(@Model.LowerBottomKey) = row.@(@Model.LowerBottomPrimaryKey);//下关联字段=下表主表关联字段
|
||||||
|
console.log('handleIndexChange--', state.queryParams.@(@Model.LowerBottomKey));
|
||||||
|
await @(@Model.LowerBottomTab)BottomRef.value?.listhandleQuery(state.queryParams);
|
||||||
|
};
|
||||||
|
const handleBottomChange = async (row: any) => {
|
||||||
|
console.log('handleBottomChange--', JSON.stringify(row));
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-input),
|
||||||
|
:deep(.el-select),
|
||||||
|
:deep(.el-input-number) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
:deep(.el-slider .el-input-number){
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-codeGenConfig-container">
|
<div class="sys-codeGenConfig-container">
|
||||||
<vxe-modal v-model="state.isShowDialog" title="生成配置" :width="800" :height="350" show-footer show-zoom resize fullscreen @close="cancel">
|
<vxe-modal v-model="state.isShowDialog" title="生成配置" :width="800" :height="350" show-footer show-zoom resize
|
||||||
|
fullscreen @close="cancel">
|
||||||
<template #default>
|
<template #default>
|
||||||
<vxe-grid ref="xGrid" class="xGrid-table-style" v-bind="options">
|
<vxe-grid ref="xGrid" class="xGrid-table-style" v-bind="options">
|
||||||
<template #drag_default="{}">
|
<template #drag_default="{}">
|
||||||
@ -9,17 +10,23 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #effectType="{ row, $index }">
|
<template #effectType="{ row, $index }">
|
||||||
<vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select" transfer :disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable>
|
<vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select"
|
||||||
<vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
transfer :disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable>
|
||||||
|
<vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value"
|
||||||
|
:value="item.code" />
|
||||||
</vxe-select>
|
</vxe-select>
|
||||||
<vxe-button v-if="row.effectType === 'ApiTreeSelector' || row.effectType === 'ForeignKey'" style="width: 30%" icon="vxe-icon-edit" @click="effectTypeChange(row, $index)">修改</vxe-button>
|
<vxe-button v-if="row.effectType === 'ApiTreeSelector' || row.effectType === 'ForeignKey'"
|
||||||
|
style="width: 30%" icon="vxe-icon-edit"
|
||||||
|
@click="effectTypeChange(row, $index)">修改</vxe-button>
|
||||||
</template>
|
</template>
|
||||||
<template #columnComment="{ row }">
|
<template #columnComment="{ row }">
|
||||||
<vxe-input v-model="row.columnComment" autocomplete="off" />
|
<vxe-input v-model="row.columnComment" autocomplete="off" />
|
||||||
</template>
|
</template>
|
||||||
<template #dictType="{ row }">
|
<template #dictType="{ row }">
|
||||||
<vxe-select v-model="row.dictTypeCode" class="m-2" :disabled="effectTypeEnable(row)" filterable transfer>
|
<vxe-select v-model="row.dictTypeCode" class="m-2" :disabled="effectTypeEnable(row)" filterable
|
||||||
<vxe-option v-for="item in state.dictTypeCodeList" :key="item.code" :label="item.name" :value="item.code" />
|
transfer>
|
||||||
|
<vxe-option v-for="item in state.dictTypeCodeList" :key="item.code" :label="item.name"
|
||||||
|
:value="item.code" />
|
||||||
</vxe-select>
|
</vxe-select>
|
||||||
</template>
|
</template>
|
||||||
<template #whetherTable="{ row }">
|
<template #whetherTable="{ row }">
|
||||||
@ -35,16 +42,24 @@
|
|||||||
<vxe-tag v-if="row.whetherRequired" status="success">是</vxe-tag>
|
<vxe-tag v-if="row.whetherRequired" status="success">是</vxe-tag>
|
||||||
<vxe-tag v-else status="info">否</vxe-tag>
|
<vxe-tag v-else status="info">否</vxe-tag>
|
||||||
</template>
|
</template>
|
||||||
|
<template #statistical="{ row }">
|
||||||
|
<vxe-switch v-model="row.statistical" open-label="是" close-label="否" :openValue="true"
|
||||||
|
:closeValue="false"></vxe-switch>
|
||||||
|
</template>
|
||||||
<template #queryWhether="{ row }">
|
<template #queryWhether="{ row }">
|
||||||
<vxe-switch v-model="row.queryWhether" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
|
<vxe-switch v-model="row.queryWhether" open-label="是" close-label="否" :openValue="true"
|
||||||
|
:closeValue="false"></vxe-switch>
|
||||||
</template>
|
</template>
|
||||||
<template #queryType="{ row }">
|
<template #queryType="{ row }">
|
||||||
<vxe-select v-model="row.queryType" class="m-2" placeholder="Select" :disabled="!row.queryWhether" filterable transfer>
|
<vxe-select v-model="row.queryType" class="m-2" placeholder="Select"
|
||||||
<vxe-option v-for="item in state.queryTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
:disabled="!row.queryWhether" filterable transfer>
|
||||||
|
<vxe-option v-for="item in state.queryTypeList" :key="item.code" :label="item.value"
|
||||||
|
:value="item.code" />
|
||||||
</vxe-select>
|
</vxe-select>
|
||||||
</template>
|
</template>
|
||||||
<template #verification="{ row }">
|
<template #verification="{ row }">
|
||||||
<vxe-button status="primary" plain v-if="row.columnKey === 'False' && !row.whetherCommon" @click="openVerifyDialog(row)">校验规则{{ row.ruleCount }}</vxe-button>
|
<vxe-button status="primary" plain v-if="row.columnKey === 'False' && !row.whetherCommon"
|
||||||
|
@click="openVerifyDialog(row)">校验规则{{ row.ruleCount }}</vxe-button>
|
||||||
<span v-else></span>
|
<span v-else></span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-grid>
|
</vxe-grid>
|
||||||
@ -83,6 +98,8 @@ const verifyDialogRef = ref();
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
EntityName: '',
|
||||||
|
ConfigId:'',
|
||||||
dbData: [] as any,
|
dbData: [] as any,
|
||||||
effectTypeList: [] as any,
|
effectTypeList: [] as any,
|
||||||
dictTypeCodeList: [] as any,
|
dictTypeCodeList: [] as any,
|
||||||
@ -191,6 +208,15 @@ const options = reactive<VxeGridProps>({
|
|||||||
default: 'whetherSortable',
|
default: 'whetherSortable',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'statistical',
|
||||||
|
title: '统计字段',
|
||||||
|
minWidth: 70,
|
||||||
|
slots: {
|
||||||
|
edit: 'statistical',
|
||||||
|
default: 'statistical',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'queryWhether',
|
field: 'queryWhether',
|
||||||
title: '是否是查询',
|
title: '是否是查询',
|
||||||
@ -282,7 +308,7 @@ const submitRefreshFk = (data: any) => {
|
|||||||
// 页面初始化
|
// 页面初始化
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// mittBus.off('submitRefresh', () => {});
|
// mittBus.off('submitRefresh', () => {});
|
||||||
mittBus.off('submitRefreshFk', () => {});
|
mittBus.off('submitRefreshFk', () => { });
|
||||||
});
|
});
|
||||||
|
|
||||||
// 控件类型改变
|
// 控件类型改变
|
||||||
@ -342,7 +368,8 @@ function effectTypeEnable(data: any) {
|
|||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = async (addRow: any) => {
|
const openDialog = async (addRow: any) => {
|
||||||
state.isShowDialog = true;
|
state.isShowDialog = true;
|
||||||
|
state.ConfigId=addRow.configId;
|
||||||
|
state.EntityName=addRow.tableName;
|
||||||
nextTick(async () => {
|
nextTick(async () => {
|
||||||
await handleQuery(addRow);
|
await handleQuery(addRow);
|
||||||
rowDrop();
|
rowDrop();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user