1、解决在线开发明细最后一条删除不了的bug

2、解决在线开发明细新增时报主键重复的bug
This commit is contained in:
alex
2023-07-20 14:42:31 +08:00
parent 46e280bf4c
commit bf76a84621

View File

@@ -822,9 +822,13 @@ public class RunService : IRunService, ITransient
foreach (KeyValuePair<string, object> child in data)
{
if (child.Key.Equals("id") && child.Value.IsNotEmptyOrNull())
{
//modify by ly on 20230720 判断如果子表主键为空的把原主键值赋值给子表主键,直接复制会导致主键重复
if(tableField[childPrimary.field].IsNull() || tableField[childPrimary.field].ToString().IsNullOrEmpty())
{
tableField[childPrimary.field] = child.Value;
}
}
else if (child.Key.IsNotEmptyOrNull() && child.Value.IsNotEmptyOrNull() && child.Value.ToString() != "[]")
{
var value = _formDataParsing.InsertValueHandle(dbType, tableList, child.Key, child.Value, fieldsModel?.__config__.children, "create", templateInfo.visualDevEntity != null ? templateInfo.visualDevEntity.isShortLink : false);
@@ -986,7 +990,7 @@ public class RunService : IRunService, ITransient
// 查找到该控件数据
List<Dictionary<string, object>>? model = allDataMap[item].ToObject<List<Dictionary<string, object>>>();
if (model != null && model.Count > 0)
if (model != null && model.Count >= 0) //modify by ly on 20230720 将Count>0改为>=0否则最后一条明细数据删除不掉
{
// 利用key去找模板
FieldsModel? fieldsModel = templateInfo.FieldsModelList.Find(f => f.__vModel__ == item);