添加项目文件。
This commit is contained in:
1536
visualdev/Tnb.VisualDev.Engine/CodeGen/CodeGenWay.cs
Normal file
1536
visualdev/Tnb.VisualDev.Engine/CodeGen/CodeGenWay.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,497 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev.Engine;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.RemoteRequest.Extensions;
|
||||
using JNPF.Systems.Entitys.Model.DataInterFace;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Spire.Pdf.Lists;
|
||||
using Senparc.NeuChar.Entities;
|
||||
|
||||
namespace JNPF.Common.CodeGen.DataParsing;
|
||||
|
||||
public class ControlParsing : ITransient
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务基础仓储.
|
||||
/// </summary>
|
||||
private readonly ISqlSugarRepository<UserEntity> _repository;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存管理.
|
||||
/// </summary>
|
||||
private readonly ICacheManager _cacheManager;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理.
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
/// <summary>
|
||||
/// 数据接口.
|
||||
/// </summary>
|
||||
private readonly IDataInterfaceService _dataInterfaceService;
|
||||
|
||||
/// <summary>
|
||||
/// 解析控件的控件属性 (vModel , Attr).
|
||||
/// </summary>
|
||||
private Dictionary<string, FieldsModel>? ControlAttr;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数.
|
||||
/// </summary>
|
||||
public ControlParsing(
|
||||
IUserManager userManager,
|
||||
ISqlSugarRepository<UserEntity> repositoryRepository,
|
||||
IDataInterfaceService dataInterfaceService,
|
||||
ICacheManager cacheManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_repository = repositoryRepository;
|
||||
_cacheManager = cacheManager;
|
||||
_dataInterfaceService = dataInterfaceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析控件数据.
|
||||
/// </summary>
|
||||
/// <param name="oldDatas">原数据集合.</param>
|
||||
/// <param name="vModelStr">解析的字段集合 多个需以 ,号隔开.</param>
|
||||
/// <param name="jnpfKeyConst">控件类型 (JnpfKeyConst).</param>
|
||||
/// <param name="tenantId">租户Id.</param>
|
||||
/// <param name="vModelAttr">控件属性 (vModel ,属性字符串).</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Dictionary<string, object>>> GetParsDataList(List<Dictionary<string, object>> oldDatas, string vModelStr, string jnpfKeyConst, string tenantId, List<FieldsModel>? vModelAttr = null)
|
||||
{
|
||||
ControlAttr = new Dictionary<string, FieldsModel>();
|
||||
if (vModelAttr != null) vModelAttr.ForEach(it => ControlAttr.Add(it.__vModel__, it));
|
||||
|
||||
var vModels = new Dictionary<string, object>();
|
||||
var vModelList = vModelStr.Split(',');
|
||||
oldDatas.ForEach(items =>
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (vModelList.Contains(item.Key) && !vModels.ContainsKey(item.Key)) vModels.Add(item.Key, jnpfKeyConst);
|
||||
|
||||
// 子表
|
||||
if (item.Value != null && item.Key.ToLower().Contains("tablefield") && (item.Value is List<Dictionary<string, object>> || item.Value.GetType().Name.Equals("JArray")))
|
||||
{
|
||||
var ctOldDatas = item.Value.ToObject<List<Dictionary<string, object>>>();
|
||||
ctOldDatas.ForEach(ctItems =>
|
||||
{
|
||||
foreach (var ctItem in ctItems) if (vModelList.Contains(ctItem.Key) && !vModels.ContainsKey(ctItem.Key)) vModels.Add(ctItem.Key, jnpfKeyConst);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return await GetParsDataByList(oldDatas, vModels, tenantId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取解析数据.
|
||||
/// </summary>
|
||||
/// <param name="oldDatas">原数据集合.</param>
|
||||
/// <param name="vModels">需解析的字段 (字段名,JnpfKeyConst/子表dictionary).</param>
|
||||
/// <param name="tenantId">租户Id.</param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<Dictionary<string, object>>> GetParsDataByList(List<Dictionary<string, object>> oldDatas, Dictionary<string, object> vModels, string tenantId)
|
||||
{
|
||||
var cacheData = await GetCaCheData(vModels, tenantId);
|
||||
var usersselectDatas = cacheData.Where(t => t.Key.Equals(CommonConst.CodeGenDynamic + "_usersSelect_" + tenantId)).FirstOrDefault().Value.ToObject<Dictionary<string, string>>(); // 用户组件
|
||||
|
||||
oldDatas.ForEach(async items =>
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (vModels.Any(x => x.Key.Equals(item.Key)))
|
||||
{
|
||||
FieldsModel model = ControlAttr.ContainsKey(item.Key) ? ControlAttr[item.Key] : new FieldsModel();
|
||||
model.separator = ",";
|
||||
var jnpfKey = vModels.FirstOrDefault(x => x.Key.Equals(item.Key)).Value;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.USERSSELECT:
|
||||
{
|
||||
if (item.Value != null)
|
||||
{
|
||||
var vList = new List<string>();
|
||||
if (item.Value.ToString().Contains("[")) vList = item.Value.ToString().ToObject<List<string>>();
|
||||
else vList.Add(item.Value.ToString());
|
||||
var itemValues = new List<string>();
|
||||
vList.ForEach(it =>
|
||||
{
|
||||
if (usersselectDatas.ContainsKey(it)) itemValues.Add(usersselectDatas[it]);
|
||||
});
|
||||
if (itemValues.Any()) items[item.Key] = string.Join(",", itemValues);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.POPUPSELECT: // 弹窗选择
|
||||
{
|
||||
if (model.interfaceId.IsNullOrEmpty()) continue;
|
||||
List<Dictionary<string, string>> popupselectDataList = new List<Dictionary<string, string>>();
|
||||
|
||||
// 获取远端数据
|
||||
var dynamic = await _dataInterfaceService.GetInfo(model.interfaceId);
|
||||
var redisName = CommonConst.CodeGenDynamic + "_" + model.interfaceId + "_" + tenantId;
|
||||
if (_cacheManager.Exists(redisName))
|
||||
{
|
||||
popupselectDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, string>>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dynamic == null) break;
|
||||
switch (dynamic.DataType)
|
||||
{
|
||||
case 1: // SQL数据
|
||||
{
|
||||
_dataInterfaceService.ReplaceParameterValue(dynamic, new Dictionary<string, string>());
|
||||
var pObj = await _dataInterfaceService.GetData(dynamic);
|
||||
popupselectDataList = pObj.ToJsonString().ToObject<List<Dictionary<string, string>>>();
|
||||
}
|
||||
break;
|
||||
case 2: // 静态数据
|
||||
{
|
||||
var children = model.props.props.children;
|
||||
foreach (var data in JValue.Parse(dynamic.Query))
|
||||
{
|
||||
popupselectDataList.Add(new Dictionary<string, string>() { { data.Value<string>(model.props.props.value), data.Value<string>(model.props.props.label) } });
|
||||
if (data.Value<object>(children) != null && data.Value<object>(children).ToString() != "")
|
||||
popupselectDataList.AddRange(GetDynamicInfiniteData(data.Value<object>(children).ToString(), model.props.props));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3: // Api数据
|
||||
{
|
||||
var result = await GetApiDataByTypePreview(dynamic); // 请求接口
|
||||
popupselectDataList = result.ContainsKey("list") ? result["list"].ToObject<List<Dictionary<string, string>>>() : new List<Dictionary<string, string>>();
|
||||
if ((popupselectDataList == null || !popupselectDataList.Any()) && result.ContainsKey("data"))
|
||||
popupselectDataList = result["data"].ToObject<Dictionary<string, object>>().ContainsKey("list") ? result["data"]["list"].ToObject<List<Dictionary<string, string>>>() : new List<Dictionary<string, string>>();
|
||||
}
|
||||
break;
|
||||
}
|
||||
_cacheManager.Set(redisName, popupselectDataList.ToList(), TimeSpan.FromMinutes(10)); // 缓存10分钟
|
||||
popupselectDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, string>>>();
|
||||
}
|
||||
|
||||
switch (dynamic.DataType)
|
||||
{
|
||||
case 1: // SQL数据
|
||||
{
|
||||
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(items[item.Key].ToString())).FirstOrDefault();
|
||||
if (specificData != null)
|
||||
{
|
||||
// 要用模板的 “显示字段 - relationField”来展示数据
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[item.Key] = specificData[model.relationField];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.multiple)
|
||||
{
|
||||
var nameList = new List<string>();
|
||||
items[item.Key].ToObject<List<string>>().ForEach(strIt =>
|
||||
{
|
||||
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(strIt)).FirstOrDefault();
|
||||
if (specificData != null)
|
||||
{
|
||||
// 要用模板的 “显示字段 - relationField”来展示数据
|
||||
if (model.relationField.IsNotEmptyOrNull())
|
||||
nameList.Add(specificData[model.relationField]);
|
||||
}
|
||||
});
|
||||
if (nameList.Any())
|
||||
{
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[item.Key] = string.Join(model.separator, nameList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items[item.Key] = items[item.Key].ToString().Contains("[") ? string.Join(model.separator, items[item.Key].ToObject<List<object>>()) : items[item.Key];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: // 静态数据
|
||||
{
|
||||
List<string> dataList = items[item.Key].ToJsonString().ToObject<List<string>>();
|
||||
List<string> cascaderList = new List<string>();
|
||||
foreach (var it in dataList)
|
||||
{
|
||||
var vara = popupselectDataList.Where(a => a.ContainsValue(it)).FirstOrDefault();
|
||||
if (vara != null) cascaderList.Add(vara[model.props.props.label]);
|
||||
}
|
||||
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[item.Key] = string.Join(model.separator, cascaderList);
|
||||
}
|
||||
break;
|
||||
case 3: // Api数据
|
||||
{
|
||||
List<object> cascaderList = new List<object>();
|
||||
if (popupselectDataList != null) popupselectDataList.ForEach(obj => { if (obj[model.propsValue] == items[item.Key].ToString()) cascaderList.Add(obj[model.relationField]); });
|
||||
|
||||
items[item.Key + "_id"] = items[item.Key];
|
||||
items[item.Key] = string.Join(model.separator, cascaderList);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case JnpfKeyConst.RELATIONFORM: // 关联表单
|
||||
{
|
||||
if (model.modelId.IsNullOrEmpty()) continue;
|
||||
List<Dictionary<string, object>> relationFormDataList = new List<Dictionary<string, object>>();
|
||||
|
||||
var redisName = CommonConst.CodeGenDynamic + "_" + model.modelId + "_" + tenantId;
|
||||
if (_cacheManager.Exists(redisName))
|
||||
{
|
||||
relationFormDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, object>>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 根据可视化功能ID获取该模板全部数据
|
||||
var relationFormModel = await _repository.AsSugarClient().Queryable<VisualDevEntity>().FirstAsync(v => v.Id == model.modelId);
|
||||
var newFieLdsModelList = relationFormModel.FormData.ToObject<FormDataModel>().fields.FindAll(x => model.relationField.Equals(x.__vModel__));
|
||||
VisualDevModelListQueryInput listQueryInput = new VisualDevModelListQueryInput
|
||||
{
|
||||
dataType = "1",
|
||||
pageSize = 999999
|
||||
};
|
||||
|
||||
Scoped.Create(async (_, scope) =>
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var _runService = App.GetService<IRunService>(services);
|
||||
var res = await _runService.GetRelationFormList(relationFormModel, listQueryInput);
|
||||
_cacheManager.Set(redisName, res.list.ToList(), TimeSpan.FromMinutes(10)); // 缓存10分钟
|
||||
});
|
||||
var cacheStr = _cacheManager.Get(redisName);
|
||||
if (cacheStr.IsNotEmptyOrNull()) relationFormDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, object>>>();
|
||||
}
|
||||
|
||||
var relationFormRealData = relationFormDataList.Where(it => it["id"].Equals(items[item.Key])).FirstOrDefault();
|
||||
if (relationFormRealData != null && relationFormRealData.Count > 0)
|
||||
{
|
||||
items[item.Key + "_id"] = relationFormRealData["id"];
|
||||
items[item.Key] = relationFormRealData.ContainsKey(model.relationField) ? relationFormRealData[model.relationField] : string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
items[item.Key] = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 子表
|
||||
if (item.Value != null && item.Key.ToLower().Contains("tablefield") && (item.Value is List<Dictionary<string, object>> || item.Value.GetType().Name.Equals("JArray")))
|
||||
{
|
||||
var ctList = item.Value.ToObject<List<Dictionary<string, object>>>();
|
||||
var ctVModels = new Dictionary<string, object>();
|
||||
vModels.Where(x => x.Key.Contains(item.Key)).ToList().ForEach(ctItem => ctVModels.Add(ctItem.Key.Split("-").LastOrDefault(), ctItem.Value));
|
||||
if (ctList.Any()) items[item.Key] = await GetParsDataByList(ctList, ctVModels, tenantId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return oldDatas;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取解析数据缓存.
|
||||
/// </summary>
|
||||
/// <param name="vModels"></param>
|
||||
/// <param name="tenantId"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Dictionary<string, object>> GetCaCheData(Dictionary<string, object> vModels, string tenantId)
|
||||
{
|
||||
var res = new Dictionary<string, object>();
|
||||
|
||||
if (vModels.Where(x => x.Value.Equals(JnpfKeyConst.USERSSELECT)).Any())
|
||||
{
|
||||
string? userCacheKey = CommonConst.CodeGenDynamic + "_usersSelect_" + tenantId;
|
||||
if (_cacheManager.Exists(userCacheKey))
|
||||
{
|
||||
res.Add(userCacheKey, _cacheManager.Get(userCacheKey).ToObject<Dictionary<string, object>>());
|
||||
}
|
||||
else
|
||||
{
|
||||
var addList = new Dictionary<string, string>();
|
||||
(await _repository.AsSugarClient().Queryable<UserEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.RealName, x.Account }).ToListAsync()).ForEach(item => addList.Add(item.Id + "--user", item.RealName + "/" + item.Account));
|
||||
(await _repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
addList.Add(item.Id + "--company", item.FullName);
|
||||
addList.Add(item.Id + "--department", item.FullName);
|
||||
});
|
||||
(await _repository.AsSugarClient().Queryable<RoleEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item => addList.Add(item.Id + "--role", item.FullName));
|
||||
(await _repository.AsSugarClient().Queryable<PositionEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item => addList.Add(item.Id + "--position", item.FullName));
|
||||
(await _repository.AsSugarClient().Queryable<GroupEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item => addList.Add(item.Id + "--group", item.FullName));
|
||||
|
||||
// 缓存5分钟
|
||||
_cacheManager.Set(userCacheKey, addList, TimeSpan.FromMinutes(5));
|
||||
res.Add(userCacheKey, addList);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户组件查询条件组装.
|
||||
/// </summary>
|
||||
/// <param name="key">字段名.</param>
|
||||
/// <param name="value">查询值.</param>
|
||||
/// <param name="multiple">是否多选.</param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GetUsersSelectQueryWhere(string key, string value, bool multiple)
|
||||
{
|
||||
var conModels = new List<IConditionalModel>();
|
||||
if (value.IsNullOrEmpty()) return conModels;
|
||||
if (multiple)
|
||||
{
|
||||
var rIdList = _repository.AsSugarClient().Queryable<UserRelationEntity>().Where(x => x.UserId.Equals(value.Replace("--user", string.Empty))).Select(x => new { x.ObjectId, x.ObjectType }).ToList();
|
||||
var objIdList = new List<string>() { value };
|
||||
rIdList.ForEach(x =>
|
||||
{
|
||||
if (x.ObjectType.Equals("Organize"))
|
||||
{
|
||||
objIdList.Add(x.ObjectId + "--company");
|
||||
objIdList.Add(x.ObjectId + "--department");
|
||||
}
|
||||
else
|
||||
{
|
||||
objIdList.Add(x.ObjectId + "--" + x.ObjectType.ToLower());
|
||||
}
|
||||
});
|
||||
|
||||
var whereList = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
||||
for (var i = 0; i < objIdList.Count(); i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Like,
|
||||
FieldValue = objIdList[i]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
conModels.Add(new ConditionalCollections() { ConditionalList = whereList });
|
||||
}
|
||||
else
|
||||
{
|
||||
conModels.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = key,
|
||||
ConditionalType = ConditionalType.Equal,
|
||||
FieldValue = value
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return conModels;
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取动态无限级数据.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="props"></param>
|
||||
/// <returns></returns>
|
||||
private List<Dictionary<string, string>> GetDynamicInfiniteData(string data, PropsBeanModel props)
|
||||
{
|
||||
List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
|
||||
string? value = props.value;
|
||||
string? label = props.label;
|
||||
string? children = props.children;
|
||||
foreach (JToken? info in JToken.Parse(data))
|
||||
{
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic[info.Value<string>(value)] = info.Value<string>(label);
|
||||
list.Add(dic);
|
||||
if (info.Value<object>(children) != null && info.Value<object>(children).ToString() != string.Empty)
|
||||
list.AddRange(GetDynamicInfiniteData(info.Value<object>(children).ToString(), props));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据不同规则请求接口(预览).
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<JObject> GetApiDataByTypePreview(DataInterfaceEntity entity)
|
||||
{
|
||||
var result = new JObject();
|
||||
var parameters = entity.RequestParameters.ToObject<List<DataInterfaceReqParameter>>();
|
||||
var parametersHerader = entity.RequestHeaders.ToObject<List<DataInterfaceReqParameter>>();
|
||||
var dic = new Dictionary<string, object>();
|
||||
var dicHerader = new Dictionary<string, object>();
|
||||
dicHerader.Add("JNPF_API", true);
|
||||
if (_userManager.ToKen != null && !_userManager.ToKen.Contains("::"))
|
||||
dicHerader.Add("Authorization", _userManager.ToKen);
|
||||
foreach (var key in parameters)
|
||||
{
|
||||
dic.Add(key.field, key.defaultValue);
|
||||
}
|
||||
|
||||
foreach (var key in parametersHerader)
|
||||
{
|
||||
dicHerader[key.field] = key.defaultValue;
|
||||
}
|
||||
|
||||
switch (entity.RequestMethod)
|
||||
{
|
||||
case "6":
|
||||
result = (await entity.Path.SetHeaders(dicHerader).SetQueries(dic).GetAsStringAsync()).ToObject<JObject>();
|
||||
break;
|
||||
case "7":
|
||||
result = (await entity.Path.SetHeaders(dicHerader).SetBody(dic).PostAsStringAsync()).ToObject<JObject>();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
2096
visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs
Normal file
2096
visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs
Normal file
File diff suppressed because it is too large
Load Diff
55
visualdev/Tnb.VisualDev.Engine/Core/TemplateAnalysis.cs
Normal file
55
visualdev/Tnb.VisualDev.Engine/Core/TemplateAnalysis.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using JNPF.Common.Const;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析.
|
||||
/// </summary>
|
||||
public static class TemplateAnalysis
|
||||
{
|
||||
/// <summary>
|
||||
/// 解析模板数据
|
||||
/// 移除模板内的布局类型控件.
|
||||
/// </summary>
|
||||
public static List<FieldsModel> AnalysisTemplateData(List<FieldsModel> fieldsModelList)
|
||||
{
|
||||
var template = new List<FieldsModel>();
|
||||
|
||||
// 将模板内的无限children解析出来
|
||||
// 不包含子表children
|
||||
foreach (var item in fieldsModelList)
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
template.Add(item);
|
||||
break;
|
||||
case JnpfKeyConst.ROW:
|
||||
case JnpfKeyConst.CARD:
|
||||
template.AddRange(AnalysisTemplateData(config.children));
|
||||
break;
|
||||
case JnpfKeyConst.COLLAPSE:
|
||||
case JnpfKeyConst.TAB:
|
||||
foreach (FieldsModel? collapse in config.children)
|
||||
{
|
||||
template.AddRange(AnalysisTemplateData(collapse.__config__.children));
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.JNPFTEXT:
|
||||
case JnpfKeyConst.DIVIDER:
|
||||
case JnpfKeyConst.GROUPTITLE:
|
||||
case JnpfKeyConst.BUTTON:
|
||||
case JnpfKeyConst.ALERT:
|
||||
case JnpfKeyConst.LINK:
|
||||
break;
|
||||
default:
|
||||
template.Add(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
}
|
||||
526
visualdev/Tnb.VisualDev.Engine/Core/TemplateParsingBase.cs
Normal file
526
visualdev/Tnb.VisualDev.Engine/Core/TemplateParsingBase.cs
Normal file
@@ -0,0 +1,526 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.VisualDev.Engine.Model;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using Mapster;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析 基础类.
|
||||
/// </summary>
|
||||
public class TemplateParsingBase
|
||||
{
|
||||
public TemplateParsingBase() { }
|
||||
|
||||
/// <summary>
|
||||
/// 模板实体.
|
||||
/// </summary>
|
||||
public VisualDevEntity visualDevEntity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页面类型 (1、纯表单,2、表单加列表,3、表单列表工作流).
|
||||
/// </summary>
|
||||
public int WebType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有表 (true 有表, false 无表).
|
||||
/// </summary>
|
||||
public bool IsHasTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单配置JSON模型.
|
||||
/// </summary>
|
||||
public FormDataModel? FormModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列配置JSON模型.
|
||||
/// </summary>
|
||||
public ColumnDesignModel ColumnData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App列配置JSON模型.
|
||||
/// </summary>
|
||||
public ColumnDesignModel AppColumnData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所有控件集合.
|
||||
/// </summary>
|
||||
public List<FieldsModel> AllFieldsModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所有控件集合(已剔除布局控件).
|
||||
/// </summary>
|
||||
public List<FieldsModel> FieldsModelList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表控件集合.
|
||||
/// </summary>
|
||||
public List<FieldsModel> MainTableFieldsModelList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 副表控件集合.
|
||||
/// </summary>
|
||||
public List<FieldsModel> AuxiliaryTableFieldsModelList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表控件集合.
|
||||
/// </summary>
|
||||
public List<FieldsModel> ChildTableFieldsModelList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主/副表控件集合(列表展示数据控件).
|
||||
/// </summary>
|
||||
public List<FieldsModel> SingleFormData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所有表.
|
||||
/// </summary>
|
||||
public List<TableModel> AllTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表.
|
||||
/// </summary>
|
||||
public TableModel? MainTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表 表名.
|
||||
/// </summary>
|
||||
public string? MainTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主/副表 系统生成控件集合.
|
||||
/// </summary>
|
||||
public List<FieldsModel> GenerateFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表 vModel 字段 字典.
|
||||
/// Key : vModel , Value : 主表.vModel.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> MainTableFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 副表 vModel 字段 字典.
|
||||
/// Key : vModel , Value : 副表.vModel.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> AuxiliaryTableFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表 vModel 字段 字典.
|
||||
/// Key : 设计子表-vModel , Value : 子表.vModel.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> ChildTableFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所有表 vModel 字段 字典.
|
||||
/// Key : 设计子表-vModel , Value : 表.vModel.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> AllTableFields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称.
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表主键名.
|
||||
/// </summary>
|
||||
public string MainPrimary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接.
|
||||
/// </summary>
|
||||
public DbLinkEntity DbLink { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导入模式.(1 仅新增,2 更新和新增数据).
|
||||
/// </summary>
|
||||
public string dataType { get; set; } = "1";
|
||||
|
||||
/// <summary>
|
||||
/// 导入数据列表.
|
||||
/// </summary>
|
||||
public List<string> selectKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析帮助 构造 (功能表单).
|
||||
/// </summary>
|
||||
/// <param name="formJson">表单Json.</param>
|
||||
/// <param name="tables">涉及表Json.</param>
|
||||
/// <param name="isFlowTask"></param>
|
||||
public TemplateParsingBase(string formJson, string tables, bool isFlowTask = false)
|
||||
{
|
||||
InitByFormType(formJson, tables, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析帮助 构造.
|
||||
/// </summary>
|
||||
/// <param name="formJson">表单Json.</param>
|
||||
/// <param name="tables">涉及表Json.</param>
|
||||
/// <param name="formType">表单类型(1:系统表单 2:自定义表单).</param>
|
||||
public TemplateParsingBase(string formJson, string tables, int formType)
|
||||
{
|
||||
InitByFormType(formJson, tables, formType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析帮助 构造.
|
||||
/// </summary>
|
||||
/// <param name="entity">功能实体</param>
|
||||
/// <param name="isFlowTask"></param>
|
||||
public TemplateParsingBase(VisualDevEntity entity, bool isFlowTask = false)
|
||||
{
|
||||
visualDevEntity = entity;
|
||||
WebType = entity.WebType;
|
||||
if (entity.FlowId.IsNotEmptyOrNull() && entity.EnableFlow.Equals(1)) WebType = 3;
|
||||
FormDataModel formModel = entity.FormData.ToObject<FormDataModel>();
|
||||
FormModel = formModel; // 表单Json模型
|
||||
IsHasTable = !string.IsNullOrEmpty(entity.Tables) && !"[]".Equals(entity.Tables); // 是否有表
|
||||
AllFieldsModel = GetInDataFieldsModel(formModel.fields.ToJsonString().ToObject<List<FieldsModel>>()); // 所有控件集合
|
||||
FieldsModelList = GetInDataFieldsModel(formModel.fields); // 已剔除布局控件集合
|
||||
MainTable = entity.Tables.ToList<TableModel>().Find(m => m.typeId.Equals("1")); // 主表
|
||||
MainTableName = MainTable?.table; // 主表名称
|
||||
AddChlidTableFeildsModel();
|
||||
|
||||
// 处理旧控件 部分没有 tableName
|
||||
FieldsModelList.Where(x => string.IsNullOrWhiteSpace(x.__config__.tableName)).ToList().ForEach(item =>
|
||||
{
|
||||
if (item.__vModel__.Contains("_jnpf_")) item.__config__.tableName = item.__vModel__.ReplaceRegex(@"_jnpf_(\w+)", string.Empty).Replace("jnpf_", string.Empty); // 副表
|
||||
else item.__config__.tableName = MainTableName != null ? MainTableName : string.Empty; // 主表
|
||||
});
|
||||
AllTable = entity.Tables.ToObject<List<TableModel>>(); // 所有表
|
||||
AuxiliaryTableFieldsModelList = FieldsModelList.Where(x => x.__vModel__.Contains("_jnpf_")).ToList(); // 单控件副表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == "table").ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != "table").ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
MainTableFields = new Dictionary<string, string>();
|
||||
AuxiliaryTableFields = new Dictionary<string, string>();
|
||||
ChildTableFields = new Dictionary<string, string>();
|
||||
AllTableFields = new Dictionary<string, string>();
|
||||
MainTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
MainTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
AuxiliaryTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
AuxiliaryTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
AllTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
});
|
||||
ChildTableFieldsModelList.ForEach(item =>
|
||||
{
|
||||
item.__config__.children.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
ChildTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
});
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(entity.ColumnData)) ColumnData = entity.ColumnData.ToObject<ColumnDesignModel>(); // 列配置模型
|
||||
else ColumnData = new ColumnDesignModel();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(entity.AppColumnData)) AppColumnData = entity.AppColumnData.ToObject<ColumnDesignModel>(); // 列配置模型
|
||||
else AppColumnData = new ColumnDesignModel();
|
||||
|
||||
if (AppColumnData.columnList != null && AppColumnData.columnList.Any())
|
||||
{
|
||||
AppColumnData.columnList.ForEach(item =>
|
||||
{
|
||||
var addColumn = ColumnData.columnList.Find(x => x.prop == item.prop);
|
||||
if (addColumn == null) ColumnData.columnList.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
if (AppColumnData.searchList != null && AppColumnData.searchList.Any())
|
||||
{
|
||||
AppColumnData.searchList.ForEach(item =>
|
||||
{
|
||||
var addSearch = ColumnData.searchList.Find(x => x.__config__.jnpfKey == item.__config__.jnpfKey);
|
||||
if (addSearch == null) ColumnData.searchList.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
if (ColumnData.searchList != null && ColumnData.searchList.Any())
|
||||
{
|
||||
ColumnData.searchList.Where(x => x.__config__.jnpfKey == JnpfKeyConst.CASCADER).ToList().ForEach(item =>
|
||||
{
|
||||
var it = SingleFormData.FirstOrDefault(x => x.__vModel__ == item.__vModel__);
|
||||
if (it != null) item.multiple = it.props.props.multiple;
|
||||
});
|
||||
}
|
||||
|
||||
FullName = entity.FullName;
|
||||
|
||||
if (ColumnData.uploaderTemplateJson != null && ColumnData.uploaderTemplateJson.selectKey != null)
|
||||
{
|
||||
dataType = ColumnData.uploaderTemplateJson.dataType;
|
||||
selectKey = new List<string>();
|
||||
|
||||
// 列顺序
|
||||
AllFieldsModel.ForEach(item =>
|
||||
{
|
||||
if (ColumnData.uploaderTemplateJson.selectKey.Any(x => x.Equals(item.__vModel__))) selectKey.Add(item.__vModel__);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析帮助 构造(代码生成用).
|
||||
/// </summary>
|
||||
/// <param name="dblink">数据连接.</param>
|
||||
/// <param name="fieldList">控件集合.</param>
|
||||
/// <param name="tables">主/副/子 表.</param>
|
||||
/// <param name="mainPrimary">主表主键.</param>
|
||||
/// <param name="webType">页面类型 (1、纯表单,2、表单加列表,3、表单列表工作流).</param>
|
||||
/// <param name="primaryKeyPolicy">主键策略(1 雪花ID 2 自增长ID).</param>
|
||||
/// <param name="uploaderKey">导入导出数据列名集合.</param>
|
||||
/// <param name="_dataType">导入类型 1 新增, 2 新增和修改.</param>
|
||||
/// <param name="enableFlow">是否开启流程 1 开启.</param>
|
||||
public TemplateParsingBase(
|
||||
DbLinkEntity dblink,
|
||||
List<FieldsModel> fieldList,
|
||||
List<DbTableRelationModel> tables,
|
||||
string mainPrimary,
|
||||
int webType,
|
||||
int primaryKeyPolicy,
|
||||
List<string> uploaderKey,
|
||||
string _dataType, int enableFlow = 0)
|
||||
{
|
||||
if (enableFlow.Equals(1)) visualDevEntity = new VisualDevEntity() { EnableFlow = 1 };
|
||||
DbLink = dblink;
|
||||
AllTable = tables.ToObject<List<TableModel>>(); // 所有表
|
||||
FieldsModelList = fieldList;
|
||||
AllFieldsModel = FieldsModelList.Copy();
|
||||
MainTable = AllTable.Find(m => m.typeId.Equals("1")); // 主表
|
||||
MainTableName = MainTable?.table; // 主表名称
|
||||
MainPrimary = mainPrimary;
|
||||
AddCodeGenChlidTableFeildsModel();
|
||||
|
||||
// 处理旧控件 部分没有 tableName
|
||||
FieldsModelList.Where(x => string.IsNullOrWhiteSpace(x.__config__.tableName)).ToList().ForEach(item =>
|
||||
{
|
||||
if (item.__vModel__.Contains("_jnpf_")) item.__config__.tableName = item.__vModel__.ReplaceRegex(@"_jnpf_(\w+)", string.Empty).Replace("jnpf_", string.Empty); // 副表
|
||||
else item.__config__.tableName = MainTableName != null ? MainTableName : string.Empty; // 主表
|
||||
});
|
||||
AuxiliaryTableFieldsModelList = FieldsModelList.Where(x => x.__vModel__.Contains("_jnpf_")).ToList(); // 单控件副表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == "table").ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != "table").ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
MainTableFields = new Dictionary<string, string>();
|
||||
AuxiliaryTableFields = new Dictionary<string, string>();
|
||||
ChildTableFields = new Dictionary<string, string>();
|
||||
AllTableFields = new Dictionary<string, string>();
|
||||
MainTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
MainTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
AuxiliaryTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
AuxiliaryTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
AllTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
});
|
||||
ChildTableFieldsModelList.ForEach(item =>
|
||||
{
|
||||
item.__config__.children.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
ChildTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
});
|
||||
|
||||
WebType = webType;
|
||||
FormModel = new FormDataModel();
|
||||
FormModel.primaryKeyPolicy = primaryKeyPolicy;
|
||||
ColumnData = new ColumnDesignModel();
|
||||
ColumnData.type = 1;
|
||||
AppColumnData = new ColumnDesignModel();
|
||||
selectKey = uploaderKey;
|
||||
dataType = _dataType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证模板.
|
||||
/// </summary>
|
||||
/// <returns>true 通过.</returns>
|
||||
public bool VerifyTemplate()
|
||||
{
|
||||
if (FieldsModelList != null && FieldsModelList.Any(x => x.__config__.jnpfKey == "table"))
|
||||
{
|
||||
foreach (FieldsModel? item in ChildTableFieldsModelList)
|
||||
{
|
||||
FieldsModel? tc = AuxiliaryTableFieldsModelList.Find(x => x.__vModel__.Contains(item.__config__.tableName + "_jnpf_"));
|
||||
if (tc != null) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取带数据转换的控件
|
||||
/// 移除模板内的布局类型控件.
|
||||
/// </summary>
|
||||
/// <param name="fieldsModelList">组件集合.</param>
|
||||
/// <returns>带数据的控件.</returns>
|
||||
public List<FieldsModel> GetInDataFieldsModel(List<FieldsModel> fieldsModelList)
|
||||
{
|
||||
List<FieldsModel>? template = new List<FieldsModel>();
|
||||
|
||||
// 将模板内的无限children解析出来
|
||||
// 不包含子表children
|
||||
foreach (FieldsModel? item in fieldsModelList)
|
||||
{
|
||||
ConfigModel? config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE: // 表格
|
||||
template.Add(item);
|
||||
break;
|
||||
case JnpfKeyConst.ROW: // 卡片
|
||||
case JnpfKeyConst.CARD: // 栅格布局
|
||||
template.AddRange(GetInDataFieldsModel(config.children));
|
||||
break;
|
||||
case JnpfKeyConst.COLLAPSE: // 折叠面板
|
||||
case JnpfKeyConst.TAB: // Tab标签
|
||||
config.children.ForEach(item => template.AddRange(GetInDataFieldsModel(item.__config__.children)));
|
||||
break;
|
||||
case JnpfKeyConst.JNPFTEXT: // 文本
|
||||
case JnpfKeyConst.DIVIDER: // 分割线
|
||||
case JnpfKeyConst.BUTTON: // 按钮
|
||||
case JnpfKeyConst.GROUPTITLE: // 分组标题
|
||||
case JnpfKeyConst.ALERT:
|
||||
case JnpfKeyConst.LINK: // 链接
|
||||
break;
|
||||
default:
|
||||
template.Add(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统生成字段空格键.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<FieldsModel> GetGenerateFields()
|
||||
{
|
||||
// 系统生成字段 key
|
||||
var gfList = new List<string>() { JnpfKeyConst.BILLRULE, JnpfKeyConst.CREATEUSER, JnpfKeyConst.CREATETIME, JnpfKeyConst.MODIFYUSER, JnpfKeyConst.MODIFYTIME, JnpfKeyConst.CURRPOSITION, JnpfKeyConst.CURRORGANIZE, JnpfKeyConst.UPLOADFZ };
|
||||
|
||||
return SingleFormData.Where(x => gfList.Contains(x.__config__.jnpfKey)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理子表内的控件 添加到所有控件.
|
||||
/// </summary>
|
||||
private void AddChlidTableFeildsModel()
|
||||
{
|
||||
var ctList = new List<FieldsModel>();
|
||||
AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.TABLE)).ToList().ForEach(item =>
|
||||
{
|
||||
item.__config__.children.Where(it => it.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(it => it.__vModel__ = item.__vModel__ + "-" + it.__vModel__);
|
||||
ctList.AddRange(GetInDataFieldsModel(item.__config__.children));
|
||||
});
|
||||
AllFieldsModel.AddRange(ctList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理子表内的控件 添加到所有控件.
|
||||
/// </summary>
|
||||
private void AddCodeGenChlidTableFeildsModel()
|
||||
{
|
||||
var ctList = new List<FieldsModel>();
|
||||
AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.TABLE)).ToList().ForEach(item =>
|
||||
{
|
||||
item.__config__.children.Where(it => it.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(it =>
|
||||
{
|
||||
it.__config__.label = it.__config__.label.Replace(it.__vModel__, item.__vModel__ + "-" + it.__vModel__);
|
||||
it.__vModel__ = item.__vModel__ + "-" + it.__vModel__;
|
||||
});
|
||||
ctList.AddRange(item.__config__.children);
|
||||
});
|
||||
AllFieldsModel.AddRange(ctList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据表单类型初始化.
|
||||
/// </summary>
|
||||
/// <param name="formJson">表单Json.</param>
|
||||
/// <param name="tables">涉及表Json.</param>
|
||||
/// <param name="formType">表单类型(1:系统表单 2:自定义表单).</param>
|
||||
private void InitByFormType(string formJson, string tables, int formType)
|
||||
{
|
||||
if (formType.Equals(1))
|
||||
{
|
||||
AllFieldsModel = new List<FieldsModel>();
|
||||
var fields = formJson.ToObject<List<Dictionary<string, object>>>();
|
||||
fields.ForEach(it =>
|
||||
{
|
||||
if (it.ContainsKey("filedId"))
|
||||
AllFieldsModel.Add(new FieldsModel() { __vModel__ = it["filedId"].ToString(), __config__ = new ConfigModel() { label = it["filedName"].ToString(), jnpfKey = JnpfKeyConst.COMINPUT } });
|
||||
});
|
||||
FieldsModelList = AllFieldsModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
FormDataModel formModel = formJson.ToObject<FormDataModel>();
|
||||
FormModel = formModel; // 表单Json模型
|
||||
IsHasTable = !string.IsNullOrEmpty(tables) && !"[]".Equals(tables); // 是否有表
|
||||
AllFieldsModel = GetInDataFieldsModel(formModel.fields.ToJsonString().ToObject<List<FieldsModel>>()); // 所有控件集合
|
||||
FieldsModelList = GetInDataFieldsModel(formModel.fields); // 已剔除布局控件集合
|
||||
MainTable = tables.ToList<TableModel>().Find(m => m.typeId.Equals("1")); // 主表
|
||||
MainTableName = MainTable?.table; // 主表名称
|
||||
AddChlidTableFeildsModel();
|
||||
|
||||
// 处理旧控件 部分没有 tableName
|
||||
FieldsModelList.Where(x => string.IsNullOrWhiteSpace(x.__config__.tableName)).ToList().ForEach(item =>
|
||||
{
|
||||
if (item.__vModel__.Contains("_jnpf_")) item.__config__.tableName = item.__vModel__.ReplaceRegex(@"_jnpf_(\w+)", string.Empty).Replace("jnpf_", string.Empty); // 副表
|
||||
else item.__config__.tableName = MainTableName != null ? MainTableName : string.Empty; // 主表
|
||||
});
|
||||
AllTable = tables.ToObject<List<TableModel>>(); // 所有表
|
||||
AuxiliaryTableFieldsModelList = FieldsModelList.Where(x => x.__vModel__.Contains("_jnpf_")).ToList(); // 单控件副表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == "table").ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != "table").ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
MainTableFields = new Dictionary<string, string>();
|
||||
AuxiliaryTableFields = new Dictionary<string, string>();
|
||||
ChildTableFields = new Dictionary<string, string>();
|
||||
AllTableFields = new Dictionary<string, string>();
|
||||
MainTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
MainTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(x.__vModel__, x.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
AuxiliaryTableFieldsModelList.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
AuxiliaryTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
AllTableFields.Add(x.__vModel__, x.__vModel__.Replace("_jnpf_", ".").Replace("jnpf_", string.Empty));
|
||||
});
|
||||
ChildTableFieldsModelList.ForEach(item =>
|
||||
{
|
||||
item.__config__.children.Where(x => x.__vModel__.IsNotEmptyOrNull()).ToList().ForEach(x =>
|
||||
{
|
||||
ChildTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
});
|
||||
|
||||
ColumnData = new ColumnDesignModel();
|
||||
AppColumnData = new ColumnDesignModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Enum.VisualDevModelData
|
||||
{
|
||||
/// <summary>
|
||||
/// 在线开发控件 数据缓存枚举.
|
||||
/// </summary>
|
||||
public enum vModelType
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典DataType.
|
||||
/// </summary>
|
||||
[Description("dictionary")]
|
||||
DICTIONARY,
|
||||
|
||||
/// <summary>
|
||||
/// 静态数据DataType.
|
||||
/// </summary>
|
||||
[Description("static")]
|
||||
STATIC,
|
||||
|
||||
/// <summary>
|
||||
/// 查询字段数据.
|
||||
/// </summary>
|
||||
[Description("keyJsonMap")]
|
||||
KEYJSONMAP,
|
||||
|
||||
/// <summary>
|
||||
/// 级联选择静态模板值.
|
||||
/// </summary>
|
||||
[Description("value")]
|
||||
VALUE,
|
||||
|
||||
/// <summary>
|
||||
/// 远程数据DataType.
|
||||
/// </summary>
|
||||
[Description("dynamic")]
|
||||
DYNAMIC,
|
||||
|
||||
/// <summary>
|
||||
/// 远程数据.
|
||||
/// </summary>
|
||||
[Description("timeControl")]
|
||||
TIMECONTROL,
|
||||
|
||||
/// <summary>
|
||||
/// 可视化数据列表结果key.
|
||||
/// </summary>
|
||||
[Description("list")]
|
||||
LIST
|
||||
}
|
||||
}
|
||||
30
visualdev/Tnb.VisualDev.Engine/Mapper/VisualDev.cs
Normal file
30
visualdev/Tnb.VisualDev.Engine/Mapper/VisualDev.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.Common.Models.VisualDev;
|
||||
using JNPF.Common.Security;
|
||||
using Mapster;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Mapper;
|
||||
|
||||
internal class VisualDev : IRegister
|
||||
{
|
||||
public void Register(TypeAdapterConfig config)
|
||||
{
|
||||
config.ForType<FieldsModel, ListSearchParametersModel>()
|
||||
.Map(dest => dest.jnpfKey, src => src.__config__.jnpfKey)
|
||||
.Map(dest => dest.format, src => src.format)
|
||||
.Map(dest => dest.multiple, src => src.multiple)
|
||||
.Map(dest => dest.searchType, src => src.searchType)
|
||||
.Map(dest => dest.vModel, src => src.__vModel__);
|
||||
config.ForType<CodeGenFieldsModel, FieldsModel>()
|
||||
.Map(dest => dest.__config__, src => src.__config__.ToObject<ConfigModel>())
|
||||
.Map(dest => dest.__slot__, src => string.IsNullOrEmpty(src.__slot__) ? null : src.__slot__.ToObject<SlotModel>())
|
||||
.Map(dest => dest.props, src => string.IsNullOrEmpty(src.props) ? null : src.props.ToObject<CodeGenPropsModel>())
|
||||
.Map(dest => dest.options, src => string.IsNullOrEmpty(src.options) ? null : src.options.ToObject<List<object>>())
|
||||
.Map(dest => dest.ableDepIds, src => string.IsNullOrEmpty(src.ableDepIds) ? null : src.ableDepIds.ToObject<List<string>>())
|
||||
.Map(dest => dest.ablePosIds, src => string.IsNullOrEmpty(src.ablePosIds) ? null : src.ablePosIds.ToObject<List<string>>())
|
||||
.Map(dest => dest.ableUserIds, src => string.IsNullOrEmpty(src.ableUserIds) ? null : src.ableUserIds.ToObject<List<string>>())
|
||||
.Map(dest => dest.ableRoleIds, src => string.IsNullOrEmpty(src.ableRoleIds) ? null : src.ableRoleIds.ToObject<List<string>>())
|
||||
.Map(dest => dest.ableGroupIds, src => string.IsNullOrEmpty(src.ableGroupIds) ? null : src.ableGroupIds.ToObject<List<string>>())
|
||||
.Map(dest => dest.ableIds, src => string.IsNullOrEmpty(src.ableIds) ? null : src.ableIds.ToObject<List<string>>());
|
||||
}
|
||||
}
|
||||
25
visualdev/Tnb.VisualDev.Engine/Model/ButtonConfigModel.cs
Normal file
25
visualdev/Tnb.VisualDev.Engine/Model/ButtonConfigModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 按钮配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ButtonConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 值.
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标.
|
||||
/// </summary>
|
||||
public string icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成详细配置参数.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称.
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务名.
|
||||
/// </summary>
|
||||
public string BusName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命名空间.
|
||||
/// </summary>
|
||||
public string NameSpace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型名称.
|
||||
/// </summary>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public string PrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerPrimaryKey => string.IsNullOrWhiteSpace(PrimaryKey) ? null : PrimaryKey.Substring(0, 1).ToLower() + PrimaryKey[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 原始主键.
|
||||
/// </summary>
|
||||
public string OriginalPrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键策略.
|
||||
/// </summary>
|
||||
public int PrimaryKeyPolicy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表.
|
||||
/// </summary>
|
||||
public string MainTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原本名称.
|
||||
/// </summary>
|
||||
public string OriginalMainTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerMainTable => string.IsNullOrWhiteSpace(MainTable) ? null : MainTable.Substring(0, 1).ToLower() + MainTable[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 服务列表.
|
||||
/// </summary>
|
||||
public List<string> ServiceList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表分页.
|
||||
/// </summary>
|
||||
public bool hasPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能列表.
|
||||
/// </summary>
|
||||
public List<CodeGenFunctionModel> Function { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表字段.
|
||||
/// </summary>
|
||||
public List<TableColumnConfigModel> TableField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表关系.
|
||||
/// </summary>
|
||||
public List<CodeGenTableRelationsModel> TableRelations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认排序.
|
||||
/// </summary>
|
||||
public string DefaultSidx { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在单据规则控件.
|
||||
/// </summary>
|
||||
public bool IsBillRule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否导出.
|
||||
/// </summary>
|
||||
public bool IsExport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否批量删除.
|
||||
/// </summary>
|
||||
public bool IsBatchRemove { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有上传控件.
|
||||
/// </summary>
|
||||
public bool IsUpload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在关系.
|
||||
/// </summary>
|
||||
public bool IsTableRelations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否要生成对象映射.
|
||||
/// </summary>
|
||||
public bool IsMapper { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主表.
|
||||
/// </summary>
|
||||
public bool IsMainTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否副表.
|
||||
/// </summary>
|
||||
public bool IsAuxiliaryTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接ID.
|
||||
/// </summary>
|
||||
public string DbLinkId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成表单ID.
|
||||
/// </summary>
|
||||
public string FormId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页面类型(1、纯表单,2、表单加列表,3、表单列表工作流).
|
||||
/// </summary>
|
||||
public int WebType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页面类型(1-Web设计,2-App设计,3-流程表单,4-Web表单,5-App表单).
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启流程.
|
||||
/// </summary>
|
||||
public bool EnableFlow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板编码.
|
||||
/// </summary>
|
||||
public string EnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启数据权限.
|
||||
/// </summary>
|
||||
public bool UseDataPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询类型为等于的控件数量.
|
||||
/// </summary>
|
||||
public int SearchControlNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表关系模型.
|
||||
/// </summary>
|
||||
public List<CodeGenTableRelationsModel> AuxiliaryTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出字段.
|
||||
/// </summary>
|
||||
public string ExportField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联表数量.
|
||||
/// </summary>
|
||||
public int LeagueTableCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否数据转换.
|
||||
/// </summary>
|
||||
public bool IsConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否更新.
|
||||
/// </summary>
|
||||
public bool IsUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在子表数据转换.
|
||||
/// </summary>
|
||||
public bool IsChildConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开启高级查询.
|
||||
/// </summary>
|
||||
public bool HasSuperQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否唯一.
|
||||
/// </summary>
|
||||
public bool IsUnique { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 并发锁.
|
||||
/// </summary>
|
||||
public bool ConcurrencyLock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否行内编辑.
|
||||
/// </summary>
|
||||
public bool IsInlineEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示子表字段.
|
||||
/// </summary>
|
||||
public bool IsShowSubTableField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表数据类型
|
||||
/// 1-常规列表,2-左侧树+列表,3-分组表格,4-行内编辑.
|
||||
/// </summary>
|
||||
public int IndexDataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组字段名..
|
||||
/// </summary>
|
||||
public string GroupField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组显示字段名..
|
||||
/// </summary>
|
||||
public string GroupShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否导入数据.
|
||||
/// </summary>
|
||||
public bool IsImportData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导入数据类型.
|
||||
/// </summary>
|
||||
public string ImportDataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在系统控件.
|
||||
/// </summary>
|
||||
public bool IsSystemControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开).
|
||||
/// </summary>
|
||||
public List<string[]> ParsJnpfKeyConstList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开)详情页 (行内编辑的时候特殊处理).
|
||||
/// </summary>
|
||||
public List<string[]> ParsJnpfKeyConstListDetails { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成常规表单选项配置控件配置.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenConvFormPropsControlDesign
|
||||
{
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerName => string.IsNullOrWhiteSpace(Name) ? null : Name.Substring(0, 1).ToLower() + Name[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 选项配置.
|
||||
/// </summary>
|
||||
public PropsBeanModel Props { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成常规Index列表控件Options设计.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenConvIndexListControlOptionDesign
|
||||
{
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerName => string.IsNullOrWhiteSpace(Name) ? null : Name.Substring(0, 1).ToLower() + Name[1..];
|
||||
|
||||
/// <summary>
|
||||
/// Options名称.
|
||||
/// </summary>
|
||||
public string OptionsName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// jnpf控件key.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容.
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题.
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型.
|
||||
/// </summary>
|
||||
public string DictionaryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否静态数据.
|
||||
/// </summary>
|
||||
public bool IsStatic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否Props.
|
||||
/// </summary>
|
||||
public bool IsProps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项配置.
|
||||
/// </summary>
|
||||
public string Props { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询选项配置.
|
||||
/// </summary>
|
||||
public string QueryProps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示在列表页.
|
||||
/// </summary>
|
||||
public bool IsIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表控件.
|
||||
/// </summary>
|
||||
public bool IsChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否联动重复
|
||||
/// 目前用于子表联动控件Options.
|
||||
/// </summary>
|
||||
public bool IsLinkedRepeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否被联动(反).
|
||||
/// </summary>
|
||||
public bool IsLinked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否联动(正).
|
||||
/// </summary>
|
||||
public bool IsLinkage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板json.
|
||||
/// </summary>
|
||||
public string TemplateJson { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成前端配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenFrontendConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 表单ref.
|
||||
/// </summary>
|
||||
public string FormRef { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单Model.
|
||||
/// </summary>
|
||||
public string FromModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单宽度.
|
||||
/// </summary>
|
||||
public string LabelWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单位置.
|
||||
/// </summary>
|
||||
public string LabelPosition { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成功能模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenFunctionModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称.
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否接口.
|
||||
/// </summary>
|
||||
public bool IsInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序.
|
||||
/// </summary>
|
||||
public int orderBy { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成表关系模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class CodeGenTableRelationsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 功能名称.
|
||||
/// </summary>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerClassName => string.IsNullOrWhiteSpace(ClassName) ? null : ClassName.Substring(0, 1).ToLower() + ClassName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 表名.
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联主表.
|
||||
/// </summary>
|
||||
public string RelationTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始表名称.
|
||||
/// </summary>
|
||||
public string OriginalTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件绑定模型.
|
||||
/// </summary>
|
||||
public string ControlModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表名(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerTableName => string.IsNullOrWhiteSpace(TableName) ? null : TableName.Substring(0, 1).ToLower() + TableName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public string PrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerPrimaryKey => string.IsNullOrWhiteSpace(PrimaryKey) ? null : PrimaryKey.Substring(0, 1).ToLower() + PrimaryKey[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 表描述.
|
||||
/// </summary>
|
||||
public string TableComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件内表描述.
|
||||
/// </summary>
|
||||
public string ControlTableComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外键字段.
|
||||
/// </summary>
|
||||
public string TableField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始外键字段.
|
||||
/// </summary>
|
||||
public string OriginalTableField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联主键.
|
||||
/// </summary>
|
||||
public string RelationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始关联主键.
|
||||
/// </summary>
|
||||
public string OriginalRelationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联主键.
|
||||
/// </summary>
|
||||
public string LowerRelationField => string.IsNullOrWhiteSpace(RelationField) ? null : RelationField.Substring(0, 1).ToLower() + RelationField[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 子表控件配置.
|
||||
/// </summary>
|
||||
public List<TableColumnConfigModel> ChilderColumnConfigList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表有限字段长度.
|
||||
/// </summary>
|
||||
public int ChilderColumnConfigListCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编号.
|
||||
/// </summary>
|
||||
public int TableNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查询条件.
|
||||
/// </summary>
|
||||
public bool IsQueryWhether { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示字段.
|
||||
/// </summary>
|
||||
public bool IsShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否唯一.
|
||||
/// </summary>
|
||||
public bool IsUnique { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否数据转换.
|
||||
/// </summary>
|
||||
public bool IsConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否详情数据转换.
|
||||
/// </summary>
|
||||
public bool IsDetailConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否导入数据.
|
||||
/// </summary>
|
||||
public bool IsImportData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否系统控件.
|
||||
/// </summary>
|
||||
public bool IsSystemControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否更新.
|
||||
/// </summary>
|
||||
public bool IsUpdate { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,651 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 表单控件设计模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class FormControlDesignModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 控件名称.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写控件.
|
||||
/// </summary>
|
||||
public string LowerName => string.IsNullOrWhiteSpace(Name) ? null : Name.Substring(0, 1).ToLower() + Name[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 原名称.
|
||||
/// </summary>
|
||||
public string OriginalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// jnpfKey.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件宽度.
|
||||
/// </summary>
|
||||
public int Span { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 槽.
|
||||
/// </summary>
|
||||
public int Gutter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示子表标题.
|
||||
/// </summary>
|
||||
public bool ShowTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题名.
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表名称.
|
||||
/// </summary>
|
||||
public string ChildTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerChildTableName => string.IsNullOrWhiteSpace(ChildTableName) ? null : ChildTableName.Substring(0, 1).ToLower() + ChildTableName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 样式.
|
||||
/// </summary>
|
||||
public string Style { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 占位提示.
|
||||
/// </summary>
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可清除.
|
||||
/// </summary>
|
||||
public string Clearable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否只读.
|
||||
/// </summary>
|
||||
public string Readonly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public string Required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public bool required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public string IsRequired => string.Format(":required='requiredList.{0}'", LowerName);
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用.
|
||||
/// </summary>
|
||||
public string Disabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PC端表单权限.
|
||||
/// </summary>
|
||||
public string IsDisabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示输入字数统计.
|
||||
/// </summary>
|
||||
public string ShowWordLimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示绑定值的格式.
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际绑定值的格式.
|
||||
/// </summary>
|
||||
public string ValueFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型.
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自适应内容高度.
|
||||
/// </summary>
|
||||
public string AutoSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public string Multiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格.
|
||||
/// </summary>
|
||||
public string Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项配置.
|
||||
/// </summary>
|
||||
public PropsBeanModel Props { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件名.
|
||||
/// </summary>
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置阴影显示时机.
|
||||
/// </summary>
|
||||
public string Shadow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文案的位置.
|
||||
/// </summary>
|
||||
public string Contentposition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认.
|
||||
/// </summary>
|
||||
public string Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组标题的内容.
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文本样式.
|
||||
/// </summary>
|
||||
public object TextStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值.
|
||||
/// </summary>
|
||||
public object DefaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为时间范围选择,仅对<see cref="el-time-picker"/>有效.
|
||||
/// </summary>
|
||||
public string IsRange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项样式.
|
||||
/// </summary>
|
||||
public string OptionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前图标.
|
||||
/// </summary>
|
||||
public string PrefixIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后图标.
|
||||
/// </summary>
|
||||
public string SuffixIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大长度.
|
||||
/// </summary>
|
||||
public string MaxLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计数器步长.
|
||||
/// </summary>
|
||||
public string Step { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否只能输入 step 的倍数.
|
||||
/// </summary>
|
||||
public string StepStrictly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制按钮位置.
|
||||
/// </summary>
|
||||
public string ControlsPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示中文大写.
|
||||
/// </summary>
|
||||
public string ShowChinese { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示密码.
|
||||
/// </summary>
|
||||
public string ShowPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可搜索.
|
||||
/// </summary>
|
||||
public string Filterable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 输入框中是否显示选中值的完整路径.
|
||||
/// </summary>
|
||||
public string ShowAllLevels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项分隔符.
|
||||
/// </summary>
|
||||
public string Separator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择范围时的分隔符.
|
||||
/// </summary>
|
||||
public string RangeSeparator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围选择时开始日期/时间的占位内容.
|
||||
/// </summary>
|
||||
public string StartPlaceholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围选择时结束日期/时间的占位内容.
|
||||
/// </summary>
|
||||
public string EndPlaceholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前时间日期选择器特有的选项.
|
||||
/// </summary>
|
||||
public string PickerOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置选项.
|
||||
/// </summary>
|
||||
public string Options { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值.
|
||||
/// </summary>
|
||||
public string Max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值.
|
||||
/// </summary>
|
||||
public string Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许半选.
|
||||
/// </summary>
|
||||
public string AllowHalf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示子表标题.
|
||||
/// </summary>
|
||||
public bool ShowText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示文本.
|
||||
/// </summary>
|
||||
public string ShowTexts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示分数.
|
||||
/// </summary>
|
||||
public string ShowScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持透明度选择.
|
||||
/// </summary>
|
||||
public string ShowAlpha { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色的格式.
|
||||
/// </summary>
|
||||
public string ColorFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的文字描述.
|
||||
/// </summary>
|
||||
public string ActiveText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 关闭时的文字描述.
|
||||
/// </summary>
|
||||
public string InactiveText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的背景色.
|
||||
/// </summary>
|
||||
public string ActiveColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 关闭时的背景色.
|
||||
/// </summary>
|
||||
public string InactiveColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的值.
|
||||
/// </summary>
|
||||
public string IsSwitch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示间断点.
|
||||
/// </summary>
|
||||
public string ShowStops { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为范围选择
|
||||
/// 滑块.
|
||||
/// </summary>
|
||||
public string Range { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可接受上传类型.
|
||||
/// </summary>
|
||||
public string Accept { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上传提示.
|
||||
/// </summary>
|
||||
public string ShowTip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小.
|
||||
/// </summary>
|
||||
public string FileSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小单位.
|
||||
/// </summary>
|
||||
public string SizeUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大上传个数.
|
||||
/// </summary>
|
||||
public string Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传按钮文本.
|
||||
/// </summary>
|
||||
public string ButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级.
|
||||
/// </summary>
|
||||
public string Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 动作文本.
|
||||
/// </summary>
|
||||
public string ActionText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否隐藏.
|
||||
/// </summary>
|
||||
public string NoShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// v-model.
|
||||
/// </summary>
|
||||
public string vModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string Prepend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string Append { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string Accordion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题.
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string Active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string MainProps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string TabPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App max属性.
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列宽度.
|
||||
/// </summary>
|
||||
public string ColumnWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模块ID.
|
||||
/// </summary>
|
||||
public string ModelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 远端接口ID.
|
||||
/// </summary>
|
||||
public string InterfaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示字段.
|
||||
/// </summary>
|
||||
public string RelationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储字段.
|
||||
/// </summary>
|
||||
public string PropsValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string ColumnOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否分页.
|
||||
/// </summary>
|
||||
public string HasPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页数.
|
||||
/// </summary>
|
||||
public string PageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度.
|
||||
/// </summary>
|
||||
public string Precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统控件 - 所属组织 属性 - 显示内容
|
||||
/// all :显示组织, last : 显示部门.
|
||||
/// </summary>
|
||||
public string ShowLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对齐方式.
|
||||
/// </summary>
|
||||
public string Align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 边框.
|
||||
/// </summary>
|
||||
public string Border { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题宽度.
|
||||
/// </summary>
|
||||
public int LabelWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启合计.
|
||||
/// </summary>
|
||||
public bool ShowSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗类型.
|
||||
/// </summary>
|
||||
public string PopupType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗标题.
|
||||
/// </summary>
|
||||
public string PopupTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗宽度.
|
||||
/// </summary>
|
||||
public string PopupWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string ShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 链接地址.
|
||||
/// </summary>
|
||||
public string Href { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内外链.
|
||||
/// </summary>
|
||||
public string Target { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示图标.
|
||||
/// </summary>
|
||||
public string ShowIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择类型.
|
||||
/// </summary>
|
||||
public string SelectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否自定义选择.
|
||||
/// </summary>
|
||||
public bool IsCustomSelect => jnpfKey.Equals(JnpfKeyConst.USERSELECT) || jnpfKey.Equals(JnpfKeyConst.USERSSELECT) || jnpfKey.Equals(JnpfKeyConst.DEPSELECT) || jnpfKey.Equals(JnpfKeyConst.POSSELECT) ? (SelectType == "all" ? false : true) : false;
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
public string AbleDepIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选岗位.
|
||||
/// </summary>
|
||||
public string AblePosIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选用户.
|
||||
/// </summary>
|
||||
public string AbleUserIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选角色.
|
||||
/// </summary>
|
||||
public string AbleRoleIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选分组.
|
||||
/// </summary>
|
||||
public string AbleGroupIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多选用户组件.
|
||||
/// </summary>
|
||||
public string AbleIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件子项.
|
||||
/// </summary>
|
||||
public ICollection<FormControlDesignModel> Children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表添加类型
|
||||
/// 0-常规添加,1-数据传递.
|
||||
/// </summary>
|
||||
public int AddType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行内编辑使用
|
||||
/// 宽度.
|
||||
/// </summary>
|
||||
public int? IndexWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行内编辑使用
|
||||
/// 对齐方式.
|
||||
/// </summary>
|
||||
public string IndexAlign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否行内编辑.
|
||||
/// </summary>
|
||||
public bool IsInlineEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否排序.
|
||||
/// </summary>
|
||||
public bool IsSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件属性类型 1:展示数据,2:存储数据.
|
||||
/// </summary>
|
||||
public int IsStorage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户选择控件 关联字段关联属性:ableRelationIds="dataForm.depSelect".
|
||||
/// </summary>
|
||||
public string UserRelationAttr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否被联动控件(反).
|
||||
/// </summary>
|
||||
public bool IsLinked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表联动控件(正).
|
||||
/// </summary>
|
||||
public bool IsLinkage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 远端数据模板JSON.
|
||||
/// </summary>
|
||||
public string TemplateJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关联表单.
|
||||
/// </summary>
|
||||
public bool IsRelationForm { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成表单列模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class FormScriptDesignModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始列名.
|
||||
/// </summary>
|
||||
public string OriginalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerName => string.IsNullOrWhiteSpace(Name) ? null : Name.Substring(0, 1).ToLower() + Name[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 标签类型.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型.
|
||||
/// </summary>
|
||||
public string DictionaryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式化.
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多选标记.
|
||||
/// </summary>
|
||||
public bool Multiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自动生成规则.
|
||||
/// </summary>
|
||||
public string BillRule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 必填.
|
||||
/// </summary>
|
||||
public bool Required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证规则.
|
||||
/// </summary>
|
||||
public List<RegListModel> RegList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提示时机.
|
||||
/// </summary>
|
||||
public string Trigger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提示语.
|
||||
/// </summary>
|
||||
public string Placeholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围.
|
||||
/// </summary>
|
||||
public bool Range { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值.
|
||||
/// </summary>
|
||||
public object DefaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子控件列表.
|
||||
/// </summary>
|
||||
public List<FormScriptDesignModel> ChildrenList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启合计.
|
||||
/// </summary>
|
||||
public bool ShowSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 合计数组.
|
||||
/// </summary>
|
||||
public string SummaryField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否合计.
|
||||
/// </summary>
|
||||
public bool IsSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否数据传递.
|
||||
/// </summary>
|
||||
public bool IsDataTransfer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据传递表配置.
|
||||
/// </summary>
|
||||
public string AddTableConf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表添加类型
|
||||
/// 0-常规添加,1-数据传递.
|
||||
/// </summary>
|
||||
public int AddType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否行内编辑.
|
||||
/// </summary>
|
||||
public bool IsInlineEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否被联动(反).
|
||||
/// </summary>
|
||||
public bool IsLinked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否联动(正).
|
||||
/// </summary>
|
||||
public bool IsLinkage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联动反向关系.
|
||||
/// </summary>
|
||||
public List<LinkageConfig> LinkageRelationship { get; set; } = new List<LinkageConfig>();
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 前端生成配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class FrontEndGenConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 命名空间.
|
||||
/// </summary>
|
||||
public string NameSpace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型名称.
|
||||
/// </summary>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单.
|
||||
/// </summary>
|
||||
public string FormRef { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单模型.
|
||||
/// </summary>
|
||||
public string FormModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 尺寸.
|
||||
/// </summary>
|
||||
public string Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布局方式-文本定位.
|
||||
/// </summary>
|
||||
public string LabelPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布局方式-文本宽度.
|
||||
/// </summary>
|
||||
public int LabelWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单规则.
|
||||
/// </summary>
|
||||
public string FormRules { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表布局
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-行内编辑.
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树绑定字段.
|
||||
/// </summary>
|
||||
public string TreeRelation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树标题.
|
||||
/// </summary>
|
||||
public string TreeTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树数据源绑定字段.
|
||||
/// </summary>
|
||||
public string TreePropsValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树数据来源.
|
||||
/// </summary>
|
||||
public string TreeDataSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树数据字典.
|
||||
/// </summary>
|
||||
public string TreeDictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据接口.
|
||||
/// </summary>
|
||||
public string TreePropsUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子级字段.
|
||||
/// </summary>
|
||||
public string TreePropsChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示字段.
|
||||
/// </summary>
|
||||
public string TreePropsLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树是否存在查询内.
|
||||
/// </summary>
|
||||
public bool IsExistQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否分页.
|
||||
/// </summary>
|
||||
public bool HasPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单列表.
|
||||
/// </summary>
|
||||
public List<FormScriptDesignModel> FormList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗类型.
|
||||
/// </summary>
|
||||
public string PopupType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public string PrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单主键.
|
||||
/// </summary>
|
||||
public string FormPrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询列设计.
|
||||
/// </summary>
|
||||
public List<IndexSearchFieldDesignModel> SearchColumnDesign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头部按钮设计.
|
||||
/// </summary>
|
||||
public List<IndexButtonDesign> TopButtonDesign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头部按钮设计.
|
||||
/// </summary>
|
||||
public List<IndexButtonDesign> ColumnButtonDesign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表设计.
|
||||
/// </summary>
|
||||
public List<IndexColumnDesign> ColumnDesign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表主表控件Option.
|
||||
/// </summary>
|
||||
public List<CodeGenConvIndexListControlOptionDesign> OptionsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单全部控件.
|
||||
/// </summary>
|
||||
public List<FormControlDesignModel> FormAllContols { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有批量删除.
|
||||
/// </summary>
|
||||
public bool IsBatchRemoveDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有导出.
|
||||
/// </summary>
|
||||
public bool IsDownload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有删除.
|
||||
/// </summary>
|
||||
public bool IsRemoveDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有详情.
|
||||
/// </summary>
|
||||
public bool IsDetail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有编辑.
|
||||
/// </summary>
|
||||
public bool IsEdit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有排序.
|
||||
/// </summary>
|
||||
public bool IsSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有新增.
|
||||
/// </summary>
|
||||
public bool IsAdd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有导入.
|
||||
/// </summary>
|
||||
public bool IsUpload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启按钮权限.
|
||||
/// </summary>
|
||||
public bool UseBtnPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启列表权限.
|
||||
/// </summary>
|
||||
public bool UseColumnPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启表单权限.
|
||||
/// </summary>
|
||||
public bool UseFormPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交按钮文本.
|
||||
/// </summary>
|
||||
public string CancelButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 确认按钮文本.
|
||||
/// </summary>
|
||||
public string ConfirmButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 普通弹窗表单宽度.
|
||||
/// </summary>
|
||||
public string GeneralWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 全屏弹窗表单宽度.
|
||||
/// </summary>
|
||||
public string FullScreenWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// drawer宽度.
|
||||
/// </summary>
|
||||
public string DrawerWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单样式.
|
||||
/// </summary>
|
||||
public string FormStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否合计.
|
||||
/// </summary>
|
||||
public bool IsSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分页大小.
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序方式.
|
||||
/// </summary>
|
||||
public string Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启打印.
|
||||
/// </summary>
|
||||
public bool HasPrintBtn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打印按钮文本.
|
||||
/// </summary>
|
||||
public string PrintButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打印模板ID.
|
||||
/// </summary>
|
||||
public string PrintId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表数据传递.
|
||||
/// </summary>
|
||||
public bool IsChildDataTransfer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表查询.
|
||||
/// </summary>
|
||||
public bool IsChildTableQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表显示.
|
||||
/// </summary>
|
||||
public bool IsChildTableShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否列展示字段.
|
||||
/// </summary>
|
||||
public string ColumnList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 高级查询.
|
||||
/// </summary>
|
||||
public bool HasSuperQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列选项.
|
||||
/// </summary>
|
||||
public string ColumnOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否行内编辑.
|
||||
/// </summary>
|
||||
public bool IsInlineEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表类型.
|
||||
/// </summary>
|
||||
public int IndexDataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组字段名.
|
||||
/// </summary>
|
||||
public string GroupField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组显示字段名..
|
||||
/// </summary>
|
||||
public string GroupShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自增长策略.
|
||||
/// </summary>
|
||||
public int PrimaryKeyPolicy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关联表单.
|
||||
/// </summary>
|
||||
public bool IsRelationForm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表样式
|
||||
/// 1-分组展示,2-折叠展示.
|
||||
/// </summary>
|
||||
public int ChildTableStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否冻结.
|
||||
/// </summary>
|
||||
public bool IsFixed { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成常规Index列表页面头部按钮配置.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexButtonDesign
|
||||
{
|
||||
/// <summary>
|
||||
/// 按钮类型.
|
||||
/// </summary>
|
||||
public string @Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标.
|
||||
/// </summary>
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法.
|
||||
/// </summary>
|
||||
public string Method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 按钮值.
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 按钮文本.
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用.
|
||||
/// </summary>
|
||||
public string Disabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否详情.
|
||||
/// </summary>
|
||||
public bool IsDetail { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成常规Index列表列设计.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexColumnDesign
|
||||
{
|
||||
/// <summary>
|
||||
/// 表名称.
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件名称.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Options名称.
|
||||
/// </summary>
|
||||
public string OptionsName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件Key.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文本.
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 宽度.
|
||||
/// </summary>
|
||||
public string Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Align.
|
||||
/// </summary>
|
||||
public string Align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否自动转换.
|
||||
/// </summary>
|
||||
public bool IsAutomatic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式化.
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否排序.
|
||||
/// </summary>
|
||||
public string IsSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表.
|
||||
/// </summary>
|
||||
public bool IsChildTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 固定.
|
||||
/// </summary>
|
||||
public string Fixed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表配置.
|
||||
/// </summary>
|
||||
public List<IndexColumnDesign> ChildTableDesigns { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成Index查询列设计.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexSearchFieldDesignModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 真实名字.
|
||||
/// </summary>
|
||||
public string OriginalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母小写列名.
|
||||
/// </summary>
|
||||
public string LowerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件名.
|
||||
/// </summary>
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可清除的.
|
||||
/// </summary>
|
||||
public string Clearable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式化.
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型.
|
||||
/// </summary>
|
||||
public string @Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间输出类型.
|
||||
/// </summary>
|
||||
public string ValueFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题名.
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询控件Key.
|
||||
/// </summary>
|
||||
public string QueryControlsKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项配置.
|
||||
/// </summary>
|
||||
public PropsBeanModel Props { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号.
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 输入框中是否显示选中值的完整路径.
|
||||
/// </summary>
|
||||
public string ShowAllLevels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级.
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否子查询.
|
||||
/// </summary>
|
||||
public bool IsChildQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择类型.
|
||||
/// </summary>
|
||||
public string SelectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否自定义选择.
|
||||
/// </summary>
|
||||
public bool IsCustomSelect => SelectType == "all" ? false : true;
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
public string AbleDepIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选岗位.
|
||||
/// </summary>
|
||||
public string AblePosIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选用户.
|
||||
/// </summary>
|
||||
public string AbleUserIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选角色.
|
||||
/// </summary>
|
||||
public string AbleRoleIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选分组.
|
||||
/// </summary>
|
||||
public string AbleGroupIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选分组.
|
||||
/// </summary>
|
||||
public string AbleIds { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表列.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class TableColumnConfigModel
|
||||
{
|
||||
|
||||
#region 通用参数
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称.
|
||||
/// </summary>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerClassName => string.IsNullOrWhiteSpace(ClassName) ? null : ClassName.Substring(0, 1).ToLower() + ClassName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 字段名-大写(剔除"F_","f_").
|
||||
/// </summary>
|
||||
public string ColumnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库字段名(首字母小写).
|
||||
/// </summary>
|
||||
public string LowerColumnName => string.IsNullOrWhiteSpace(ColumnName) ? null : ColumnName.Substring(0, 1).ToLower() + ColumnName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 原本名称.
|
||||
/// </summary>
|
||||
public string OriginalColumnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件标题.
|
||||
/// </summary>
|
||||
public string ControlLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库中类型.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .NET字段类型.
|
||||
/// </summary>
|
||||
public string NetType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段描述.
|
||||
/// </summary>
|
||||
public string ColumnComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是查询条件.
|
||||
/// </summary>
|
||||
public bool QueryWhether { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询方式
|
||||
/// 1-等于,2-模糊,3-范围.
|
||||
/// </summary>
|
||||
public int QueryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示.
|
||||
/// </summary>
|
||||
public bool IsShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主键.
|
||||
/// </summary>
|
||||
public bool PrimaryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否外键字段.
|
||||
/// </summary>
|
||||
public bool ForeignKeyField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件Key.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件Key
|
||||
/// 用途:数据转换时 字段名+控件key 单驼峰命名规则.
|
||||
/// </summary>
|
||||
public string upperJnpfKey => string.IsNullOrWhiteSpace(jnpfKey) ? null : jnpfKey.Substring(0, 1).ToUpper() + jnpfKey[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 单据规则.
|
||||
/// </summary>
|
||||
public string Rule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表名称.
|
||||
/// </summary>
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 格式化表名称
|
||||
/// 子表或者副表使用.
|
||||
/// </summary>
|
||||
public string FormatTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 格式化表名称
|
||||
/// 子表或者副表使用.
|
||||
/// </summary>
|
||||
public string LowerFormatTableName => string.IsNullOrWhiteSpace(FormatTableName) ? null : FormatTableName.Substring(0, 1).ToLower() + FormatTableName[1..];
|
||||
|
||||
/// <summary>
|
||||
/// 是否yyyy-MM-dd HH:mm:ss.
|
||||
/// </summary>
|
||||
public bool IsDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式化.
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开关控件 属性 - 开启展示值.
|
||||
/// </summary>
|
||||
public string ActiveTxt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开关控件 属性 - 关闭展示值.
|
||||
/// </summary>
|
||||
public string InactiveTxt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 静态数据JSON.
|
||||
/// </summary>
|
||||
public List<StaticDataModel> StaticData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件数据来源
|
||||
/// 部分控件的数据源
|
||||
/// 例如 静态数据,数据字段,远端数据.
|
||||
/// </summary>
|
||||
public string ControlsDataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据来源ID.
|
||||
/// </summary>
|
||||
public string propsUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项的值为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否转换数据.
|
||||
/// </summary>
|
||||
public bool IsConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否详情转换数据.
|
||||
/// </summary>
|
||||
public bool IsDetailConversion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否系统控件.
|
||||
/// </summary>
|
||||
public bool IsSystemControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否唯一.
|
||||
/// </summary>
|
||||
public bool IsUnique { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否更新.
|
||||
/// </summary>
|
||||
public bool IsUpdate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 副表使用
|
||||
|
||||
/// <summary>
|
||||
/// 是否副表.
|
||||
/// </summary>
|
||||
public bool IsAuxiliary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表编号
|
||||
/// 子表或者副表使用.
|
||||
/// </summary>
|
||||
public int TableNo { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 子表使用
|
||||
|
||||
/// <summary>
|
||||
/// 子表控件Key.
|
||||
/// </summary>
|
||||
public string ChildControlKey { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据导出导入
|
||||
|
||||
/// <summary>
|
||||
/// 导出配置.
|
||||
/// </summary>
|
||||
public CodeGenFieldsModel ImportConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否导入字段.
|
||||
/// </summary>
|
||||
public bool IsImportField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项标签为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项的子选项为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string Children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项分隔符.
|
||||
/// </summary>
|
||||
public string Separator { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 联表编号
|
||||
/// 后续会被遗弃.
|
||||
/// </summary>
|
||||
public string LeagueTableNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开).
|
||||
/// </summary>
|
||||
public List<string[]> ParsJnpfKeyConstList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开)(行内编辑 特殊处理).
|
||||
/// </summary>
|
||||
public List<string[]> ParsJnpfKeyConstListDetails { get; set; }
|
||||
}
|
||||
157
visualdev/Tnb.VisualDev.Engine/Model/ColumnDesignModel.cs
Normal file
157
visualdev/Tnb.VisualDev.Engine/Model/ColumnDesignModel.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 列表设计模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ColumnDesignModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询列表.
|
||||
/// </summary>
|
||||
public List<IndexSearchFieldModel> searchList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示列.
|
||||
/// </summary>
|
||||
public List<IndexGridFieldModel> columnList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认显示列.
|
||||
/// </summary>
|
||||
public List<IndexGridFieldModel> defaultColumnList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP排序.
|
||||
/// </summary>
|
||||
public List<IndexEachConfigBase> sortList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列选项.
|
||||
/// </summary>
|
||||
public List<IndexGridFieldModel> columnOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表布局
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-编辑表格.
|
||||
/// </summary>
|
||||
public int type { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 高级查询.
|
||||
/// </summary>
|
||||
public bool hasSuperQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表样式
|
||||
/// 1-分组展示,2-折叠展示.
|
||||
/// </summary>
|
||||
public int childTableStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段.
|
||||
/// </summary>
|
||||
public string defaultSidx { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序类型.
|
||||
/// </summary>
|
||||
public string sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表分页.
|
||||
/// </summary>
|
||||
public bool hasPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分页条数.
|
||||
/// </summary>
|
||||
public int pageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树标题.
|
||||
/// </summary>
|
||||
public string treeTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树数据来源.
|
||||
/// </summary>
|
||||
public string treeDataSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树数据字典.
|
||||
/// </summary>
|
||||
public string treeDictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联字段.
|
||||
/// </summary>
|
||||
public string treeRelation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据接口.
|
||||
/// </summary>
|
||||
public string treePropsUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键字段.
|
||||
/// </summary>
|
||||
public string treePropsValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子级字段.
|
||||
/// </summary>
|
||||
public string treePropsChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示字段.
|
||||
/// </summary>
|
||||
public string treePropsLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组字段.
|
||||
/// </summary>
|
||||
public string groupField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表权限.
|
||||
/// </summary>
|
||||
public bool useColumnPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单权限.
|
||||
/// </summary>
|
||||
public bool useFormPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 按钮权限.
|
||||
/// </summary>
|
||||
public bool useBtnPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据权限.
|
||||
/// </summary>
|
||||
public bool useDataPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 按钮配置.
|
||||
/// </summary>
|
||||
public List<ButtonConfigModel> btnsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列按钮配.
|
||||
/// </summary>
|
||||
public List<ButtonConfigModel> columnBtnsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义按钮配置.
|
||||
/// </summary>
|
||||
public List<ButtonConfigModel> customBtnsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传数据模板json.
|
||||
/// </summary>
|
||||
public UploaderTemplateJsonModel uploaderTemplateJson { get; set; }
|
||||
}
|
||||
20
visualdev/Tnb.VisualDev.Engine/Model/ColumnOptionsModel.cs
Normal file
20
visualdev/Tnb.VisualDev.Engine/Model/ColumnOptionsModel.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 列配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ColumnOptionsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 字段.
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
}
|
||||
223
visualdev/Tnb.VisualDev.Engine/Model/ConfigModel.cs
Normal file
223
visualdev/Tnb.VisualDev.Engine/Model/ConfigModel.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ConfigModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题名.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题宽度.
|
||||
/// </summary>
|
||||
public int? labelWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示标题.
|
||||
/// </summary>
|
||||
public bool showLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件名.
|
||||
/// </summary>
|
||||
public string tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件图标.
|
||||
/// </summary>
|
||||
public string tagIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public bool required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布局类型.
|
||||
/// </summary>
|
||||
public string layout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// object数据类型.
|
||||
/// </summary>
|
||||
public string dataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件宽度.
|
||||
/// </summary>
|
||||
public int span { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// jnpf识别符.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据字典类型.
|
||||
/// </summary>
|
||||
public string dictionaryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件ID.
|
||||
/// </summary>
|
||||
public int? formId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件标识符.
|
||||
/// </summary>
|
||||
public long? renderKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证规则.
|
||||
/// </summary>
|
||||
public List<RegListModel> regList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值.
|
||||
/// </summary>
|
||||
public object defaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 远端数据接口.
|
||||
/// </summary>
|
||||
public string propsUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项样式.
|
||||
/// </summary>
|
||||
public string optionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项配置.
|
||||
/// </summary>
|
||||
public PropsBeanModel props { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示子表标题.
|
||||
/// </summary>
|
||||
public bool showTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库子表名称.
|
||||
/// </summary>
|
||||
public string tableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子集.
|
||||
/// </summary>
|
||||
public List<FieldsModel> children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据规则必须填.
|
||||
/// </summary>
|
||||
public string rule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否隐藏.
|
||||
/// </summary>
|
||||
public bool noShow { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 验证时机.
|
||||
/// </summary>
|
||||
public object trigger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被选中(适用于tab和折叠面板).
|
||||
/// </summary>
|
||||
public object active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列宽度.
|
||||
/// </summary>
|
||||
public int? columnWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 边框.
|
||||
/// </summary>
|
||||
public bool border { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表.
|
||||
/// </summary>
|
||||
public string relationTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求端可见 pc、app.
|
||||
/// </summary>
|
||||
public List<string> visibility { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否唯一.
|
||||
/// </summary>
|
||||
public bool unique { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件属性类型 1:展示数据,2:存储数据.
|
||||
/// </summary>
|
||||
public int isStorage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联动模板json.
|
||||
/// </summary>
|
||||
public List<LinkageConfig> templateJson { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联动配置.
|
||||
/// </summary>
|
||||
public class LinkageConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认值.
|
||||
/// </summary>
|
||||
public string defaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段.
|
||||
/// </summary>
|
||||
public string field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型.
|
||||
/// </summary>
|
||||
public string dataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public int required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段名.
|
||||
/// </summary>
|
||||
public string fieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表单字段.
|
||||
/// </summary>
|
||||
public string relationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// jnpf识别符.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自生成字段
|
||||
/// 是否子表控件.
|
||||
/// </summary>
|
||||
public bool isChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自生成字段
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
}
|
||||
50
visualdev/Tnb.VisualDev.Engine/Model/DbTableRelationModel.cs
Normal file
50
visualdev/Tnb.VisualDev.Engine/Model/DbTableRelationModel.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 数据关联.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class DbTableRelationModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型:1-主表、0-子表.
|
||||
/// </summary>
|
||||
public string typeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表名.
|
||||
/// </summary>
|
||||
public string table { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 说明.
|
||||
/// </summary>
|
||||
public string tableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public string tableKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外键字段.
|
||||
/// </summary>
|
||||
public string tableField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联主表.
|
||||
/// </summary>
|
||||
public string relationTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联主键.
|
||||
/// </summary>
|
||||
public string relationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称.
|
||||
/// </summary>
|
||||
public string className { get; set; }
|
||||
}
|
||||
38
visualdev/Tnb.VisualDev.Engine/Model/EntityFieldModel.cs
Normal file
38
visualdev/Tnb.VisualDev.Engine/Model/EntityFieldModel.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 实体字段模型
|
||||
/// 版 本:V3.0.0
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
/// 作 者:JNPF开发平台组.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class EntityFieldModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 字段名称.
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段说明.
|
||||
/// </summary>
|
||||
public string FieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型.
|
||||
/// </summary>
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据长度.
|
||||
/// </summary>
|
||||
public string DataLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public int? PrimaryKey { get; set; }
|
||||
}
|
||||
584
visualdev/Tnb.VisualDev.Engine/Model/FieldsModel.cs
Normal file
584
visualdev/Tnb.VisualDev.Engine/Model/FieldsModel.cs
Normal file
@@ -0,0 +1,584 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 组件模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class FieldsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置.
|
||||
/// </summary>
|
||||
public ConfigModel __config__ { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 插槽.
|
||||
/// </summary>
|
||||
public SlotModel __slot__ { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 占位提示.
|
||||
/// </summary>
|
||||
public string placeholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 样式.
|
||||
/// </summary>
|
||||
public object style { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可清除.
|
||||
/// </summary>
|
||||
public bool clearable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前图标.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "prefix-icon")]
|
||||
public string prefixicon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后图标.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "suffix-icon")]
|
||||
public string suffixicon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大长度.
|
||||
/// </summary>
|
||||
public string maxlength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示输入字数统计.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-word-limit")]
|
||||
public bool showWordlimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否只读.
|
||||
/// </summary>
|
||||
public bool @readonly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用.
|
||||
/// </summary>
|
||||
public bool disabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置默认值为空字符串.
|
||||
/// </summary>
|
||||
public string __vModel__ { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 类型.
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自适应内容高度.
|
||||
/// </summary>
|
||||
public object autosize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计数器步长.
|
||||
/// </summary>
|
||||
public int? step { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否只能输入 step 的倍数.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "step-strictly")]
|
||||
public bool stepstrictly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制按钮位置.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "controls-position")]
|
||||
public string controlsposition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文本样式.
|
||||
/// </summary>
|
||||
public object textStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字体样式.
|
||||
/// </summary>
|
||||
public string fontStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示中文大写.
|
||||
/// </summary>
|
||||
public bool showChinese { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示密码.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-password")]
|
||||
public bool showPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格.
|
||||
/// </summary>
|
||||
public string size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可搜索.
|
||||
/// </summary>
|
||||
public bool filterable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool multiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置选项.
|
||||
/// </summary>
|
||||
public PropsModel props { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 输入框中是否显示选中值的完整路径.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-all-levels")]
|
||||
public bool showalllevels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项分隔符.
|
||||
/// </summary>
|
||||
public string separator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为时间范围选择,仅对<see cref="el-time-picker"/>有效.
|
||||
/// </summary>
|
||||
public bool isrange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择范围时的分隔符.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "range-separator")]
|
||||
public string rangeseparator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围选择时开始日期/时间的占位内容.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "start-placeholder")]
|
||||
public string startplaceholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围选择时开始日期/时间的占位内容.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "end-placeholder")]
|
||||
public string endplaceholder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示绑定值的格式.
|
||||
/// </summary>
|
||||
public string format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际绑定值的格式.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "value-format")]
|
||||
public string valueformat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前时间日期选择器特有的选项.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "picker-options")]
|
||||
public object pickeroptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值.
|
||||
/// </summary>
|
||||
public int? max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许半选.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "allow-half")]
|
||||
public bool allowhalf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示文本.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-text")]
|
||||
public bool showtext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示分数.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-score")]
|
||||
public bool showScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持透明度选择.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-alpha")]
|
||||
public bool showalpha { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色的格式.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "color-format")]
|
||||
public string colorformat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色.
|
||||
/// </summary>
|
||||
public string color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的文字描述.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "active-text")]
|
||||
public string activetext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 关闭时的文字描述.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "inactive-text")]
|
||||
public string inactivetext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的背景色.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "active-color")]
|
||||
public string activecolor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 关闭时的背景色.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "inactive-color")]
|
||||
public string inactivecolor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 打开时的值.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "active-value")]
|
||||
public int? activevalue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// switch 关闭时的值.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "inactive-value")]
|
||||
public int? inactivevalue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值.
|
||||
/// </summary>
|
||||
public int? min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示间断点.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-stops")]
|
||||
public bool showstops { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为范围选择
|
||||
/// 滑块.
|
||||
/// </summary>
|
||||
public bool range { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可接受上传类型.
|
||||
/// </summary>
|
||||
public string accept { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上传提示.
|
||||
/// </summary>
|
||||
public bool showTip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小.
|
||||
/// </summary>
|
||||
public int? fileSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小单位.
|
||||
/// </summary>
|
||||
public string sizeUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大上传个数.
|
||||
/// </summary>
|
||||
public int? limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文案的位置.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "content-position")]
|
||||
public string contentposition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传按钮文本.
|
||||
/// </summary>
|
||||
public string buttonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级.
|
||||
/// </summary>
|
||||
public int level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置项.
|
||||
/// </summary>
|
||||
public List<object> options { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 动作文本.
|
||||
/// </summary>
|
||||
public string actionText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置阴影显示时机.
|
||||
/// </summary>
|
||||
public string shadow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// app卡片容器标题.
|
||||
/// </summary>
|
||||
public string header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组标题的内容.
|
||||
/// </summary>
|
||||
public string content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表单id.
|
||||
/// </summary>
|
||||
public string modelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表单字段.
|
||||
/// </summary>
|
||||
public string relationField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表单属性 显示 字段.
|
||||
/// </summary>
|
||||
public string showField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程ID.
|
||||
/// </summary>
|
||||
public string flowId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询类型
|
||||
/// 1-等于,2-模糊,3-范围,.
|
||||
/// </summary>
|
||||
public int? searchType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据接口ID.
|
||||
/// </summary>
|
||||
public string interfaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表配置.
|
||||
/// </summary>
|
||||
public List<ColumnOptionsModel> columnOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否分页.
|
||||
/// </summary>
|
||||
public bool hasPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页数.
|
||||
/// </summary>
|
||||
public int? pageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗选择主键.
|
||||
/// </summary>
|
||||
public string propsValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 折叠菜单.
|
||||
/// </summary>
|
||||
public bool accordion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题.
|
||||
/// </summary>
|
||||
public string title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称.
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tab位置.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "tab-position")]
|
||||
public string tabPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度.
|
||||
/// </summary>
|
||||
public int? precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开关控件 属性 - 开启展示值.
|
||||
/// </summary>
|
||||
public string activeTxt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开关控件 属性 - 关闭展示值.
|
||||
/// </summary>
|
||||
public string inactiveTxt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统控件 - 所属组织 属性 - 显示内容
|
||||
/// all :显示组织, last : 显示部门.
|
||||
/// </summary>
|
||||
public string showLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对齐方式.
|
||||
/// </summary>
|
||||
public string align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启合计.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-summary")]
|
||||
public bool showSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 合计数组.
|
||||
/// </summary>
|
||||
public List<string> summaryField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗类型.
|
||||
/// </summary>
|
||||
public string popupType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗标题.
|
||||
/// </summary>
|
||||
public string popupTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗宽度.
|
||||
/// </summary>
|
||||
public string popupWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 链接地址.
|
||||
/// </summary>
|
||||
public string href { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打开方式.
|
||||
/// </summary>
|
||||
public string target { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public bool closable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示图标.
|
||||
/// </summary>
|
||||
[JsonProperty(propertyName: "show-icon")]
|
||||
public bool showIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选范围.
|
||||
/// </summary>
|
||||
public string selectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
public List<string> ableDepIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选岗位.
|
||||
/// </summary>
|
||||
public List<string> ablePosIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选用户.
|
||||
/// </summary>
|
||||
public List<string> ableUserIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选角色.
|
||||
/// </summary>
|
||||
public List<string> ableRoleIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选分组.
|
||||
/// </summary>
|
||||
public List<string> ableGroupIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 新用户选择控件.
|
||||
/// </summary>
|
||||
public List<string> ableIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表添加数据类型
|
||||
/// 0-常规,1-数据传递.
|
||||
/// </summary>
|
||||
public int addType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public object addTableConf { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联动模板json.
|
||||
/// </summary>
|
||||
public List<LinkageConfig> templateJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 是否查询字段.
|
||||
/// </summary>
|
||||
public bool isQueryField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 是否列表展示.
|
||||
/// </summary>
|
||||
public bool isIndexShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 是否被联动(反).
|
||||
/// </summary>
|
||||
public bool IsLinked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 是否联动(正).
|
||||
/// </summary>
|
||||
public bool IsLinkage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 联动反向关系.
|
||||
/// </summary>
|
||||
public List<LinkageConfig> linkageReverseRelationship { get; set; } = new List<LinkageConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环
|
||||
/// 上级__vModel__.
|
||||
/// </summary>
|
||||
public string superiorVModel { get; set; }
|
||||
}
|
||||
155
visualdev/Tnb.VisualDev.Engine/Model/FormDataModel.cs
Normal file
155
visualdev/Tnb.VisualDev.Engine/Model/FormDataModel.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 表单数据模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class FormDataModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 模块.
|
||||
/// </summary>
|
||||
public string areasName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能名称.
|
||||
/// </summary>
|
||||
public List<string> className { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端目录.
|
||||
/// </summary>
|
||||
public string serviceDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属模块.
|
||||
/// </summary>
|
||||
public string module { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表名称集合.
|
||||
/// </summary>
|
||||
public string subClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单.
|
||||
/// </summary>
|
||||
public string formRef { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单模型.
|
||||
/// </summary>
|
||||
public string formModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 尺寸.
|
||||
/// </summary>
|
||||
public string size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布局方式-文本定位.
|
||||
/// </summary>
|
||||
public string labelPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 布局方式-文本宽度.
|
||||
/// </summary>
|
||||
public int labelWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单规则.
|
||||
/// </summary>
|
||||
public string formRules { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 间距.
|
||||
/// </summary>
|
||||
public int gutter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用.
|
||||
/// </summary>
|
||||
public bool disabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 宽度.
|
||||
/// </summary>
|
||||
public int? span { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组件数组.
|
||||
/// </summary>
|
||||
public List<FieldsModel> fields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 弹窗类型.
|
||||
/// </summary>
|
||||
public string popupType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子级.
|
||||
/// </summary>
|
||||
public FieldsModel children { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交按钮文本.
|
||||
/// </summary>
|
||||
public string cancelButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 确认按钮文本.
|
||||
/// </summary>
|
||||
public string confirmButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 普通弹窗表单宽度.
|
||||
/// </summary>
|
||||
public string generalWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 全屏弹窗表单宽度.
|
||||
/// </summary>
|
||||
public string fullScreenWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// drawer宽度.
|
||||
/// </summary>
|
||||
public string drawerWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启打印.
|
||||
/// </summary>
|
||||
public bool hasPrintBtn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打印按钮文本.
|
||||
/// </summary>
|
||||
public string printButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打印模板ID.
|
||||
/// </summary>
|
||||
public string printId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单样式.
|
||||
/// </summary>
|
||||
public string formStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 并发锁定.
|
||||
/// </summary>
|
||||
public bool concurrencyLock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主键策略(1 雪花ID 2 自增长ID).
|
||||
/// </summary>
|
||||
public int primaryKeyPolicy { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除.
|
||||
/// </summary>
|
||||
public bool logicalDelete { get; set; }
|
||||
}
|
||||
25
visualdev/Tnb.VisualDev.Engine/Model/IndexEachConfigBase.cs
Normal file
25
visualdev/Tnb.VisualDev.Engine/Model/IndexEachConfigBase.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 列表页各配置基类.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexEachConfigBase : FieldsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 字段.
|
||||
/// </summary>
|
||||
public string prop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列名.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控件KEY.
|
||||
/// </summary>
|
||||
public string jnpfKey { get; set; }
|
||||
}
|
||||
30
visualdev/Tnb.VisualDev.Engine/Model/IndexGridFieldModel.cs
Normal file
30
visualdev/Tnb.VisualDev.Engine/Model/IndexGridFieldModel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 显示列模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexGridFieldModel : IndexEachConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 对齐.
|
||||
/// </summary>
|
||||
public string align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 固定.
|
||||
/// </summary>
|
||||
public string @fixed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 宽度.
|
||||
/// </summary>
|
||||
public int? width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否排序.
|
||||
/// </summary>
|
||||
public bool sortable { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 列表查询字段模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class IndexSearchFieldModel : IndexEachConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 值.
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询类型.
|
||||
/// </summary>
|
||||
public int? searchType { get; set; }
|
||||
}
|
||||
30
visualdev/Tnb.VisualDev.Engine/Model/OptionsModel.cs
Normal file
30
visualdev/Tnb.VisualDev.Engine/Model/OptionsModel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 配置模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class OptionsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// id.
|
||||
/// </summary>
|
||||
public int? id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值.
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子级.
|
||||
/// </summary>
|
||||
public List<OptionsModel> children { get; set; }
|
||||
}
|
||||
30
visualdev/Tnb.VisualDev.Engine/Model/PropsBeanModel.cs
Normal file
30
visualdev/Tnb.VisualDev.Engine/Model/PropsBeanModel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 配置属性模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class PropsBeanModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool multiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项标签为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项的值为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定选项的子选项为选项对象的某个属性值.
|
||||
/// </summary>
|
||||
public string children { get; set; }
|
||||
}
|
||||
15
visualdev/Tnb.VisualDev.Engine/Model/PropsModel.cs
Normal file
15
visualdev/Tnb.VisualDev.Engine/Model/PropsModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 配置选项模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class PropsModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置选项.
|
||||
/// </summary>
|
||||
public PropsBeanModel props { get; set; }
|
||||
}
|
||||
20
visualdev/Tnb.VisualDev.Engine/Model/RegListModel.cs
Normal file
20
visualdev/Tnb.VisualDev.Engine/Model/RegListModel.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 验证规则模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class RegListModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 正则表达式.
|
||||
/// </summary>
|
||||
public string pattern { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误提示.
|
||||
/// </summary>
|
||||
public string message { get; set; }
|
||||
}
|
||||
40
visualdev/Tnb.VisualDev.Engine/Model/SlotModel.cs
Normal file
40
visualdev/Tnb.VisualDev.Engine/Model/SlotModel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 插槽模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class SlotModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 前.
|
||||
/// </summary>
|
||||
public string prepend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后.
|
||||
/// </summary>
|
||||
public string append { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认名称.
|
||||
/// </summary>
|
||||
public string defaultName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置项.
|
||||
/// </summary>
|
||||
public List<Dictionary<string, object>> options { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// app配置项.
|
||||
/// </summary>
|
||||
public string appOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认.
|
||||
/// </summary>
|
||||
public string @default { get; set; }
|
||||
}
|
||||
20
visualdev/Tnb.VisualDev.Engine/Model/TableModel.cs
Normal file
20
visualdev/Tnb.VisualDev.Engine/Model/TableModel.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 在线开发模型数据表模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class TableModel : DbTableRelationModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 控件key.
|
||||
/// </summary>
|
||||
public string ControlKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列字段.
|
||||
/// </summary>
|
||||
public List<EntityFieldModel> fields { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine;
|
||||
|
||||
/// <summary>
|
||||
/// 数据导入模板模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class UploaderTemplateJsonModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 导入类型.
|
||||
/// </summary>
|
||||
public string dataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导入列名 集合.
|
||||
/// </summary>
|
||||
public List<string> selectKey { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,544 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.VisualDev.Entitys.Enum;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成控件属性帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenControlsAttributeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 转换静态数据.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static List<StaticDataModel> ConversionStaticData(string data)
|
||||
{
|
||||
var list = new List<StaticDataModel>();
|
||||
if (!string.IsNullOrEmpty(data))
|
||||
{
|
||||
var conData = data.ToObject<List<StaticDataModel>>();
|
||||
if (conData != null)
|
||||
{
|
||||
foreach (var item in conData)
|
||||
{
|
||||
list.Add(new StaticDataModel()
|
||||
{
|
||||
id = item.id,
|
||||
fullName = item.fullName,
|
||||
});
|
||||
if (item.children != null)
|
||||
list.AddRange(ConversionStaticData(item.children.ToJsonString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断控件是否数据转换.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool JudgeControlIsDataConversion(string jnpfKey, string dataType, bool multiple)
|
||||
{
|
||||
bool tag = false;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.UPLOADFZ:
|
||||
case JnpfKeyConst.UPLOADIMG:
|
||||
tag = true;
|
||||
break;
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case "dictionary":
|
||||
if (!multiple)
|
||||
{
|
||||
tag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag = true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.RADIO:
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case "dictionary":
|
||||
tag = false;
|
||||
break;
|
||||
default:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
case JnpfKeyConst.POSSELECT:
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.ROLESELECT:
|
||||
case JnpfKeyConst.GROUPSELECT:
|
||||
{
|
||||
if (!multiple)
|
||||
tag = false;
|
||||
else
|
||||
tag = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.CHECKBOX:
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取各模式控件是否列表转换.
|
||||
/// </summary>
|
||||
/// <param name="generatePattern">生成模式.</param>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <param name="dataType">数据类型 dictionary-数据字段,dynamic-远端数据.</param>
|
||||
/// <param name="multiple">是否多选.</param>
|
||||
/// <param name="subTableListDisplay">子表列表显示.</param>
|
||||
/// <returns>true-ThenMapper转换,false-列表转换.</returns>
|
||||
public static bool GetWhetherToConvertAllModeControlsIntoLists(GeneratePatterns generatePattern, string jnpfKey, string dataType, bool multiple, bool subTableListDisplay)
|
||||
{
|
||||
bool tag = false;
|
||||
|
||||
/*
|
||||
* 因ORM原因 导航查询 一对多 列表查询
|
||||
* 不能使用ORM 自带函数 待作者开放.Select()
|
||||
* 导致一对多列表查询转换必须全使用子查询
|
||||
* 远端数据与静态数据无法列表转换所以全部ThenMapper内转换
|
||||
* 数据字典又分为两种值转换ID与EnCode
|
||||
*/
|
||||
switch (subTableListDisplay)
|
||||
{
|
||||
case true:
|
||||
switch (generatePattern)
|
||||
{
|
||||
case GeneratePatterns.MainBelt:
|
||||
case GeneratePatterns.PrimarySecondary:
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CREATEUSER:
|
||||
case JnpfKeyConst.MODIFYUSER:
|
||||
case JnpfKeyConst.CURRORGANIZE:
|
||||
case JnpfKeyConst.CURRPOSITION:
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
case JnpfKeyConst.POSSELECT:
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.ROLESELECT:
|
||||
case JnpfKeyConst.GROUPSELECT:
|
||||
case JnpfKeyConst.RADIO:
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
case JnpfKeyConst.CHECKBOX:
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
case JnpfKeyConst.SWITCH:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case "dictionary":
|
||||
if (multiple)
|
||||
tag = true;
|
||||
else
|
||||
tag = false;
|
||||
break;
|
||||
default:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.RADIO:
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case "dictionary":
|
||||
tag = false;
|
||||
break;
|
||||
default:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
case JnpfKeyConst.POSSELECT:
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.ROLESELECT:
|
||||
case JnpfKeyConst.GROUPSELECT:
|
||||
{
|
||||
if (multiple)
|
||||
tag = true;
|
||||
else
|
||||
tag = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case JnpfKeyConst.CHECKBOX:
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断含子表字段控件是否数据转换.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <returns></returns>
|
||||
public static bool JudgeContainsChildTableControlIsDataConversion(string jnpfKey)
|
||||
{
|
||||
bool tag = false;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.UPLOADFZ:
|
||||
case JnpfKeyConst.UPLOADIMG:
|
||||
case JnpfKeyConst.CREATEUSER:
|
||||
case JnpfKeyConst.MODIFYUSER:
|
||||
case JnpfKeyConst.CURRORGANIZE:
|
||||
case JnpfKeyConst.CURRPOSITION:
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
case JnpfKeyConst.POSSELECT:
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.ROLESELECT:
|
||||
case JnpfKeyConst.GROUPSELECT:
|
||||
case JnpfKeyConst.RADIO:
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
case JnpfKeyConst.CHECKBOX:
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
case JnpfKeyConst.SWITCH:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系统控件不更新.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <returns></returns>
|
||||
public static bool JudgeControlIsSystemControls(string jnpfKey)
|
||||
{
|
||||
bool tag = true;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CREATEUSER:
|
||||
case JnpfKeyConst.CREATETIME:
|
||||
case JnpfKeyConst.CURRPOSITION:
|
||||
case JnpfKeyConst.CURRORGANIZE:
|
||||
case JnpfKeyConst.BILLRULE:
|
||||
tag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控件数据来源ID.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <param name="dataType">数据类型.</param>
|
||||
/// <param name="control">控件全属性.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetControlsPropsUrl(string jnpfKey, string dataType, FieldsModel control)
|
||||
{
|
||||
string propsUrl = string.Empty;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
propsUrl = control.interfaceId;
|
||||
break;
|
||||
default:
|
||||
switch (dataType)
|
||||
{
|
||||
case "dictionary":
|
||||
propsUrl = control.__config__.dictionaryType;
|
||||
break;
|
||||
default:
|
||||
propsUrl = control.__config__.propsUrl;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return propsUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控件指定选项的值.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <param name="dataType">数据类型.</param>
|
||||
/// <param name="control">控件全属性.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetControlsLabel(string jnpfKey, string dataType, FieldsModel control)
|
||||
{
|
||||
string label = string.Empty;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
label = control.relationField;
|
||||
break;
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
label = control.props.props.label;
|
||||
break;
|
||||
default:
|
||||
label = control.__config__.props?.label;
|
||||
break;
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控件指定选项标签.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <param name="dataType">数据类型.</param>
|
||||
/// <param name="control">控件全属性.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetControlsValue(string jnpfKey, string dataType, FieldsModel control)
|
||||
{
|
||||
string value = string.Empty;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
value = control.propsValue;
|
||||
break;
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
value = control.props.props.value;
|
||||
break;
|
||||
default:
|
||||
value = control.__config__.props?.value;
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取控件指定选项的子选项.
|
||||
/// </summary>
|
||||
/// <param name="jnpfKey">控件Key.</param>
|
||||
/// <param name="dataType">数据类型.</param>
|
||||
/// <param name="control">控件全属性.</param>
|
||||
/// <returns></returns>
|
||||
public static string GetControlsChildren(string jnpfKey, string dataType, FieldsModel control)
|
||||
{
|
||||
string children = string.Empty;
|
||||
switch (jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
children = control.props.props.children;
|
||||
break;
|
||||
default:
|
||||
children = control.__config__.props?.children;
|
||||
break;
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取导出配置.
|
||||
/// </summary>
|
||||
/// <param name="control">控件全属性.</param>
|
||||
/// <param name="model">数据库真实字段.</param>
|
||||
/// <param name="tableName">表名称.</param>
|
||||
/// <returns></returns>
|
||||
public static CodeGenFieldsModel GetImportConfig(FieldsModel control, string model, string tableName)
|
||||
{
|
||||
var fieldModel = new CodeGenFieldsModel();
|
||||
var configModel = new CodeGenConfigModel();
|
||||
fieldModel.__vModel__ = model;
|
||||
fieldModel.level = control.level;
|
||||
fieldModel.min = control.min;
|
||||
fieldModel.max = control.max;
|
||||
fieldModel.activeTxt = control.activeTxt;
|
||||
fieldModel.inactiveTxt = control.inactiveTxt;
|
||||
fieldModel.format = control.format;
|
||||
fieldModel.multiple = CodeGenFieldJudgeHelper.IsMultipleColumn(control, model);
|
||||
fieldModel.separator = control.separator;
|
||||
fieldModel.__slot__ = control.__slot__?.ToObject<CodeGenSlotModel>()?.ToJsonString().ToJsonString();
|
||||
fieldModel.props = control.props?.ToObject<CodeGenPropsModel>()?.ToJsonString().ToJsonString();
|
||||
fieldModel.options = control.options?.ToObject<List<object>>()?.ToJsonString().ToJsonString();
|
||||
fieldModel.propsValue = control.propsValue;
|
||||
fieldModel.relationField = control.relationField;
|
||||
fieldModel.modelId = control.modelId;
|
||||
fieldModel.interfaceId = control.interfaceId;
|
||||
fieldModel.selectType = control.selectType;
|
||||
fieldModel.ableDepIds = control.ableDepIds?.ToJsonString().ToJsonString();
|
||||
fieldModel.ablePosIds = control.ablePosIds?.ToJsonString().ToJsonString();
|
||||
fieldModel.ableUserIds = control.ableUserIds?.ToJsonString().ToJsonString();
|
||||
fieldModel.ableRoleIds = control.ableRoleIds?.ToJsonString().ToJsonString();
|
||||
fieldModel.ableGroupIds = control.ableGroupIds?.ToJsonString().ToJsonString();
|
||||
fieldModel.ableIds = control.ableIds?.ToJsonString().ToJsonString();
|
||||
configModel = control.__config__.ToObject<CodeGenConfigModel>();
|
||||
configModel.tableName = tableName;
|
||||
fieldModel.__config__ = configModel.ToJsonString().ToJsonString();
|
||||
return fieldModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取需解析的字段集合.
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
/// <param name="isInlineEditor"></param>
|
||||
/// <returns>jnpfKey @@ vmodel集合以 , 号隔开.</returns>
|
||||
public static List<string[]> GetParsJnpfKeyConstList(List<FieldsModel> control, bool isInlineEditor)
|
||||
{
|
||||
var res = new Dictionary<string, List<string>>();
|
||||
|
||||
control.ForEach(item =>
|
||||
{
|
||||
switch (item.__config__.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.USERSSELECT: // 用户选择组件(包含组织、角色、岗位、分组、用户 Id)
|
||||
if (!res.ContainsKey(JnpfKeyConst.USERSSELECT)) res.Add(JnpfKeyConst.USERSSELECT, new List<string>());
|
||||
res[JnpfKeyConst.USERSSELECT].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.TABLE: // 遍历 子表 控件
|
||||
var ctRes = GetParsJnpfKeyConstList(item.__config__.children, isInlineEditor);
|
||||
if (ctRes != null && ctRes.Any())
|
||||
{
|
||||
foreach (var ct in ctRes)
|
||||
{
|
||||
if (!res.ContainsKey(ct.FirstOrDefault())) res.Add(ct.FirstOrDefault(), new List<string>());
|
||||
res[ct.FirstOrDefault()].AddRange(ct.LastOrDefault().Split(','));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
var ret = new List<string[]>();
|
||||
foreach (var item in res)
|
||||
{
|
||||
// 如果是行内编辑
|
||||
if (isInlineEditor)
|
||||
{
|
||||
var newValue = new List<string>();
|
||||
foreach (var it in item.Value) newValue.Add(it + "_name");
|
||||
res[item.Key] = newValue;
|
||||
}
|
||||
}
|
||||
foreach (var item in res)
|
||||
{
|
||||
ret.Add(new string[] { item.Key, string.Join(",", item.Value) });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取需解析的字段集合.
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
/// <param name="isInlineEditor"></param>
|
||||
/// <returns>jnpfKey @@ vmodel集合以 , 号隔开.</returns>
|
||||
public static List<string[]> GetParsJnpfKeyConstListDetails(List<FieldsModel> control)
|
||||
{
|
||||
var res = new Dictionary<string, List<string>>();
|
||||
|
||||
control.ForEach(item =>
|
||||
{
|
||||
switch (item.__config__.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.USERSSELECT: // 用户选择组件(包含组织、角色、岗位、分组、用户 Id)
|
||||
if (!res.ContainsKey(JnpfKeyConst.USERSSELECT)) res.Add(JnpfKeyConst.USERSSELECT, new List<string>());
|
||||
res[JnpfKeyConst.USERSSELECT].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.POPUPTABLESELECT: // 下拉表格.
|
||||
if (!res.ContainsKey(JnpfKeyConst.POPUPTABLESELECT)) res.Add(JnpfKeyConst.POPUPTABLESELECT, new List<string>());
|
||||
res[JnpfKeyConst.POPUPTABLESELECT].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.POPUPSELECT: // 弹窗选择.
|
||||
if (!res.ContainsKey(JnpfKeyConst.POPUPSELECT)) res.Add(JnpfKeyConst.POPUPSELECT, new List<string>());
|
||||
res[JnpfKeyConst.POPUPSELECT].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.RELATIONFORM: // 关联表单.
|
||||
if (!res.ContainsKey(JnpfKeyConst.RELATIONFORM)) res.Add(JnpfKeyConst.RELATIONFORM, new List<string>());
|
||||
res[JnpfKeyConst.RELATIONFORM].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.TABLE: // 遍历 子表 控件
|
||||
var ctRes = GetParsJnpfKeyConstListDetails(item.__config__.children);
|
||||
if (ctRes != null && ctRes.Any())
|
||||
{
|
||||
foreach (var ct in ctRes)
|
||||
{
|
||||
if (!res.ContainsKey(item.__vModel__ + "-" + ct.FirstOrDefault())) res.Add(item.__vModel__ + "-" + ct.FirstOrDefault(), new List<string>());
|
||||
res[item.__vModel__ + "-" + ct.FirstOrDefault()].AddRange(ct.LastOrDefault().Split(','));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
var ret = new List<string[]>();
|
||||
foreach (var item in res)
|
||||
{
|
||||
ret.Add(new string[] { item.Key, string.Join(",", item.Value) });
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Text;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成导出字段帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenExportFieldHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取主表字段名.
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
public static string ExportColumnField(List<IndexGridFieldModel>? list)
|
||||
{
|
||||
StringBuilder columnSb = new StringBuilder();
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
columnSb.AppendFormat("{{\\\"value\\\":\\\"{0}\\\",\\\"field\\\":\\\"{1}\\\"}},", item.label, item.prop);
|
||||
}
|
||||
}
|
||||
|
||||
return columnSb.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成表字段判断帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenFieldJudgeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否查询列.
|
||||
/// </summary>
|
||||
/// <param name="searchList">模板内查询列表.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsColumnQueryWhether(List<IndexSearchFieldModel>? searchList, string fieldName)
|
||||
{
|
||||
var column = searchList?.Any(s => s.prop == fieldName);
|
||||
return column ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列查询类型.
|
||||
/// </summary>
|
||||
/// <param name="searchList">模板内查询列表.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static int ColumnQueryType(List<IndexSearchFieldModel>? searchList, string fieldName)
|
||||
{
|
||||
var column = searchList?.Find(s => s.prop == fieldName);
|
||||
return column?.searchType ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示列.
|
||||
/// </summary>
|
||||
/// <param name="columnList">模板内展示字段.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsShowColumn(List<IndexGridFieldModel>? columnList, string fieldName)
|
||||
{
|
||||
bool? column = columnList?.Any(s => s.prop == fieldName);
|
||||
return column ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否多选.
|
||||
/// </summary>
|
||||
/// <param name="columnList">模板内控件列表.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMultipleColumn(List<FieldsModel> columnList, string fieldName)
|
||||
{
|
||||
bool isMultiple = false;
|
||||
var column = columnList.Find(s => s.__vModel__ == fieldName);
|
||||
if (column != null)
|
||||
{
|
||||
switch (column?.__config__.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CASCADER:
|
||||
isMultiple = column.props.props.multiple;
|
||||
break;
|
||||
default:
|
||||
isMultiple = column.multiple;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isMultiple;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否多选.
|
||||
/// </summary>
|
||||
/// <param name="columnList">模板内控件列表.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMultipleColumn(FieldsModel column, string fieldName)
|
||||
{
|
||||
bool isMultiple = false;
|
||||
if (column != null)
|
||||
{
|
||||
switch (column?.__config__.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CASCADER:
|
||||
isMultiple = column.props.props.multiple;
|
||||
break;
|
||||
default:
|
||||
isMultiple = column.multiple;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isMultiple;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否datetime.
|
||||
/// </summary>
|
||||
/// <param name="fields"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDateTime(FieldsModel? fields)
|
||||
{
|
||||
bool isDateTime = false;
|
||||
if (fields?.__config__.jnpfKey == JnpfKeyConst.DATE || fields?.__config__.jnpfKey == JnpfKeyConst.TIME)
|
||||
isDateTime = true;
|
||||
return isDateTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否副表datetime.
|
||||
/// </summary>
|
||||
/// <param name="fields"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsSecondaryTableDateTime(FieldsModel? fields)
|
||||
{
|
||||
bool isDateTime = false;
|
||||
if (fields?.__config__.jnpfKey == JnpfKeyConst.DATE || fields?.__config__.jnpfKey == JnpfKeyConst.TIME || fields?.__config__.jnpfKey == JnpfKeyConst.CREATETIME || fields?.__config__.jnpfKey == JnpfKeyConst.MODIFYTIME)
|
||||
isDateTime = true;
|
||||
return isDateTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否子表映射.
|
||||
/// </summary>
|
||||
/// <param name="tableColumnConfig">表列.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsChildTableMapper(List<TableColumnConfigModel> tableColumnConfig)
|
||||
{
|
||||
bool isOpen = false;
|
||||
tableColumnConfig.ForEach(item =>
|
||||
{
|
||||
switch (item.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.UPLOADIMG:
|
||||
case JnpfKeyConst.UPLOADFZ:
|
||||
case JnpfKeyConst.DATE:
|
||||
case JnpfKeyConst.TIME:
|
||||
isOpen = true;
|
||||
break;
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
case JnpfKeyConst.POSSELECT:
|
||||
switch (item.IsMultiple)
|
||||
{
|
||||
case true:
|
||||
isOpen = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
return isOpen;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
using JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成方法帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenFunctionHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取纯表单方法.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenFunctionModel> GetPureFormMethod()
|
||||
{
|
||||
return new List<CodeGenFunctionModel>
|
||||
{
|
||||
new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "add",
|
||||
IsInterface = true,
|
||||
orderBy = 1,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取纯表单带流程方法.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenFunctionModel> GetPureFormWithProcessMethod()
|
||||
{
|
||||
return new List<CodeGenFunctionModel>
|
||||
{
|
||||
new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "info",
|
||||
IsInterface = true,
|
||||
orderBy = 1,
|
||||
},
|
||||
new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "save",
|
||||
IsInterface = true,
|
||||
orderBy = 2,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 常规列表方法.
|
||||
/// </summary>
|
||||
/// <param name="hasPage">是否分页.</param>
|
||||
/// <param name="btnsList">头部按钮.</param>
|
||||
/// <param name="columnBtnsList">列表按钮.</param>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenFunctionModel> GetGeneralListMethod(bool hasPage, List<ButtonConfigModel> btnsList, List<ButtonConfigModel> columnBtnsList)
|
||||
{
|
||||
List<CodeGenFunctionModel> functionList = new List<CodeGenFunctionModel>
|
||||
{
|
||||
// 默认注入获取信息方法
|
||||
new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "info",
|
||||
IsInterface = true,
|
||||
orderBy = 1,
|
||||
}
|
||||
};
|
||||
|
||||
// 根据是否分页注入默认列表方法.
|
||||
switch (hasPage)
|
||||
{
|
||||
case false:
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "noPage",
|
||||
IsInterface = true,
|
||||
orderBy = 3,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "page",
|
||||
IsInterface = true,
|
||||
orderBy = 3,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
btnsList?.ForEach(b =>
|
||||
{
|
||||
int orderBy = 0;
|
||||
|
||||
switch (b.value)
|
||||
{
|
||||
case "add":
|
||||
orderBy = 4;
|
||||
break;
|
||||
case "upload":
|
||||
orderBy = 5;
|
||||
break;
|
||||
case "download":
|
||||
orderBy = 9;
|
||||
break;
|
||||
case "batchRemove":
|
||||
orderBy = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
if (b.value == "download" && !hasPage)
|
||||
{
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "page",
|
||||
IsInterface = false,
|
||||
orderBy = 10,
|
||||
});
|
||||
}
|
||||
else if (b.value == "download" && hasPage)
|
||||
{
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "noPage",
|
||||
IsInterface = false,
|
||||
orderBy = 10,
|
||||
});
|
||||
}
|
||||
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = b.value,
|
||||
IsInterface = true,
|
||||
orderBy = orderBy,
|
||||
});
|
||||
});
|
||||
columnBtnsList?.ForEach(c =>
|
||||
{
|
||||
int orderBy = 0;
|
||||
switch (c.value)
|
||||
{
|
||||
case "edit":
|
||||
orderBy = 7;
|
||||
break;
|
||||
case "remove":
|
||||
orderBy = 6;
|
||||
break;
|
||||
case "detail":
|
||||
orderBy = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = c.value,
|
||||
IsInterface = true,
|
||||
orderBy = orderBy,
|
||||
});
|
||||
});
|
||||
|
||||
return functionList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 常规列表带流程方法.
|
||||
/// </summary>
|
||||
/// <param name="hasPage"></param>
|
||||
/// <param name="btnsList"></param>
|
||||
/// <param name="columnBtnsList"></param>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenFunctionModel> GetGeneralListWithProcessMethod(bool hasPage, List<ButtonConfigModel> btnsList, List<ButtonConfigModel> columnBtnsList)
|
||||
{
|
||||
List<CodeGenFunctionModel> functionList = new List<CodeGenFunctionModel>
|
||||
{
|
||||
// 默认注入获取信息方法
|
||||
new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "info",
|
||||
IsInterface = true,
|
||||
orderBy = 1,
|
||||
}
|
||||
};
|
||||
|
||||
// 根据是否分页注入默认列表方法.
|
||||
switch (hasPage)
|
||||
{
|
||||
case false:
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "noPage",
|
||||
IsInterface = true,
|
||||
orderBy = 3,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "page",
|
||||
IsInterface = true,
|
||||
orderBy = 3,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
btnsList?.ForEach(b =>
|
||||
{
|
||||
int orderBy = 0;
|
||||
|
||||
switch (b.value)
|
||||
{
|
||||
case "save":
|
||||
orderBy = 4;
|
||||
break;
|
||||
case "upload":
|
||||
orderBy = 5;
|
||||
break;
|
||||
case "download":
|
||||
orderBy = 9;
|
||||
break;
|
||||
case "batchRemove":
|
||||
orderBy = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
if (b.value == "download" && !hasPage)
|
||||
{
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "page",
|
||||
IsInterface = false,
|
||||
orderBy = 10,
|
||||
});
|
||||
}
|
||||
else if (b.value == "download" && hasPage)
|
||||
{
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = "noPage",
|
||||
IsInterface = false,
|
||||
orderBy = 10,
|
||||
});
|
||||
}
|
||||
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = b.value,
|
||||
IsInterface = true,
|
||||
orderBy = orderBy,
|
||||
});
|
||||
});
|
||||
columnBtnsList?.ForEach(c =>
|
||||
{
|
||||
int orderBy = 0;
|
||||
switch (c.value)
|
||||
{
|
||||
case "remove":
|
||||
orderBy = 6;
|
||||
break;
|
||||
case "detail":
|
||||
orderBy = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
functionList.Add(new CodeGenFunctionModel()
|
||||
{
|
||||
FullName = c.value,
|
||||
IsInterface = true,
|
||||
orderBy = orderBy,
|
||||
});
|
||||
});
|
||||
|
||||
return functionList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成列表按钮帮助类.
|
||||
/// </summary>
|
||||
public class GetCodeGenIndexButtonHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成单表Index列表列按钮方法.
|
||||
/// </summary>
|
||||
/// <param name="value">按钮类型.</param>
|
||||
/// <param name="primaryKey">主键key.</param>
|
||||
/// <param name="primaryKeyPolicy">主键策略.</param>
|
||||
/// <param name="isFlow">是否工作流表单.</param>
|
||||
/// <param name="isInlineEditor">是否行内编辑.</param>
|
||||
/// <returns></returns>
|
||||
public static string IndexColumnButton(string value, string primaryKey, int primaryKeyPolicy, bool isFlow = false, bool isInlineEditor = false)
|
||||
{
|
||||
string method = string.Empty;
|
||||
switch (value)
|
||||
{
|
||||
case "edit":
|
||||
switch (isInlineEditor)
|
||||
{
|
||||
case true:
|
||||
method = string.Format("scope.row.rowEdit=true");
|
||||
break;
|
||||
default:
|
||||
switch (primaryKeyPolicy)
|
||||
{
|
||||
case 2:
|
||||
switch (isFlow)
|
||||
{
|
||||
case true:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.flowTaskId)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.{0})", primaryKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.{0})", primaryKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "remove":
|
||||
method = string.Format("handleDel(scope.row.{0})", primaryKey);
|
||||
break;
|
||||
case "detail":
|
||||
switch (isFlow)
|
||||
{
|
||||
case true:
|
||||
switch (isInlineEditor)
|
||||
{
|
||||
case true:
|
||||
switch (primaryKeyPolicy)
|
||||
{
|
||||
case 2:
|
||||
method = string.Format("goDetail(scope.row.flowTaskId,scope.row.flowState)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("goDetail(scope.row.{0},scope.row.flowState)", primaryKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch (primaryKeyPolicy)
|
||||
{
|
||||
case 2:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.flowTaskId,scope.row.flowState)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.{0},scope.row.flowState)", primaryKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
method = string.Format("goDetail(scope.row.{0})", primaryKey);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成单表Index列表头部按钮方法.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string IndexTopButton(string value)
|
||||
{
|
||||
var method = string.Empty;
|
||||
switch (value)
|
||||
{
|
||||
case "add":
|
||||
method = "addOrUpdateHandle()";
|
||||
break;
|
||||
case "download":
|
||||
method = "exportData()";
|
||||
break;
|
||||
case "batchRemove":
|
||||
method = "handleBatchRemoveDel()";
|
||||
break;
|
||||
case "upload":
|
||||
method = "handelUpload()";
|
||||
break;
|
||||
}
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成流程Index列表列按钮是否禁用.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string WorkflowIndexColumnButton(string value)
|
||||
{
|
||||
var disabled = string.Empty;
|
||||
switch (value)
|
||||
{
|
||||
case "edit":
|
||||
disabled = ":disabled='[1, 2, 4, 5].indexOf(scope.row.flowState) > -1' ";
|
||||
break;
|
||||
case "remove":
|
||||
disabled = ":disabled='[1, 2, 3, 5].indexOf(scope.row.flowState) > -1' ";
|
||||
break;
|
||||
case "detail":
|
||||
disabled = ":disabled='!scope.row.flowState' ";
|
||||
break;
|
||||
}
|
||||
|
||||
return disabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,730 @@
|
||||
using JNPF.Common.Configuration;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成目标路径帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenTargetPathHelper
|
||||
{
|
||||
#region 前端相关文件
|
||||
|
||||
/// <summary>
|
||||
/// 前端页面生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">主表名称.</param>
|
||||
/// <param name="fileName">压缩包名称.</param>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="enableFlow">是否开启流程(0-否,1-是).</param>
|
||||
/// <param name="isDetail">是否有详情.</param>
|
||||
/// <param name="hasSuperQuery">高级查询.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> FrontEndTargetPathList(string tableName, string fileName, int webType, int enableFlow, bool isDetail = false, bool hasSuperQuery = false)
|
||||
{
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "PC", tableName, "index.vue");
|
||||
var formPath = Path.Combine(frontendPath, "html", "PC", tableName, "Form.vue");
|
||||
var detailPath = Path.Combine(frontendPath, "html", "PC", tableName, "Detail.vue");
|
||||
var exportJsonPath = Path.Combine(frontendPath, "fff", "flowForm.fff");
|
||||
var columnJsonPath = Path.Combine(frontendPath, "html", "PC", tableName, "columnList.js");
|
||||
var superQueryJsonPath = Path.Combine(frontendPath, "html", "PC", tableName, "superQueryJson.js");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(indexPath);
|
||||
pathList.Add(formPath);
|
||||
if (enableFlow == 1)
|
||||
pathList.Add(exportJsonPath);
|
||||
break;
|
||||
case 2:
|
||||
pathList.Add(indexPath);
|
||||
pathList.Add(formPath);
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
if (isDetail)
|
||||
pathList.Add(detailPath);
|
||||
break;
|
||||
case 1:
|
||||
pathList.Add(exportJsonPath);
|
||||
break;
|
||||
}
|
||||
pathList.Add(columnJsonPath);
|
||||
if (hasSuperQuery)
|
||||
pathList.Add(superQueryJsonPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前端页面模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表,3、表单列表工作流).</param>
|
||||
/// <param name="enableFlow">是否开启流程(0-否,1-是).</param>
|
||||
/// <param name="isDetail">是否有详情.</param>
|
||||
/// <param name="hasSuperQuery">高级查询.</param>
|
||||
/// <returns>返回前端模板地址列表.</returns>
|
||||
public static List<string> FrontEndTemplatePathList(int webType, int enableFlow, bool isDetail = false, bool hasSuperQuery = false)
|
||||
{
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(Path.Combine(templatePath, "PureForm", "index.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "WorkflowForm.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "ExportJson.json.vm"));
|
||||
break;
|
||||
default:
|
||||
pathList.Add(Path.Combine(templatePath, "Form.vue.vm"));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(Path.Combine(templatePath, "WorkflowIndex.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "WorkflowForm.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "ExportJson.json.vm"));
|
||||
break;
|
||||
default:
|
||||
pathList.Add(Path.Combine(templatePath, "index.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "Form.vue.vm"));
|
||||
if (isDetail)
|
||||
pathList.Add(Path.Combine(templatePath, "Detail.vue.vm"));
|
||||
break;
|
||||
}
|
||||
pathList.Add(Path.Combine(templatePath, "columnList.js.vm"));
|
||||
if (hasSuperQuery)
|
||||
pathList.Add(Path.Combine(templatePath, "superQueryJson.js.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前端行内编辑页面生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">主表名称.</param>
|
||||
/// <param name="fileName">压缩包名称.</param>
|
||||
/// <param name="enableFlow">是否开启流程.</param>
|
||||
/// <param name="isDetail">是否有详情.</param>
|
||||
/// <param name="hasSuperQuery">高级查询.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> FrontEndInlineEditorTargetPathList(string tableName, string fileName, int enableFlow, bool isDetail = false, bool hasSuperQuery = false)
|
||||
{
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "PC", tableName, "index.vue");
|
||||
var detailPath = Path.Combine(frontendPath, "html", "PC", tableName, "Detail.vue");
|
||||
var formPath = Path.Combine(frontendPath, "html", "PC", tableName, "Form.vue");
|
||||
var exportJsonPath = Path.Combine(frontendPath, "fff", "ExportJson.fff");
|
||||
var columnJsonPath = Path.Combine(frontendPath, "html", "PC", tableName, "columnList.js");
|
||||
var superQueryJsonPath = Path.Combine(frontendPath, "html", "PC", tableName, "superQueryJson.js");
|
||||
var pathList = new List<string>();
|
||||
|
||||
pathList.Add(indexPath);
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
if (isDetail)
|
||||
pathList.Add(detailPath);
|
||||
break;
|
||||
default:
|
||||
if (isDetail)
|
||||
pathList.Add(formPath);
|
||||
pathList.Add(exportJsonPath);
|
||||
break;
|
||||
}
|
||||
pathList.Add(columnJsonPath);
|
||||
if (hasSuperQuery)
|
||||
pathList.Add(superQueryJsonPath);
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前端行内编辑页面模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="enableFlow">是否开启流程.</param>
|
||||
/// <param name="isDetail">是否有详情.</param>
|
||||
/// <param name="hasSuperQuery">高级查询.</param>
|
||||
/// <returns>返回前端模板地址列表.</returns>
|
||||
public static List<string> FrontEndInlineEditorTemplatePathList(int enableFlow, bool isDetail = false, bool hasSuperQuery = false)
|
||||
{
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
var pathList = new List<string>();
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
pathList.Add(Path.Combine(templatePath, "editorIndex.vue.vm"));
|
||||
if (isDetail)
|
||||
pathList.Add(Path.Combine(templatePath, "Detail.vue.vm"));
|
||||
break;
|
||||
case 1:
|
||||
pathList.Add(Path.Combine(templatePath, "editorWorkflowIndex.vue.vm"));
|
||||
if (isDetail)
|
||||
pathList.Add(Path.Combine(templatePath, "WorkflowForm.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "ExportJson.json.vm"));
|
||||
break;
|
||||
}
|
||||
pathList.Add(Path.Combine(templatePath, "columnList.js.vm"));
|
||||
if (hasSuperQuery)
|
||||
pathList.Add(Path.Combine(templatePath, "superQueryJson.js.vm"));
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// App前端带流程页面模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> AppFrontEndWorkflowTemplatePathList(int webType)
|
||||
{
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(Path.Combine(templatePath, "PureForm", "appWorkflowIndex.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "appWorkflowForm.vue.vm"));
|
||||
break;
|
||||
case 2:
|
||||
pathList.Add(Path.Combine(templatePath, "appWorkflowIndex.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "appWorkflowForm.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "columnList.js.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置App前端带流程页面生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">主表名称.</param>
|
||||
/// <param name="fileName">压缩包名称.</param>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="isDetail">是否开启详情.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> AppFrontEndWorkflowTargetPathList(string tableName, string fileName, int webType)
|
||||
{
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "App", "index", tableName, "index.vue");
|
||||
var formPath = Path.Combine(frontendPath, "html", "App", "form", tableName, "index.vue");
|
||||
var columnJsonPath = Path.Combine(frontendPath, "html", "App", "index", tableName, "columnList.js");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(indexPath);
|
||||
pathList.Add(formPath);
|
||||
break;
|
||||
case 2:
|
||||
pathList.Add(indexPath);
|
||||
pathList.Add(formPath);
|
||||
pathList.Add(columnJsonPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// App前端页面模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表,3、表单列表工作流).</param>
|
||||
/// <param name="isDetail">是否开启详情.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> AppFrontEndTemplatePathList(int webType, bool isDetail)
|
||||
{
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(Path.Combine(templatePath, "appForm.vue.vm"));
|
||||
break;
|
||||
case 2:
|
||||
pathList.Add(Path.Combine(templatePath, "appIndex.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "appForm.vue.vm"));
|
||||
if (isDetail)
|
||||
pathList.Add(Path.Combine(templatePath, "appDetail.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "columnList.js.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置App前端页面生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">主表名称.</param>
|
||||
/// <param name="fileName">压缩包名称.</param>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="isDetail">是否开启详情.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> AppFrontEndTargetPathList(string tableName, string fileName, int webType, bool isDetail)
|
||||
{
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "App", tableName, "index.vue");
|
||||
var formPath = Path.Combine(frontendPath, "html", "App", tableName, "form.vue");
|
||||
var detailPath = Path.Combine(frontendPath, "html", "App", tableName, "Detail.vue");
|
||||
var columnJsonPath = Path.Combine(frontendPath, "html", "App", tableName, "columnList.js");
|
||||
var pathList = new List<string>();
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
pathList.Add(indexPath);
|
||||
break;
|
||||
case 2:
|
||||
pathList.Add(indexPath);
|
||||
pathList.Add(formPath);
|
||||
if (isDetail)
|
||||
pathList.Add(detailPath);
|
||||
pathList.Add(columnJsonPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程前端页面模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="logicType">逻辑类型4-pc,5-app.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> FlowFrontEndTemplatePathList(int logicType)
|
||||
{
|
||||
var pathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
switch (logicType)
|
||||
{
|
||||
case 4:
|
||||
pathList.Add(Path.Combine(templatePath, "WorkflowForm.vue.vm"));
|
||||
break;
|
||||
case 5:
|
||||
pathList.Add(Path.Combine(templatePath, "appWorkflowForm.vue.vm"));
|
||||
break;
|
||||
}
|
||||
pathList.Add(Path.Combine(templatePath, "ExportJson.json.vm"));
|
||||
return pathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程前端页面生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="logicType">逻辑类型4-pc,5-app.</param>
|
||||
/// <param name="tableName">主表名称.</param>
|
||||
/// <param name="fileName">压缩包名称.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> FlowFrontEndTargetPathList(int logicType, string tableName, string fileName)
|
||||
{
|
||||
var pathList = new List<string>();
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "PC", tableName, "index.vue");
|
||||
var indexAppPath = Path.Combine(frontendPath, "html", "APP", tableName, "index.vue");
|
||||
var exportJsonPath = Path.Combine(frontendPath, "fff", "flowForm.fff");
|
||||
switch (logicType)
|
||||
{
|
||||
case 4:
|
||||
pathList.Add(indexPath);
|
||||
break;
|
||||
case 5:
|
||||
pathList.Add(indexAppPath);
|
||||
break;
|
||||
}
|
||||
pathList.Add(exportJsonPath);
|
||||
return pathList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 单主表相关文件
|
||||
|
||||
/// <summary>
|
||||
/// 后端模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="genModel">SingleTable-单主表,MainBelt-主带子,,,.</param>
|
||||
/// <param name="webType">生成模板类型(1、纯表单,2、表单加列表,3、表单列表工作流).</param>
|
||||
/// <param name="enableFlow">是否开启工作流.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendTemplatePathList(string genModel, int webType, int enableFlow, bool isMapper)
|
||||
{
|
||||
List<string> templatePathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Service.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, "IService.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 1:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Service.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, "IService.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
templatePathList.Add(Path.Combine(templatePath, "UpInput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "ListQueryInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "ListOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "DetailOutput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return templatePathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端主表生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">表名.</param>
|
||||
/// <param name="fileName">文件价名称.</param>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="enableFlow">是否开启工作流.</param>
|
||||
/// <param name="isInlineEditor">是否行内编辑.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendTargetPathList(string tableName, string fileName, int webType, int enableFlow, bool isInlineEditor, bool isMapper)
|
||||
{
|
||||
List<string> targetPathList = new List<string>();
|
||||
var backendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var servicePath = Path.Combine(backendPath, "Controller", tableName, tableName + "Service.cs");
|
||||
var iservicePath = Path.Combine(backendPath, "Controller", tableName, "I" + tableName + "Service.cs");
|
||||
var entityPath = Path.Combine(backendPath, "Models", "Entity", tableName, tableName + "Entity.cs");
|
||||
var mapperPath = Path.Combine(backendPath, "Models", "Mapper", tableName, tableName + "Mapper.cs");
|
||||
var inputCrPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "CrInput.cs");
|
||||
var inputUpPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "UpInput.cs");
|
||||
var inputListQueryPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "ListQueryInput.cs");
|
||||
var outputInfoPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "InfoOutput.cs");
|
||||
var outputListPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "ListOutput.cs");
|
||||
var outputDetailPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "DetailOutput.cs");
|
||||
var inlineEditorListPath = Path.Combine(backendPath, "Models", "Dto", tableName, tableName + "InlineEditorOutput.cs");
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
targetPathList.Add(servicePath);
|
||||
targetPathList.Add(iservicePath);
|
||||
targetPathList.Add(entityPath);
|
||||
if (isMapper)
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 1:
|
||||
targetPathList.Add(outputInfoPath);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
targetPathList.Add(servicePath);
|
||||
targetPathList.Add(iservicePath);
|
||||
targetPathList.Add(entityPath);
|
||||
if (isMapper)
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
targetPathList.Add(inputUpPath);
|
||||
break;
|
||||
}
|
||||
targetPathList.Add(inputListQueryPath);
|
||||
targetPathList.Add(outputInfoPath);
|
||||
targetPathList.Add(outputListPath);
|
||||
if (isInlineEditor)
|
||||
targetPathList.Add(inlineEditorListPath);
|
||||
targetPathList.Add(outputDetailPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return targetPathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端行内编辑模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="genModel">SingleTable-单主表,MainBelt-主带子,,,.</param>
|
||||
/// <param name="webType">生成模板类型(1、纯表单,2、表单加列表,3、表单列表工作流).</param>
|
||||
/// <param name="enableFlow">是否开启工作流.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendInlineEditorTemplatePathList(string genModel, int webType, int enableFlow, bool isMapper)
|
||||
{
|
||||
List<string> templatePathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
switch (webType)
|
||||
{
|
||||
case 2:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InlineEditor", "Service.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, "IService.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
templatePathList.Add(Path.Combine(templatePath, "UpInput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "ListQueryInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InlineEditor", "ListOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InlineEditor", "InlineEditorOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "DetailOutput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return templatePathList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 后端子表
|
||||
|
||||
/// <summary>
|
||||
/// 后端模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="genModel">SingleTable-单主表,MainBelt-主带子,,,.</param>
|
||||
/// <param name="webType">生成模板类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="type">模板类型.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <param name="isShowSubTableField">是否展示子表字段.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendChildTableTemplatePathList(string genModel, int webType, int type, bool isMapper, bool isShowSubTableField)
|
||||
{
|
||||
List<string> templatePathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
if (type == 3)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
break;
|
||||
case 2:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, "UpInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
if (isShowSubTableField)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "ListOutput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "DetailOutput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return templatePathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端主表生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">表名.</param>
|
||||
/// <param name="fileName">文件价名称.</param>
|
||||
/// <param name="webType">页面类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="type">模板类型.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <param name="isShowSubTableField">是否展示子表字段.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendChildTableTargetPathList(string tableName, string fileName, int webType, int type, bool isMapper, bool isShowSubTableField)
|
||||
{
|
||||
List<string> targetPathList = new List<string>();
|
||||
var backendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var entityPath = Path.Combine(backendPath, "Models", "Entity", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "Entity.cs");
|
||||
var mapperPath = Path.Combine(backendPath, "Models", "Mapper", tableName, tableName + "Mapper.cs");
|
||||
var inputCrPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "CrInput.cs");
|
||||
var inputUpPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "UpInput.cs");
|
||||
var outputInfoPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "InfoOutput.cs");
|
||||
var outputListPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "ListOutput.cs");
|
||||
var inputListQueryPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "ListQueryInput.cs");
|
||||
var outputDetailPath = Path.Combine(backendPath, "Models", "Dto", (type == 3 ? "WorkFlowForm\\" : string.Empty) + tableName, tableName + "DetailOutput.cs");
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
targetPathList.Add(entityPath);
|
||||
if (isMapper)
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
if (type == 3)
|
||||
targetPathList.Add(outputInfoPath);
|
||||
break;
|
||||
case 2:
|
||||
targetPathList.Add(entityPath);
|
||||
if (isMapper)
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
targetPathList.Add(inputUpPath);
|
||||
targetPathList.Add(outputInfoPath);
|
||||
if (isShowSubTableField)
|
||||
targetPathList.Add(outputListPath);
|
||||
targetPathList.Add(outputDetailPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return targetPathList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 后端副表
|
||||
|
||||
/// <summary>
|
||||
/// 后端副表生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">表名.</param>
|
||||
/// <param name="fileName">文件价名称.</param>
|
||||
/// <param name="webType">生成模板类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="type">模板类型.</param>
|
||||
/// <param name="enableFlow">是否开启流程.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendAuxiliaryTargetPathList(string tableName, string fileName, int webType, int type, int enableFlow)
|
||||
{
|
||||
List<string> targetPathList = new List<string>();
|
||||
var backendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var entityPath = Path.Combine(backendPath, "Models", "Entity", type == 3 ? "WorkFlowForm\\" + tableName : tableName, tableName + "Entity.cs");
|
||||
var mapperPath = Path.Combine(backendPath, "Models", "Mapper", tableName, tableName + "Mapper.cs");
|
||||
var inputCrPath = Path.Combine(backendPath, "Models", "Dto", type == 3 ? "WorkFlowForm\\" + tableName : tableName, tableName + "CrInput.cs");
|
||||
var outputInfoPath = Path.Combine(backendPath, "Models", "Dto", type == 3 ? "WorkFlowForm\\" + tableName : tableName, tableName + "InfoOutput.cs");
|
||||
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
targetPathList.Add(entityPath);
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
if (enableFlow == 1 || type == 3)
|
||||
targetPathList.Add(outputInfoPath);
|
||||
break;
|
||||
default:
|
||||
targetPathList.Add(entityPath);
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
targetPathList.Add(outputInfoPath);
|
||||
break;
|
||||
}
|
||||
|
||||
return targetPathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端副表模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="genModel">SingleTable-单主表,MainBelt-主带子,,,.</param>
|
||||
/// <param name="webType">生成模板类型(1、纯表单,2、表单加列表).</param>
|
||||
/// <param name="enableFlow">是否开启流程.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendAuxiliaryTemplatePathList(string genModel, int webType, int type, int enableFlow)
|
||||
{
|
||||
List<string> templatePathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
|
||||
switch (webType)
|
||||
{
|
||||
case 1:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
if (enableFlow == 1 || type == 3)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
break;
|
||||
default:
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
break;
|
||||
}
|
||||
|
||||
return templatePathList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 后端流程
|
||||
|
||||
/// <summary>
|
||||
/// 后端流程模板文件路径集合.
|
||||
/// </summary>
|
||||
/// <param name="genModel">SingleTable-单主表,MainBelt-主带子,,,.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendFlowTemplatePathList(string genModel, bool isMapper)
|
||||
{
|
||||
List<string> templatePathList = new List<string>();
|
||||
var templatePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "Template");
|
||||
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Service.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, "IService.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Entity.cs.vm"));
|
||||
if (isMapper)
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "Mapper.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "CrInput.cs.vm"));
|
||||
templatePathList.Add(Path.Combine(templatePath, genModel, "InfoOutput.cs.vm"));
|
||||
|
||||
return templatePathList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端主表生成文件路径.
|
||||
/// </summary>
|
||||
/// <param name="tableName">表名.</param>
|
||||
/// <param name="fileName">文件价名称.</param>
|
||||
/// <param name="isMapper">是否对象映射.</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> BackendFlowTargetPathList(string tableName, string fileName, bool isMapper)
|
||||
{
|
||||
List<string> targetPathList = new List<string>();
|
||||
var backendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var servicePath = Path.Combine(backendPath, "Controller", tableName, tableName + "Service.cs");
|
||||
var iservicePath = Path.Combine(backendPath, "Controller", tableName, "I" + tableName + "Service.cs");
|
||||
var entityPath = Path.Combine(backendPath, "Models", "Entity", "WorkFlowForm", tableName + "Entity.cs");
|
||||
var mapperPath = Path.Combine(backendPath, "Models", "Mapper", tableName, tableName + "Mapper.cs");
|
||||
var inputCrPath = Path.Combine(backendPath, "Models", "Dto", "WorkFlowForm", tableName, tableName + "CrInput.cs");
|
||||
var outputInfoPath = Path.Combine(backendPath, "Models", "Dto", "WorkFlowForm", tableName, tableName + "InfoOutput.cs");
|
||||
|
||||
targetPathList.Add(servicePath);
|
||||
targetPathList.Add(iservicePath);
|
||||
targetPathList.Add(entityPath);
|
||||
if (isMapper)
|
||||
targetPathList.Add(mapperPath);
|
||||
targetPathList.Add(inputCrPath);
|
||||
targetPathList.Add(outputInfoPath);
|
||||
|
||||
return targetPathList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Extension;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成 统一处理帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenUnifiedHandlerHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 统一处理表单内控件.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<FieldsModel> UnifiedHandlerFormDataModel(List<FieldsModel> formDataModel, ColumnDesignModel pcColumnDesignModel, ColumnDesignModel appColumnDesignModel, bool isMain = true, string tableControlsKey = "")
|
||||
{
|
||||
var template = new List<FieldsModel>();
|
||||
|
||||
// 循环表单内控件
|
||||
formDataModel.ForEach(item =>
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
item.__config__.children = UnifiedHandlerFormDataModel(item.__config__.children, pcColumnDesignModel, appColumnDesignModel, false, item.__vModel__);
|
||||
template.Add(item);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (isMain)
|
||||
{
|
||||
// 是否为PC端查询字段与移动端查询字段
|
||||
bool pcSearch = (pcColumnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(item.__vModel__))).ParseToBool();
|
||||
bool appSearch = (appColumnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(item.__vModel__))).ParseToBool();
|
||||
if (pcSearch || appSearch)
|
||||
item.isQueryField = true;
|
||||
else
|
||||
item.isQueryField = false;
|
||||
|
||||
bool pcColumn = (pcColumnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(item.__vModel__))).ParseToBool();
|
||||
bool appColumn = (appColumnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(item.__vModel__))).ParseToBool();
|
||||
if (pcColumn || appColumn)
|
||||
item.isIndexShow = true;
|
||||
else
|
||||
item.isIndexShow = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool pcSearch = (pcColumnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)))).ParseToBool();
|
||||
bool appSearch = (appColumnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)))).ParseToBool();
|
||||
if (pcSearch || appSearch)
|
||||
item.isQueryField = true;
|
||||
else
|
||||
item.isQueryField = false;
|
||||
|
||||
bool pcColumn = (pcColumnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)))).ParseToBool();
|
||||
bool appColumn = (appColumnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)))).ParseToBool();
|
||||
if (pcColumn || appColumn)
|
||||
item.isIndexShow = true;
|
||||
else
|
||||
item.isIndexShow = false;
|
||||
}
|
||||
|
||||
template.Add(item);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一处理表单内控件.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<FieldsModel> UnifiedHandlerFormDataModel(List<FieldsModel> formDataModel, ColumnDesignModel columnDesignModel, bool isMain = true, string tableControlsKey = "")
|
||||
{
|
||||
var template = new List<FieldsModel>();
|
||||
|
||||
// 循环表单内控件
|
||||
formDataModel.ForEach(item =>
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
item.__config__.children = UnifiedHandlerFormDataModel(item.__config__.children, columnDesignModel, false, item.__vModel__);
|
||||
template.Add(item);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (isMain)
|
||||
{
|
||||
// 是否为PC端查询字段与移动端查询字段
|
||||
bool search = (bool)columnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(item.__vModel__));
|
||||
if (search)
|
||||
item.isQueryField = true;
|
||||
else
|
||||
item.isQueryField = false;
|
||||
|
||||
bool column = (bool)columnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(item.__vModel__));
|
||||
if (column)
|
||||
item.isIndexShow = true;
|
||||
else
|
||||
item.isIndexShow = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool search = (bool)columnDesignModel?.searchList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)));
|
||||
if (search)
|
||||
{
|
||||
item.isQueryField = true;
|
||||
item.superiorVModel = tableControlsKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isQueryField = false;
|
||||
}
|
||||
|
||||
bool column = (bool)columnDesignModel?.columnList?.Any(it => it.__vModel__.Equals(string.Format("{0}-{1}", tableControlsKey, item.__vModel__)));
|
||||
if (column)
|
||||
item.isIndexShow = true;
|
||||
else
|
||||
item.isIndexShow = false;
|
||||
}
|
||||
|
||||
template.Add(item);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联动关系链判断.
|
||||
/// </summary>
|
||||
/// <param name="formDataModel"></param>
|
||||
/// <param name="columnDesignModel"></param>
|
||||
/// <param name="isMain"></param>
|
||||
/// <param name="tableControlsKey"></param>
|
||||
/// <returns></returns>
|
||||
public static List<FieldsModel> LinkageChainJudgment(List<FieldsModel> formDataModel, ColumnDesignModel columnDesignModel, bool isMain = true, string tableControlsKey = "")
|
||||
{
|
||||
var NewFormDataModel = formDataModel.Copy();
|
||||
var childrenFormModel = new List<FieldsModel>();
|
||||
if (!isMain)
|
||||
{
|
||||
formDataModel = NewFormDataModel.Find(it => it.__vModel__.Equals(tableControlsKey) && it.__config__.jnpfKey.Equals(JnpfKeyConst.TABLE)).__config__.children;
|
||||
childrenFormModel = formDataModel.Copy();
|
||||
}
|
||||
|
||||
formDataModel.ForEach(item =>
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
{
|
||||
NewFormDataModel = LinkageChainJudgment(NewFormDataModel, columnDesignModel, false, item.__vModel__);
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.RADIO:
|
||||
case JnpfKeyConst.CHECKBOX:
|
||||
case JnpfKeyConst.SELECT:
|
||||
case JnpfKeyConst.CASCADER:
|
||||
case JnpfKeyConst.TREESELECT:
|
||||
switch (isMain)
|
||||
{
|
||||
case true:
|
||||
// dataType = dynamic && templateJson属性有长度,则代表有远端联动
|
||||
if (config.dataType == "dynamic" && config.templateJson?.Count() > 0)
|
||||
{
|
||||
config.templateJson.FindAll(it => it.relationField.Any()).ForEach(items =>
|
||||
{
|
||||
var fieldModel = NewFormDataModel.Where(it => it.__vModel__.Equals(items.relationField) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
fieldModel.IsLinked = true;
|
||||
List<LinkageConfig> linkageConfigs = new List<LinkageConfig>
|
||||
{
|
||||
new LinkageConfig()
|
||||
{
|
||||
field = item.__vModel__,
|
||||
fieldName = item.__vModel__.ToLowerCase(),
|
||||
jnpfKey = config.jnpfKey,
|
||||
IsMultiple = config.jnpfKey.Equals(JnpfKeyConst.CASCADER) ? item.props.props.multiple : config.jnpfKey.Equals(JnpfKeyConst.CHECKBOX)? true: item.multiple,
|
||||
}
|
||||
};
|
||||
fieldModel.linkageReverseRelationship.AddRange(linkageConfigs);
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (config.dataType == "dynamic" && config.templateJson?.Count() > 0)
|
||||
{
|
||||
var childrenFieldModel = childrenFormModel.Where(it => item.__vModel__.Equals(it.__vModel__) && it.__config__.jnpfKey.Equals(config.jnpfKey)).FirstOrDefault();
|
||||
childrenFieldModel.IsLinkage = true;
|
||||
config.templateJson.FindAll(it => it.relationField.Any()).ForEach(items =>
|
||||
{
|
||||
var isTrigger = false;
|
||||
var fieldModel = childrenFormModel.Where(it => items.relationField.Equals(string.Format("{0}-{1}", tableControlsKey, it.__vModel__)) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
if (fieldModel == null)
|
||||
{
|
||||
isTrigger = true;
|
||||
fieldModel = NewFormDataModel.Where(it => it.__vModel__.Equals(items.relationField) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
}
|
||||
fieldModel.IsLinked = true;
|
||||
List<LinkageConfig> linkageConfigs = new List<LinkageConfig>
|
||||
{
|
||||
new LinkageConfig()
|
||||
{
|
||||
field = item.__vModel__,
|
||||
fieldName = tableControlsKey,
|
||||
jnpfKey = config.jnpfKey,
|
||||
isChildren = isTrigger,
|
||||
IsMultiple = config.jnpfKey.Equals(JnpfKeyConst.CASCADER) ? item.props.props.multiple : item.multiple,
|
||||
}
|
||||
};
|
||||
fieldModel.linkageReverseRelationship.AddRange(linkageConfigs);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.POPUPSELECT:
|
||||
switch (isMain)
|
||||
{
|
||||
case true:
|
||||
var mainFieldModel = NewFormDataModel.Where(it => item.__vModel__.Equals(it.__vModel__) && it.__config__.jnpfKey.Equals(config.jnpfKey)).FirstOrDefault();
|
||||
mainFieldModel.IsLinkage = true;
|
||||
item.templateJson?.FindAll(it => it.relationField.Any()).ForEach(items =>
|
||||
{
|
||||
var fieldModel = NewFormDataModel.Where(it => it.__vModel__.Equals(items.relationField) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
fieldModel.IsLinked = true;
|
||||
List<LinkageConfig> linkageConfigs = new List<LinkageConfig>
|
||||
{
|
||||
new LinkageConfig()
|
||||
{
|
||||
field = item.__vModel__,
|
||||
fieldName = item.__vModel__.ToLowerCase(),
|
||||
jnpfKey = config.jnpfKey,
|
||||
IsMultiple = config.jnpfKey.Equals(JnpfKeyConst.CASCADER) ? item.props.props.multiple : config.jnpfKey.Equals(JnpfKeyConst.CHECKBOX) ? true : item.multiple,
|
||||
}
|
||||
};
|
||||
fieldModel.linkageReverseRelationship.AddRange(linkageConfigs);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
var childrenFieldModel = childrenFormModel.Where(it => item.__vModel__.Equals(it.__vModel__) && it.__config__.jnpfKey.Equals(config.jnpfKey)).FirstOrDefault();
|
||||
childrenFieldModel.IsLinkage = true;
|
||||
item.templateJson?.FindAll(it => it.relationField.Any()).ForEach(items =>
|
||||
{
|
||||
var isTrigger = false;
|
||||
var fieldModel = childrenFormModel.Where(it => items.relationField.Equals(string.Format("{0}-{1}", tableControlsKey, it.__vModel__)) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
if (fieldModel == null)
|
||||
{
|
||||
isTrigger = true;
|
||||
fieldModel = NewFormDataModel.Where(it => it.__vModel__.Equals(items.relationField) && it.__config__.jnpfKey.Equals(items.jnpfKey)).FirstOrDefault();
|
||||
}
|
||||
fieldModel.IsLinked = true;
|
||||
List<LinkageConfig> linkageConfigs = new List<LinkageConfig>
|
||||
{
|
||||
new LinkageConfig()
|
||||
{
|
||||
field = item.__vModel__,
|
||||
fieldName = tableControlsKey,
|
||||
jnpfKey = config.jnpfKey,
|
||||
isChildren = isTrigger,
|
||||
IsMultiple = config.jnpfKey.Equals(JnpfKeyConst.CASCADER) ? item.props.props.multiple : item.multiple,
|
||||
}
|
||||
};
|
||||
fieldModel.linkageReverseRelationship.AddRange(linkageConfigs);
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (!isMain)
|
||||
{
|
||||
NewFormDataModel.Find(it => it.__vModel__.Equals(tableControlsKey) && it.__config__.jnpfKey.Equals(JnpfKeyConst.TABLE)).__config__.children = childrenFormModel;
|
||||
}
|
||||
return NewFormDataModel;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,186 @@
|
||||
using JNPF.Common.Const;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成查询控件归类帮助类.
|
||||
/// </summary>
|
||||
public class CodeGenQueryControlClassificationHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表查询控件.
|
||||
/// </summary>
|
||||
/// <param name="type">1-Web设计,2-App设计,3-流程表单,4-Web表单,5-App表单.</param>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, List<string>> ListQueryControl(int type)
|
||||
{
|
||||
Dictionary<string, List<string>> listQueryControl = new Dictionary<string, List<string>>();
|
||||
switch (type)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
var useInputList = new List<string>();
|
||||
useInputList.Add(JnpfKeyConst.COMINPUT);
|
||||
useInputList.Add(JnpfKeyConst.TEXTAREA);
|
||||
useInputList.Add(JnpfKeyConst.JNPFTEXT);
|
||||
useInputList.Add(JnpfKeyConst.BILLRULE);
|
||||
listQueryControl["inputList"] = useInputList;
|
||||
|
||||
var useDateList = new List<string>();
|
||||
useDateList.Add(JnpfKeyConst.CREATETIME);
|
||||
useDateList.Add(JnpfKeyConst.MODIFYTIME);
|
||||
listQueryControl["dateList"] = useDateList;
|
||||
|
||||
var useSelectList = new List<string>();
|
||||
useSelectList.Add(JnpfKeyConst.SELECT);
|
||||
useSelectList.Add(JnpfKeyConst.RADIO);
|
||||
useSelectList.Add("checkbox");
|
||||
listQueryControl["selectList"] = useSelectList;
|
||||
|
||||
var timePickerList = new List<string>();
|
||||
timePickerList.Add(JnpfKeyConst.TIME);
|
||||
listQueryControl["timePickerList"] = timePickerList;
|
||||
|
||||
var numRangeList = new List<string>();
|
||||
numRangeList.Add(JnpfKeyConst.NUMINPUT);
|
||||
numRangeList.Add(JnpfKeyConst.CALCULATE);
|
||||
listQueryControl["numRangeList"] = numRangeList;
|
||||
|
||||
var datePickerList = new List<string>();
|
||||
datePickerList.Add(JnpfKeyConst.DATE);
|
||||
listQueryControl["datePickerList"] = datePickerList;
|
||||
|
||||
var userSelectList = new List<string>();
|
||||
userSelectList.Add(JnpfKeyConst.CREATEUSER);
|
||||
userSelectList.Add(JnpfKeyConst.MODIFYUSER);
|
||||
userSelectList.Add(JnpfKeyConst.USERSELECT);
|
||||
listQueryControl["userSelectList"] = userSelectList;
|
||||
|
||||
var usersSelectList = new List<string>();
|
||||
usersSelectList.Add(JnpfKeyConst.USERSSELECT);
|
||||
listQueryControl["usersSelectList"] = usersSelectList;
|
||||
|
||||
var comSelectList = new List<string>();
|
||||
comSelectList.Add(JnpfKeyConst.COMSELECT);
|
||||
comSelectList.Add(JnpfKeyConst.CURRORGANIZE);
|
||||
listQueryControl["comSelectList"] = comSelectList;
|
||||
|
||||
var depSelectList = new List<string>();
|
||||
depSelectList.Add(JnpfKeyConst.CURRDEPT);
|
||||
depSelectList.Add(JnpfKeyConst.DEPSELECT);
|
||||
listQueryControl["depSelectList"] = depSelectList;
|
||||
|
||||
var posSelectList = new List<string>();
|
||||
posSelectList.Add(JnpfKeyConst.CURRPOSITION);
|
||||
posSelectList.Add(JnpfKeyConst.POSSELECT);
|
||||
listQueryControl["posSelectList"] = posSelectList;
|
||||
|
||||
var useCascaderList = new List<string>();
|
||||
useCascaderList.Add(JnpfKeyConst.CASCADER);
|
||||
listQueryControl["useCascaderList"] = useCascaderList;
|
||||
|
||||
var jNPFAddressList = new List<string>();
|
||||
jNPFAddressList.Add(JnpfKeyConst.ADDRESS);
|
||||
listQueryControl["JNPFAddressList"] = jNPFAddressList;
|
||||
|
||||
var treeSelectList = new List<string>();
|
||||
treeSelectList.Add(JnpfKeyConst.TREESELECT);
|
||||
listQueryControl["treeSelectList"] = treeSelectList;
|
||||
}
|
||||
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
var inputList = new List<string>();
|
||||
inputList.Add(JnpfKeyConst.COMINPUT);
|
||||
inputList.Add(JnpfKeyConst.TEXTAREA);
|
||||
inputList.Add(JnpfKeyConst.JNPFTEXT);
|
||||
inputList.Add(JnpfKeyConst.BILLRULE);
|
||||
inputList.Add(JnpfKeyConst.CALCULATE);
|
||||
listQueryControl["input"] = inputList;
|
||||
|
||||
var numRangeList = new List<string>();
|
||||
numRangeList.Add(JnpfKeyConst.NUMINPUT);
|
||||
listQueryControl["numRange"] = numRangeList;
|
||||
|
||||
var switchList = new List<string>();
|
||||
switchList.Add(JnpfKeyConst.SWITCH);
|
||||
listQueryControl["switch"] = switchList;
|
||||
|
||||
var selectList = new List<string>();
|
||||
selectList.Add(JnpfKeyConst.RADIO);
|
||||
selectList.Add(JnpfKeyConst.CHECKBOX);
|
||||
selectList.Add(JnpfKeyConst.SELECT);
|
||||
listQueryControl["select"] = selectList;
|
||||
|
||||
var cascaderList = new List<string>();
|
||||
cascaderList.Add(JnpfKeyConst.CASCADER);
|
||||
listQueryControl["cascader"] = cascaderList;
|
||||
|
||||
var timeList = new List<string>();
|
||||
timeList.Add(JnpfKeyConst.TIME);
|
||||
listQueryControl["time"] = timeList;
|
||||
|
||||
var dateList = new List<string>();
|
||||
dateList.Add(JnpfKeyConst.DATE);
|
||||
dateList.Add(JnpfKeyConst.CREATETIME);
|
||||
dateList.Add(JnpfKeyConst.MODIFYTIME);
|
||||
listQueryControl["date"] = dateList;
|
||||
|
||||
var comSelectList = new List<string>();
|
||||
comSelectList.Add(JnpfKeyConst.COMSELECT);
|
||||
listQueryControl["comSelect"] = comSelectList;
|
||||
|
||||
var depSelectList = new List<string>();
|
||||
depSelectList.Add(JnpfKeyConst.DEPSELECT);
|
||||
depSelectList.Add(JnpfKeyConst.CURRDEPT);
|
||||
depSelectList.Add(JnpfKeyConst.CURRORGANIZE);
|
||||
listQueryControl["depSelect"] = depSelectList;
|
||||
|
||||
var posSelectList = new List<string>();
|
||||
posSelectList.Add(JnpfKeyConst.POSSELECT);
|
||||
posSelectList.Add(JnpfKeyConst.CURRPOSITION);
|
||||
listQueryControl["posSelect"] = posSelectList;
|
||||
|
||||
var userSelectList = new List<string>();
|
||||
userSelectList.Add(JnpfKeyConst.USERSELECT);
|
||||
userSelectList.Add(JnpfKeyConst.CREATEUSER);
|
||||
userSelectList.Add(JnpfKeyConst.MODIFYUSER);
|
||||
listQueryControl["userSelect"] = userSelectList;
|
||||
|
||||
var usersSelectList = new List<string>();
|
||||
usersSelectList.Add(JnpfKeyConst.USERSSELECT);
|
||||
listQueryControl["usersSelectList"] = usersSelectList;
|
||||
|
||||
var treeSelectList = new List<string>();
|
||||
treeSelectList.Add(JnpfKeyConst.TREESELECT);
|
||||
listQueryControl["treeSelect"] = treeSelectList;
|
||||
|
||||
var addressList = new List<string>();
|
||||
addressList.Add(JnpfKeyConst.ADDRESS);
|
||||
listQueryControl["address"] = addressList;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return listQueryControl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 需要转换的列表列控件.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, List<string>> ListColumnControls()
|
||||
{
|
||||
Dictionary<string, List<string>> listColumnControlsType = new Dictionary<string, List<string>>();
|
||||
var columnList = new List<string>();
|
||||
columnList.Add("date");
|
||||
columnList.Add("createTime");
|
||||
columnList.Add("modifyTime");
|
||||
|
||||
listColumnControlsType["columnList"] = columnList;
|
||||
|
||||
return listColumnControlsType;
|
||||
}
|
||||
}
|
||||
18
visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj
Normal file
18
visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Tnb.VisualDev.Interfaces\Tnb.VisualDev.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\workflow\Tnb.WorkFlow.Interfaces\Tnb.WorkFlow.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user