merge from 2023-03-14

This commit is contained in:
2023-03-24 09:37:07 +08:00
parent f95ef4cf73
commit 3de92dab06
57 changed files with 1538 additions and 528 deletions

View File

@@ -106,8 +106,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -149,8 +147,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -292,6 +289,7 @@ public class CodeGenWay
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
IsImportField = isImportField.ParseToBool(),
ChildControlKey = controlId,
ShowField = control.relational,
});
break;
case false:
@@ -426,8 +424,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField == null ? false : (bool)isImportField,
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -465,8 +461,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField == null ? false : (bool)isImportField,
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -580,8 +575,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -621,8 +614,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
}
@@ -740,8 +731,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)) == null ? false : (bool)columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -781,8 +770,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)) == null ? false : (bool)columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -893,8 +881,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -932,8 +918,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -1214,7 +1199,7 @@ public class CodeGenWay
var isAdd = indexTopButton.Any(it => it.Value == "add");
var isTreeRelation = !string.IsNullOrEmpty(columnDesignModel?.treeRelation);
var isRelationForm = formControlList.Any(it => it.IsRelationForm);
var isFixed = columnDesignModel.childTableStyle == 1 ? indexColumnDesign.Any(it => it.Fixed.Any()) : false;
var isFixed = columnDesignModel.childTableStyle == 1 ? indexColumnDesign.Any(it => it.Fixed.Equals("fixed='left' ") && !it.Name.Equals(columnDesignModel.groupField)) : false;
switch (logic)
{

View File

@@ -250,12 +250,7 @@ public class TableColumnConfigModel
public string LeagueTableNo { get; set; }
/// <summary>
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开).
/// 展示字段.
/// </summary>
public List<string[]> ParsJnpfKeyConstList { get; set; }
/// <summary>
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开)(行内编辑 特殊处理).
/// </summary>
public List<string[]> ParsJnpfKeyConstListDetails { get; set; }
public string ShowField { get; set; }
}

View File

@@ -220,4 +220,10 @@ public class LinkageConfig
/// 是否多选.
/// </summary>
public bool IsMultiple { get; set; }
/// <summary>
/// 联动模板json.
/// </summary>
public List<LinkageConfig> templateJson { get; set; }
}

View File

@@ -5,7 +5,7 @@ namespace JNPF.VisualDev.Engine;
/// <summary>
/// 实体字段模型
/// 版 本V3.0.0
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组.
/// </summary>
[SuppressSniffer]

View File

@@ -581,4 +581,9 @@ public class FieldsModel
/// 上级__vModel__.
/// </summary>
public string superiorVModel { get; set; }
/// <summary>
/// 后端自我创建字段、用于统一处理关联表单属性与弹窗选择属性.
/// </summary>
public string relational { get; set; }
}

View File

@@ -92,7 +92,6 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
{
@@ -106,7 +105,9 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.CHECKBOX:
case JnpfKeyConst.CASCADER:
case JnpfKeyConst.COMSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ADDRESS:
case JnpfKeyConst.USERSSELECT:
tag = true;
break;
}
@@ -206,7 +207,6 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
{
@@ -221,6 +221,7 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.CASCADER:
case JnpfKeyConst.COMSELECT:
case JnpfKeyConst.ADDRESS:
case JnpfKeyConst.POPUPTABLESELECT:
tag = true;
break;
}
@@ -248,6 +249,7 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.USERSSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
@@ -456,6 +458,14 @@ public class CodeGenControlsAttributeHelper
if (!res.ContainsKey(JnpfKeyConst.USERSSELECT)) res.Add(JnpfKeyConst.USERSSELECT, new List<string>());
res[JnpfKeyConst.USERSSELECT].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 = GetParsJnpfKeyConstList(item.__config__.children, isInlineEditor);
if (ctRes != null && ctRes.Any())
@@ -463,7 +473,7 @@ public class CodeGenControlsAttributeHelper
foreach (var ct in ctRes)
{
if (!res.ContainsKey(ct.FirstOrDefault())) res.Add(ct.FirstOrDefault(), new List<string>());
res[ct.FirstOrDefault()].AddRange(ct.LastOrDefault().Split(','));
res[ct.FirstOrDefault()].Add(item.__vModel__ + "-" + ct.LastOrDefault());
}
}
break;
@@ -506,10 +516,6 @@ public class CodeGenControlsAttributeHelper
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__);
@@ -524,8 +530,8 @@ public class CodeGenControlsAttributeHelper
{
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(','));
if (!res.ContainsKey(ct.FirstOrDefault())) res.Add(ct.FirstOrDefault(), new List<string>());
res[ct.FirstOrDefault()].Add(item.__vModel__ + "-" + ct.LastOrDefault());
}
}

View File

@@ -288,4 +288,41 @@ public class CodeGenUnifiedHandlerHelper
}
return NewFormDataModel;
}
/// <summary>
/// 统一处理控件关系.
/// </summary>
/// <param name="formDataModel">控件列表.</param>
/// <returns></returns>
public static List<FieldsModel> UnifiedHandlerControlRelationship(List<FieldsModel> formDataModel, bool isMain = true)
{
formDataModel.ForEach(item =>
{
switch (item.__config__.jnpfKey)
{
case JnpfKeyConst.RELATIONFORM:
{
var list = formDataModel.FindAll(it => it.__config__.jnpfKey.Equals(JnpfKeyConst.RELATIONFORMATTR) && it.relationField.Equals(string.Format("{0}_jnpfTable_{1}{2}", item.__vModel__, item.__config__.tableName, isMain ? 1 : 0)) && it.__config__.isStorage.Equals(1));
item.relational = string.Join(",", list.Select(it => it.showField).ToList());
}
break;
case JnpfKeyConst.TABLE:
{
item.__config__.children = UnifiedHandlerControlRelationship(item.__config__.children, false);
}
break;
case JnpfKeyConst.POPUPSELECT:
{
var list = formDataModel.FindAll(it => it.__config__.jnpfKey.Equals(JnpfKeyConst.POPUPATTR) && it.relationField.Equals(string.Format("{0}_jnpfTable_{1}{2}", item.__vModel__, item.__config__.tableName, isMain ? 1 : 0)) && it.__config__.isStorage.Equals(1));
item.relational = string.Join(",", list.Select(it => it.showField).ToList());
}
break;
}
});
return formDataModel;
}
}

View File

@@ -363,9 +363,11 @@ public class CodeGenFormControlDesignHelper
{
var relationField = Regex.Match(item.relationField, @"^(.+)_jnpfTable_").Groups[1].Value;
var relationControl = realisticControls.Find(it => it.__vModel__ == relationField);
var columnDesign = columnDesignModel?.Find(it => it.__vModel__ == item.__vModel__);
list.Add(new FormControlDesignModel()
{
vModel = item.__vModel__.IsNotEmptyOrNull() ? string.Format("v-model=\"dataForm.{0}\"", item.__vModel__) : string.Empty,
IsInlineEditor = columnDesignModel != null ? columnDesignModel.Any(it => it.__vModel__ == item.__vModel__) : false,
Style = item.style != null && !item.style.ToString().Equals("{}") ? $":style='{item.style.ToJsonString()}' " : string.Empty,
jnpfKey = config.jnpfKey,
OriginalName = config.isStorage == 2 ? item.__vModel__ : relationField,
@@ -377,7 +379,9 @@ public class CodeGenFormControlDesignHelper
Label = config.label,
Span = config.span,
IsStorage = config.isStorage,
IndexWidth = columnDesign?.width,
LabelWidth = config?.labelWidth ?? labelWidth,
IndexAlign = columnDesign?.align,
});
}

View File

@@ -15,9 +15,6 @@ 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;
@@ -43,11 +40,6 @@ public class ControlParsing : ITransient
/// </summary>
private readonly IDataInterfaceService _dataInterfaceService;
/// <summary>
/// 解析控件的控件属性 (vModel , Attr).
/// </summary>
private Dictionary<string, FieldsModel>? ControlAttr;
/// <summary>
/// 构造函数.
/// </summary>
@@ -74,9 +66,6 @@ public class ControlParsing : ITransient
/// <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 =>
@@ -91,45 +80,54 @@ public class ControlParsing : ITransient
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);
foreach (var ctItem in ctItems)
{
if (vModelList.Contains(item.Key + "-" + ctItem.Key) && !vModels.ContainsKey(item.Key + "-" + ctItem.Key))
vModels.Add(item.Key + "-" + ctItem.Key, jnpfKeyConst);
}
});
}
}
});
return await GetParsDataByList(oldDatas, vModels, tenantId);
return await GetParsDataByList(vModelAttr, oldDatas, vModels, tenantId);
}
/// <summary>
/// 获取解析数据.
/// </summary>
/// <param name="fields">模板集合.</param>
/// <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)
private async Task<List<Dictionary<string, object>>> GetParsDataByList(List<FieldsModel> fields, 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 items in oldDatas)
{
foreach (var item in items)
for(var i = 0; i < items.Count; i++)
{
if (vModels.Any(x => x.Key.Equals(item.Key)))
var item = items.ToList()[i];
if (vModels.Any(x => x.Key.Equals(item.Key)) && items[item.Key] != null)
{
FieldsModel model = ControlAttr.ContainsKey(item.Key) ? ControlAttr[item.Key] : new FieldsModel();
FieldsModel model = fields.Any(x=>x.__vModel__.Equals(item.Key)) ? fields.Find(x=> x.__vModel__.Equals(item.Key)) : (fields.Any(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) ? fields.Find(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) : 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 itemValue = item.Value;
if (itemValue == null && items.ContainsKey(item.Key.Replace("_name", string.Empty))) itemValue = items[item.Key.Replace("_name", string.Empty)];
if (itemValue != null)
{
var vList = new List<string>();
if (item.Value.ToString().Contains("[")) vList = item.Value.ToString().ToObject<List<string>>();
else vList.Add(item.Value.ToString());
if (itemValue.ToString().Contains("[")) vList = itemValue.ToString().ToObject<List<string>>();
else vList.Add(itemValue.ToString());
var itemValues = new List<string>();
vList.ForEach(it =>
{
@@ -140,7 +138,6 @@ public class ControlParsing : ITransient
}
break;
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.POPUPSELECT: // 弹窗选择
{
if (model.interfaceId.IsNullOrEmpty()) continue;
@@ -193,62 +190,45 @@ public class ControlParsing : ITransient
{
case 1: // SQL数据
{
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(items[item.Key].ToString())).FirstOrDefault();
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(items[item.Key] == null ? model.interfaceId : 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];
}
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = specificData[fItem];
}
}
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(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
if (vara != null)
{
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] = vara[items[item.Key].ToString()];
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = string.Join(model.separator, cascaderList);
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = vara[fItem];
}
}
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]); });
var vara = popupselectDataList.Where(a => a.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
if (vara != null)
{
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = vara[items[item.Key].ToString()];
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = string.Join(model.separator, cascaderList);
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = vara[fItem];
}
}
break;
}
@@ -293,6 +273,10 @@ public class ControlParsing : ITransient
{
items[item.Key + "_id"] = relationFormRealData["id"];
items[item.Key] = relationFormRealData.ContainsKey(model.relationField) ? relationFormRealData[model.relationField] : string.Empty;
// 关联表单属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = relationFormRealData[fItem];
}
else
{
@@ -309,11 +293,15 @@ public class ControlParsing : ITransient
{
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);
foreach (var ctItem in vModels.Where(x => x.Key.Contains(item.Key)).ToList())
{
ctVModels.Add(ctItem.Key.Split("-").LastOrDefault(), ctItem.Value);
var ctFields = fields.Find(x => x.__vModel__.Equals(ctItem.Key.Split("-").FirstOrDefault())).__config__.children;
if (ctList.Any()) items[item.Key] = await GetParsDataByList(ctFields, ctList, ctVModels, tenantId);
}
}
}
});
}
return oldDatas;
}
@@ -493,5 +481,4 @@ public class ControlParsing : ITransient
}
#endregion
}

View File

@@ -21,9 +21,9 @@ using JNPF.Systems.Entitys.Model.DataInterFace;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Engine;
using JNPF.VisualDev.Engine.Core;
using JNPF.VisualDev.Interfaces;
using JNPF.WorkFlow.Interfaces.Service;
using Mapster;
using Newtonsoft.Json.Linq;
@@ -50,7 +50,7 @@ public class ExportImportDataHelper : ITransient
/// <summary>
/// 在线开发运行服务.
/// </summary>
private readonly IRunService _runService;
private readonly RunService _runService;
/// <summary>
/// 单据.
@@ -93,7 +93,7 @@ public class ExportImportDataHelper : ITransient
public ExportImportDataHelper(
ISqlSugarRepository<OrganizeEntity> repositoryRepository,
IUserManager userManager,
IRunService runService,
RunService runService,
IBillRullService billRuleService,
IDataInterfaceService dataInterfaceService,
IDataBaseManager databaseService,
@@ -369,6 +369,55 @@ public class ExportImportDataHelper : ITransient
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
fieldList.Add(field);
}
}
}
return fieldList;
}
/// <summary>
/// 获取数据转换模板解析.
/// </summary>
public static List<FieldsModel> GetDataConversionTemplateParsing<T>(T entity)
{
List<FieldsModel> fieldList = new List<FieldsModel>();
foreach (PropertyInfo prop in entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
FieldsModel field = new FieldsModel();
foreach (var att in prop.GetCustomAttributes(false))
{
if (att is CodeGenUploadAttribute)
{
var configModel = new ConfigModel();
field.__vModel__ = (att as CodeGenUploadAttribute).__vModel__ ?? (att as CodeGenUploadAttribute).__Model__;
field.level = (att as CodeGenUploadAttribute).level;
field.min = (att as CodeGenUploadAttribute).min == 0 ? null : (att as CodeGenUploadAttribute).min;
field.max = (att as CodeGenUploadAttribute).max == 0 ? null : (att as CodeGenUploadAttribute).max;
field.activeTxt = (att as CodeGenUploadAttribute).activeTxt;
field.inactiveTxt = (att as CodeGenUploadAttribute).inactiveTxt;
field.format = (att as CodeGenUploadAttribute).format;
field.multiple = (att as CodeGenUploadAttribute).multiple;
field.separator = (att as CodeGenUploadAttribute).separator;
field.__slot__ = (att as CodeGenUploadAttribute).__slot__.Adapt<SlotModel>();
field.props = (att as CodeGenUploadAttribute).props.Adapt<PropsModel>();
field.options = (att as CodeGenUploadAttribute).options;
field.propsValue = (att as CodeGenUploadAttribute).propsValue;
field.relationField = (att as CodeGenUploadAttribute).relationField;
field.modelId = (att as CodeGenUploadAttribute).modelId;
field.interfaceId = (att as CodeGenUploadAttribute).interfaceId;
field.selectType = (att as CodeGenUploadAttribute).selectType;
field.ableDepIds = (att as CodeGenUploadAttribute).ableDepIds;
field.ablePosIds = (att as CodeGenUploadAttribute).ablePosIds;
field.ableUserIds = (att as CodeGenUploadAttribute).ableUserIds;
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
@@ -416,6 +465,56 @@ public class ExportImportDataHelper : ITransient
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
fieldList.Add(field);
}
}
}
return fieldList;
}
/// <summary>
/// 获取数据转换模板解析.
/// </summary>
public static List<FieldsModel> GetDataConversionTemplateParsing<T>(T entity, string tableName)
{
List<FieldsModel> fieldList = new List<FieldsModel>();
foreach (PropertyInfo prop in entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
FieldsModel field = new FieldsModel();
foreach (var att in prop.GetCustomAttributes(false))
{
if (att is CodeGenUploadAttribute)
{
var configModel = new ConfigModel();
field.__vModel__ = string.Format("jnpf_{0}_jnpf_{1}", tableName, (att as CodeGenUploadAttribute).__vModel__ ?? (att as CodeGenUploadAttribute).__Model__);
field.level = (att as CodeGenUploadAttribute).level;
field.min = (att as CodeGenUploadAttribute).min == 0 ? null : (att as CodeGenUploadAttribute).min;
field.max = (att as CodeGenUploadAttribute).max == 0 ? null : (att as CodeGenUploadAttribute).max;
field.activeTxt = (att as CodeGenUploadAttribute).activeTxt;
field.inactiveTxt = (att as CodeGenUploadAttribute).inactiveTxt;
field.format = (att as CodeGenUploadAttribute).format;
field.multiple = (att as CodeGenUploadAttribute).multiple;
field.separator = (att as CodeGenUploadAttribute).separator;
field.__slot__ = (att as CodeGenUploadAttribute).__slot__.Adapt<SlotModel>();
field.props = (att as CodeGenUploadAttribute).props.Adapt<PropsModel>();
field.options = (att as CodeGenUploadAttribute).options;
field.propsValue = (att as CodeGenUploadAttribute).propsValue;
field.relationField = (att as CodeGenUploadAttribute).relationField;
field.modelId = (att as CodeGenUploadAttribute).modelId;
field.interfaceId = (att as CodeGenUploadAttribute).interfaceId;
field.selectType = (att as CodeGenUploadAttribute).selectType;
field.ableDepIds = (att as CodeGenUploadAttribute).ableDepIds;
field.ablePosIds = (att as CodeGenUploadAttribute).ablePosIds;
field.ableUserIds = (att as CodeGenUploadAttribute).ableUserIds;
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
@@ -660,78 +759,78 @@ public class ExportImportDataHelper : ITransient
return new { dataRow = resData, headerRow = headerRow };
}
///// <summary>
///// 导入数据.
///// </summary>
///// <param name="tInfo">模板信息.</param>
///// <param name="list">数据集合.</param>
///// <returns>[成功列表,失败列表].</returns>
//public async Task<object[]> ImportMenuData(TemplateParsingBase tInfo, List<Dictionary<string, object>> list)
//{
// List<Dictionary<string, object>> userInputList = ImportFirstVerify(tInfo, list);
// List<FieldsModel> fieldsModelList = tInfo.AllFieldsModel.Where(x => tInfo.selectKey.Contains(x.__vModel__)).ToList();
/// <summary>
/// 导入数据.
/// </summary>
/// <param name="tInfo">模板信息.</param>
/// <param name="list">数据集合.</param>
/// <returns>[成功列表,失败列表].</returns>
public async Task<object[]> ImportMenuData(TemplateParsingBase tInfo, List<Dictionary<string, object>> list)
{
List<Dictionary<string, object>> userInputList = ImportFirstVerify(tInfo, list);
List<FieldsModel> fieldsModelList = tInfo.AllFieldsModel.Where(x => tInfo.selectKey.Contains(x.__vModel__)).ToList();
// var successList = new List<Dictionary<string, object>>();
// var errorsList = new List<Dictionary<string, object>>();
var successList = new List<Dictionary<string, object>>();
var errorsList = new List<Dictionary<string, object>>();
// // 捞取控件解析数据
// var cData = await GetCDataList(tInfo.AllFieldsModel, new Dictionary<string, List<Dictionary<string, string>>>());
// var res = await ImportDataAssemble(fieldsModelList, userInputList, cData);
// res.Where(x => x.ContainsKey("errorsInfo")).ToList().ForEach(item => errorsList.Add(item));
// res.Where(x => !x.ContainsKey("errorsInfo")).ToList().ForEach(item => successList.Add(item));
// 捞取控件解析数据
var cData = await GetCDataList(tInfo.AllFieldsModel, new Dictionary<string, List<Dictionary<string, string>>>());
var res = await ImportDataAssemble(fieldsModelList, userInputList, cData);
res.Where(x => x.ContainsKey("errorsInfo")).ToList().ForEach(item => errorsList.Add(item));
res.Where(x => !x.ContainsKey("errorsInfo")).ToList().ForEach(item => successList.Add(item));
// try
// {
// // 唯一验证已处理,入库前去掉.
// tInfo.AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.COMINPUT) && x.__config__.unique).ToList().ForEach(item => item.__config__.unique = false);
// _sqlSugarClient.BeginTran();
// foreach (var item in successList)
// {
// if (item.ContainsKey("Update_MainTablePrimary_Id"))
// {
// string? mainId = item["Update_MainTablePrimary_Id"].ToString();
// var haveTableSql = await _runService.GetUpdateSqlByTemplate(tInfo, new VisualDevModelDataUpInput() { data = item.ToJsonString() }, mainId);
// foreach (var it in haveTableSql) await _databaseService.ExecuteSql(tInfo.DbLink, it); // 修改功能数据
// }
// else
// {
// if ((tInfo.visualDevEntity?.EnableFlow.Equals(1)).ParseToBool())
// {
// var flowId = _repository.AsSugarClient().Queryable<WorkFlow.Entitys.Entity.FlowFormEntity>().First(x => x.Id.Equals(tInfo.visualDevEntity.Id)).FlowId;
// await _flowTaskService.Create(new Common.Models.WorkFlow.FlowTaskSubmitModel() { formData = item.ToJsonString(), flowId = flowId, flowUrgent = 1 });
// }
// else
// {
// string? mainId = YitIdHelper.NextId().ToString();
// var haveTableSql = await _runService.GetCreateSqlByTemplate(tInfo, new VisualDevModelDataCrInput() { data = item.ToJsonString() }, mainId);
try
{
// 唯一验证已处理,入库前去掉.
tInfo.AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.COMINPUT) && x.__config__.unique).ToList().ForEach(item => item.__config__.unique = false);
_sqlSugarClient.BeginTran();
foreach (var item in successList)
{
if (item.ContainsKey("Update_MainTablePrimary_Id"))
{
string? mainId = item["Update_MainTablePrimary_Id"].ToString();
var haveTableSql = await _runService.GetUpdateSqlByTemplate(tInfo, new VisualDevModelDataUpInput() { data = item.ToJsonString() }, mainId);
foreach (var it in haveTableSql) await _databaseService.ExecuteSql(tInfo.DbLink, it); // 修改功能数据
}
else
{
if ((tInfo.visualDevEntity?.EnableFlow.Equals(1)).ParseToBool())
{
var flowId = _repository.AsSugarClient().Queryable<WorkFlow.Entitys.Entity.FlowFormEntity>().First(x => x.Id.Equals(tInfo.visualDevEntity.Id)).FlowId;
await _flowTaskService.Create(new Common.Models.WorkFlow.FlowTaskSubmitModel() { formData = item, flowId = flowId, flowUrgent = 1, status = 1 });
}
else
{
string? mainId = YitIdHelper.NextId().ToString();
var haveTableSql = await _runService.GetCreateSqlByTemplate(tInfo, new VisualDevModelDataCrInput() { data = item.ToJsonString() }, mainId);
// // 主表自增长Id.
// if (haveTableSql.ContainsKey("MainTableReturnIdentity"))
// {
// mainId = haveTableSql["MainTableReturnIdentity"].First().First().Value.ToString();
// haveTableSql.Remove("MainTableReturnIdentity");
// }
// foreach (var it in haveTableSql)
// await _databaseService.ExecuteSql(tInfo.DbLink, it.Key, it.Value); // 新增功能数据
// }
// }
// }
// 主表自增长Id.
if (haveTableSql.ContainsKey("MainTableReturnIdentity"))
{
mainId = haveTableSql["MainTableReturnIdentity"].First().First().Value.ToString();
haveTableSql.Remove("MainTableReturnIdentity");
}
foreach (var it in haveTableSql)
await _databaseService.ExecuteSql(tInfo.DbLink, it.Key, it.Value); // 新增功能数据
}
}
}
// _sqlSugarClient.CommitTran();
// }
// catch (Exception e)
// {
// _sqlSugarClient.RollbackTran();
// throw;
// }
_sqlSugarClient.CommitTran();
}
catch (Exception e)
{
_sqlSugarClient.RollbackTran();
throw;
}
// errorsList.ForEach(item =>
// {
// if (item.ContainsKey("errorsInfo") && item["errorsInfo"].IsNotEmptyOrNull()) item["errorsInfo"] = item["errorsInfo"].ToString().TrimStart(',').TrimEnd(',');
// });
errorsList.ForEach(item =>
{
if (item.ContainsKey("errorsInfo") && item["errorsInfo"].IsNotEmptyOrNull()) item["errorsInfo"] = item["errorsInfo"].ToString().TrimStart(',').TrimEnd(',');
});
// return new object[] { successList, errorsList };
//}
return new object[] { successList, errorsList };
}
/// <summary>
/// Excel 转输出 Model.

View File

@@ -21,8 +21,6 @@ using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Entitys.Dto.CodeGen;
using JNPF.VisualDev.Entitys.Enum;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Crmf;
using Spire.Presentation;
using SqlSugar;
using System.IO.Compression;
using System.Text;
@@ -300,6 +298,7 @@ public class CodeGenService : IDynamicApiController, ITransient
// 统一处理下表单内控件
controls = CodeGenUnifiedHandlerHelper.UnifiedHandlerFormDataModel(controls, pcColumnDesignModel, appColumnDesignModel);
controls = CodeGenUnifiedHandlerHelper.UnifiedHandlerControlRelationship(controls);
break;
}

View File

@@ -1462,7 +1462,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@userAraSubordinates", // 条件内容(当前用户及下属)
@@ -1519,7 +1519,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@organizationAndSuborganization", // 条件内容(当前组织及组织)
@@ -1558,7 +1558,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@branchManageOrganize", // 条件内容(当前分管组织)
@@ -1576,7 +1576,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@branchManageOrganizeAndSub", // 条件内容(当前分管组织及子组织)
@@ -1623,11 +1623,11 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|| x.FullName == "当前用户及下属" || x.FullName == "当前组织及子组织"
|| x.FullName == "当前分管组织" || x.FullName == "当前分管组织及子组织")
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\""))
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\""))
.ToListAsync();
List<ModuleDataAuthorizeSchemeEntity>? authSchemeList = new List<ModuleDataAuthorizeSchemeEntity>(); // 方案管理
@@ -1668,16 +1668,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@userAraSubordinates"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@userAraSubordinates";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@userAraSubordinates}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@userAraSubordinates}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前用户及下属",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@userAraSubordinates}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@userAraSubordinates}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1685,14 +1685,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1700,7 +1700,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
@@ -1735,16 +1735,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@organizationAndSuborganization"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@organizationAndSuborganization";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@organizationAndSuborganization}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@organizationAndSuborganization}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前组织及子组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@organizationAndSuborganization}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@organizationAndSuborganization}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1752,14 +1752,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1767,7 +1767,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
@@ -1783,18 +1783,18 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
condJson.groups.First().bindTable = model.BindTable;
condJson.groups.First().field = item.__vModel__;
condJson.groups.First().fieldRule = model.FieldRule.ParseToInt();
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@branchManageOrganize";
// 新增
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@branchManageOrganize}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@branchManageOrganize}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前分管组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@branchManageOrganize}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@branchManageOrganize}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1802,16 +1802,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@branchManageOrganizeAndSub"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@branchManageOrganizeAndSub";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@branchManageOrganizeAndSub}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@branchManageOrganizeAndSub}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前分管组织及子组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@branchManageOrganizeAndSub}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@branchManageOrganizeAndSub}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1819,14 +1819,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1834,7 +1834,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}