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