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,
});
}