😎代码生成及校验规则优化
This commit is contained in:
parent
119d2e5668
commit
c5a032f42a
@ -24,12 +24,6 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="App\**" />
|
|
||||||
<EmbeddedResource Remove="App\**" />
|
|
||||||
<None Remove="App\**" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
|
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\Admin.NET.Plugin.GoView\Admin.NET.Plugin.GoView.csproj" />
|
<ProjectReference Include="..\Plugins\Admin.NET.Plugin.GoView\Admin.NET.Plugin.GoView.csproj" />
|
||||||
|
|||||||
@ -219,5 +219,6 @@ public class CodeGenConfig
|
|||||||
/// 验证触发器
|
/// 验证触发器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Trigger { get; set; }
|
public string Trigger { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion 不在数据库中的字段
|
||||||
}
|
}
|
||||||
@ -9,26 +9,32 @@ public class VerifyRuleItem
|
|||||||
/// 编码
|
/// 编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long Key { get; set; }
|
public long Key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证类型
|
/// 验证类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证错误消息
|
/// 验证错误消息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最小值
|
/// 最小值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Min { get; set; }
|
public string Min { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大值
|
/// 最大值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Max { get; set; }
|
public string Max { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 正则表达式
|
/// 正则表达式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Pattern { get; set; }
|
public string Pattern { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据类型(搭配正则)
|
/// 数据类型(搭配正则)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -120,7 +120,9 @@ public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
// 生成代码时,主键并不是必要输入项,故一定要排除主键字段
|
// 生成代码时,主键并不是必要输入项,故一定要排除主键字段
|
||||||
//codeGenConfig.WhetherRequired = (tableColumn.IsNullable || tableColumn.IsPrimarykey) ? YesNoEnum.N.ToString() : YesNoEnum.Y.ToString();
|
//codeGenConfig.WhetherRequired = (tableColumn.IsNullable || tableColumn.IsPrimarykey) ? YesNoEnum.N.ToString() : YesNoEnum.Y.ToString();
|
||||||
|
|
||||||
#region 添加校验规则
|
#region 添加校验规则
|
||||||
|
|
||||||
//添加校验规则
|
//添加校验规则
|
||||||
codeGenConfig.Id = YitIdHelper.NextId();
|
codeGenConfig.Id = YitIdHelper.NextId();
|
||||||
//验证规则
|
//验证规则
|
||||||
@ -135,8 +137,9 @@ public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
codeGenConfig.WhetherRequired = ruleItems.Any(t => t.Type == "required") ? YesNoEnum.Y.ToString() : YesNoEnum.N.ToString();
|
codeGenConfig.WhetherRequired = ruleItems.Any(t => t.Type == "required") ? YesNoEnum.Y.ToString() : YesNoEnum.N.ToString();
|
||||||
codeGenConfig.Rules = ruleItems.ToJson();
|
codeGenConfig.Rules = ruleItems.ToJson();
|
||||||
#endregion
|
|
||||||
|
#endregion 添加校验规则
|
||||||
|
|
||||||
codeGenConfig.QueryWhether = YesOrNo;
|
codeGenConfig.QueryWhether = YesOrNo;
|
||||||
codeGenConfig.WhetherAddUpdate = YesOrNo;
|
codeGenConfig.WhetherAddUpdate = YesOrNo;
|
||||||
|
|||||||
@ -345,7 +345,9 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
Directory.Delete(outputPath, true);
|
Directory.Delete(outputPath, true);
|
||||||
|
|
||||||
var tableFieldList = await _codeGenConfigService.GetList(new CodeGenConfig() { CodeGenId = input.Id }); // 字段集合
|
var tableFieldList = await _codeGenConfigService.GetList(new CodeGenConfig() { CodeGenId = input.Id }); // 字段集合
|
||||||
|
|
||||||
#region 构造前端需要验证的数据
|
#region 构造前端需要验证的数据
|
||||||
|
|
||||||
foreach (var item in tableFieldList)
|
foreach (var item in tableFieldList)
|
||||||
{
|
{
|
||||||
List<VerifyRuleItem> list = new List<VerifyRuleItem>();
|
List<VerifyRuleItem> list = new List<VerifyRuleItem>();
|
||||||
@ -365,7 +367,9 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
item.AnyRule = list.Count > 0;
|
item.AnyRule = list.Count > 0;
|
||||||
item.RemoteVerify = list.Any(t => t.Type == "remote");
|
item.RemoteVerify = list.Any(t => t.Type == "remote");
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 构造前端需要验证的数据
|
||||||
|
|
||||||
var queryWhetherList = tableFieldList.Where(u => u.QueryWhether == YesNoEnum.Y.ToString()).ToList(); // 前端查询集合
|
var queryWhetherList = tableFieldList.Where(u => u.QueryWhether == YesNoEnum.Y.ToString()).ToList(); // 前端查询集合
|
||||||
var joinTableList = tableFieldList.Where(u => u.EffectType == "Upload" || u.EffectType == "fk" || u.EffectType == "ApiTreeSelect").ToList(); // 需要连表查询的字段
|
var joinTableList = tableFieldList.Where(u => u.EffectType == "Upload" || u.EffectType == "fk" || u.EffectType == "ApiTreeSelect").ToList(); // 需要连表查询的字段
|
||||||
(string joinTableNames, string lowerJoinTableNames) = GetJoinTableStr(joinTableList); // 获取连表的实体名和别名
|
(string joinTableNames, string lowerJoinTableNames) = GetJoinTableStr(joinTableList); // 获取连表的实体名和别名
|
||||||
@ -455,7 +459,9 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
public async Task<Dictionary<string, string>> Preview(SysCodeGen input)
|
public async Task<Dictionary<string, string>> Preview(SysCodeGen input)
|
||||||
{
|
{
|
||||||
var tableFieldList = await _codeGenConfigService.GetList(new CodeGenConfig() { CodeGenId = input.Id }); // 字段集合
|
var tableFieldList = await _codeGenConfigService.GetList(new CodeGenConfig() { CodeGenId = input.Id }); // 字段集合
|
||||||
|
|
||||||
#region 构造前端需要验证的数据
|
#region 构造前端需要验证的数据
|
||||||
|
|
||||||
foreach (var item in tableFieldList)
|
foreach (var item in tableFieldList)
|
||||||
{
|
{
|
||||||
List<VerifyRuleItem> list = new List<VerifyRuleItem>();
|
List<VerifyRuleItem> list = new List<VerifyRuleItem>();
|
||||||
@ -475,7 +481,9 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
item.AnyRule = list.Count > 0;
|
item.AnyRule = list.Count > 0;
|
||||||
item.RemoteVerify = list.Any(t => t.Type == "remote");
|
item.RemoteVerify = list.Any(t => t.Type == "remote");
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 构造前端需要验证的数据
|
||||||
|
|
||||||
var queryWhetherList = tableFieldList.Where(u => u.QueryWhether == YesNoEnum.Y.ToString()).ToList(); // 前端查询集合
|
var queryWhetherList = tableFieldList.Where(u => u.QueryWhether == YesNoEnum.Y.ToString()).ToList(); // 前端查询集合
|
||||||
var joinTableList = tableFieldList.Where(u => u.EffectType == "Upload" || u.EffectType == "fk" || u.EffectType == "ApiTreeSelect").ToList(); // 需要连表查询的字段
|
var joinTableList = tableFieldList.Where(u => u.EffectType == "Upload" || u.EffectType == "fk" || u.EffectType == "ApiTreeSelect").ToList(); // 需要连表查询的字段
|
||||||
(string joinTableNames, string lowerJoinTableNames) = GetJoinTableStr(joinTableList); // 获取连表的实体名和别名
|
(string joinTableNames, string lowerJoinTableNames) = GetJoinTableStr(joinTableList); // 获取连表的实体名和别名
|
||||||
|
|||||||
@ -7,15 +7,15 @@
|
|||||||
using Admin.NET.Core;
|
using Admin.NET.Core;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
@{
|
@{
|
||||||
string RemoteField="";
|
string RemoteField="";
|
||||||
string PKName="";
|
string PKName="";
|
||||||
foreach (var column in Model.TableField){
|
foreach (var column in Model.TableField){
|
||||||
if(column.RemoteVerify){
|
if(column.RemoteVerify){
|
||||||
RemoteField=@column.PropertyName;
|
RemoteField=@column.PropertyName;
|
||||||
}
|
}
|
||||||
if(column.ColumnKey == "True"){
|
if(column.ColumnKey == "True"){
|
||||||
PKName=column.PropertyName;
|
PKName=column.PropertyName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,14 +90,14 @@ if (@column.WhetherAddUpdate == "Y"){
|
|||||||
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
||||||
}
|
}
|
||||||
@if(@column.AnyRule){
|
@if(@column.AnyRule){
|
||||||
@foreach(var rule in @column.RuleItems){
|
@foreach(var rule in @column.RuleItems){
|
||||||
@if(rule.Type=="pattern"){
|
@if(rule.Type=="pattern"){
|
||||||
@:[RegularExpression(@@"@(@FormatPattern(rule.Pattern))", ErrorMessage = "@(@rule.Message)")]
|
@:[RegularExpression(@@"@(@FormatPattern(rule.Pattern))", ErrorMessage = "@(@rule.Message)")]
|
||||||
}
|
}
|
||||||
@if(rule.Type=="length"){
|
@if(rule.Type=="length"){
|
||||||
@:[StringLength(@(@rule.Max),MinimumLength = @(@rule.Min), ErrorMessage = "@(@column.ColumnComment)只能是@(@rule.Min)至@(@rule.Max)字符")]
|
@:[StringLength(@(@rule.Max),MinimumLength = @(@rule.Min), ErrorMessage = "@(@column.ColumnComment)只能是@(@rule.Min)至@(@rule.Max)字符")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@:public override @column.NetType @column.PropertyName { get; set; }
|
@:public override @column.NetType @column.PropertyName { get; set; }
|
||||||
@:
|
@:
|
||||||
@ -147,14 +147,14 @@ if (@column.WhetherAddUpdate == "Y"){
|
|||||||
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
@:[StringLength(@(@column.ColumnLength), ErrorMessage = "@(@column.ColumnComment)不能超过@(@column.ColumnLength)个字符")]
|
||||||
}
|
}
|
||||||
@if(@column.AnyRule){
|
@if(@column.AnyRule){
|
||||||
@foreach(var rule in @column.RuleItems){
|
@foreach(var rule in @column.RuleItems){
|
||||||
@if(rule.Type=="pattern"){
|
@if(rule.Type=="pattern"){
|
||||||
@:[RegularExpression(@@"@(@FormatPattern(rule.Pattern))", ErrorMessage = "@(@rule.Message)")]
|
@:[RegularExpression(@@"@(@FormatPattern(rule.Pattern))", ErrorMessage = "@(@rule.Message)")]
|
||||||
}
|
}
|
||||||
@if(rule.Type=="length"){
|
@if(rule.Type=="length"){
|
||||||
@:[StringLength(@(@rule.Max),MinimumLength = @(@rule.Min), ErrorMessage = "@(@column.ColumnComment)只能是@(@rule.Min)至@(@rule.Max)字符")]
|
@:[StringLength(@(@rule.Max),MinimumLength = @(@rule.Min), ErrorMessage = "@(@column.ColumnComment)只能是@(@rule.Min)至@(@rule.Max)字符")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@:public override @column.NetType @column.PropertyName { get; set; }
|
@:public override @column.NetType @column.PropertyName { get; set; }
|
||||||
@:
|
@:
|
||||||
@ -172,21 +172,21 @@ if (@column.WhetherAddUpdate == "Y"){
|
|||||||
|
|
||||||
|
|
||||||
@if(@Model.RemoteVerify){
|
@if(@Model.RemoteVerify){
|
||||||
@:/// <summary>
|
@:/// <summary>
|
||||||
@:/// 检查@(RemoteField)字段参数
|
@:/// 检查@(RemoteField)字段参数
|
||||||
@:/// </summary>
|
@:/// </summary>
|
||||||
@:public class Exists@(RemoteField)Input
|
@:public class Exists@(RemoteField)Input
|
||||||
@:{
|
@:{
|
||||||
@:/// <summary>
|
@:/// <summary>
|
||||||
@:/// 字段名称
|
@:/// 字段名称
|
||||||
@:/// </summary>
|
@:/// </summary>
|
||||||
@:public string FieldName { get; set; }
|
@:public string FieldName { get; set; }
|
||||||
@:
|
@:
|
||||||
@:/// <summary>
|
@:/// <summary>
|
||||||
@:/// 旧字段名
|
@:/// 旧字段名
|
||||||
@:/// </summary>
|
@:/// </summary>
|
||||||
@:public string OldFieldName { get; set; }
|
@:public string OldFieldName { get; set; }
|
||||||
@:}
|
@:}
|
||||||
}
|
}
|
||||||
@{
|
@{
|
||||||
string FormatPattern(string pattern)
|
string FormatPattern(string pattern)
|
||||||
|
|||||||
@ -11,17 +11,17 @@ using Microsoft.AspNetCore.Http;
|
|||||||
Dictionary<string, int> definedObjects = new Dictionary<string, int>();
|
Dictionary<string, int> definedObjects = new Dictionary<string, int>();
|
||||||
bool haveLikeCdt = false;
|
bool haveLikeCdt = false;
|
||||||
string RemoteField="";
|
string RemoteField="";
|
||||||
string PKName="";
|
string PKName="";
|
||||||
foreach (var column in Model.TableField){
|
foreach (var column in Model.TableField){
|
||||||
if (column.QueryWhether == "Y" && column.QueryType == "like"){
|
if (column.QueryWhether == "Y" && column.QueryType == "like"){
|
||||||
haveLikeCdt = true;
|
haveLikeCdt = true;
|
||||||
}
|
}
|
||||||
if(column.RemoteVerify){
|
if(column.RemoteVerify){
|
||||||
RemoteField=@column.PropertyName;
|
RemoteField=@column.PropertyName;
|
||||||
}
|
}
|
||||||
if(column.ColumnKey == "True"){
|
if(column.ColumnKey == "True"){
|
||||||
PKName=column.PropertyName;
|
PKName=column.PropertyName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace @Model.NameSpace;
|
namespace @Model.NameSpace;
|
||||||
@ -48,7 +48,7 @@ public class @(@Model.ClassName)Service : IDynamicApiController, ITransient
|
|||||||
public async Task<SqlSugarPagedList<@(@Model.ClassName)Output>> Page(Page@(@Model.ClassName)Input input)
|
public async Task<SqlSugarPagedList<@(@Model.ClassName)Output>> Page(Page@(@Model.ClassName)Input input)
|
||||||
{
|
{
|
||||||
@if (haveLikeCdt) {
|
@if (haveLikeCdt) {
|
||||||
@:input.SearchKey = input.SearchKey?.Trim();
|
@:input.SearchKey = input.SearchKey?.Trim();
|
||||||
}
|
}
|
||||||
var query = _@(@Model.LowerClassName)Rep.AsQueryable()
|
var query = _@(@Model.LowerClassName)Rep.AsQueryable()
|
||||||
@{string conditionFlag = "";}
|
@{string conditionFlag = "";}
|
||||||
@ -116,7 +116,7 @@ if (@column.QueryWhether == "Y"){
|
|||||||
} else {
|
} else {
|
||||||
@:.Select<@(@Model.ClassName)Output>();
|
@:.Select<@(@Model.ClassName)Output>();
|
||||||
}
|
}
|
||||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -136,7 +136,7 @@ if (@column.QueryWhether == "Y"){
|
|||||||
@://已存在
|
@://已存在
|
||||||
@:throw Oops.Oh(ErrorCodeEnum.D1006);
|
@:throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
@:}
|
@:}
|
||||||
}
|
}
|
||||||
await _@(@Model.LowerClassName)Rep.InsertAsync(entity);
|
await _@(@Model.LowerClassName)Rep.InsertAsync(entity);
|
||||||
return entity.@(@PKName);
|
return entity.@(@PKName);
|
||||||
}
|
}
|
||||||
@ -170,14 +170,14 @@ if (@column.ColumnKey == "True"){
|
|||||||
{
|
{
|
||||||
var entity = input.Adapt<@(@Model.ClassName)>();
|
var entity = input.Adapt<@(@Model.ClassName)>();
|
||||||
@if(Model.RemoteVerify){
|
@if(Model.RemoteVerify){
|
||||||
@://验证重复值
|
@://验证重复值
|
||||||
@:if (await _advertsRep.IsAnyAsync(t => t.@(RemoteField) == entity.@(RemoteField) && t.@(@PKName) != entity.@(@PKName)))
|
@:if (await _advertsRep.IsAnyAsync(t => t.@(RemoteField) == entity.@(RemoteField) && t.@(@PKName) != entity.@(@PKName)))
|
||||||
@:{
|
@:{
|
||||||
@://已存在
|
@://已存在
|
||||||
@:throw Oops.Oh(ErrorCodeEnum.D1006);
|
@:throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
@:}
|
@:}
|
||||||
}
|
}
|
||||||
await _@(@Model.LowerClassName)Rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
await _@(@Model.LowerClassName)Rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -181,7 +181,7 @@ if(@Model.TableField.Any(x=>x.EffectType == "Upload")){
|
|||||||
foreach (var column in Model.QueryWhetherList){
|
foreach (var column in Model.QueryWhetherList){
|
||||||
if(@column.EffectType == "fk"){
|
if(@column.EffectType == "fk"){
|
||||||
@:import { get@(@column.FkEntityName)@(@column.PropertyName)Dropdown } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
@:import { get@(@column.FkEntityName)@(@column.PropertyName)Dropdown } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
|
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
|
||||||
@ -199,7 +199,7 @@ if(@column.EffectType == "fk"){
|
|||||||
@foreach (var column in Model.TableField){
|
@foreach (var column in Model.TableField){
|
||||||
if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("import__@(@column.FkEntityName)Tree")){
|
if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("import__@(@column.FkEntityName)Tree")){
|
||||||
@{definedObjects.Add("import__@(@column.FkEntityName)Tree", 1);}
|
@{definedObjects.Add("import__@(@column.FkEntityName)Tree", 1);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if(@Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
|
@if(@Model.TableField.Any(x=>x.EffectType == "EnumSelector")){
|
||||||
@:import { SysEnumApi } from '/@@/api-services/api';
|
@:import { SysEnumApi } from '/@@/api-services/api';
|
||||||
@ -327,13 +327,13 @@ const submit = async () => {
|
|||||||
let values = state.ruleForm;
|
let values = state.ruleForm;
|
||||||
if (state.ruleForm.@(@pkFieldName) == undefined || state.ruleForm.@(@pkFieldName) == null || state.ruleForm.@(@pkFieldName) == "" || state.ruleForm.@(@pkFieldName) == 0) {
|
if (state.ruleForm.@(@pkFieldName) == undefined || state.ruleForm.@(@pkFieldName) == null || state.ruleForm.@(@pkFieldName) == "" || state.ruleForm.@(@pkFieldName) == 0) {
|
||||||
@if (@Model.IsApiService) {
|
@if (@Model.IsApiService) {
|
||||||
@:await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)AddPost(state.ruleForm);
|
@:await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)AddPost(state.ruleForm);
|
||||||
} else {
|
} else {
|
||||||
@:await add@(@Model.ClassName)(values);
|
@:await add@(@Model.ClassName)(values);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@if (@Model.IsApiService) {
|
@if (@Model.IsApiService) {
|
||||||
@:await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)UpdatePost(state.ruleForm);
|
@:await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)UpdatePost(state.ruleForm);
|
||||||
} else {
|
} else {
|
||||||
@:await update@(@Model.ClassName)(values);
|
@:await update@(@Model.ClassName)(values);
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ const submit = async () => {
|
|||||||
if(@column.EffectType == "fk" && @column.WhetherAddUpdate == "Y"){
|
if(@column.EffectType == "fk" && @column.WhetherAddUpdate == "Y"){
|
||||||
@:const @LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList = ref<any>([]);
|
@:const @LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList = ref<any>([]);
|
||||||
@:const get@(@column.FkEntityName)@(@column.PropertyName)DropdownList = async () => {
|
@:const get@(@column.FkEntityName)@(@column.PropertyName)DropdownList = async () => {
|
||||||
@if (@Model.IsApiService) {
|
@if (@Model.IsApiService) {
|
||||||
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)@(@column.PropertyName)DropdownGet();
|
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)@(@column.PropertyName)DropdownGet();
|
||||||
} else {
|
} else {
|
||||||
@:let list = await get@(@column.FkEntityName)@(@column.PropertyName)Dropdown();
|
@:let list = await get@(@column.FkEntityName)@(@column.PropertyName)Dropdown();
|
||||||
@ -369,7 +369,7 @@ if(@column.EffectType == "ApiTreeSelect" && !definedObjects.ContainsKey("define_
|
|||||||
@{definedObjects.Add("define_get@(@column.FkEntityName)TreeData", 1);}
|
@{definedObjects.Add("define_get@(@column.FkEntityName)TreeData", 1);}
|
||||||
@:const @LowerFirstLetter(@column.FkEntityName)TreeData = ref<any>([]);
|
@:const @LowerFirstLetter(@column.FkEntityName)TreeData = ref<any>([]);
|
||||||
@:const get@(@column.FkEntityName)TreeData = async () => {
|
@:const get@(@column.FkEntityName)TreeData = async () => {
|
||||||
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)TreeGet();
|
@:let list = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)@(@column.FkEntityName)TreeGet();
|
||||||
@:@LowerFirstLetter(@column.FkEntityName)TreeData.value = list.data.result ?? [];
|
@:@LowerFirstLetter(@column.FkEntityName)TreeData.value = list.data.result ?? [];
|
||||||
@:};
|
@:};
|
||||||
@:get@(@column.FkEntityName)TreeData();
|
@:get@(@column.FkEntityName)TreeData();
|
||||||
@ -391,7 +391,7 @@ if(column.WhetherAddUpdate=="N") continue;
|
|||||||
if(@column.EffectType == "Upload"){
|
if(@column.EffectType == "Upload"){
|
||||||
@:const upload@(@column.PropertyName)Handle = async (options: UploadRequestOptions) => {
|
@:const upload@(@column.PropertyName)Handle = async (options: UploadRequestOptions) => {
|
||||||
@if (@Model.IsApiService) {
|
@if (@Model.IsApiService) {
|
||||||
@:let res = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)Upload@(@column.FkEntityName)PostForm(options);
|
@:let res = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)Upload@(@column.FkEntityName)PostForm(options);
|
||||||
} else {
|
} else {
|
||||||
@:let res = await upload@(@column.PropertyName)(options);
|
@:let res = await upload@(@column.PropertyName)(options);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
|
|||||||
import { AdminResultListCodeGenConfig } from '../models';
|
import { AdminResultListCodeGenConfig } from '../models';
|
||||||
import { AdminResultSysCodeGenConfig } from '../models';
|
import { AdminResultSysCodeGenConfig } from '../models';
|
||||||
import { CodeGenConfig } from '../models';
|
import { CodeGenConfig } from '../models';
|
||||||
|
import { VerifyRuleItem } from '../models';
|
||||||
/**
|
/**
|
||||||
* SysCodeGenConfigApi - axios parameter creator
|
* SysCodeGenConfigApi - axios parameter creator
|
||||||
* @export
|
* @export
|
||||||
@ -62,10 +63,15 @@ export const SysCodeGenConfigApiAxiosParamCreator = function (configuration?: Co
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
apiSysCodeGenConfigDetailGet: async (id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
apiSysCodeGenConfigDetailGet: async (id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/api/sysCodeGenConfig/detail`;
|
const localVarPath = `/api/sysCodeGenConfig/detail`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||||
@ -218,6 +224,26 @@ export const SysCodeGenConfigApiAxiosParamCreator = function (configuration?: Co
|
|||||||
localVarQueryParameter['OrderNo'] = orderNo;
|
localVarQueryParameter['OrderNo'] = orderNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rules !== undefined) {
|
||||||
|
localVarQueryParameter['Rules'] = rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ruleItems) {
|
||||||
|
localVarQueryParameter['RuleItems'] = ruleItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remoteVerify !== undefined) {
|
||||||
|
localVarQueryParameter['RemoteVerify'] = remoteVerify;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anyRule !== undefined) {
|
||||||
|
localVarQueryParameter['AnyRule'] = anyRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trigger !== undefined) {
|
||||||
|
localVarQueryParameter['Trigger'] = trigger;
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams(localVarUrlObj.search);
|
const query = new URLSearchParams(localVarUrlObj.search);
|
||||||
for (const key in localVarQueryParameter) {
|
for (const key in localVarQueryParameter) {
|
||||||
query.set(key, localVarQueryParameter[key]);
|
query.set(key, localVarQueryParameter[key]);
|
||||||
@ -270,10 +296,15 @@ export const SysCodeGenConfigApiAxiosParamCreator = function (configuration?: Co
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
apiSysCodeGenConfigListGet: async (id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
apiSysCodeGenConfigListGet: async (id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/api/sysCodeGenConfig/list`;
|
const localVarPath = `/api/sysCodeGenConfig/list`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||||
@ -426,6 +457,26 @@ export const SysCodeGenConfigApiAxiosParamCreator = function (configuration?: Co
|
|||||||
localVarQueryParameter['OrderNo'] = orderNo;
|
localVarQueryParameter['OrderNo'] = orderNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rules !== undefined) {
|
||||||
|
localVarQueryParameter['Rules'] = rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ruleItems) {
|
||||||
|
localVarQueryParameter['RuleItems'] = ruleItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remoteVerify !== undefined) {
|
||||||
|
localVarQueryParameter['RemoteVerify'] = remoteVerify;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anyRule !== undefined) {
|
||||||
|
localVarQueryParameter['AnyRule'] = anyRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trigger !== undefined) {
|
||||||
|
localVarQueryParameter['Trigger'] = trigger;
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams(localVarUrlObj.search);
|
const query = new URLSearchParams(localVarUrlObj.search);
|
||||||
for (const key in localVarQueryParameter) {
|
for (const key in localVarQueryParameter) {
|
||||||
query.set(key, localVarQueryParameter[key]);
|
query.set(key, localVarQueryParameter[key]);
|
||||||
@ -535,11 +586,16 @@ export const SysCodeGenConfigApiFp = function(configuration?: Configuration) {
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultSysCodeGenConfig>>> {
|
async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultSysCodeGenConfig>>> {
|
||||||
const localVarAxiosArgs = await SysCodeGenConfigApiAxiosParamCreator(configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options);
|
const localVarAxiosArgs = await SysCodeGenConfigApiAxiosParamCreator(configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
@ -581,11 +637,16 @@ export const SysCodeGenConfigApiFp = function(configuration?: Configuration) {
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListCodeGenConfig>>> {
|
async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListCodeGenConfig>>> {
|
||||||
const localVarAxiosArgs = await SysCodeGenConfigApiAxiosParamCreator(configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options);
|
const localVarAxiosArgs = await SysCodeGenConfigApiAxiosParamCreator(configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
@ -650,11 +711,16 @@ export const SysCodeGenConfigApiFactory = function (configuration?: Configuratio
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultSysCodeGenConfig>> {
|
async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultSysCodeGenConfig>> {
|
||||||
return SysCodeGenConfigApiFp(configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options).then((request) => request(axios, basePath));
|
return SysCodeGenConfigApiFp(configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -692,11 +758,16 @@ export const SysCodeGenConfigApiFactory = function (configuration?: Configuratio
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListCodeGenConfig>> {
|
async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListCodeGenConfig>> {
|
||||||
return SysCodeGenConfigApiFp(configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options).then((request) => request(axios, basePath));
|
return SysCodeGenConfigApiFp(configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -754,12 +825,17 @@ export class SysCodeGenConfigApi extends BaseAPI {
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @memberof SysCodeGenConfigApi
|
* @memberof SysCodeGenConfigApi
|
||||||
*/
|
*/
|
||||||
public async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultSysCodeGenConfig>> {
|
public async apiSysCodeGenConfigDetailGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultSysCodeGenConfig>> {
|
||||||
return SysCodeGenConfigApiFp(this.configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options).then((request) => request(this.axios, this.basePath));
|
return SysCodeGenConfigApiFp(this.configuration).apiSysCodeGenConfigDetailGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -797,12 +873,17 @@ export class SysCodeGenConfigApi extends BaseAPI {
|
|||||||
* @param {string} [valueColumn] 选中值字段
|
* @param {string} [valueColumn] 选中值字段
|
||||||
* @param {string} [pidColumn] 父级字段
|
* @param {string} [pidColumn] 父级字段
|
||||||
* @param {number} [orderNo] 排序
|
* @param {number} [orderNo] 排序
|
||||||
|
* @param {string} [rules] 字段验证规则
|
||||||
|
* @param {Array<VerifyRuleItem>} [ruleItems] 字段验证集合
|
||||||
|
* @param {boolean} [remoteVerify] 是否远程验证
|
||||||
|
* @param {boolean} [anyRule] 是否存在验证规则
|
||||||
|
* @param {string} [trigger] 验证触发器
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @memberof SysCodeGenConfigApi
|
* @memberof SysCodeGenConfigApi
|
||||||
*/
|
*/
|
||||||
public async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListCodeGenConfig>> {
|
public async apiSysCodeGenConfigListGet(id?: number, codeGenId?: number, columnName?: string, propertyName?: string, columnLength?: number, lowerPropertyName?: string, columnComment?: string, netType?: string, effectType?: string, fkConfigId?: string, fkEntityName?: string, fkTableName?: string, lowerFkEntityName?: string, fkColumnName?: string, fkLinkColumnName?: string, lowerFkColumnName?: string, fkColumnNetType?: string, dictTypeCode?: string, whetherRetract?: string, whetherRequired?: string, whetherSortable?: string, queryWhether?: string, queryType?: string, whetherTable?: string, whetherAddUpdate?: string, columnKey?: string, dataType?: string, whetherCommon?: string, tableNickName?: string, displayColumn?: string, valueColumn?: string, pidColumn?: string, orderNo?: number, rules?: string, ruleItems?: Array<VerifyRuleItem>, remoteVerify?: boolean, anyRule?: boolean, trigger?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListCodeGenConfig>> {
|
||||||
return SysCodeGenConfigApiFp(this.configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, options).then((request) => request(this.axios, this.basePath));
|
return SysCodeGenConfigApiFp(this.configuration).apiSysCodeGenConfigListGet(id, codeGenId, columnName, propertyName, columnLength, lowerPropertyName, columnComment, netType, effectType, fkConfigId, fkEntityName, fkTableName, lowerFkEntityName, fkColumnName, fkLinkColumnName, lowerFkColumnName, fkColumnNetType, dictTypeCode, whetherRetract, whetherRequired, whetherSortable, queryWhether, queryType, whetherTable, whetherAddUpdate, columnKey, dataType, whetherCommon, tableNickName, displayColumn, valueColumn, pidColumn, orderNo, rules, ruleItems, remoteVerify, anyRule, trigger, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { VerifyRuleItem } from './verify-rule-item';
|
||||||
/**
|
/**
|
||||||
* 代码生成详细配置参数
|
* 代码生成详细配置参数
|
||||||
*
|
*
|
||||||
@ -283,4 +284,44 @@ export interface CodeGenConfig {
|
|||||||
* @memberof CodeGenConfig
|
* @memberof CodeGenConfig
|
||||||
*/
|
*/
|
||||||
orderNo?: number;
|
orderNo?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段验证规则
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof CodeGenConfig
|
||||||
|
*/
|
||||||
|
rules?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段验证集合
|
||||||
|
*
|
||||||
|
* @type {Array<VerifyRuleItem>}
|
||||||
|
* @memberof CodeGenConfig
|
||||||
|
*/
|
||||||
|
ruleItems?: Array<VerifyRuleItem> | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否远程验证
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof CodeGenConfig
|
||||||
|
*/
|
||||||
|
remoteVerify?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否存在验证规则
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof CodeGenConfig
|
||||||
|
*/
|
||||||
|
anyRule?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证触发器
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof CodeGenConfig
|
||||||
|
*/
|
||||||
|
trigger?: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -404,6 +404,7 @@ export * from './user-input';
|
|||||||
export * from './user-menu-input';
|
export * from './user-menu-input';
|
||||||
export * from './user-output';
|
export * from './user-output';
|
||||||
export * from './user-role-input';
|
export * from './user-role-input';
|
||||||
|
export * from './verify-rule-item';
|
||||||
export * from './visual-column';
|
export * from './visual-column';
|
||||||
export * from './visual-db-table';
|
export * from './visual-db-table';
|
||||||
export * from './visual-table';
|
export * from './visual-table';
|
||||||
|
|||||||
@ -307,4 +307,12 @@ export interface SysCodeGenConfig {
|
|||||||
* @memberof SysCodeGenConfig
|
* @memberof SysCodeGenConfig
|
||||||
*/
|
*/
|
||||||
orderNo?: number;
|
orderNo?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段验证规则
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SysCodeGenConfig
|
||||||
|
*/
|
||||||
|
rules?: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
78
Web/src/api-services/models/verify-rule-item.ts
Normal file
78
Web/src/api-services/models/verify-rule-item.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* Admin.NET 通用权限开发平台
|
||||||
|
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证规则选项
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface VerifyRuleItem
|
||||||
|
*/
|
||||||
|
export interface VerifyRuleItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
key?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证类型
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
type?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证错误消息
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
message?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小值
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
min?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
max?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正则表达式
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
pattern?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型(搭配正则)
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof VerifyRuleItem
|
||||||
|
*/
|
||||||
|
dataType?: string | null;
|
||||||
|
}
|
||||||
@ -19,7 +19,15 @@
|
|||||||
<el-table-column prop="effectType" label="作用类型" width="140" show-overflow-tooltip>
|
<el-table-column prop="effectType" label="作用类型" width="140" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="effect-type-container">
|
<div class="effect-type-container">
|
||||||
<el-select v-model="scope.row.effectType" class="m-2" style="width: 90%" placeholder="Select" :disabled="judgeColumns(scope.row)" @change="effectTypeChange(scope.row, scope.$index)" filterable>
|
<el-select
|
||||||
|
v-model="scope.row.effectType"
|
||||||
|
class="m-2"
|
||||||
|
style="width: 90%"
|
||||||
|
placeholder="Select"
|
||||||
|
:disabled="judgeColumns(scope.row)"
|
||||||
|
@change="effectTypeChange(scope.row, scope.$index)"
|
||||||
|
filterable
|
||||||
|
>
|
||||||
<el-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
<el-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button
|
<el-button
|
||||||
@ -80,10 +88,9 @@
|
|||||||
<el-input v-model="scope.row.orderNo" autocomplete="off" type="number" />
|
<el-input v-model="scope.row.orderNo" autocomplete="off" type="number" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="orderNo" label="校验" width="120" align="center" show-overflow-tooltip>
|
<el-table-column prop="orderNo" label="校验规则" width="120" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" v-if="(scope.row.columnKey=== 'False') && (!scope.row.whetherCommon)"
|
<el-button type="primary" plain v-if="scope.row.columnKey === 'False' && !scope.row.whetherCommon" @click="openVerifyDialog(scope.row)">校验规则{{ scope.row.ruleCount }}</el-button>
|
||||||
@click="openVerifyDialog(scope.row)">规则{{ scope.row.ruleCount }}</el-button>
|
|
||||||
<span v-else></span>
|
<span v-else></span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -113,7 +120,7 @@ import verifyDialog from '/@/views/system/codeGen/component/verifyDialog.vue';
|
|||||||
|
|
||||||
import { getAPI } from '/@/utils/axios-utils';
|
import { getAPI } from '/@/utils/axios-utils';
|
||||||
import { SysCodeGenConfigApi, SysConstApi, SysDictDataApi, SysDictTypeApi, SysEnumApi } from '/@/api-services/api';
|
import { SysCodeGenConfigApi, SysConstApi, SysDictDataApi, SysDictTypeApi, SysEnumApi } from '/@/api-services/api';
|
||||||
import { CodeGenConfig } from '/@/api-services/models/code-gen-config';
|
// import { CodeGenConfig } from '/@/api-services/models/code-gen-config';
|
||||||
|
|
||||||
const emits = defineEmits(['handleQuery']);
|
const emits = defineEmits(['handleQuery']);
|
||||||
const fkDialogRef = ref();
|
const fkDialogRef = ref();
|
||||||
@ -122,7 +129,7 @@ const verifyDialogRef = ref();
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
tableData: [] as CodeGenConfig[],
|
tableData: [] as any, // CodeGenConfig[],
|
||||||
dbData: [] as any,
|
dbData: [] as any,
|
||||||
effectTypeList: [] as any,
|
effectTypeList: [] as any,
|
||||||
dictTypeCodeList: [] as any,
|
dictTypeCodeList: [] as any,
|
||||||
@ -198,8 +205,8 @@ const handleQuery = async (row: any) => {
|
|||||||
if (item[key] === 'N' || (lstWhetherColumn.includes(key) && item[key] === null)) {
|
if (item[key] === 'N' || (lstWhetherColumn.includes(key) && item[key] === null)) {
|
||||||
item[key] = false;
|
item[key] = false;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
//验证规则相关
|
// 验证规则相关
|
||||||
let rules = new Array();
|
let rules = new Array();
|
||||||
if (item.rules != '' && item.rules !== null) {
|
if (item.rules != '' && item.rules !== null) {
|
||||||
rules = JSON.parse(item.rules);
|
rules = JSON.parse(item.rules);
|
||||||
@ -244,7 +251,7 @@ const openVerifyDialog = (row: any) => {
|
|||||||
verifyDialogRef.value.openDialog(row);
|
verifyDialogRef.value.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
//验证提交回调
|
// 验证提交回调
|
||||||
const submitVerifyOk = (data: any) => {
|
const submitVerifyOk = (data: any) => {
|
||||||
console.log('submitVerifyOk', data);
|
console.log('submitVerifyOk', data);
|
||||||
for (let i = 0; i < state.tableData.length; i++) {
|
for (let i = 0; i < state.tableData.length; i++) {
|
||||||
@ -255,13 +262,13 @@ const submitVerifyOk = (data: any) => {
|
|||||||
let rules = new Array();
|
let rules = new Array();
|
||||||
if (data.rules != '' && data.rules !== null) {
|
if (data.rules != '' && data.rules !== null) {
|
||||||
rules = JSON.parse(data.rules);
|
rules = JSON.parse(data.rules);
|
||||||
let requiredRule = rules.find(t => t.type === 'required');
|
let requiredRule = rules.find((t) => t.type === 'required');
|
||||||
if (requiredRule) {
|
if (requiredRule) {
|
||||||
state.tableData[i].whetherRequired = true;
|
state.tableData[i].whetherRequired = true;
|
||||||
} else {
|
} else {
|
||||||
state.tableData[i].whetherRequired = false;
|
state.tableData[i].whetherRequired = false;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,14 +290,14 @@ const submit = async () => {
|
|||||||
state.loading = true;
|
state.loading = true;
|
||||||
var lst = state.tableData;
|
var lst = state.tableData;
|
||||||
console.log(lst);
|
console.log(lst);
|
||||||
let ignoreFields=['remoteVerify','anyRule','columnKey'];
|
let ignoreFields = ['remoteVerify', 'anyRule', 'columnKey'];
|
||||||
lst.forEach((item: CodeGenConfig) => {
|
lst.forEach((item: any) => {
|
||||||
// 必填那一项转换
|
// 必填那一项转换
|
||||||
for (var key in item) {
|
for (var key in item) {
|
||||||
if (item[key] === true&&!ignoreFields.includes(key)) {
|
if (item[key] === true && !ignoreFields.includes(key)) {
|
||||||
item[key] = 'Y';
|
item[key] = 'Y';
|
||||||
}
|
}
|
||||||
if (item[key] === false&&!ignoreFields.includes(key)) {
|
if (item[key] === false && !ignoreFields.includes(key)) {
|
||||||
item[key] = 'N';
|
item[key] = 'N';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,51 +307,6 @@ const submit = async () => {
|
|||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
const convertDbType = (dbType: number) => {
|
|
||||||
let result = '';
|
|
||||||
switch (dbType) {
|
|
||||||
case 0:
|
|
||||||
result = 'MySql';
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
result = 'SqlServer';
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
result = 'Sqlite';
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
result = 'Oracle';
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
result = 'PostgreSql';
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
result = 'Dm';
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
result = 'Kdbndp';
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
result = 'Oscar';
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
result = 'MySqlConnector';
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
result = 'Access';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result = 'Custom';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const isOrNotSelect = () => [
|
|
||||||
{ label: '是', value: 1 },
|
|
||||||
{ label: '否', value: 0 },
|
|
||||||
];
|
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,292 +1,291 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-codeGenConfig-container">
|
<div class="sys-codeGenConfig-container">
|
||||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="600px">
|
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="600px">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<span> 选择正则 </span>
|
<span> 选择正则 </span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="pattern-box">
|
<div class="pattern-box">
|
||||||
<div class="pattern-item" v-for="(item, index) in patternData" :key="index"
|
<div class="pattern-item" v-for="(item, index) in patternData" :key="index" :class="{ active: state.index == index }" @click="handlePatternClick(item, index)">
|
||||||
:class="{ active: state.index == index }" @click="handlePatternClick(item, index)">
|
<div class="title">{{ item.title }}</div>
|
||||||
<div class="title">{{ item.title }}</div>
|
<div class="info">{{ item.info }}</div>
|
||||||
<div class="info">{{ item.info }}</div>
|
<div class="pattern">{{ item.pattern }}</div>
|
||||||
<div class="pattern">{{ item.pattern }}</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<template #footer>
|
||||||
<template #footer>
|
<span class="dialog-footer">
|
||||||
<span class="dialog-footer">
|
<el-button @click="cancel">取 消</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
<el-button type="primary" @click="submit">确 定</el-button>
|
</span>
|
||||||
</span>
|
</template>
|
||||||
</template>
|
</el-dialog>
|
||||||
</el-dialog>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, reactive, ref, toRaw } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
||||||
const patternData = ref([
|
const patternData = ref([
|
||||||
{
|
{
|
||||||
title: '手机号',
|
title: '手机号',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^1[3,4,5,6,7,8,9][0-9]{9}$/',
|
pattern: '/^1[3,4,5,6,7,8,9][0-9]{9}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '邮箱',
|
title: '邮箱',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^([a-zA-Z]|[0-9])(\\w|\\-)+@[a-zA-Z0-9]+\\.([a-zA-Z]{2,4})$/',
|
pattern: '/^([a-zA-Z]|[0-9])(\\w|\\-)+@[a-zA-Z0-9]+\\.([a-zA-Z]{2,4})$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '网址',
|
title: '网址',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?$/',
|
pattern: '/^http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '字母/数字/下划线',
|
title: '字母/数字/下划线',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\w+$/',
|
pattern: '/^\\w+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '中英文/数字/下划线',
|
title: '中英文/数字/下划线',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[\\u4e00-\\u9fa5_a-zA-Z0-9]+$/',
|
pattern: '/^[\\u4e00-\\u9fa5_a-zA-Z0-9]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '中文/英文',
|
title: '中文/英文',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[\\u4e00-\\u9fa5a-zA-Z]+$/',
|
pattern: '/^[\\u4e00-\\u9fa5a-zA-Z]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '规范金额',
|
title: '规范金额',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/(^[\\d]|^[1-9][\\d]*)($|[\\.][\\d]{0,2}$)/',
|
pattern: '/(^[\\d]|^[1-9][\\d]*)($|[\\.][\\d]{0,2}$)/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '用户名不能全是数字',
|
title: '用户名不能全是数字',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/[^\\d]/g',
|
pattern: '/[^\\d]/g',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '中文',
|
title: '中文',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[\\u4e00-\\u9fa5]+$/',
|
pattern: '/^[\\u4e00-\\u9fa5]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '非中文',
|
title: '非中文',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[^\\u4e00-\\u9fa5]*$/',
|
pattern: '/^[^\\u4e00-\\u9fa5]*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '限制长度',
|
title: '限制长度',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\d{1,20}$/',
|
pattern: '/^\\d{1,20}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '数字',
|
title: '数字',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[0-9]*$/',
|
pattern: '/^[0-9]*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '正整数及整数',
|
title: '正整数及整数',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[1-9]\\d*$/',
|
pattern: '/^[1-9]\\d*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '数字(可正负)',
|
title: '数字(可正负)',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^-[0-9]*[1-9][0-9]*$/',
|
pattern: '/^-[0-9]*[1-9][0-9]*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '数字/小数点',
|
title: '数字/小数点',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\d+$|^\\d*\\.\\d+$/',
|
pattern: '/^\\d+$|^\\d*\\.\\d+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '合法IP地址',
|
title: '合法IP地址',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$/',
|
pattern: '/^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '手机号码或者固话',
|
title: '手机号码或者固话',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^((0\\d{2,3}-\\d{7,8})|(1[3456789]\\d{9}))$/',
|
pattern: '/^((0\\d{2,3}-\\d{7,8})|(1[3456789]\\d{9}))$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '身份证号码',
|
title: '身份证号码',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)/',
|
pattern: '/(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '大写字母',
|
title: '大写字母',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[A-Z]+$/',
|
pattern: '/^[A-Z]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '小写字母',
|
title: '小写字母',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[a-z]+$/',
|
pattern: '/^[a-z]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '大小写混合',
|
title: '大小写混合',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[A-Za-z]+$/',
|
pattern: '/^[A-Za-z]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '多个8位数字格式(yyyyMMdd)并以逗号隔开',
|
title: '多个8位数字格式(yyyyMMdd)并以逗号隔开',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\d{8}(\\,\\d{8})*$/',
|
pattern: '/^\\d{8}(\\,\\d{8})*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '数字加英文',
|
title: '数字加英文',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[a-zA-Z0-9]+$/',
|
pattern: '/^[a-zA-Z0-9]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '前两位是数字后一位是英文',
|
title: '前两位是数字后一位是英文',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\d{2}[a-zA-Z]+$/',
|
pattern: '/^\\d{2}[a-zA-Z]+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '1到100的数字',
|
title: '1到100的数字',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[0-9]\\d{0,1}$/',
|
pattern: '/^[0-9]\\d{0,1}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '1-1000两位小数',
|
title: '1-1000两位小数',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(.*[^0-9]|)(1000|[1-9]\\d{0,2})([^0-9].*|)$/',
|
pattern: '/^(.*[^0-9]|)(1000|[1-9]\\d{0,2})([^0-9].*|)$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '小数点后只能有两位数(可为0)',
|
title: '小数点后只能有两位数(可为0)',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(-?\\d+)(\\.\\d{1,2})?$/',
|
pattern: '/^(-?\\d+)(\\.\\d{1,2})?$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '密码正则',
|
title: '密码正则',
|
||||||
info: '以字母开头,长度在6~18之间,只能包含字母、数字和下划线',
|
info: '以字母开头,长度在6~18之间,只能包含字母、数字和下划线',
|
||||||
pattern: '/^[a-zA-Z]\\w{5,17}$/',
|
pattern: '/^[a-zA-Z]\\w{5,17}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '强密码',
|
title: '强密码',
|
||||||
info: '必须包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间',
|
info: '必须包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间',
|
||||||
pattern: '/^(?=.\\d)(?=.[a-z])(?=.[A-Z]).{8,10}$/',
|
pattern: '/^(?=.\\d)(?=.[a-z])(?=.[A-Z]).{8,10}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '强密码',
|
title: '强密码',
|
||||||
info: '最少6位,包括至少1个大写字母,1个小写字母,1个数字,1个特殊字符',
|
info: '最少6位,包括至少1个大写字母,1个小写字母,1个数字,1个特殊字符',
|
||||||
pattern: '/^.*(?=.{6,})(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/',
|
pattern: '/^.*(?=.{6,})(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'QQ号码',
|
title: 'QQ号码',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[1-9][0-9]{4,12}$/',
|
pattern: '/^[1-9][0-9]{4,12}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '微信号码',
|
title: '微信号码',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/',
|
pattern: '/^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '域名',
|
title: '域名',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?$/',
|
pattern: '/^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '车牌号码',
|
title: '车牌号码',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/',
|
pattern: '/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '护照',
|
title: '护照',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(P\\d{7}|G\\d{7,8}|TH\\d{7,8}|S\\d{7,8}|A\\d{7,8}|L\\d{7,8}|\\d{9}|D\\d+|1[4,5]\\d{7})$/',
|
pattern: '/^(P\\d{7}|G\\d{7,8}|TH\\d{7,8}|S\\d{7,8}|A\\d{7,8}|L\\d{7,8}|\\d{9}|D\\d+|1[4,5]\\d{7})$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '固定电话',
|
title: '固定电话',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{8}$/',
|
pattern: '/^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{8}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '邮政编码',
|
title: '邮政编码',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[1-9]{1}(\\d+){5}$/',
|
pattern: '/^[1-9]{1}(\\d+){5}$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '经度',
|
title: '经度',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(\\-|\\+)?(((\\d|[1-9]\\d|1[0-7]\\d|0{1,3})\\.\\d{0,6})|(\\d|[1-9]\\d|1[0-7]\\d|0{1,3})|180\\.0{0,6}|180)$/',
|
pattern: '/^(\\-|\\+)?(((\\d|[1-9]\\d|1[0-7]\\d|0{1,3})\\.\\d{0,6})|(\\d|[1-9]\\d|1[0-7]\\d|0{1,3})|180\\.0{0,6}|180)$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '纬度',
|
title: '纬度',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^(\\-|\\+)?([0-8]?\\d{1}\\.\\d{0,6}|90\\.0{0,6}|[0-8]?\\d{1}|90)$/',
|
pattern: '/^(\\-|\\+)?([0-8]?\\d{1}\\.\\d{0,6}|90\\.0{0,6}|[0-8]?\\d{1}|90)$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '正整数 + 0',
|
title: '正整数 + 0',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^\\d+$/',
|
pattern: '/^\\d+$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '正整数',
|
title: '正整数',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^[0-9]*[1-9][0-9]*$/',
|
pattern: '/^[0-9]*[1-9][0-9]*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '负整数 + 0',
|
title: '负整数 + 0',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^((-\\d+)|(0+))$/',
|
pattern: '/^((-\\d+)|(0+))$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '负整数',
|
title: '负整数',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^-[0-9]*[1-9][0-9]*$/',
|
pattern: '/^-[0-9]*[1-9][0-9]*$/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '匹配整数',
|
title: '匹配整数',
|
||||||
info: '',
|
info: '',
|
||||||
pattern: '/^-?\\d+$/',
|
pattern: '/^-?\\d+$/',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
selectPattern: null,
|
selectPattern: null,
|
||||||
index: -1,
|
index: -1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["submitPattern"]);
|
const emit = defineEmits(['submitPattern']);
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = () => {
|
const openDialog = () => {
|
||||||
state.isShowDialog = true;
|
state.isShowDialog = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
state.isShowDialog = false;
|
state.isShowDialog = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消
|
// 取消
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePatternClick = (item: any, index: number) => {
|
const handlePatternClick = (item: any, index: number) => {
|
||||||
state.selectPattern = item;
|
state.selectPattern = item;
|
||||||
state.index = index;
|
state.index = index;
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: `点击确定完成操作!`,
|
message: `点击确定完成操作!`,
|
||||||
type: "success",
|
type: 'success',
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
emit('submitPattern', state.selectPattern);
|
emit('submitPattern', state.selectPattern);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
@ -295,49 +294,49 @@ defineExpose({ openDialog });
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pattern-box {
|
.pattern-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 0px 10px;
|
padding: 0px 10px;
|
||||||
|
|
||||||
.pattern-item {
|
.pattern-item {
|
||||||
width: 48%;
|
width: 48%;
|
||||||
border: 1px solid #D9D9D9;
|
border: 1px solid #d9d9d9;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pattern {
|
.pattern {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
background: #1D1F21;
|
background: #1d1f21;
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
color: #D9D9D9;
|
color: #d9d9d9;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
//border: 1px solid red;
|
//border: 1px solid red;
|
||||||
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.2);
|
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
border: 1px solid red !important;
|
border: 1px solid red !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,62 +1,49 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-codeGenConfig-container">
|
<div class="sys-codeGenConfig-container">
|
||||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="800px">
|
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="800px">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit />
|
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
||||||
</el-icon>
|
<span> 编辑规则 </span>
|
||||||
<span> 编辑规则 </span>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
||||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
<el-row :gutter="35">
|
||||||
<el-row :gutter="35">
|
<el-form-item v-show="false">
|
||||||
<el-form-item v-show="false">
|
<el-input v-model="state.ruleForm.id" />
|
||||||
<el-input v-model="state.ruleForm.id" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="验证类型" prop="type">
|
||||||
<el-form-item label="验证类型" prop="type">
|
<el-select v-model="state.ruleForm.type" placeholder="请选择类型" @change="handleTypeChange">
|
||||||
<el-select v-model="state.ruleForm.type" placeholder="请选择类型" @change="handleTypeChange">
|
<el-option v-for="(item, index) in validTypeData" :key="index" :label="item.name" :value="item.code" />
|
||||||
<el-option v-for="(item, index) in validTypeData" :key="index" :label="item.name"
|
</el-select>
|
||||||
:value="item.code" />
|
</el-form-item>
|
||||||
</el-select>
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.ruleForm.type == 'pattern'">
|
||||||
|
<el-form-item label="提示信息" prop="message">
|
||||||
</el-col>
|
<el-input v-model="state.ruleForm.message" placeholder="请输入提示信息" maxlength="128" show-word-limit clearable />
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
</el-form-item>
|
||||||
v-if="state.ruleForm.type == 'pattern'">
|
</el-col>
|
||||||
<el-form-item label="提示信息" prop="message">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.ruleForm.type == 'length'">
|
||||||
<el-input v-model="state.ruleForm.message" placeholder="请输入提示信息" maxlength="128" show-word-limit
|
<el-form-item label="最小值" prop="min">
|
||||||
clearable />
|
<el-input-number v-model="state.ruleForm.min" :min="0" :max="100000" />
|
||||||
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.ruleForm.type == 'length'">
|
||||||
</el-col>
|
<el-form-item label="最大值" prop="max">
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
<el-input-number v-model="state.ruleForm.max" :min="0" :max="100000" />
|
||||||
v-if="state.ruleForm.type == 'length'">
|
</el-form-item>
|
||||||
<el-form-item label="最小值" prop="min">
|
</el-col>
|
||||||
<el-input-number v-model="state.ruleForm.min" :min="0" :max="100000" />
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="state.ruleForm.type == 'pattern'">
|
||||||
</el-form-item>
|
<el-form-item label="正则式" prop="pattern">
|
||||||
|
<el-input v-model="state.ruleForm.pattern" placeholder="请输入正则表达式">
|
||||||
</el-col>
|
<template #append>
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
<el-button @click="openPatternDialog">选择正则</el-button>
|
||||||
v-if="state.ruleForm.type == 'length'">
|
</template>
|
||||||
<el-form-item label="最大值" prop="max">
|
</el-input>
|
||||||
<el-input-number v-model="state.ruleForm.max" :min="0" :max="100000" />
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-form-item>
|
<!-- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
||||||
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
|
||||||
v-if="state.ruleForm.type == 'pattern'">
|
|
||||||
<el-form-item label="正则式" prop="pattern">
|
|
||||||
<el-input v-model="state.ruleForm.pattern" placeholder="请输入正则表达式">
|
|
||||||
<template #append>
|
|
||||||
<el-button @click="openPatternDialog">选择正则</el-button>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<!-- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"
|
|
||||||
v-if="state.ruleForm.type == 'pattern'">
|
v-if="state.ruleForm.type == 'pattern'">
|
||||||
<el-form-item label="数据类型" prop="dataType">
|
<el-form-item label="数据类型" prop="dataType">
|
||||||
<el-radio-group v-model="state.ruleForm.dataType">
|
<el-radio-group v-model="state.ruleForm.dataType">
|
||||||
@ -64,91 +51,88 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col> -->
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</el-row>
|
<patternDialog ref="patternDialogRef" @submit-pattern="submitPatternOK" />
|
||||||
</el-form>
|
</div>
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="submit">确 定</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<patternDialog ref="patternDialogRef" @submit-pattern="submitPatternOK" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.tool-box {
|
.tool-box {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// background: red;
|
// background: red;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, reactive, ref, toRaw, isReactive } from 'vue';
|
import { reactive, ref, toRaw } from 'vue';
|
||||||
import patternDialog from '/@/views/system/codeGen/component/patternDialog.vue';
|
import patternDialog from '/@/views/system/codeGen/component/patternDialog.vue';
|
||||||
import { ElMessage, dialogEmits } from "element-plus";
|
import { ElMessage } from 'element-plus';
|
||||||
import type { FormRules } from "element-plus";
|
import type { FormRules } from 'element-plus';
|
||||||
|
|
||||||
const emit = defineEmits(["submitRule"]);
|
const emit = defineEmits(['submitRule']);
|
||||||
//自行添加其他规则
|
// 自行添加其他规则
|
||||||
const rules = ref<FormRules>({
|
const rules = ref<FormRules>({
|
||||||
type: [
|
type: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择验证类型',
|
message: '请选择验证类型',
|
||||||
trigger: 'change',
|
trigger: 'change',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
min: [
|
min: [
|
||||||
{
|
{
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /[^\d]/g,
|
pattern: /[^\d]/g,
|
||||||
message: '请输入正确的数字',
|
message: '请输入正确的数字',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
max: [
|
max: [
|
||||||
{
|
{
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /[^\d]/g,
|
pattern: /[^\d]/g,
|
||||||
message: '请输入正确的数字',
|
message: '请输入正确的数字',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
message: [
|
message: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入提示信息',
|
message: '请输入提示信息',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
pattern: [
|
pattern: [{ required: true, message: '请输入正则表达式', trigger: 'blur' }],
|
||||||
{ required: true, message: '请输入正则表达式', trigger: 'blur' },
|
// dataType: [
|
||||||
],
|
// {
|
||||||
// dataType: [
|
// required: true,
|
||||||
// {
|
// message: '请选择数据类型',
|
||||||
// required: true,
|
// trigger: 'change',
|
||||||
// message: '请选择数据类型',
|
// },
|
||||||
// trigger: 'change',
|
// ]
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
});
|
});
|
||||||
const ruleFormRef = ref();
|
const ruleFormRef = ref();
|
||||||
const patternDialogRef = ref();
|
const patternDialogRef = ref();
|
||||||
const validTypeData = ref([
|
const validTypeData = ref([
|
||||||
{ code: 'required', name: '必填验证' },
|
{ code: 'required', name: '必填验证' },
|
||||||
{ code: 'remote', name: '远程验证' },
|
{ code: 'remote', name: '远程验证' },
|
||||||
{ code: 'array', name: '数组验证' },
|
{ code: 'array', name: '数组验证' },
|
||||||
{ code: 'pattern', name: '正则模式' },
|
{ code: 'pattern', name: '正则模式' },
|
||||||
{ code: 'length', name: '长度限制' },
|
{ code: 'length', name: '长度限制' },
|
||||||
]);
|
]);
|
||||||
// const dataTypeData = ref([
|
// const dataTypeData = ref([
|
||||||
// { code: 'string', name: '字符串' },
|
// { code: 'string', name: '字符串' },
|
||||||
@ -156,73 +140,72 @@ const validTypeData = ref([
|
|||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
ruleForm: {} as any,
|
ruleForm: {} as any,
|
||||||
id: 0,
|
id: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (id: number) => {
|
const openDialog = (id: number) => {
|
||||||
// const data = JSON.parse(JSON.stringify(row));
|
// const data = JSON.parse(JSON.stringify(row));
|
||||||
// state.ruleForm = data;
|
// state.ruleForm = data;
|
||||||
state.id = id;
|
state.id = id;
|
||||||
state.isShowDialog = true;
|
state.isShowDialog = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
// emit("reloadTable");
|
// emit("reloadTable");
|
||||||
ruleFormRef.value.resetFields();
|
ruleFormRef.value.resetFields();
|
||||||
state.isShowDialog = false;
|
state.isShowDialog = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//打开正则选择框
|
// 打开正则选择框
|
||||||
const openPatternDialog = () => {
|
const openPatternDialog = () => {
|
||||||
|
patternDialogRef.value.openDialog();
|
||||||
patternDialogRef.value.openDialog();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
// 取消
|
// 取消
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
// state.isShowDialog = false;
|
// state.isShowDialog = false;
|
||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitPatternOK = (data: any) => {
|
const submitPatternOK = (data: any) => {
|
||||||
// console.log('submitPatternOK', data);
|
// console.log('submitPatternOK', data);
|
||||||
state.ruleForm.pattern = data.pattern;
|
state.ruleForm.pattern = data.pattern;
|
||||||
}
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
let values = toRaw(state.ruleForm);
|
let values = toRaw(state.ruleForm);
|
||||||
values.key = toRaw(state.id);
|
values.key = toRaw(state.id);
|
||||||
emit("submitRule", Object.assign({}, values));
|
emit('submitRule', Object.assign({}, values));
|
||||||
closeDialog();
|
closeDialog();
|
||||||
} else {
|
} else {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
||||||
type: "error",
|
type: 'error',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//类型发生改变
|
// 类型发生改变
|
||||||
const handleTypeChange=()=>{
|
const handleTypeChange = () => {
|
||||||
resetFields();
|
resetFields();
|
||||||
|
};
|
||||||
|
// 重置表单值
|
||||||
|
const resetFields = () => {
|
||||||
|
state.ruleForm.message = '';
|
||||||
|
state.ruleForm.min = 0;
|
||||||
|
state.ruleForm.max = 10;
|
||||||
|
state.ruleForm.pattern = '';
|
||||||
|
// state.ruleForm.dataType=null;
|
||||||
};
|
};
|
||||||
//重置表单值
|
|
||||||
const resetFields=()=>{
|
|
||||||
state.ruleForm.message="";
|
|
||||||
state.ruleForm.min=0;
|
|
||||||
state.ruleForm.max=10;
|
|
||||||
state.ruleForm.pattern="";
|
|
||||||
// state.ruleForm.dataType=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
|
|||||||
@ -1,46 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-codeGenConfig-container">
|
<div class="sys-codeGenConfig-container">
|
||||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="800px">
|
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="800px">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit />
|
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
||||||
</el-icon>
|
<span> {{ state.title }} </span>
|
||||||
<span> {{ state.title }} </span>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
<div class="tool-box">
|
||||||
<div class="tool-box">
|
<el-button type="primary" icon="ele-Plus" @click="openRuleDialog"> 新增 </el-button>
|
||||||
<el-button type="primary" icon="ele-Plus" @click="openRuleDialog"> 新增 </el-button>
|
</div>
|
||||||
</div>
|
<el-table :data="state.tableData" style="width: 100%" v-loading="state.loading" border>
|
||||||
<el-table :data="state.tableData" style="width: 100%" v-loading="state.loading" border>
|
<el-table-column prop="type" label="类型" width="120" show-overflow-tooltip />
|
||||||
<el-table-column prop="type" label="类型" width="120" show-overflow-tooltip />
|
<el-table-column prop="message" label="提示信息" minWidth="180" show-overflow-tooltip />
|
||||||
<el-table-column prop="message" label="提示信息" minWidth="180" show-overflow-tooltip />
|
<el-table-column prop="max" label="最大值" minWidth="100" show-overflow-tooltip />
|
||||||
<el-table-column prop="max" label="最大值" minWidth="100" show-overflow-tooltip />
|
<el-table-column prop="min" label="最小值" minWidth="100" show-overflow-tooltip />
|
||||||
<el-table-column prop="min" label="最小值" minWidth="100" show-overflow-tooltip />
|
<el-table-column prop="pattern" label="正则式" minWidth="120" show-overflow-tooltip />
|
||||||
<el-table-column prop="pattern" label="正则式" minWidth="120" show-overflow-tooltip />
|
<el-table-column prop="action" label="操作" width="100" align="center" show-overflow-tooltip>
|
||||||
<el-table-column prop="action" label="操作" width="100" align="center" show-overflow-tooltip>
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-button type="primary" @click="handleDeleteRule(scope)">删除</el-button>
|
||||||
<el-button type="primary" @click="handleDeleteRule(scope)">删除</el-button>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table>
|
||||||
</el-table>
|
<template #footer>
|
||||||
<template #footer>
|
<span class="dialog-footer">
|
||||||
<span class="dialog-footer">
|
<el-button @click="cancel">取 消</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
<el-button type="primary" @click="submit">确 定</el-button>
|
</span>
|
||||||
</span>
|
</template>
|
||||||
</template>
|
</el-dialog>
|
||||||
</el-dialog>
|
<ruleDialog ref="ruleDialogRef" @submitRule="submitRuleOK" />
|
||||||
<ruleDialog ref="ruleDialogRef" @submitRule="submitRuleOK" />
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.tool-box {
|
.tool-box {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// background: red;
|
// background: red;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -52,79 +51,74 @@ const emits = defineEmits(['submitVerify']);
|
|||||||
// const fkDialogRef = ref();
|
// const fkDialogRef = ref();
|
||||||
const ruleDialogRef = ref();
|
const ruleDialogRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
tableData: [] as any,
|
tableData: [] as any,
|
||||||
title: ''
|
title: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {});
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加返回
|
// 添加返回
|
||||||
const submitRuleOK = (data: any) => {
|
const submitRuleOK = (data: any) => {
|
||||||
let row = toRaw(data);
|
let row = toRaw(data);
|
||||||
if (state.tableData === null) {
|
if (state.tableData === null) {
|
||||||
state.tableData = [];
|
state.tableData = [];
|
||||||
}
|
}
|
||||||
console.log('row', state.tableData);
|
console.log('row', state.tableData);
|
||||||
state.tableData.push(row);
|
state.tableData.push(row);
|
||||||
// console.log('submitRuleOK',state.tableData);
|
// console.log('submitRuleOK',state.tableData);
|
||||||
};
|
};
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// mittBus.off('submitRefresh', () => { });
|
// mittBus.off('submitRefresh', () => { });
|
||||||
//mittBus.off('submitRefreshFk', () => { });
|
//mittBus.off('submitRefreshFk', () => { });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (row: any) => {
|
const openDialog = (row: any) => {
|
||||||
// handleQuery(addRow);
|
// handleQuery(addRow);
|
||||||
state.title = `${row.columnComment} -- 校验规则`;
|
state.title = `${row.columnComment} -- 校验规则`;
|
||||||
// console.log('row',row);
|
// console.log('row',row);
|
||||||
state.tableData = new Array();
|
state.tableData = new Array();
|
||||||
if (row.rules != '') {
|
if (row.rules != '') {
|
||||||
state.tableData = JSON.parse(row.rules);
|
state.tableData = JSON.parse(row.rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// state.tableData = row.rules;
|
||||||
// state.tableData = row.rules;
|
state.id = row.id;
|
||||||
state.id = row.id;
|
state.isShowDialog = true;
|
||||||
state.isShowDialog = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openRuleDialog = () => {
|
const openRuleDialog = () => {
|
||||||
ruleDialogRef.value.openDialog(state.id);
|
ruleDialogRef.value.openDialog(state.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
state.isShowDialog = false;
|
state.isShowDialog = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消
|
// 取消
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
state.isShowDialog = false;
|
state.isShowDialog = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
let data = toRaw(state);
|
let data = toRaw(state);
|
||||||
let newData = Object.assign({}, data);
|
let newData = Object.assign({}, data);
|
||||||
let ruleCount = newData.tableData.length > 0 ? `(${newData.tableData.length})` : '';
|
let ruleCount = newData.tableData.length > 0 ? `(${newData.tableData.length})` : '';
|
||||||
emits('submitVerify', { id: newData.id, rules: JSON.stringify(newData.tableData), ruleCount: ruleCount });
|
emits('submitVerify', { id: newData.id, rules: JSON.stringify(newData.tableData), ruleCount: ruleCount });
|
||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
//删除验证规则
|
// 删除验证规则
|
||||||
const handleDeleteRule = (scope: any) => {
|
const handleDeleteRule = (scope: any) => {
|
||||||
state.tableData.splice(scope.$index, 1);
|
state.tableData.splice(scope.$index, 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user