v3.4.6
This commit is contained in:
@@ -32,7 +32,10 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
// 移除乐观锁
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("version"));
|
||||
@@ -58,18 +61,18 @@ public class CodeGenWay
|
||||
IsConversion = false,
|
||||
IsSystemControl = false,
|
||||
IsAuxiliary = true,
|
||||
IsControlParsing = false,
|
||||
IsUpdate = false,
|
||||
TableNo = tableNo,
|
||||
TableName = tableName,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
switch (controls.Any(c => c.__vModel__.Equals(string.Format("jnpf_{0}_jnpf_{1}", tableName, field))))
|
||||
var childControl = string.Format("jnpf_{0}_jnpf_{1}", tableName, field);
|
||||
switch (controls.Any(c => c.__vModel__.Equals(childControl)))
|
||||
{
|
||||
case true:
|
||||
var childControl = string.Empty;
|
||||
childControl = string.Format("jnpf_{0}_jnpf_{1}", tableName, field);
|
||||
FieldsModel control = controls.Find(c => c.__vModel__.Equals(string.Format("jnpf_{0}_jnpf_{1}", tableName, field)));
|
||||
FieldsModel control = controls.Find(c => c.__vModel__.Equals(childControl));
|
||||
var isImportField = templateEntity.WebType == 1 ? false : columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(childControl));
|
||||
switch (control.__config__.jnpfKey)
|
||||
{
|
||||
@@ -86,7 +89,8 @@ public class CodeGenWay
|
||||
NetType = CodeGenHelper.ConvertDataType(column.dataType),
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, childControl),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, childControl),
|
||||
IsShow = control.isIndexShow,
|
||||
IsUnique = control.__config__.unique,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
@@ -95,8 +99,8 @@ public class CodeGenWay
|
||||
IsDateTime = CodeGenFieldJudgeHelper.IsSecondaryTableDateTime(control),
|
||||
ActiveTxt = control.activeTxt,
|
||||
InactiveTxt = control.inactiveTxt,
|
||||
IsDetailConversion = CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, string.Format("jnpf_{0}_jnpf_{1}", tableName, field))),
|
||||
IsConversion = modelType == 1 ? CodeGenControlsAttributeHelper.JudgeContainsChildTableControlIsDataConversion(control.__config__.jnpfKey) : CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, string.Format("jnpf_{0}_jnpf_{1}", tableName, field))),
|
||||
IsDetailConversion = CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, childControl)),
|
||||
IsConversion = modelType == 1 ? CodeGenControlsAttributeHelper.JudgeContainsChildTableControlIsDataConversion(control.__config__.jnpfKey) : CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, childControl)),
|
||||
IsSystemControl = true,
|
||||
IsUpdate = CodeGenControlsAttributeHelper.JudgeControlIsSystemControls(control.__config__.jnpfKey),
|
||||
IsAuxiliary = true,
|
||||
@@ -105,7 +109,9 @@ public class CodeGenWay
|
||||
FormatTableName = tableName.ParseToPascalCase(),
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
IsControlParsing = false,
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsTreeParentField = childControl.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -118,10 +124,11 @@ public class CodeGenWay
|
||||
DataType = column.dataType,
|
||||
NetType = CodeGenHelper.ConvertDataType(column.dataType),
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = CodeGenFieldJudgeHelper.IsColumnQueryWhether(searchList: columnDesignModel.searchList, string.Format("jnpf_{0}_jnpf_{1}", tableName, field)),
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, string.Format("jnpf_{0}_jnpf_{1}", tableName, field)),
|
||||
IsShow = CodeGenFieldJudgeHelper.IsShowColumn(columnDesignModel.columnList, string.Format("jnpf_{0}_jnpf_{1}", tableName, field)),
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, string.Format("jnpf_{0}_jnpf_{1}", tableName, field)),
|
||||
QueryWhether = CodeGenFieldJudgeHelper.IsColumnQueryWhether(searchList: columnDesignModel.searchList, childControl),
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, childControl),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, childControl),
|
||||
IsShow = CodeGenFieldJudgeHelper.IsShowColumn(columnDesignModel.columnList, childControl),
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, childControl),
|
||||
IsUnique = control.__config__.unique,
|
||||
jnpfKey = control.__config__.jnpfKey,
|
||||
Rule = control.__config__.rule,
|
||||
@@ -136,8 +143,8 @@ public class CodeGenWay
|
||||
Value = CodeGenControlsAttributeHelper.GetControlsValue(control.__config__.jnpfKey, dataType, control),
|
||||
Children = CodeGenControlsAttributeHelper.GetControlsChildren(control.__config__.jnpfKey, dataType, control),
|
||||
Separator = control.separator,
|
||||
IsDetailConversion = CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, dataType, CodeGenFieldJudgeHelper.IsMultipleColumn(controls, string.Format("jnpf_{0}_jnpf_{1}", tableName, field))),
|
||||
IsConversion = modelType == 1 ? CodeGenControlsAttributeHelper.JudgeContainsChildTableControlIsDataConversion(control.__config__.jnpfKey) : CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, string.Format("jnpf_{0}_jnpf_{1}", tableName, field))),
|
||||
IsDetailConversion = CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, dataType, CodeGenFieldJudgeHelper.IsMultipleColumn(controls, childControl)),
|
||||
IsConversion = modelType == 1 ? CodeGenControlsAttributeHelper.JudgeContainsChildTableControlIsDataConversion(control.__config__.jnpfKey) : CodeGenControlsAttributeHelper.JudgeControlIsDataConversion(control.__config__.jnpfKey, "", CodeGenFieldJudgeHelper.IsMultipleColumn(controls, childControl)),
|
||||
IsSystemControl = false,
|
||||
IsUpdate = CodeGenControlsAttributeHelper.JudgeControlIsSystemControls(control.__config__.jnpfKey),
|
||||
IsAuxiliary = true,
|
||||
@@ -147,7 +154,9 @@ public class CodeGenWay
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsControlParsing = CodeGenFieldJudgeHelper.IsControlParsing(control),
|
||||
ShowField = control.relational,
|
||||
IsTreeParentField = childControl.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -168,6 +177,7 @@ public class CodeGenWay
|
||||
IsAuxiliary = true,
|
||||
IsUpdate = false,
|
||||
TableNo = tableNo,
|
||||
IsControlParsing = false,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -187,6 +197,9 @@ public class CodeGenWay
|
||||
// 是否对象映射
|
||||
bool isMapper = CodeGenFieldJudgeHelper.IsChildTableMapper(tableColumnList);
|
||||
|
||||
// 是否查询条件多选
|
||||
bool isSearchMultiple = tableColumnList.Any(it => it.QueryMultiple);
|
||||
|
||||
return new CodeGenConfigModel()
|
||||
{
|
||||
NameSpace = formDataModel.areasName,
|
||||
@@ -204,6 +217,7 @@ public class CodeGenWay
|
||||
PrimaryKeyPolicy = formDataModel.primaryKeyPolicy,
|
||||
IsImportData = tableColumnList.Any(it => it.IsImportField.Equals(true)),
|
||||
EnableFlow = templateEntity.EnableFlow == 1 ? true : false,
|
||||
IsSearchMultiple = isSearchMultiple,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -224,7 +238,10 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
// 移除乐观锁
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("version"));
|
||||
@@ -247,6 +264,7 @@ public class CodeGenWay
|
||||
DataType = column.dataType,
|
||||
NetType = CodeGenHelper.ConvertDataType(column.dataType),
|
||||
PrimaryKey = true,
|
||||
IsControlParsing = false,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -267,6 +285,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, string.Format("{0}-{1}", controlId, field)),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, string.Format("{0}-{1}", controlId, field)),
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
IsUnique = control.__config__.unique,
|
||||
jnpfKey = control.__config__.jnpfKey,
|
||||
@@ -290,6 +309,7 @@ public class CodeGenWay
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ChildControlKey = controlId,
|
||||
ShowField = control.relational,
|
||||
IsControlParsing = CodeGenFieldJudgeHelper.IsControlParsing(control),
|
||||
});
|
||||
break;
|
||||
case false:
|
||||
@@ -302,6 +322,7 @@ public class CodeGenWay
|
||||
NetType = CodeGenHelper.ConvertDataType(column.dataType),
|
||||
ForeignKeyField = true,
|
||||
IsImportField = false,
|
||||
IsControlParsing = false,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -322,6 +343,9 @@ public class CodeGenWay
|
||||
|
||||
bool isShowSubTableField = tableColumnList.Any(it => it.IsShow.Equals(true));
|
||||
|
||||
// 是否查询条件多选
|
||||
bool isSearchMultiple = tableColumnList.Any(it => it.QueryMultiple);
|
||||
|
||||
return new CodeGenConfigModel()
|
||||
{
|
||||
NameSpace = formDataModel.areasName,
|
||||
@@ -337,6 +361,7 @@ public class CodeGenWay
|
||||
PrimaryKeyPolicy = formDataModel.primaryKeyPolicy,
|
||||
IsImportData = tableColumnList.Any(it => it.IsImportField.Equals(true)),
|
||||
IsShowSubTableField = isShowSubTableField,
|
||||
IsSearchMultiple = isSearchMultiple,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -355,7 +380,7 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
|
||||
// 移除乐观锁
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("version"));
|
||||
@@ -363,6 +388,9 @@ public class CodeGenWay
|
||||
// 移除真实流程ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowtaskid"));
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
var table = templateEntity.Tables.ToObject<List<DbTableRelationModel>>();
|
||||
|
||||
var tableColumnList = new List<TableColumnConfigModel>();
|
||||
@@ -409,6 +437,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsUnique = control.__config__.unique,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
@@ -424,6 +453,7 @@ public class CodeGenWay
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField == null ? false : (bool)isImportField,
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsTreeParentField = childControl.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -438,6 +468,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
IsUnique = control.__config__.unique,
|
||||
@@ -462,6 +493,7 @@ public class CodeGenWay
|
||||
IsImportField = isImportField == null ? false : (bool)isImportField,
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
ShowField = control.relational,
|
||||
IsTreeParentField = childControl.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -479,6 +511,7 @@ public class CodeGenWay
|
||||
IsSystemControl = false,
|
||||
ForeignKeyField = true,
|
||||
IsUpdate = false,
|
||||
IsControlParsing = false,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -507,7 +540,7 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
|
||||
// 移除乐观锁
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("version"));
|
||||
@@ -515,6 +548,9 @@ public class CodeGenWay
|
||||
// 移除真实流程ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowtaskid"));
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
var tableColumnList = new List<TableColumnConfigModel>();
|
||||
foreach (DbTableFieldModel? column in dbTableFields)
|
||||
{
|
||||
@@ -558,6 +594,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsUnique = control.__config__.unique,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
@@ -575,6 +612,7 @@ public class CodeGenWay
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -589,6 +627,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
IsUnique = control.__config__.unique,
|
||||
@@ -614,6 +653,7 @@ public class CodeGenWay
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -631,6 +671,7 @@ public class CodeGenWay
|
||||
IsSystemControl = false,
|
||||
IsAuxiliary = false,
|
||||
IsUpdate = false,
|
||||
IsControlParsing = false,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -665,7 +706,7 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
|
||||
// 移除乐观锁
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("version"));
|
||||
@@ -673,6 +714,9 @@ public class CodeGenWay
|
||||
// 移除真实流程ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowtaskid"));
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
var tableColumnList = new List<TableColumnConfigModel>();
|
||||
|
||||
foreach (DbTableFieldModel? column in dbTableFields)
|
||||
@@ -714,6 +758,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsUnique = control.__config__.unique,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
@@ -731,6 +776,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),
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -745,6 +791,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
IsUnique = control.__config__.unique,
|
||||
@@ -771,6 +818,7 @@ public class CodeGenWay
|
||||
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),
|
||||
ShowField = control.relational,
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -815,7 +863,7 @@ public class CodeGenWay
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
columnDesignModel.searchList = GetMultiEndQueryMerging(templateEntity, controls);
|
||||
columnDesignModel.columnList = GetMultiTerminalListDisplayAndConsolidation(templateEntity);
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formDataModel = templateEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
var tableColumnList = new List<TableColumnConfigModel>();
|
||||
|
||||
// 移除乐观锁
|
||||
@@ -824,6 +872,9 @@ public class CodeGenWay
|
||||
// 移除真实流程ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowtaskid"));
|
||||
|
||||
// 移除流程引擎ID
|
||||
dbTableFields.RemoveAll(it => it.field.ReplaceRegex("^f_", string.Empty).ToLower().Equals("flowid"));
|
||||
|
||||
foreach (DbTableFieldModel? column in dbTableFields)
|
||||
{
|
||||
var field = column.field.ReplaceRegex("^f_", string.Empty).ParseToPascalCase().ToLowerCase();
|
||||
@@ -866,6 +917,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsUnique = control.__config__.unique,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
@@ -881,6 +933,7 @@ public class CodeGenWay
|
||||
ControlLabel = control.__config__.label,
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -895,6 +948,7 @@ public class CodeGenWay
|
||||
PrimaryKey = column.primaryKey.ParseToBool(),
|
||||
QueryWhether = control.isQueryField,
|
||||
QueryType = CodeGenFieldJudgeHelper.ColumnQueryType(searchList: columnDesignModel.searchList, field),
|
||||
QueryMultiple = CodeGenFieldJudgeHelper.ColumnQueryMultiple(searchList: columnDesignModel.searchList, field),
|
||||
IsShow = control.isIndexShow,
|
||||
IsMultiple = CodeGenFieldJudgeHelper.IsMultipleColumn(controls, field),
|
||||
IsUnique = control.__config__.unique,
|
||||
@@ -919,6 +973,7 @@ public class CodeGenWay
|
||||
IsImportField = isImportField.ParseToBool(),
|
||||
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
|
||||
ShowField = control.relational,
|
||||
IsTreeParentField = field.Equals(columnDesignModel.parentField),
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -995,13 +1050,14 @@ public class CodeGenWay
|
||||
controls = CodeGenUnifiedHandlerHelper.LinkageChainJudgment(controls, columnDesignModel);
|
||||
|
||||
Dictionary<string, List<string>> listQueryControls = CodeGenQueryControlClassificationHelper.ListQueryControl(logic);
|
||||
Dictionary<string, List<string>> listColumnControlsType = CodeGenQueryControlClassificationHelper.ListColumnControls();
|
||||
|
||||
// 表单脚本设计
|
||||
var formScriptDesign = CodeGenFormControlDesignHelper.FormScriptDesign("SingleTable", controls, tableColumns, columnDesignModel?.columnList);
|
||||
List<FormScriptDesignModel>? formScriptDesign = CodeGenFormControlDesignHelper.FormScriptDesign("SingleTable", controls, tableColumns, columnDesignModel?.columnList);
|
||||
|
||||
// 整个表单控件
|
||||
var formControlList = CodeGenFormControlDesignHelper.FormControlDesign(formDataModel.fields, controls, formDataModel.gutter, formDataModel.labelWidth, columnDesignModel?.columnList, columnDesignModel.type, logic, true);
|
||||
List<FormControlDesignModel>? formControlList = CodeGenFormControlDesignHelper.FormControlDesign(formDataModel.fields, controls, formDataModel.gutter, formDataModel.labelWidth, columnDesignModel?.columnList, columnDesignModel.type, logic, true);
|
||||
|
||||
var formRealControl = CodeGenFormControlDesignHelper.FormRealControl(controls);
|
||||
|
||||
// 列表控件Option
|
||||
var indnxControlOption = CodeGenFormControlDesignHelper.FormControlProps(formDataModel.fields, controls, columnDesignModel, logic, true);
|
||||
@@ -1069,6 +1125,7 @@ public class CodeGenWay
|
||||
Type = column.type,
|
||||
ShowAllLevels = column.showalllevels ? "true" : "false",
|
||||
Level = column.level,
|
||||
IsMultiple = item.searchMultiple,
|
||||
SelectType = column.selectType != null ? column.selectType.Equals("custom") ? string.Format("selectType='{0}' ", column.selectType) : string.Format("selectType='all' ") : string.Empty,
|
||||
AbleDepIds = column.selectType != null && column.selectType == "custom" ? string.Format(":ableDepIds='{0}_AbleDepIds' ", childControl.Length >= 2 ? string.Format("{0}_{1}", childControl[0], column.__vModel__) : item.__vModel__) : string.Empty,
|
||||
AblePosIds = column.selectType != null && column.selectType == "custom" && (column.__config__.jnpfKey.Equals(JnpfKeyConst.USERSELECT) || column.__config__.jnpfKey.Equals(JnpfKeyConst.POSSELECT)) ? string.Format(":ablePosIds='{0}_AblePosIds' ", childControl.Length >= 2 ? string.Format("{0}_{1}", childControl[0], column.__vModel__) : item.__vModel__) : string.Empty,
|
||||
@@ -1086,7 +1143,7 @@ public class CodeGenWay
|
||||
{
|
||||
Type = columnDesignModel.btnsList.IndexOf(item) == 0 ? "primary" : "text",
|
||||
Icon = item.icon,
|
||||
Method = GetCodeGenIndexButtonHelper.IndexTopButton(item.value),
|
||||
Method = GetCodeGenIndexButtonHelper.IndexTopButton(item.value, templateEntity.EnableFlow == 1 ? true : false),
|
||||
Value = item.value,
|
||||
Label = item.label
|
||||
});
|
||||
@@ -1114,8 +1171,6 @@ public class CodeGenWay
|
||||
{
|
||||
if (!ChildControlField.Any(it => it == item.__vModel__))
|
||||
{
|
||||
// 控件对应的控件类型
|
||||
var conversion = listColumnControlsType.Where(q => q.Value.Contains(item.jnpfKey)).FirstOrDefault();
|
||||
var relationTable = item?.__config__?.relationTable;
|
||||
if (relationTable != null && !indexColumnDesign.Any(it => it.TableName == relationTable))
|
||||
{
|
||||
@@ -1127,7 +1182,6 @@ public class CodeGenWay
|
||||
foreach (var child in childTableAll)
|
||||
{
|
||||
var columnControl = childTable.__config__.children.Find(it => it.__vModel__.Equals(child.__vModel__.Split('-')[1]));
|
||||
conversion = listColumnControlsType.Where(q => q.Value.Contains(child.jnpfKey)).FirstOrDefault();
|
||||
childTableColumnDesign.Add(new IndexColumnDesign()
|
||||
{
|
||||
TableName = child.__config__.tableName,
|
||||
@@ -1138,10 +1192,10 @@ public class CodeGenWay
|
||||
Label = columnControl.__config__.label,
|
||||
Width = child.width.ToString() == "0" ? "0" : string.Format("{0}", child.width),
|
||||
Align = child.align,
|
||||
IsAutomatic = conversion.Key == null ? false : true,
|
||||
IsSort = child.sortable ? string.Format("sortable='custom' ") : string.Empty,
|
||||
IsChildTable = true,
|
||||
Format = child.format?.ToLower().Replace(":mm", ":MM"),
|
||||
ModelId = child.modelId,
|
||||
});
|
||||
ChildControlField.Add(string.Format("{0}", child.__vModel__));
|
||||
}
|
||||
@@ -1154,7 +1208,6 @@ public class CodeGenWay
|
||||
jnpfKey = JnpfKeyConst.TABLE,
|
||||
IsChildTable = true,
|
||||
ChildTableDesigns = childTableColumnDesign,
|
||||
IsAutomatic = childTableColumnDesign.Any(it => it.IsAutomatic),
|
||||
Fixed = string.Empty,
|
||||
});
|
||||
}
|
||||
@@ -1172,10 +1225,9 @@ public class CodeGenWay
|
||||
Width = item.width == null ? string.Empty : string.Format("width='{0}' ", item.width),
|
||||
Fixed = columnDesignModel.childTableStyle == 1 ? (item.@fixed == "none" || item.@fixed == null ? string.Empty : string.Format("fixed='{0}' ", item.@fixed)) : string.Empty,
|
||||
Align = item.align,
|
||||
Format = item.format?.ToLower().Replace(":mm", ":MM"),
|
||||
IsAutomatic = conversion.Key == null ? false : true,
|
||||
IsSort = item.sortable ? string.Format("sortable='custom' ") : string.Empty,
|
||||
IsChildTable = false,
|
||||
ModelId = item.modelId,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1188,7 +1240,11 @@ public class CodeGenWay
|
||||
break;
|
||||
}
|
||||
|
||||
var propertyJson = CodeGenFormControlDesignHelper.GetPropertyJson(formScriptDesign);
|
||||
|
||||
var printIds = columnDesignModel.printIds != null ? string.Join(",", columnDesignModel.printIds) : null;
|
||||
var isBatchRemoveDel = indexTopButton.Any(it => it.Value == "batchRemove");
|
||||
var isBatchPrint = indexTopButton.Any(it => it.Value == "batchPrint");
|
||||
var isUpload = indexTopButton.Any(it => it.Value == "upload");
|
||||
var isDownload = indexTopButton.Any(it => it.Value == "download");
|
||||
var isRemoveDel = indexColumnButtonDesign.Any(it => it.Value == "remove");
|
||||
@@ -1199,24 +1255,40 @@ 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 isTreeRelationMultiple = indexSearchFieldDesign.Any(it => it.Name.Equals(columnDesignModel?.treeRelation?.Replace("-", "_")) && it.IsMultiple);
|
||||
var isFixed = columnDesignModel.childTableStyle == 1 ? indexColumnDesign.Any(it => it.Fixed.Equals("fixed='left' ") && !it.Name.Equals(columnDesignModel.groupField)) : false;
|
||||
var isChildrenRegular = formScriptDesign.Any(it => it.jnpfKey.Equals(JnpfKeyConst.TABLE) && it.RegList != null && it.RegList.Count > 0);
|
||||
|
||||
// 表单默认值控件列表
|
||||
var defaultFormControlList = new DefaultFormControlModel();
|
||||
switch (logic)
|
||||
{
|
||||
case 4:
|
||||
columnDesignModel = templateEntity.ColumnData?.ToObject<ColumnDesignModel>();
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
defaultFormControlList = CodeGenFormControlDesignHelper.DefaultFormControlList(controls, columnDesignModel.searchList);
|
||||
break;
|
||||
case 5:
|
||||
ColumnDesignModel pcColumnDesignModel = templateEntity.ColumnData?.ToObject<ColumnDesignModel>();
|
||||
columnDesignModel = templateEntity.AppColumnData?.ToObject<ColumnDesignModel>();
|
||||
columnDesignModel ??= new ColumnDesignModel();
|
||||
defaultFormControlList = CodeGenFormControlDesignHelper.DefaultFormControlList(controls, columnDesignModel.searchList);
|
||||
|
||||
// 移动端的分页遵循PC端
|
||||
columnDesignModel.hasPage = templateEntity.WebType == 1 ? false : pcColumnDesignModel.hasPage;
|
||||
break;
|
||||
}
|
||||
|
||||
var isDefaultFormControl = defaultFormControlList.IsExistDate || defaultFormControlList.IsExistDepSelect || defaultFormControlList.IsExistComSelect || defaultFormControlList.IsExistUserSelect || defaultFormControlList.IsExistSubTable ? true : false;
|
||||
|
||||
switch (columnDesignModel.type)
|
||||
{
|
||||
case 3:
|
||||
case 5:
|
||||
columnDesignModel.hasPage = false;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (templateEntity.WebType)
|
||||
{
|
||||
case 1:
|
||||
@@ -1256,7 +1328,7 @@ public class CodeGenWay
|
||||
Sort = columnDesignModel.sort,
|
||||
HasPrintBtn = formDataModel.hasPrintBtn,
|
||||
PrintButtonText = formDataModel.printButtonText,
|
||||
PrintId = formDataModel.printId,
|
||||
PrintId = formDataModel.printId != null ? string.Join(",", formDataModel.printId) : null,
|
||||
IsChildDataTransfer = formScriptDesign.Any(it => it.IsDataTransfer.Equals(true)),
|
||||
IsChildTableQuery = indexSearchFieldDesign.Any(it => it.IsChildQuery.Equals(true)),
|
||||
IsChildTableShow = indexColumnDesign.Any(it => it.IsChildTable.Equals(true)),
|
||||
@@ -1268,10 +1340,22 @@ public class CodeGenWay
|
||||
PrimaryKeyPolicy = formDataModel.primaryKeyPolicy,
|
||||
IsRelationForm = isRelationForm,
|
||||
ChildTableStyle = columnDesignModel.childTableStyle,
|
||||
IsChildrenRegular = isChildrenRegular,
|
||||
DefaultFormControlList = defaultFormControlList,
|
||||
IsDefaultFormControl = isDefaultFormControl,
|
||||
PropertyJson = propertyJson,
|
||||
FormRealControl = formRealControl,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
var codeGenColumnData = new CodeGenColumnData
|
||||
{
|
||||
treeInterfaceId = columnDesignModel.treeInterfaceId,
|
||||
treeTemplateJson = columnDesignModel.treeTemplateJson
|
||||
};
|
||||
return new FrontEndGenConfigModel()
|
||||
{
|
||||
PrintIds = printIds,
|
||||
NameSpace = formDataModel.areasName,
|
||||
ClassName = formDataModel.className.FirstOrDefault(),
|
||||
FormRef = formDataModel.formRef,
|
||||
@@ -1293,6 +1377,7 @@ public class CodeGenWay
|
||||
TreePropsUrl = columnDesignModel?.treePropsUrl,
|
||||
TreePropsChildren = columnDesignModel?.treePropsChildren,
|
||||
TreePropsLabel = columnDesignModel?.treePropsLabel,
|
||||
IsTreeRelationMultiple = isTreeRelationMultiple,
|
||||
IsExistQuery = templateEntity.Type == 3 ? false : (bool)columnDesignModel?.searchList?.Any(it => it.prop.Equals(columnDesignModel?.treeRelation)),
|
||||
PrimaryKey = tableColumns?.Find(it => it.PrimaryKey.Equals(true))?.LowerColumnName,
|
||||
FormList = formScriptDesign,
|
||||
@@ -1303,6 +1388,7 @@ public class CodeGenWay
|
||||
ColumnDesign = indexColumnDesign,
|
||||
OptionsList = indnxControlOption,
|
||||
IsBatchRemoveDel = isBatchRemoveDel,
|
||||
IsBatchPrint = isBatchPrint,
|
||||
IsDownload = isDownload,
|
||||
IsRemoveDel = isRemoveDel,
|
||||
IsDetail = isDetail,
|
||||
@@ -1322,7 +1408,7 @@ public class CodeGenWay
|
||||
Sort = columnDesignModel.sort,
|
||||
HasPrintBtn = formDataModel.hasPrintBtn,
|
||||
PrintButtonText = formDataModel.printButtonText,
|
||||
PrintId = formDataModel.printId,
|
||||
PrintId = formDataModel.printId != null ? string.Join(",", formDataModel.printId) : null,
|
||||
IsChildDataTransfer = formScriptDesign.Any(it => it.IsDataTransfer.Equals(true)),
|
||||
IsChildTableQuery = indexSearchFieldDesign.Any(it => it.IsChildQuery.Equals(true)),
|
||||
IsChildTableShow = indexColumnDesign.Any(it => it.IsChildTable.Equals(true)),
|
||||
@@ -1337,7 +1423,18 @@ public class CodeGenWay
|
||||
IsRelationForm = isRelationForm,
|
||||
ChildTableStyle = columnDesignModel.childTableStyle,
|
||||
IsFixed = isFixed,
|
||||
IsChildrenRegular = isChildrenRegular,
|
||||
TreeSynType = columnDesignModel.treeSynType,
|
||||
HasTreeQuery = columnDesignModel.hasTreeQuery,
|
||||
ColumnData = codeGenColumnData,
|
||||
SummaryField = columnDesignModel.summaryField,
|
||||
ShowSummary = columnDesignModel.showSummary,
|
||||
DefaultFormControlList = defaultFormControlList,
|
||||
IsDefaultFormControl = isDefaultFormControl,
|
||||
PropertyJson = propertyJson,
|
||||
FormRealControl = formRealControl,
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1401,6 +1498,18 @@ public class CodeGenWay
|
||||
// 是否批量删除
|
||||
bool isBatchRemove = false;
|
||||
|
||||
// 是否查询条件多选
|
||||
bool isSearchMultiple = false;
|
||||
|
||||
// 是否树形表格
|
||||
bool isTreeTable = false;
|
||||
|
||||
// 树形表格-父级字段
|
||||
string parentField = string.Empty;
|
||||
|
||||
// 树形表格-显示字段
|
||||
string treeShowField = string.Empty;
|
||||
|
||||
switch (templateEntity.WebType)
|
||||
{
|
||||
case 2:
|
||||
@@ -1408,6 +1517,18 @@ public class CodeGenWay
|
||||
defaultSidx = columnDesignModel.defaultSidx ?? tableColumnList.Find(t => t.PrimaryKey).ColumnName;
|
||||
isExport = columnDesignModel.btnsList.Any(it => it.value == "download");
|
||||
isBatchRemove = columnDesignModel.btnsList.Any(it => it.value == "batchRemove");
|
||||
isSearchMultiple = tableColumnList.Any(it => it.QueryMultiple && !it.IsAuxiliary);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (columnDesignModel.type)
|
||||
{
|
||||
case 5:
|
||||
isTreeTable = true;
|
||||
parentField = string.Format("{0}_pid", columnDesignModel.parentField);
|
||||
treeShowField = columnDesignModel.columnList.Find(it => it.__vModel__.ToLower() != columnDesignModel.parentField.ToLower()).__vModel__;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1424,8 +1545,18 @@ public class CodeGenWay
|
||||
|
||||
bool isUpdate = tableColumnList.Any(it => it.IsUpdate);
|
||||
|
||||
bool isLogicalDelete = formDataModel.logicalDelete;
|
||||
|
||||
List<CodeGenFunctionModel> function = new List<CodeGenFunctionModel>();
|
||||
|
||||
// 树形表格没有分页
|
||||
switch (columnDesignModel.type)
|
||||
{
|
||||
case 5:
|
||||
columnDesignModel.hasPage = false;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (templateEntity.Type)
|
||||
{
|
||||
case 3:
|
||||
@@ -1514,6 +1645,11 @@ public class CodeGenWay
|
||||
ImportDataType = columnDesignModel?.uploaderTemplateJson?.dataType,
|
||||
IsSystemControl = isSystemControl,
|
||||
IsUpdate = isUpdate,
|
||||
IsSearchMultiple = isSearchMultiple,
|
||||
IsTreeTable = isTreeTable,
|
||||
ParentField = parentField,
|
||||
TreeShowField = treeShowField,
|
||||
IsLogicalDelete = isLogicalDelete,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -22,7 +21,6 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using JNPF.WorkFlow.Entitys.Entity;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -55,53 +53,44 @@ public class FormDataParsing : ITransient
|
||||
/// </summary>
|
||||
private readonly ICacheManager _cacheManager;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存管理.
|
||||
/// </summary>
|
||||
private readonly IMemoryCache _memCache;
|
||||
/// <summary>
|
||||
/// 服务基础仓储.
|
||||
/// </summary>
|
||||
private readonly ISqlSugarRepository<VisualDevEntity> _db;
|
||||
|
||||
/// <summary>
|
||||
/// 服务基础仓储.
|
||||
/// </summary>
|
||||
//private readonly ISqlSugarRepository<VisualDevEntity> _db;
|
||||
private readonly ISqlSugarClient _sugar;
|
||||
/// <summary>
|
||||
/// 构造.
|
||||
/// </summary>
|
||||
/// <param name="userManager"></param>
|
||||
/// <param name="cacheManager"></param>
|
||||
/// <param name="databaseService"></param>
|
||||
/// <param name="dataInterfaceService"></param>
|
||||
/// <param name="context"></param>
|
||||
public FormDataParsing(
|
||||
IUserManager userManager,
|
||||
ICacheManager cacheManager,
|
||||
IDataBaseManager databaseService,
|
||||
IDataInterfaceService dataInterfaceService,
|
||||
ISqlSugarRepository<VisualDevEntity> context)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_cacheManager = cacheManager;
|
||||
_databaseService = databaseService;
|
||||
_dataInterfaceService = dataInterfaceService;
|
||||
_db = context;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 构造.
|
||||
/// </summary>
|
||||
/// <param name="userManager"></param>
|
||||
/// <param name="cacheManager"></param>
|
||||
/// <param name="databaseService"></param>
|
||||
/// <param name="dataInterfaceService"></param>
|
||||
/// <param name="context"></param>
|
||||
public FormDataParsing(
|
||||
IUserManager userManager,
|
||||
ICacheManager cacheManager,
|
||||
IDataBaseManager databaseService,
|
||||
IDataInterfaceService dataInterfaceService,
|
||||
ISqlSugarRepository<VisualDevEntity> context,
|
||||
IMemoryCache memCache)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_cacheManager = cacheManager;
|
||||
_databaseService = databaseService;
|
||||
_dataInterfaceService = dataInterfaceService;
|
||||
_sugar = context.AsSugarClient().CopyNew();
|
||||
//_db = context;
|
||||
_memCache = memCache;
|
||||
}
|
||||
#endregion
|
||||
#region 解析模板数据
|
||||
|
||||
#region 解析模板数据
|
||||
|
||||
/// <summary>
|
||||
/// 控制模板数据转换.
|
||||
/// </summary>
|
||||
/// <param name="data">数据.</param>
|
||||
/// <param name="fieldsModel">数据模板.</param>
|
||||
/// <param name="actionType">操作类型(List-列表值,create-创建值,update-更新值,detail-详情值,transition-过渡值,query-查询).</param>
|
||||
/// <returns>object.</returns>
|
||||
public object TemplateControlsDataConversion(object data, FieldsModel fieldsModel, string? actionType = null)
|
||||
/// <summary>
|
||||
/// 控制模板数据转换.
|
||||
/// </summary>
|
||||
/// <param name="data">数据.</param>
|
||||
/// <param name="fieldsModel">数据模板.</param>
|
||||
/// <param name="actionType">操作类型(List-列表值,create-创建值,update-更新值,detail-详情值,transition-过渡值,query-查询).</param>
|
||||
/// <returns>object.</returns>
|
||||
public object TemplateControlsDataConversion(object data, FieldsModel fieldsModel, string? actionType = null)
|
||||
{
|
||||
if (fieldsModel == null || data == null || data.Equals("[]") || data.ToString().Equals("[]") || string.IsNullOrEmpty(data.ToString())) return string.Empty;
|
||||
try
|
||||
@@ -117,11 +106,20 @@ public class FormDataParsing : ITransient
|
||||
if (fieldsModel.precision.IsNullOrEmpty()) fieldsModel.precision = 0; // 数字输入
|
||||
if (data.ToString().Contains("."))
|
||||
{
|
||||
var len = data.ToString().Split('.').Last().Length;
|
||||
if (fieldsModel.precision > len) fieldsModel.precision = len;
|
||||
conversionData = data.ToString().Substring(0, data.ToString().IndexOf(".") + (int)fieldsModel.precision + 1);//modifyby zhoukeda 20230512 增加+1
|
||||
conversionData = data.ParseToDouble();//modifyby zhoukeda 20230512
|
||||
var dataList = data.ToString().Split('.');
|
||||
if (fieldsModel.precision == 0)
|
||||
{
|
||||
conversionData = dataList.First();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fieldsModel.precision > dataList.Last().Length) fieldsModel.precision = dataList.Last().Length;
|
||||
conversionData = dataList.First() + "." + dataList.Last().Substring(0, (int)fieldsModel.precision);
|
||||
}
|
||||
//conversionData = data.ToString().Substring(0, data.ToString().IndexOf(".") + (int)fieldsModel.precision + 1);//modifyby zhoukeda 20230512 增加+1
|
||||
//conversionData = data.ParseToDouble();//modifyby zhoukeda 20230512
|
||||
}
|
||||
else if (fieldsModel.precision > 0) conversionData = data.ToString() + ".".PadRight((int)fieldsModel.precision + 1, '0');
|
||||
else conversionData = data;
|
||||
break;
|
||||
case JnpfKeyConst.JNPFAMOUNT:
|
||||
@@ -206,7 +204,10 @@ public class FormDataParsing : ITransient
|
||||
conversionData = string.Format("{0:yyyy-MM-dd HH:mm:ss}", data.ToString().TimeStampToDateTime());
|
||||
break;
|
||||
case "create":
|
||||
conversionData = string.Format("{0:yyyy-MM-dd HH:mm:ss}", data.ToString().TimeStampToDateTime());
|
||||
if (fieldsModel.format.ToLower().Equals("yyyy-mm-dd"))
|
||||
conversionData = string.Format("{0:yyyy-MM-dd}", data.ToString().TimeStampToDateTime());
|
||||
else
|
||||
conversionData = string.Format("{0:yyyy-MM-dd HH:mm:ss}", data.ToString().TimeStampToDateTime());
|
||||
break;
|
||||
case "detail":
|
||||
conversionData = data;
|
||||
@@ -435,6 +436,11 @@ public class FormDataParsing : ITransient
|
||||
if (data.GetType().Name.ToLower().Equals("string")) conversionData = data;
|
||||
else if (data.ToString().Contains("[")) conversionData = data.ToJsonString();
|
||||
else conversionData = data;
|
||||
break;
|
||||
case "List":
|
||||
if (fieldsModel.multiple) conversionData = data.ToString().ToObject<List<object>>();
|
||||
else conversionData = data;
|
||||
|
||||
break;
|
||||
default:
|
||||
if (fieldsModel.multiple) conversionData = data.ToString().ToObject<List<object>>();
|
||||
@@ -498,8 +504,9 @@ public class FormDataParsing : ITransient
|
||||
/// <param name="data">插入的数据.</param>
|
||||
/// <param name="_fieldsModelList">控件集合.</param>
|
||||
/// <param name="actionType">操作类型.</param>
|
||||
/// <param name="isShortLink">是否外链.</param>
|
||||
/// <returns>string.</returns>
|
||||
public object InsertValueHandle(string dbType, List<DbTableFieldModel> _tableList, string field, object data, List<FieldsModel> _fieldsModelList, string actionType = "create")
|
||||
public object InsertValueHandle(string dbType, List<DbTableFieldModel> _tableList, string field, object data, List<FieldsModel> _fieldsModelList, string actionType = "create", bool isShortLink = false)
|
||||
{
|
||||
// 根据KEY查找模板
|
||||
FieldsModel? model = _fieldsModelList.Find(f => f.__vModel__ == field);
|
||||
@@ -514,7 +521,9 @@ public class FormDataParsing : ITransient
|
||||
var res = TemplateControlsDataConversion(data, model, actionType);
|
||||
if (actionType.Equals("create"))
|
||||
{
|
||||
if (model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME) || model.__config__.jnpfKey.Equals(JnpfKeyConst.DATE))
|
||||
if (isShortLink && model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME))
|
||||
return null;
|
||||
else if(model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME) || model.__config__.jnpfKey.Equals(JnpfKeyConst.DATE))
|
||||
return res.ToString().ParseToDateTime();
|
||||
else if (model.__config__.jnpfKey.Equals(JnpfKeyConst.NUMINPUT) || model.__config__.jnpfKey.Equals(JnpfKeyConst.SWITCH))//modify by zhoukeda 2023427 开关默认数字
|
||||
return res;
|
||||
@@ -561,11 +570,23 @@ public class FormDataParsing : ITransient
|
||||
if (vModelType.DYNAMIC.GetDescription() == configModel.dataType) list = await GetDynamicList(model);
|
||||
if (vModelType.STATIC.GetDescription() == configModel.dataType)
|
||||
{
|
||||
foreach (Dictionary<string, object>? item in model.__slot__.options)
|
||||
if (model.__slot__ != null && model.__slot__.options != null && model.__slot__.options.Any())
|
||||
{
|
||||
Dictionary<string, string> option = new Dictionary<string, string>();
|
||||
option.Add(item[model.__config__.props.value].ToString(), item[model.__config__.props.label].ToString());
|
||||
list.Add(option);
|
||||
foreach (Dictionary<string, object>? item in model.__slot__.options)
|
||||
{
|
||||
Dictionary<string, string> option = new Dictionary<string, string>();
|
||||
option.Add(item[model.__config__.props.value].ToString(), item[model.__config__.props.label].ToString());
|
||||
list.Add(option);
|
||||
}
|
||||
}
|
||||
else if (model.options != null && model.options.Any())
|
||||
{
|
||||
foreach (Dictionary<string, object>? item in model.options.ToObject<List<Dictionary<string, object>>>())
|
||||
{
|
||||
Dictionary<string, string> option = new Dictionary<string, string>();
|
||||
option.Add(item[model.props.props.value].ToString(), item[model.props.props.label].ToString());
|
||||
list.Add(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,7 +642,7 @@ public class FormDataParsing : ITransient
|
||||
case JnpfKeyConst.POSSELECT: // 岗位
|
||||
if (!GetCacheValues(fieldCacheKey, templateData))
|
||||
{
|
||||
List<PositionEntity>? positionEntityList = await _sugar.Queryable<PositionEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<PositionEntity>? positionEntityList = await _db.AsSugarClient().Queryable<PositionEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<Dictionary<string, string>> positionList = new List<Dictionary<string, string>>();
|
||||
foreach (PositionEntity? item in positionEntityList)
|
||||
{
|
||||
@@ -638,7 +659,7 @@ public class FormDataParsing : ITransient
|
||||
case JnpfKeyConst.GROUPSELECT: // 分组
|
||||
if (!GetCacheValues(fieldCacheKey, templateData))
|
||||
{
|
||||
List<GroupEntity>? positionEntityList = await _sugar.Queryable<GroupEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<GroupEntity>? positionEntityList = await _db.AsSugarClient().Queryable<GroupEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<Dictionary<string, string>> positionList = new List<Dictionary<string, string>>();
|
||||
foreach (GroupEntity? item in positionEntityList)
|
||||
{
|
||||
@@ -655,7 +676,7 @@ public class FormDataParsing : ITransient
|
||||
case JnpfKeyConst.ROLESELECT: // 角色
|
||||
if (!GetCacheValues(fieldCacheKey, templateData))
|
||||
{
|
||||
List<RoleEntity>? positionEntityList = await _sugar.Queryable<RoleEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<RoleEntity>? positionEntityList = await _db.AsSugarClient().Queryable<RoleEntity>().Where(u => u.DeleteMark == null).ToListAsync();
|
||||
List<Dictionary<string, string>> positionList = new List<Dictionary<string, string>>();
|
||||
foreach (RoleEntity? item in positionEntityList)
|
||||
{
|
||||
@@ -689,7 +710,7 @@ public class FormDataParsing : ITransient
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ProvinceEntity>? addressEntityList = await _sugar.Queryable<ProvinceEntity>().Select(x => new ProvinceEntity { Id = x.Id, ParentId = x.ParentId, Type = x.Type, FullName = x.FullName }).ToListAsync();
|
||||
List<ProvinceEntity>? addressEntityList = await _db.AsSugarClient().Queryable<ProvinceEntity>().Select(x => new ProvinceEntity { Id = x.Id, ParentId = x.ParentId, Type = x.Type, FullName = x.FullName }).ToListAsync();
|
||||
|
||||
// 处理省市区树
|
||||
addressEntityList.Where(x => x.Type == "1").ToList().ForEach(item => item.QuickQuery = item.FullName);
|
||||
@@ -731,7 +752,7 @@ public class FormDataParsing : ITransient
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ProvinceEntity>? addressEntityList = await _sugar.Queryable<ProvinceEntity>().Select(x => new ProvinceEntity { Id = x.Id, ParentId = x.ParentId, Type = x.Type, FullName = x.FullName }).ToListAsync();
|
||||
List<ProvinceEntity>? addressEntityList = await _db.AsSugarClient().Queryable<ProvinceEntity>().Select(x => new ProvinceEntity { Id = x.Id, ParentId = x.ParentId, Type = x.Type, FullName = x.FullName }).ToListAsync();
|
||||
|
||||
// 处理省市区树
|
||||
addressEntityList.Where(x => x.Type == "1").ToList().ForEach(item => item.QuickQuery = item.FullName);
|
||||
@@ -787,7 +808,7 @@ public class FormDataParsing : ITransient
|
||||
}
|
||||
else
|
||||
{
|
||||
List<UserEntity>? userEntityList = await _sugar.Queryable<UserEntity>().Where(x => x.DeleteMark == null).Select(x => new UserEntity() { Id = x.Id, RealName = x.RealName, Account = x.Account }).ToListAsync();
|
||||
List<UserEntity>? userEntityList = await _db.AsSugarClient().Queryable<UserEntity>().Where(x => x.DeleteMark == null).Select(x => new UserEntity() { Id = x.Id, RealName = x.RealName, Account = x.Account }).ToListAsync();
|
||||
|
||||
List<Dictionary<string, string>> userList = new List<Dictionary<string, string>>();
|
||||
foreach (UserEntity? item in userEntityList)
|
||||
@@ -813,32 +834,32 @@ public class FormDataParsing : ITransient
|
||||
else
|
||||
{
|
||||
var addList = new List<Dictionary<string, string>>();
|
||||
(await _sugar.Queryable<UserEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.RealName, x.Account }).ToListAsync()).ForEach(item =>
|
||||
(await _db.AsSugarClient().Queryable<UserEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.RealName, x.Account }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
Dictionary<string, string> user = new Dictionary<string, string>();
|
||||
user.Add(item.Id + "--user", item.RealName + "/" + item.Account);
|
||||
addList.Add(user);
|
||||
});
|
||||
(await _sugar.Queryable<OrganizeEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
(await _db.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
Dictionary<string, string> user = new Dictionary<string, string>();
|
||||
user.Add(item.Id + "--company", item.FullName);
|
||||
user.Add(item.Id + "--department", item.FullName);
|
||||
addList.Add(user);
|
||||
});
|
||||
(await _sugar.Queryable<RoleEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
(await _db.AsSugarClient().Queryable<RoleEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
Dictionary<string, string> user = new Dictionary<string, string>();
|
||||
user.Add(item.Id + "--role", item.FullName);
|
||||
addList.Add(user);
|
||||
});
|
||||
(await _sugar.Queryable<PositionEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
(await _db.AsSugarClient().Queryable<PositionEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
Dictionary<string, string> user = new Dictionary<string, string>();
|
||||
user.Add(item.Id + "--position", item.FullName);
|
||||
addList.Add(user);
|
||||
});
|
||||
(await _sugar.Queryable<GroupEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
(await _db.AsSugarClient().Queryable<GroupEntity>().Where(x => x.DeleteMark == null).Select(x => new { x.Id, x.FullName }).ToListAsync()).ForEach(item =>
|
||||
{
|
||||
Dictionary<string, string> user = new Dictionary<string, string>();
|
||||
user.Add(item.Id + "--group", item.FullName);
|
||||
@@ -884,7 +905,7 @@ public class FormDataParsing : ITransient
|
||||
{
|
||||
if (!GetCacheValues(fieldCacheKey, templateData))
|
||||
{
|
||||
List<OrganizeEntity>? dep_organizeEntityList = await _sugar.Queryable<OrganizeEntity>().Where(d => d.EnabledMark == 1 && d.DeleteMark == null)
|
||||
List<OrganizeEntity>? dep_organizeEntityList = await _db.AsSugarClient().Queryable<OrganizeEntity>().Where(d => d.EnabledMark == 1 && d.DeleteMark == null)
|
||||
.WhereIF(orgType.Equals(JnpfKeyConst.DEPSELECT), d => d.Category.Equals("department")).ToListAsync();
|
||||
|
||||
List<Dictionary<string, object>> vlist = new List<Dictionary<string, object>>();
|
||||
@@ -954,7 +975,7 @@ public class FormDataParsing : ITransient
|
||||
parameter.Add(new SugarParameter("@currentChargeorganizationAndSuborganization", subsidiary));
|
||||
}
|
||||
|
||||
DbLinkEntity? linkEntity = await _sugar.Queryable<DbLinkEntity>().Where(m => m.Id == dynamic.DBLinkId && m.DeleteMark == null).FirstAsync();
|
||||
DbLinkEntity? linkEntity = await _db.AsSugarClient().Queryable<DbLinkEntity>().Where(m => m.Id == dynamic.DBLinkId && m.DeleteMark == null).FirstAsync();
|
||||
if (linkEntity == null) linkEntity = _databaseService.GetTenantDbLink(_userManager.TenantId, _userManager.TenantDbName);
|
||||
_dataInterfaceService.ReplaceParameterValue(dynamic, new Dictionary<string, string>());
|
||||
System.Data.DataTable? dt = _databaseService.GetInterFaceData(linkEntity, dynamic.Query, parameter.ToArray());
|
||||
@@ -1064,7 +1085,7 @@ public class FormDataParsing : ITransient
|
||||
/// <returns>List.</returns>
|
||||
private async Task<List<Dictionary<string, string>>> GetDictionaryList(string? dictionaryTypeId = null)
|
||||
{
|
||||
List<DictionaryDataEntity> dictionaryDataEntityList = await _sugar.Queryable<DictionaryDataEntity, DictionaryTypeEntity>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.DictionaryTypeId))
|
||||
List<DictionaryDataEntity> dictionaryDataEntityList = await _db.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.DictionaryTypeId))
|
||||
.WhereIF(dictionaryTypeId.IsNotEmptyOrNull(), (a, b) => b.Id == dictionaryTypeId || b.EnCode == dictionaryTypeId).Where(a => a.DeleteMark == null).ToListAsync();
|
||||
|
||||
List<Dictionary<string, string>> dictionaryDataList = new List<Dictionary<string, string>>();
|
||||
@@ -1141,7 +1162,7 @@ public class FormDataParsing : ITransient
|
||||
Dictionary<string, object> dataMap = modelData.ToObject<Dictionary<string, object>>(); // 数据库保存的F_Data
|
||||
|
||||
// 序列化后时间戳转换处理
|
||||
List<FieldsModel>? timeList = formData.Where(x => x.__config__.jnpfKey == "createTime" || x.__config__.jnpfKey == "modifyTime").ToList();
|
||||
List<FieldsModel>? timeList = formData.Where(x => x.__config__.jnpfKey == JnpfKeyConst.CREATETIME || x.__config__.jnpfKey == JnpfKeyConst.MODIFYTIME).ToList();
|
||||
if (timeList.Any())
|
||||
{
|
||||
timeList.ForEach(item =>
|
||||
@@ -1185,10 +1206,10 @@ public class FormDataParsing : ITransient
|
||||
break;
|
||||
case JnpfKeyConst.CREATEUSER:
|
||||
case JnpfKeyConst.MODIFYUSER:
|
||||
dataMap[key] = await _sugar.Queryable<UserEntity>().Where(x => x.Id == dataValue).Select(x => SqlFunc.MergeString(x.RealName, "/", x.Account)).FirstAsync();
|
||||
dataMap[key] = await _db.AsSugarClient().Queryable<UserEntity>().Where(x => x.Id == dataValue).Select(x => SqlFunc.MergeString(x.RealName, "/", x.Account)).FirstAsync();
|
||||
break;
|
||||
case JnpfKeyConst.CURRPOSITION:
|
||||
dataMap[key] = (await _sugar.Queryable<PositionEntity>().FirstAsync(p => p.Id == dataMap[key].ToString()))?.FullName;
|
||||
dataMap[key] = (await _db.AsSugarClient().Queryable<PositionEntity>().FirstAsync(p => p.Id == dataMap[key].ToString()))?.FullName;
|
||||
if (dataMap[key].IsNullOrEmpty()) dataMap[key] = " ";
|
||||
break;
|
||||
case JnpfKeyConst.CURRORGANIZE:
|
||||
@@ -1267,111 +1288,6 @@ public class FormDataParsing : ITransient
|
||||
|
||||
#endregion
|
||||
|
||||
#region 无表的数据查询筛选
|
||||
|
||||
/// <summary>
|
||||
/// 无表的数据筛选.
|
||||
/// </summary>
|
||||
/// <param name="list">数据列表.</param>
|
||||
/// <param name="keyJsonMap">查询条件值.</param>
|
||||
/// <param name="formData"></param>
|
||||
/// <returns></returns>
|
||||
public List<Dictionary<string, object>> GetNoTableFilteringData(List<VisualDevModelDataEntity> list, Dictionary<string, object> keyJsonMap, List<FieldsModel> formData)
|
||||
{
|
||||
List<Dictionary<string, object>> realList = new List<Dictionary<string, object>>();
|
||||
foreach (var entity in list)
|
||||
{
|
||||
Dictionary<string, object> query = keyJsonMap;
|
||||
Dictionary<string, object> realEntity = entity.Data.ToObject<Dictionary<string, object>>();
|
||||
realEntity.Add("id", entity.Id);
|
||||
if (query != null && query.Count != 0)
|
||||
{
|
||||
int m = 0;
|
||||
int dicCount = query.Keys.Count;
|
||||
string[] strKey = new string[dicCount];
|
||||
query.Keys.CopyTo(strKey, 0);
|
||||
for (int i = 0; i < strKey.Length; i++)
|
||||
{
|
||||
var keyValue = keyJsonMap[strKey[i]];
|
||||
var queryEntity = realEntity.Where(e => e.Key == strKey[i]).FirstOrDefault();
|
||||
var model = formData.Where(f => f.__vModel__ == strKey[i]).FirstOrDefault();
|
||||
if (queryEntity.Value != null && !string.IsNullOrWhiteSpace(keyValue.ToString()))
|
||||
{
|
||||
var realValue = queryEntity.Value.ObjToString();
|
||||
var type = model.__config__.jnpfKey;
|
||||
switch (type)
|
||||
{
|
||||
case JnpfKeyConst.TIME:
|
||||
{
|
||||
var queryTime = new List<string>();
|
||||
keyValue.ToObject<List<string>>().ForEach(item => { if (!string.IsNullOrWhiteSpace(item)) queryTime.Add(item.ParseToDateTime().ToLongTimeString()); });
|
||||
|
||||
if (Common.Extension.Extensions.IsInTimeRange(realValue.ParseToDateTime(), queryTime.First(), queryTime.Last(), 3)) m++;
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.DATE:
|
||||
{
|
||||
List<string> queryTime = keyValue.ToObject<List<string>>();
|
||||
int formatType = 0;
|
||||
if (model.format == "yyyy-MM") formatType = 1;
|
||||
else if (model.format == "yyyy") formatType = 2;
|
||||
string value1 = string.Format("{0:yyyy-MM-dd}", queryTime.First().ParseToDateTime());
|
||||
string value2 = string.Format("{0:yyyy-MM-dd}", queryTime.Last().ParseToDateTime());
|
||||
if (Common.Extension.Extensions.IsInTimeRange(realValue.ParseToDateTime(), value1, value2, formatType)) m++;
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.CREATETIME:
|
||||
case JnpfKeyConst.MODIFYTIME:
|
||||
{
|
||||
List<string> dayTime1 = keyValue.ToObject<List<string>>();
|
||||
string value1 = string.Format("{0:yyyy-MM-dd 00:00:00}", dayTime1.First().ParseToDateTime());
|
||||
string value2 = string.Format("{0:yyyy-MM-dd 23:59:59}", dayTime1.Last().ParseToDateTime());
|
||||
if (!string.IsNullOrEmpty(realValue) && Common.Extension.Extensions.IsInTimeRange(Convert.ToDateTime(realValue), value1, value2)) m++;
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.NUMINPUT:
|
||||
case JnpfKeyConst.CALCULATE:
|
||||
{
|
||||
List<string> numArray = keyValue.ToObject<List<string>>();
|
||||
var numA = numArray.First().ParseToInt();
|
||||
var numB = numArray.Last() == null ? long.MaxValue : numArray.Last().ParseToInt();
|
||||
var numC = realValue.ParseToInt();
|
||||
if (numC >= numA && numC <= numB) m++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (realValue.IsNotEmptyOrNull() && keyValue != null)
|
||||
{
|
||||
string keyV = keyValue.ToString();
|
||||
|
||||
if (model.searchType == 2 && realValue.Contains(keyV)) m++;
|
||||
else if (model.searchType == 1)
|
||||
{
|
||||
// 多选时为模糊查询
|
||||
if ((model.multiple || type == "checkbox") && realValue.Contains(keyV)) m++;
|
||||
else if (realValue.Equals(keyV)) m++;
|
||||
}
|
||||
else if (realValue.Replace(" ", "").Contains(keyV.Replace(" ", ""))) m++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m == dicCount) realList.Add(realEntity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
realList.Add(realEntity);
|
||||
}
|
||||
}
|
||||
|
||||
return realList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 列表转换数据(Id 转 Name)
|
||||
|
||||
/// <summary>
|
||||
@@ -1383,17 +1299,31 @@ public class FormDataParsing : ITransient
|
||||
/// <param name="actionType"></param>
|
||||
/// <param name="webType">表单类型1-纯表单、2-普通表单、3-工作流表单.</param>
|
||||
/// <param name="primaryKey">数据主键.</param>
|
||||
/// <param name="mainData">子表解析时调用 (控件联动可能需要主表的数据).</param>
|
||||
/// <param name="isShortLink">是否外链.</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Dictionary<string, object>>> GetKeyData(
|
||||
List<FieldsModel> formData,
|
||||
public async Task<List<Dictionary<string, object>>> GetKeyData(List<FieldsModel> formData,
|
||||
List<Dictionary<string, object>> list,
|
||||
ColumnDesignModel? columnDesign = null,
|
||||
string actionType = "List",
|
||||
int webType = 2,
|
||||
string primaryKey = "F_Id",
|
||||
Dictionary<string, object>? mainData = null)
|
||||
bool isShortLink = false)
|
||||
{
|
||||
if (isShortLink)
|
||||
{
|
||||
formData = formData.Where(x => x.__config__.jnpfKey == JnpfKeyConst.COMINPUT || x.__config__.jnpfKey == JnpfKeyConst.TEXTAREA
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.NUMINPUT && x.__config__.jnpfKey == JnpfKeyConst.SWITCH)
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.RADIO && x.__config__.dataType.Equals("static"))
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.CHECKBOX && x.__config__.dataType.Equals("static"))
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.SELECT && x.__config__.dataType.Equals("static"))
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.CASCADER && x.__config__.dataType.Equals("static"))
|
||||
|| (x.__config__.jnpfKey == JnpfKeyConst.TREESELECT && x.__config__.dataType.Equals("static"))
|
||||
|| x.__config__.jnpfKey == JnpfKeyConst.DATE || x.__config__.jnpfKey == JnpfKeyConst.TIME || x.__config__.jnpfKey == JnpfKeyConst.COLORPICKER
|
||||
|| x.__config__.jnpfKey == JnpfKeyConst.RATE || x.__config__.jnpfKey == JnpfKeyConst.SLIDER || x.__config__.jnpfKey == JnpfKeyConst.EDITOR
|
||||
|| x.__config__.jnpfKey == JnpfKeyConst.LINK || x.__config__.jnpfKey == JnpfKeyConst.JNPFTEXT || x.__config__.jnpfKey == JnpfKeyConst.ALERT)
|
||||
.Where(x => !x.__config__.jnpfKey.Equals(JnpfKeyConst.POPUPTABLESELECT)).ToList();
|
||||
}
|
||||
|
||||
// 获取控件缓存数据
|
||||
Dictionary<string, object> templateData = await GetVisualDevCaCheData(formData);
|
||||
|
||||
@@ -1418,12 +1348,13 @@ public class FormDataParsing : ITransient
|
||||
List<Dictionary<string, string>>? roleTemplateValue = new List<Dictionary<string, string>>(); // 角色
|
||||
Dictionary<string, List<Dictionary<string, string>>>? templateValues = new Dictionary<string, List<Dictionary<string, string>>>(); // 其他
|
||||
|
||||
if (webType == 3)
|
||||
if (webType == 3 && list.Any(x => x.ContainsKey(primaryKey)))
|
||||
{
|
||||
var ids = list.Select(x => x[primaryKey]).ToList();
|
||||
var flowTaskList = await _sugar.Queryable<FlowTaskEntity>().Where(x => ids.Contains(x.Id)).Select(x => new FlowTaskEntity() { Id = x.Id, Status = x.Status }).ToListAsync();
|
||||
var flowTaskList = await _db.AsSugarClient().Queryable<FlowTaskEntity>().Where(x => ids.Contains(x.Id)).Select(x => new FlowTaskEntity() { Id = x.Id, Status = x.Status }).ToListAsync();
|
||||
list.ForEach(item =>
|
||||
{
|
||||
if (item.ContainsKey("F_FlowId")) item["flowId"] = item["F_FlowId"];
|
||||
if (flowTaskList.Any(x => x.Id.Equals(item[primaryKey].ToString())))
|
||||
{
|
||||
var flowTask = flowTaskList.Where(x => x.Id.Equals(item[primaryKey].ToString())).FirstOrDefault();
|
||||
@@ -1442,7 +1373,6 @@ public class FormDataParsing : ITransient
|
||||
foreach (Dictionary<string, object>? dataMap in list)
|
||||
{
|
||||
var oldDataMap = dataMap.Copy();
|
||||
if (mainData != null) oldDataMap.Add("JnpfKeyConst_MainData", mainData);
|
||||
if (dataMap.ContainsKey(primaryKey)) dataMap["id"] = dataMap[primaryKey].ToString(); // 主键
|
||||
|
||||
int dicCount = dataMap.Keys.Count;
|
||||
@@ -1455,7 +1385,6 @@ public class FormDataParsing : ITransient
|
||||
if (!(dataMap[strKey[i]] is null))
|
||||
{
|
||||
FieldsModel? form = formData.Where(f => f.__vModel__ == strKey[i]).FirstOrDefault();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
if (form.__vModel__.Contains(form.__config__.jnpfKey + "Field")) dataMap[strKey[i]] = TemplateControlsDataConversion(dataMap[strKey[i]], form);
|
||||
@@ -1707,30 +1636,18 @@ public class FormDataParsing : ITransient
|
||||
}
|
||||
break;
|
||||
case JnpfKeyConst.CURRDEPT:
|
||||
dataMap[key] = await _memCache.GetOrCreateAsync($"organizeId_{dataValue}", async entry =>
|
||||
{
|
||||
entry.SlidingExpiration = TimeSpan.FromSeconds(60);
|
||||
return (await _sugar.Queryable<OrganizeEntity>().FirstAsync(x => x.Id == dataValue.ToString()))?.FullName;
|
||||
});
|
||||
dataMap[key] = (await _db.AsSugarClient().Queryable<OrganizeEntity>().FirstAsync(x => x.Id == dataValue.ToString()))?.FullName;
|
||||
break;
|
||||
case JnpfKeyConst.MODIFYUSER:
|
||||
case JnpfKeyConst.CREATEUSER:
|
||||
dataMap[key] = await _memCache.GetOrCreateAsync($"userId_{dataValue}", async entry =>
|
||||
{
|
||||
entry.SlidingExpiration = TimeSpan.FromSeconds(60);
|
||||
return await _sugar.Queryable<UserEntity>().Where(x => x.Id == dataValue.ToString()).Select(x => SqlFunc.MergeString(x.RealName, "/", x.Account)).FirstAsync();
|
||||
});
|
||||
dataMap[key] = await _db.AsSugarClient().Queryable<UserEntity>().Where(x => x.Id == dataValue.ToString()).Select(x => SqlFunc.MergeString(x.RealName, "/", x.Account)).FirstAsync();
|
||||
break;
|
||||
case JnpfKeyConst.MODIFYTIME:
|
||||
case JnpfKeyConst.CREATETIME:
|
||||
dataMap[key] = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dataMap[key].ToString().ParseToDateTime());
|
||||
dataMap[key] = string.Format("{0:yyyy-MM-dd HH:mm}", dataMap[key].ToString().ParseToDateTime());
|
||||
break;
|
||||
case JnpfKeyConst.CURRPOSITION:
|
||||
dataMap[key] = await _memCache.GetOrCreateAsync($"positionId_{dataValue}", async entry =>
|
||||
{
|
||||
entry.SlidingExpiration = TimeSpan.FromSeconds(60);
|
||||
return (await _sugar.Queryable<PositionEntity>().FirstAsync(x => x.Id == dataValue.ToString()))?.FullName;
|
||||
});
|
||||
dataMap[key] = (await _db.AsSugarClient().Queryable<PositionEntity>().FirstAsync(x => x.Id == dataValue.ToString()))?.FullName;
|
||||
break;
|
||||
case JnpfKeyConst.POPUPTABLESELECT:
|
||||
case JnpfKeyConst.POPUPSELECT:
|
||||
@@ -1883,7 +1800,7 @@ public class FormDataParsing : ITransient
|
||||
else
|
||||
{
|
||||
// 根据可视化功能ID获取该模板全部数据
|
||||
var relationFormModel = await _sugar.Queryable<VisualDevEntity>().FirstAsync(v => v.Id == model.modelId);
|
||||
var relationFormModel = await _db.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
|
||||
{
|
||||
@@ -1892,27 +1809,21 @@ public class FormDataParsing : ITransient
|
||||
sort = columnDesign.sort,
|
||||
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 = cacheStr.ToObject<List<Dictionary<string, object>>>();
|
||||
//modified by PhilPan
|
||||
if (string.IsNullOrEmpty(cacheStr))
|
||||
else
|
||||
{
|
||||
await Scoped.CreateAsync(async (_, scope) =>
|
||||
Scoped.Create((_, 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分钟
|
||||
cacheStr = _cacheManager.Get(redisName);
|
||||
});
|
||||
var res = _runService.GetRelationFormList(relationFormModel, listQueryInput).WaitAsync(TimeSpan.FromMinutes(2)).Result;
|
||||
relationFormDataList = res.list.ToList();
|
||||
_cacheManager.Set(redisName, relationFormDataList, TimeSpan.FromMinutes(10)); // 缓存10分钟
|
||||
});
|
||||
}
|
||||
if (cacheStr.IsNotEmptyOrNull()) relationFormDataList = cacheStr.ToObject<List<Dictionary<string, object>>>();
|
||||
}
|
||||
|
||||
var relationFormRealData = relationFormDataList.Where(it => it["id"].Equals(dataMap[key])).FirstOrDefault();
|
||||
@@ -1990,36 +1901,16 @@ public class FormDataParsing : ITransient
|
||||
if (data.ToJsonString().Equals(mValue.ToJsonString()) && (form.__config__.templateJson != null && form.__config__.templateJson.Any()))
|
||||
{
|
||||
data.Clear();
|
||||
form.__config__.templateJson.ForEach(x =>
|
||||
{
|
||||
if (x.relationField.ToLower().Contains("tablefield") && x.relationField.Contains("-"))
|
||||
{
|
||||
var rField = x.relationField.Split("-").Last();
|
||||
if (dataMap.ContainsKey(rField)) x.defaultValue = dataMap[rField] != null ? dataMap[rField]?.ToString() : x.defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dataMap.ContainsKey(x.relationField))
|
||||
{
|
||||
x.defaultValue = dataMap[x.relationField] != null ? dataMap[x.relationField]?.ToString() : x.defaultValue;
|
||||
}
|
||||
else if (dataMap.ContainsKey("JnpfKeyConst_MainData"))
|
||||
{
|
||||
var mainData = dataMap["JnpfKeyConst_MainData"].ToObject<Dictionary<string, object>>();
|
||||
if (mainData.ContainsKey(x.relationField)) x.defaultValue = mainData[x.relationField] != null ? mainData[x.relationField]?.ToString() : x.defaultValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
form.__config__.templateJson.ForEach(x => x.defaultValue = (dataMap.ContainsKey(x.relationField) && dataMap[x.relationField] != null) ? dataMap[x.relationField]?.ToString() : x.defaultValue);
|
||||
_databaseService.ChangeDataBase(_databaseService.GetTenantDbLink(_userManager.TenantId, _userManager.TenantDbName));
|
||||
var res = _dataInterfaceService.GetResponseByType(form.__config__.propsUrl, 0, string.Empty, new Common.Dtos.VisualDev.VisualDevDataFieldDataListInput() { paramList = form.__config__.templateJson.Adapt<List<DataInterfaceReqParameterInfo>>(), pageSize = 500, currentPage = 1 }).Result;
|
||||
var resList = res.ToObject<PageResult<Dictionary<string, object>>>();
|
||||
var resList = res.ToObject<PageResult<Dictionary<string,object>>>();
|
||||
if (resList != null && resList.list.Any())
|
||||
{
|
||||
foreach (object? item in mValue)
|
||||
{
|
||||
var comData = resList.list.Where(a => a.ContainsValue(item.ToString())).FirstOrDefault();
|
||||
var props = form.__config__.props != null ? form.__config__.props.label : form.props.props.label;
|
||||
if (comData != null) data.Add(comData[props].ToString());
|
||||
if (comData != null) data.Add(comData[form.__config__.props.label].ToString());
|
||||
else data.Add(item.ToString());
|
||||
}
|
||||
}
|
||||
@@ -2055,7 +1946,7 @@ public class FormDataParsing : ITransient
|
||||
/// <param name="_dataMap"></param>
|
||||
public void GetBARAndQR(List<FieldsModel> fieldsModels, Dictionary<string, object> _newDataMap, Dictionary<string, object> _dataMap)
|
||||
{
|
||||
fieldsModels.Where(x => x.__config__.jnpfKey == "barcode" || x.__config__.jnpfKey == "qrcode").Where(x => !string.IsNullOrWhiteSpace(x.relationField)).ToList().ForEach(item =>
|
||||
fieldsModels.Where(x => x.__config__.jnpfKey == JnpfKeyConst.BARCODE || x.__config__.jnpfKey == JnpfKeyConst.QRCODE).Where(x => !string.IsNullOrWhiteSpace(x.relationField)).ToList().ForEach(item =>
|
||||
{
|
||||
if (!_newDataMap.ContainsKey(item.relationField + "_id") && _dataMap.ContainsKey(item.relationField))
|
||||
_newDataMap.Add(item.relationField + "_id", _dataMap[item.relationField]);
|
||||
|
||||
@@ -23,6 +23,7 @@ public static class TemplateAnalysis
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
item.__config__.defaultCurrent = item.__config__.children.Any(it => it.__config__.defaultCurrent);
|
||||
template.Add(item);
|
||||
break;
|
||||
case JnpfKeyConst.ROW:
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
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;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Core;
|
||||
|
||||
@@ -145,6 +144,16 @@ public class TemplateParsingBase
|
||||
/// </summary>
|
||||
public List<string> selectKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PC数据过滤 .
|
||||
/// </summary>
|
||||
public List<IConditionalModel> DataRuleListJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App数据过滤 .
|
||||
/// </summary>
|
||||
public List<IConditionalModel> AppDataRuleListJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板解析帮助 构造 (功能表单).
|
||||
/// </summary>
|
||||
@@ -177,96 +186,75 @@ public class TemplateParsingBase
|
||||
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 (entity.WebType.Equals(4))
|
||||
{
|
||||
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 =>
|
||||
FullName = entity.FullName;
|
||||
IsHasTable = false;
|
||||
InitColumnData(entity);
|
||||
AllFieldsModel = new List<FieldsModel>();
|
||||
ColumnData.columnList.ForEach(item =>
|
||||
{
|
||||
ChildTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllFieldsModel.Add(new FieldsModel() { __vModel__ = item.__vModel__, __config__ = new ConfigModel() { label = item.label, jnpfKey = item.jnpfKey } });
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
AllFieldsModel.Add(new FieldsModel() { __vModel__ = item.__vModel__, __config__ = new ConfigModel() { label = item.label, jnpfKey = item.jnpfKey } });
|
||||
});
|
||||
AllFieldsModel = AllFieldsModel.DistinctBy(x => x.__vModel__).ToList();
|
||||
FieldsModelList = AllFieldsModel;
|
||||
AuxiliaryTableFieldsModelList = AllFieldsModel;
|
||||
MainTableFieldsModelList = AllFieldsModel;
|
||||
SingleFormData = AllFieldsModel;
|
||||
}
|
||||
|
||||
if (AppColumnData.searchList != null && AppColumnData.searchList.Any())
|
||||
else
|
||||
{
|
||||
AppColumnData.searchList.ForEach(item =>
|
||||
FormDataModel formModel = entity.FormData.ToObjectOld<FormDataModel>();
|
||||
FormModel = formModel; // 表单Json模型
|
||||
IsHasTable = !string.IsNullOrEmpty(entity.Tables) && !"[]".Equals(entity.Tables); // 是否有表
|
||||
AllFieldsModel = GetInDataFieldsModel(formModel.fields.ToJsonString().ToObjectOld<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 =>
|
||||
{
|
||||
var addSearch = ColumnData.searchList.Find(x => x.__config__.jnpfKey == item.__config__.jnpfKey);
|
||||
if (addSearch == null) ColumnData.searchList.Add(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 == JnpfKeyConst.TABLE).ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != JnpfKeyConst.TABLE).ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
if (ColumnData.searchList != null && ColumnData.searchList.Any())
|
||||
{
|
||||
ColumnData.searchList.Where(x => x.__config__.jnpfKey == JnpfKeyConst.CASCADER).ToList().ForEach(item =>
|
||||
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 =>
|
||||
{
|
||||
var it = SingleFormData.FirstOrDefault(x => x.__vModel__ == item.__vModel__);
|
||||
if (it != null) item.multiple = it.props.props.multiple;
|
||||
ChildTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
AllTableFields.Add(item.__vModel__ + "-" + x.__vModel__, item.__config__.tableName + "." + x.__vModel__);
|
||||
});
|
||||
}
|
||||
|
||||
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__);
|
||||
});
|
||||
InitColumnData(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,9 +300,9 @@ public class TemplateParsingBase
|
||||
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(); // 子表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == JnpfKeyConst.TABLE).ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != "table").ToList(); // 非子表集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != JnpfKeyConst.TABLE).ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
MainTableFields = new Dictionary<string, string>();
|
||||
@@ -356,7 +344,7 @@ public class TemplateParsingBase
|
||||
/// <returns>true 通过.</returns>
|
||||
public bool VerifyTemplate()
|
||||
{
|
||||
if (FieldsModelList != null && FieldsModelList.Any(x => x.__config__.jnpfKey == "table"))
|
||||
if (FieldsModelList != null && FieldsModelList.Any(x => x.__config__.jnpfKey == JnpfKeyConst.TABLE))
|
||||
{
|
||||
foreach (FieldsModel? item in ChildTableFieldsModelList)
|
||||
{
|
||||
@@ -477,10 +465,10 @@ public class TemplateParsingBase
|
||||
}
|
||||
else
|
||||
{
|
||||
FormDataModel formModel = formJson.ToObject<FormDataModel>();
|
||||
FormDataModel formModel = formJson.ToObjectOld<FormDataModel>();
|
||||
FormModel = formModel; // 表单Json模型
|
||||
IsHasTable = !string.IsNullOrEmpty(tables) && !"[]".Equals(tables); // 是否有表
|
||||
AllFieldsModel = GetInDataFieldsModel(formModel.fields.ToJsonString().ToObject<List<FieldsModel>>()); // 所有控件集合
|
||||
IsHasTable = !string.IsNullOrEmpty(tables) && !"[]".Equals(tables) && tables.IsNullOrEmpty(); // 是否有表
|
||||
AllFieldsModel = GetInDataFieldsModel(formModel.fields.ToJsonString().ToObjectOld<List<FieldsModel>>()); // 所有控件集合
|
||||
FieldsModelList = GetInDataFieldsModel(formModel.fields); // 已剔除布局控件集合
|
||||
MainTable = tables.ToList<TableModel>().Find(m => m.typeId.Equals("1")); // 主表
|
||||
MainTableName = MainTable?.table; // 主表名称
|
||||
@@ -494,9 +482,9 @@ public class TemplateParsingBase
|
||||
});
|
||||
AllTable = tables.ToObject<List<TableModel>>(); // 所有表
|
||||
AuxiliaryTableFieldsModelList = FieldsModelList.Where(x => x.__vModel__.Contains("_jnpf_")).ToList(); // 单控件副表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == "table").ToList(); // 子表集合
|
||||
ChildTableFieldsModelList = FieldsModelList.Where(x => x.__config__.jnpfKey == JnpfKeyConst.TABLE).ToList(); // 子表集合
|
||||
MainTableFieldsModelList = FieldsModelList.Except(AuxiliaryTableFieldsModelList).Except(ChildTableFieldsModelList).ToList(); // 主表控件集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != "table").ToList(); // 非子表集合
|
||||
SingleFormData = FieldsModelList.Where(x => x.__config__.jnpfKey != JnpfKeyConst.TABLE).ToList(); // 非子表集合
|
||||
GenerateFields = GetGenerateFields(); // 系统生成控件
|
||||
|
||||
MainTableFields = new Dictionary<string, string>();
|
||||
@@ -526,4 +514,233 @@ public class TemplateParsingBase
|
||||
AppColumnData = new ColumnDesignModel();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化列配置模型.
|
||||
/// </summary>
|
||||
private void InitColumnData(VisualDevEntity entity)
|
||||
{
|
||||
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__);
|
||||
});
|
||||
}
|
||||
|
||||
// 数据过滤
|
||||
if (ColumnData.ruleList != null && ColumnData.ruleList.Any())
|
||||
{
|
||||
DataRuleListJson = new List<IConditionalModel>();
|
||||
var condTree = new ConditionalTree() { ConditionalList = new List<KeyValuePair<WhereType, IConditionalModel>>() };
|
||||
ColumnData.ruleList.ForEach(item => condTree.ConditionalList.Add(new KeyValuePair<WhereType, IConditionalModel>(WhereType.And, GetItemRule(item))));
|
||||
DataRuleListJson.Add(condTree);
|
||||
}
|
||||
|
||||
if (AppColumnData.ruleListApp != null && AppColumnData.ruleListApp.Any())
|
||||
{
|
||||
AppDataRuleListJson = new List<IConditionalModel>();
|
||||
var condTree = new ConditionalTree() { ConditionalList = new List<KeyValuePair<WhereType, IConditionalModel>>() };
|
||||
AppColumnData.ruleListApp.ForEach(item => condTree.ConditionalList.Add(new KeyValuePair<WhereType, IConditionalModel>(WhereType.And, GetItemRule(item))));
|
||||
AppDataRuleListJson.Add(condTree);
|
||||
}
|
||||
}
|
||||
|
||||
private IConditionalModel GetItemRule(RuleFieldModel item)
|
||||
{
|
||||
var conditionalType = ConditionalType.Equal;
|
||||
var between = new List<string>();
|
||||
if (item.fieldValue.IsNotEmptyOrNull())
|
||||
{
|
||||
if (item.symbol.Equals("between")) between = item.fieldValue.ToObject<List<string>>();
|
||||
switch (item.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CREATETIME:
|
||||
case JnpfKeyConst.MODIFYTIME:
|
||||
case JnpfKeyConst.DATE:
|
||||
{
|
||||
if (item.symbol.Equals("between"))
|
||||
{
|
||||
var startTime = between.First().TimeStampToDateTime();
|
||||
var endTime = between.Last().TimeStampToDateTime();
|
||||
between[0] = startTime.ToString();
|
||||
between[1] = endTime.ToString();
|
||||
if (item.format == "yyyy-MM-dd")
|
||||
{
|
||||
between[0] = new DateTime(startTime.Year, startTime.Month, startTime.Day, 0, 0, 0, 0).ToString();
|
||||
between[1] = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59, 999).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.format == "yyyy-MM-dd")
|
||||
{
|
||||
var value = item.fieldValue.ToString().TimeStampToDateTime();
|
||||
item.fieldValue = new DateTime(value.Year, value.Month, value.Day, 0, 0, 0, 0).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.fieldValue = item.fieldValue.IsNotEmptyOrNull() ? item.fieldValue.ToString().TimeStampToDateTime() : item.fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (item.symbol)
|
||||
{
|
||||
case ">=":
|
||||
conditionalType = ConditionalType.GreaterThanOrEqual;
|
||||
break;
|
||||
case ">":
|
||||
conditionalType = ConditionalType.GreaterThan;
|
||||
break;
|
||||
case "==":
|
||||
conditionalType = ConditionalType.Equal;
|
||||
break;
|
||||
case "<=":
|
||||
conditionalType = ConditionalType.LessThanOrEqual;
|
||||
break;
|
||||
case "<":
|
||||
conditionalType = ConditionalType.LessThan;
|
||||
break;
|
||||
case "<>":
|
||||
conditionalType = ConditionalType.NoEqual;
|
||||
break;
|
||||
case "like":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("[")) item.fieldValue = item.fieldValue.ToString().Replace("[", string.Empty).Replace("]", string.Empty);
|
||||
conditionalType = ConditionalType.Like;
|
||||
break;
|
||||
case "notLike":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("[")) item.fieldValue = item.fieldValue.ToString().Replace("[", string.Empty).Replace("]", string.Empty);
|
||||
conditionalType = ConditionalType.NoLike;
|
||||
break;
|
||||
case "in":
|
||||
case "notIn":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("["))
|
||||
{
|
||||
var isListValue = false;
|
||||
var itemField = AllFieldsModel.Find(x => x.__vModel__.Equals(item.__vModel__));
|
||||
if (itemField.multiple || item.jnpfKey.Equals(JnpfKeyConst.CHECKBOX) || item.jnpfKey.Equals(JnpfKeyConst.CASCADER) || item.jnpfKey.Equals(JnpfKeyConst.ADDRESS))
|
||||
isListValue = true;
|
||||
var conditionalList = new ConditionalCollections() { ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>() };
|
||||
var ids = new List<string>();
|
||||
if (item.fieldValue.ToString().Replace("\r\n", "").Replace(" ", "").Contains("[[")) ids = item.fieldValue.ToObject<List<List<string>>>().Select(x => x.Last()).ToList();
|
||||
else ids = item.fieldValue.ToObject<List<string>>();
|
||||
|
||||
for (var i = 0; i < ids.Count; i++)
|
||||
{
|
||||
var it = ids[i];
|
||||
var whereType = WhereType.And;
|
||||
if (item.symbol.Equals("in")) whereType = i.Equals(0) && item.logic.Equals("&&") ? WhereType.And : WhereType.Or;
|
||||
else whereType = i.Equals(0) && item.logic.Equals("||") ? WhereType.Or : WhereType.And;
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(whereType, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = item.symbol.Equals("in") ? ConditionalType.Like : ConditionalType.NoLike,
|
||||
FieldValue = isListValue ? it.ToJsonString() : it
|
||||
}));
|
||||
}
|
||||
|
||||
if (item.symbol.Equals("notIn"))
|
||||
{
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = null
|
||||
}));
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = string.Empty
|
||||
}));
|
||||
}
|
||||
|
||||
return conditionalList;
|
||||
}
|
||||
conditionalType = item.symbol.Equals("in") ? ConditionalType.In : ConditionalType.NotIn;
|
||||
break;
|
||||
case "null":
|
||||
conditionalType = (item.jnpfKey.Equals(JnpfKeyConst.CALCULATE) || item.jnpfKey.Equals(JnpfKeyConst.NUMINPUT)) ? ConditionalType.EqualNull : ConditionalType.IsNullOrEmpty;
|
||||
break;
|
||||
case "notNull":
|
||||
conditionalType = ConditionalType.IsNot;
|
||||
break;
|
||||
case "between":
|
||||
return new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>((item.logic.Equals("&&") ? WhereType.And : WhereType.Or), new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.GreaterThanOrEqual,
|
||||
FieldValue = between.First(),
|
||||
FieldValueConvertFunc = it => Convert.ToDateTime(it)
|
||||
}),
|
||||
new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.LessThanOrEqual,
|
||||
FieldValue = between.Last(),
|
||||
FieldValueConvertFunc = it => Convert.ToDateTime(it)
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>((item.logic.Equals("&&") ? WhereType.And : WhereType.Or), new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = conditionalType,
|
||||
FieldValue = item.fieldValue == null ? null : item.fieldValue.ToString()
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -259,6 +259,11 @@ public class CodeGenConfigModel
|
||||
/// </summary>
|
||||
public bool IsSystemControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查询条件多选.
|
||||
/// </summary>
|
||||
public bool IsSearchMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开).
|
||||
/// </summary>
|
||||
@@ -268,4 +273,24 @@ public class CodeGenConfigModel
|
||||
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开)详情页 (行内编辑的时候特殊处理).
|
||||
/// </summary>
|
||||
public List<string[]> ParsJnpfKeyConstListDetails { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否树形表格.
|
||||
/// </summary>
|
||||
public bool IsTreeTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树形表格-父级字段.
|
||||
/// </summary>
|
||||
public string ParentField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树形表格-显示字段.
|
||||
/// </summary>
|
||||
public string TreeShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启逻辑删除.
|
||||
/// </summary>
|
||||
public bool IsLogicalDelete { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
public class CodeGenExportPropertyJsonModel
|
||||
{
|
||||
public string filedName { get; set; }
|
||||
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
public string filedId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填.
|
||||
/// </summary>
|
||||
public bool required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool multiple { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成表单真实控件.
|
||||
/// </summary>
|
||||
public class CodeGenFormRealControlModel
|
||||
{
|
||||
public string jnpfKey { get; set; }
|
||||
|
||||
public string vModel { get; set; }
|
||||
|
||||
public bool multiple { get; set; }
|
||||
|
||||
public List<CodeGenFormRealControlModel> children { get; set; }
|
||||
}
|
||||
@@ -142,4 +142,11 @@ public class CodeGenTableRelationsModel
|
||||
/// 是否更新.
|
||||
/// </summary>
|
||||
public bool IsUpdate { get; set; }
|
||||
|
||||
public bool IsControlParsing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查询条件多选.
|
||||
/// </summary>
|
||||
public bool IsSearchMultiple { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Model.CodeGen;
|
||||
|
||||
/// <summary>
|
||||
/// 表单默认值控件模型.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class DefaultFormControlModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否存在日期控件.
|
||||
/// </summary>
|
||||
public bool IsExistDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在组织选择.
|
||||
/// </summary>
|
||||
public bool IsExistComSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在部门织选择.
|
||||
/// </summary>
|
||||
public bool IsExistDepSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在用户选择.
|
||||
/// </summary>
|
||||
public bool IsExistUserSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在子表.
|
||||
/// </summary>
|
||||
public bool IsExistSubTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日期选择字段.
|
||||
/// </summary>
|
||||
public List<string> DateField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表名称.
|
||||
/// </summary>
|
||||
public string SubTableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组织选择控件列表.
|
||||
/// </summary>
|
||||
public List<DefaultComSelectControl> ComSelectList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门选择控件列表.
|
||||
/// </summary>
|
||||
public List<DefaultDepSelectControl> DepSelectList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户选择控件列表.
|
||||
/// </summary>
|
||||
public List<DefaultUserSelectControl> UserSelectList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表默认值.
|
||||
/// </summary>
|
||||
public List<DefaultFormControlModel> SubTabelDefault { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 组织选择默认值.
|
||||
/// </summary>
|
||||
public class DefaultComSelectControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 表单多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询多选.
|
||||
/// </summary>
|
||||
public bool IsSearchMultiple { get; set; }
|
||||
|
||||
public string Field { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 部门选择默认值.
|
||||
/// </summary>
|
||||
public class DefaultDepSelectControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 表单多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询多选.
|
||||
/// </summary>
|
||||
public bool IsSearchMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选范围
|
||||
/// custom-自定义,all-全部.
|
||||
/// </summary>
|
||||
public string selectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
public string ableDepIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段名称.
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户选择默认值.
|
||||
/// </summary>
|
||||
public class DefaultUserSelectControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 表单多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询多选.
|
||||
/// </summary>
|
||||
public bool IsSearchMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选范围
|
||||
/// custom-自定义,all-全部.
|
||||
/// </summary>
|
||||
public string selectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
public string ableDepIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选用户.
|
||||
/// </summary>
|
||||
public string ableUserIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选岗位.
|
||||
/// </summary>
|
||||
public string ablePosIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选角色.
|
||||
/// </summary>
|
||||
public string ableRoleIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选分组.
|
||||
/// </summary>
|
||||
public string ableGroupIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段名称.
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
}
|
||||
@@ -648,4 +648,25 @@ public class FormControlDesignModel
|
||||
/// 是否关联表单.
|
||||
/// </summary>
|
||||
public bool IsRelationForm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径类型.
|
||||
/// </summary>
|
||||
public string PathType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启 分用户存储
|
||||
/// 0-关闭,1-开启.
|
||||
/// </summary>
|
||||
public string IsAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件夹名.
|
||||
/// </summary>
|
||||
public string Folder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前默认值.
|
||||
/// </summary>
|
||||
public bool DefaultCurrent { get; set; }
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class FrontEndGenConfigModel
|
||||
|
||||
/// <summary>
|
||||
/// 列表布局
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-行内编辑.
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-行内编辑,5-树形表格.
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
@@ -74,6 +74,11 @@ public class FrontEndGenConfigModel
|
||||
/// </summary>
|
||||
public string TreeDataSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否左侧树绑定字段查询条件多选.
|
||||
/// </summary>
|
||||
public bool IsTreeRelationMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树数据字典.
|
||||
/// </summary>
|
||||
@@ -159,6 +164,16 @@ public class FrontEndGenConfigModel
|
||||
/// </summary>
|
||||
public bool IsBatchRemoveDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有批量打印.
|
||||
/// </summary>
|
||||
public bool IsBatchPrint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批量打印IDS.
|
||||
/// </summary>
|
||||
public string PrintIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有导出.
|
||||
/// </summary>
|
||||
@@ -194,6 +209,11 @@ public class FrontEndGenConfigModel
|
||||
/// </summary>
|
||||
public bool IsUpload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启控件默认值.
|
||||
/// </summary>
|
||||
public bool IsDefaultFormControl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启按钮权限.
|
||||
/// </summary>
|
||||
@@ -339,4 +359,63 @@ public class FrontEndGenConfigModel
|
||||
/// 是否冻结.
|
||||
/// </summary>
|
||||
public bool IsFixed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在子表正则.
|
||||
/// </summary>
|
||||
public bool IsChildrenRegular { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树同步类型
|
||||
/// 0-同步,1-异步.
|
||||
/// </summary>
|
||||
public int TreeSynType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启左侧树查询.
|
||||
/// </summary>
|
||||
public bool HasTreeQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树异步接口.
|
||||
/// </summary>
|
||||
public CodeGenColumnData ColumnData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启合计.
|
||||
/// </summary>
|
||||
public bool ShowSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表合计字段.
|
||||
/// </summary>
|
||||
public List<string> SummaryField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单控件默认值.
|
||||
/// </summary>
|
||||
public DefaultFormControlModel DefaultFormControlList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程引擎表单字段json.
|
||||
/// </summary>
|
||||
public string PropertyJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单真实控件(剔除布局控件).
|
||||
/// </summary>
|
||||
public List<CodeGenFormRealControlModel> FormRealControl { get; set; }
|
||||
}
|
||||
|
||||
public class CodeGenColumnData
|
||||
{
|
||||
/// <summary>
|
||||
/// 左侧树异步接口.
|
||||
/// </summary>
|
||||
public string treeInterfaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树模板JSON.
|
||||
/// </summary>
|
||||
public List<object> treeTemplateJson { get; set; }
|
||||
}
|
||||
@@ -48,11 +48,6 @@ public class IndexColumnDesign
|
||||
/// </summary>
|
||||
public string Align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否自动转换.
|
||||
/// </summary>
|
||||
public bool IsAutomatic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间格式化.
|
||||
/// </summary>
|
||||
@@ -77,4 +72,9 @@ public class IndexColumnDesign
|
||||
/// 子表配置.
|
||||
/// </summary>
|
||||
public List<IndexColumnDesign> ChildTableDesigns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联表单模板ID.
|
||||
/// </summary>
|
||||
public string ModelId { get; set; }
|
||||
}
|
||||
@@ -98,6 +98,11 @@ public class IndexSearchFieldDesignModel
|
||||
/// </summary>
|
||||
public bool IsCustomSelect => SelectType == "all" ? false : true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选.
|
||||
/// </summary>
|
||||
public bool IsMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可选部门.
|
||||
/// </summary>
|
||||
|
||||
@@ -68,6 +68,11 @@ public class TableColumnConfigModel
|
||||
/// </summary>
|
||||
public int QueryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查询多选.
|
||||
/// </summary>
|
||||
public bool QueryMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示.
|
||||
/// </summary>
|
||||
@@ -188,6 +193,11 @@ public class TableColumnConfigModel
|
||||
/// </summary>
|
||||
public bool IsUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制解析.
|
||||
/// </summary>
|
||||
public bool IsControlParsing { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 副表使用
|
||||
@@ -253,4 +263,9 @@ public class TableColumnConfigModel
|
||||
/// 展示字段.
|
||||
/// </summary>
|
||||
public string ShowField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否树形父级字段.
|
||||
/// </summary>
|
||||
public bool IsTreeParentField { get; set; }
|
||||
}
|
||||
@@ -8,11 +8,26 @@ namespace JNPF.VisualDev.Engine;
|
||||
[SuppressSniffer]
|
||||
public class ColumnDesignModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 打印模板ID.
|
||||
/// </summary>
|
||||
public List<string> printIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询列表.
|
||||
/// </summary>
|
||||
public List<IndexSearchFieldModel> searchList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据过滤.
|
||||
/// </summary>
|
||||
public List<RuleFieldModel> ruleList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App数据过滤.
|
||||
/// </summary>
|
||||
public List<RuleFieldModel> ruleListApp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示列.
|
||||
/// </summary>
|
||||
@@ -35,7 +50,7 @@ public class ColumnDesignModel
|
||||
|
||||
/// <summary>
|
||||
/// 列表布局
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-编辑表格.
|
||||
/// 1-普通列表,2-左侧树形+普通表格,3-分组表格,4-编辑表格,5-树形表格.
|
||||
/// </summary>
|
||||
public int type { get; set; } = 1;
|
||||
|
||||
@@ -110,11 +125,37 @@ public class ColumnDesignModel
|
||||
/// </summary>
|
||||
public string treePropsLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树同步类型
|
||||
/// 0-同步,1-异步.
|
||||
/// </summary>
|
||||
public int treeSynType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启左侧树查询.
|
||||
/// </summary>
|
||||
public bool hasTreeQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树异步接口.
|
||||
/// </summary>
|
||||
public string treeInterfaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 左侧树模板JSON.
|
||||
/// </summary>
|
||||
public List<object> treeTemplateJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组字段.
|
||||
/// </summary>
|
||||
public string groupField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树形表格 - 父级字段.
|
||||
/// </summary>
|
||||
public string parentField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表权限.
|
||||
/// </summary>
|
||||
@@ -150,6 +191,16 @@ public class ColumnDesignModel
|
||||
/// </summary>
|
||||
public List<ButtonConfigModel> customBtnsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否合计.
|
||||
/// </summary>
|
||||
public bool showSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表合计字段.
|
||||
/// </summary>
|
||||
public List<string> summaryField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传数据模板json.
|
||||
/// </summary>
|
||||
|
||||
@@ -83,6 +83,11 @@ public class ConfigModel
|
||||
/// </summary>
|
||||
public object defaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前默认值.
|
||||
/// </summary>
|
||||
public bool defaultCurrent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 远端数据接口.
|
||||
/// </summary>
|
||||
|
||||
@@ -135,6 +135,11 @@ public class FieldsModel
|
||||
/// </summary>
|
||||
public bool multiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否多选查询.
|
||||
/// </summary>
|
||||
public bool searchMultiple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置选项.
|
||||
/// </summary>
|
||||
@@ -546,6 +551,22 @@ public class FieldsModel
|
||||
/// </summary>
|
||||
public List<LinkageConfig> templateJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路径类型.
|
||||
/// </summary>
|
||||
public string pathType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启 分用户存储
|
||||
/// 0-关闭,1-开启.
|
||||
/// </summary>
|
||||
public int isAccount { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// 文件夹名.
|
||||
/// </summary>
|
||||
public string folder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后端自我创建字段、用于统一处理减少循环判断
|
||||
/// 是否查询字段.
|
||||
|
||||
@@ -131,7 +131,7 @@ public class FormDataModel
|
||||
/// <summary>
|
||||
/// 打印模板ID.
|
||||
/// </summary>
|
||||
public string printId { get; set; }
|
||||
public List<string> printId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表单样式.
|
||||
|
||||
@@ -8,11 +8,10 @@ namespace JNPF.VisualDev.Engine;
|
||||
[SuppressSniffer]
|
||||
public class IndexGridFieldModel : IndexEachConfigBase
|
||||
{
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 对齐.
|
||||
///// </summary>
|
||||
//public string align { get; set; }
|
||||
/// <summary>
|
||||
/// 对齐.
|
||||
/// </summary>
|
||||
public string align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 固定.
|
||||
|
||||
@@ -14,9 +14,56 @@ public class IndexSearchFieldModel : IndexEachConfigBase
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 查询类型.
|
||||
///// </summary>
|
||||
//public int? searchType { get; set; }
|
||||
/// <summary>
|
||||
/// 查询类型.
|
||||
/// </summary>
|
||||
public int? searchType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据过滤集合.
|
||||
/// 数据过滤条件.
|
||||
/// </summary>
|
||||
public class RuleFieldModel : IndexEachConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 字段过滤值.
|
||||
/// </summary>
|
||||
public object fieldValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段类型.
|
||||
/// </summary>
|
||||
public string fieldType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段值类型.
|
||||
/// </summary>
|
||||
public string fieldValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .
|
||||
/// </summary>
|
||||
public string fieldLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑名.
|
||||
/// </summary>
|
||||
public string logicName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段.
|
||||
/// </summary>
|
||||
public string field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条件符号标识.
|
||||
/// </summary>
|
||||
public string symbol { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑: 并且、或者.
|
||||
/// </summary>
|
||||
public string logic { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
using JNPF.Common.Const;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.Common.Models.Authorize;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.VisualDev.Engine.Core;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Enum;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.VisualDev.Engine.Security;
|
||||
|
||||
@@ -261,6 +267,7 @@ public class CodeGenControlsAttributeHelper
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
case JnpfKeyConst.ADDRESS:
|
||||
case JnpfKeyConst.SWITCH:
|
||||
case JnpfKeyConst.DATE:
|
||||
tag = true;
|
||||
break;
|
||||
}
|
||||
@@ -467,7 +474,7 @@ public class CodeGenControlsAttributeHelper
|
||||
res[JnpfKeyConst.RELATIONFORM].Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.TABLE: // 遍历 子表 控件
|
||||
var ctRes = GetParsJnpfKeyConstList(item.__config__.children, isInlineEditor);
|
||||
var ctRes = GetParsJnpfKeyConstList(item.__config__.children, false);
|
||||
if (ctRes != null && ctRes.Any())
|
||||
{
|
||||
foreach (var ct in ctRes)
|
||||
@@ -547,4 +554,254 @@ public class CodeGenControlsAttributeHelper
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模板配置的数据过滤.
|
||||
/// </summary>
|
||||
/// <param name="templateEntity"></param>
|
||||
/// <param name="codeGenConfigModel"></param>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenDataRuleModuleResourceModel> GetDataRuleList(VisualDevEntity templateEntity, Model.CodeGen.CodeGenConfigModel codeGenConfigModel)
|
||||
{
|
||||
var ruleList = new List<CodeGenDataRuleModuleResourceModel>();
|
||||
var tInfo = new TemplateParsingBase(templateEntity);
|
||||
|
||||
// 数据过滤
|
||||
if (tInfo.ColumnData.ruleList != null && tInfo.ColumnData.ruleList.Any()) tInfo.ColumnData.ruleList.ForEach(item => ruleList.Add(GetItemRule(item, tInfo, "pc", codeGenConfigModel, ref ruleList)));
|
||||
if (tInfo.AppColumnData.ruleListApp != null && tInfo.AppColumnData.ruleListApp.Any()) tInfo.AppColumnData.ruleListApp.ForEach(item => ruleList.Add(GetItemRule(item, tInfo, "app", codeGenConfigModel, ref ruleList)));
|
||||
|
||||
var res = new List<CodeGenDataRuleModuleResourceModel>();
|
||||
foreach (var userOriginItem in new List<string>() { "pc", "app" })
|
||||
{
|
||||
ruleList.Where(x => x.UserOrigin.Equals(userOriginItem)).Select(x => x.TableName).Distinct().ToList().ForEach(tName =>
|
||||
{
|
||||
var first = ruleList.FirstOrDefault(x => x.UserOrigin.Equals(userOriginItem) && x.TableName.Equals(tName));
|
||||
var condList = ruleList.Where(x => x.UserOrigin.Equals(userOriginItem) && x.TableName.Equals(tName)).Select(x => x.conditionalModel.First()).ToList();
|
||||
var dataRuleListJson = new List<IConditionalModel>();
|
||||
var condTree = new ConditionalTree() { ConditionalList = new List<KeyValuePair<WhereType, IConditionalModel>>() };
|
||||
condList.ForEach(cItem => condTree.ConditionalList.Add(new KeyValuePair<WhereType, IConditionalModel>(WhereType.And, cItem)));
|
||||
res.Add(new CodeGenDataRuleModuleResourceModel()
|
||||
{
|
||||
FieldRule = first.TableName.Contains("@ChildFieldIsNull") ? -1 : first.FieldRule,
|
||||
TableName = first.TableName.Replace("@ChildFieldIsNull", string.Empty),
|
||||
UserOrigin = first.UserOrigin,
|
||||
conditionalModelJson = new List<IConditionalModel>() { condTree }.ToJsonString()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private static CodeGenDataRuleModuleResourceModel GetItemRule(RuleFieldModel item, TemplateParsingBase tInfo, string userOrigin, Model.CodeGen.CodeGenConfigModel codeGenConfigModel, ref List<CodeGenDataRuleModuleResourceModel> ruleList)
|
||||
{
|
||||
var result = new CodeGenDataRuleModuleResourceModel() { FieldRule = 0, TableName = tInfo.MainTableName.ToLower(), UserOrigin = userOrigin, conditionalModel = new List<IConditionalModel>() };
|
||||
if (tInfo.AuxiliaryTableFields.ContainsKey(item.__vModel__))
|
||||
{
|
||||
var tf = tInfo.AuxiliaryTableFields[item.__vModel__].Split('.');
|
||||
result.FieldRule = 1;
|
||||
result.TableName = tf.FirstOrDefault().ToLower();
|
||||
item.field = tf.LastOrDefault();
|
||||
}
|
||||
else if (tInfo.ChildTableFields.ContainsKey(item.__vModel__))
|
||||
{
|
||||
var tf = tInfo.ChildTableFields[item.__vModel__].Split('.');
|
||||
result.FieldRule = 2;
|
||||
result.TableName = tf.FirstOrDefault().ToLower();
|
||||
item.field = tf.LastOrDefault();
|
||||
|
||||
if (item.symbol.Equals("null"))
|
||||
{
|
||||
var mainTableRelationsQuery = result.Copy();
|
||||
mainTableRelationsQuery.TableName = mainTableRelationsQuery.TableName + "@ChildFieldIsNull";
|
||||
var ctPrimaryKey = codeGenConfigModel.TableRelations.Find(x => x.OriginalTableName.Equals(result.TableName)).ChilderColumnConfigList.Find(x => x.ColumnName.Equals(codeGenConfigModel.TableRelations.Find(x => x.OriginalTableName.Equals(result.TableName)).PrimaryKey)).OriginalColumnName;
|
||||
var condTree = new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, SqlSugar.ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel() { FieldName = ctPrimaryKey, ConditionalType = ConditionalType.NoEqual, FieldValue = "0", FieldValueConvertFunc = it => SqlSugar.UtilMethods.ChangeType2(it, typeof(string)) })
|
||||
}
|
||||
};
|
||||
|
||||
mainTableRelationsQuery.conditionalModel = new List<IConditionalModel>() { condTree };
|
||||
ruleList.Add(mainTableRelationsQuery);
|
||||
}
|
||||
}
|
||||
|
||||
if (codeGenConfigModel.TableField.Any(x => x.LowerColumnName.Equals(item.field)))
|
||||
{
|
||||
var fieldList = codeGenConfigModel.TableField.Where(x => x.LowerColumnName.Equals(item.field)).ToList();
|
||||
if (fieldList.Any() && fieldList.Count.Equals(1)) item.field = fieldList.First().OriginalColumnName;
|
||||
else item.field = fieldList.Find(x => x.TableName != null && x.TableName.Equals(item.__config__.tableName)).OriginalColumnName;
|
||||
}
|
||||
else if (codeGenConfigModel.TableRelations.Any(x => x.OriginalTableName.Equals(result.TableName)))
|
||||
{
|
||||
var tableRelations = codeGenConfigModel.TableRelations.Find(x => x.OriginalTableName.Equals(result.TableName) && x.ChilderColumnConfigList.Any(xx => xx.LowerColumnName.Equals(item.field)));
|
||||
if (tableRelations != null) item.field = tableRelations.ChilderColumnConfigList.Find(x => x.LowerColumnName.Equals(item.field)).OriginalColumnName;
|
||||
}
|
||||
|
||||
var conditionalType = ConditionalType.Equal;
|
||||
var between = new List<string>();
|
||||
if (item.fieldValue.IsNotEmptyOrNull())
|
||||
{
|
||||
if (item.symbol.Equals("between")) between = item.fieldValue.ToObject<List<string>>();
|
||||
switch (item.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.CREATETIME:
|
||||
case JnpfKeyConst.MODIFYTIME:
|
||||
case JnpfKeyConst.DATE:
|
||||
{
|
||||
if (item.symbol.Equals("between"))
|
||||
{
|
||||
var startTime = between.First().TimeStampToDateTime();
|
||||
var endTime = between.Last().TimeStampToDateTime();
|
||||
between[0] = startTime.ToString();
|
||||
between[1] = endTime.ToString();
|
||||
if (item.format == "yyyy-MM-dd")
|
||||
{
|
||||
between[0] = new DateTime(startTime.Year, startTime.Month, startTime.Day, 0, 0, 0, 0).ToString();
|
||||
between[1] = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59, 999).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DateTime dtDate;
|
||||
if (DateTime.TryParse(item.fieldValue.ToString(), out dtDate)) item.fieldValue = item.fieldValue.ToString();
|
||||
else item.fieldValue = string.Format("{0:yyyy-MM-dd HH:mm:ss}", item.fieldValue.ToString().TimeStampToDateTime());
|
||||
if (item.format == "yyyy-MM-dd")
|
||||
{
|
||||
var value = item.fieldValue.ToString().ParseToDateTime();
|
||||
item.fieldValue = new DateTime(value.Year, value.Month, value.Day, 0, 0, 0, 0).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.fieldValue = item.fieldValue.IsNotEmptyOrNull() ? item.fieldValue.ToString() : item.fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (item.symbol)
|
||||
{
|
||||
case ">=":
|
||||
conditionalType = ConditionalType.GreaterThanOrEqual;
|
||||
break;
|
||||
case ">":
|
||||
conditionalType = ConditionalType.GreaterThan;
|
||||
break;
|
||||
case "==":
|
||||
conditionalType = ConditionalType.Equal;
|
||||
break;
|
||||
case "<=":
|
||||
conditionalType = ConditionalType.LessThanOrEqual;
|
||||
break;
|
||||
case "<":
|
||||
conditionalType = ConditionalType.LessThan;
|
||||
break;
|
||||
case "<>":
|
||||
conditionalType = ConditionalType.NoEqual;
|
||||
break;
|
||||
case "like":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("[")) item.fieldValue = item.fieldValue.ToString().Replace("[", string.Empty).Replace("]", string.Empty);
|
||||
conditionalType = ConditionalType.Like;
|
||||
break;
|
||||
case "notLike":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("[")) item.fieldValue = item.fieldValue.ToString().Replace("[", string.Empty).Replace("]", string.Empty);
|
||||
conditionalType = ConditionalType.NoLike;
|
||||
break;
|
||||
case "in":
|
||||
case "notIn":
|
||||
if (item.fieldValue != null && item.fieldValue.ToString().Contains("["))
|
||||
{
|
||||
var isListValue = false;
|
||||
var itemField = tInfo.AllFieldsModel.Find(x => x.__vModel__.Equals(item.__vModel__));
|
||||
if (itemField.multiple || item.jnpfKey.Equals(JnpfKeyConst.CHECKBOX) || item.jnpfKey.Equals(JnpfKeyConst.CASCADER) || item.jnpfKey.Equals(JnpfKeyConst.ADDRESS))
|
||||
isListValue = true;
|
||||
var conditionalList = new ConditionalCollections() { ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>() };
|
||||
var ids = new List<string>();
|
||||
if (item.fieldValue.ToString().Replace("\r\n", "").Replace(" ", "").Contains("[[")) ids = item.fieldValue.ToObject<List<List<string>>>().Select(x => x.Last()).ToList();
|
||||
else ids = item.fieldValue.ToObject<List<string>>();
|
||||
for (var i = 0; i < ids.Count; i++)
|
||||
{
|
||||
var it = ids[i];
|
||||
var whereType = WhereType.And;
|
||||
if (item.symbol.Equals("in")) whereType = i.Equals(0) && item.logic.Equals("&&") ? WhereType.And : WhereType.Or;
|
||||
else whereType = i.Equals(0) && item.logic.Equals("||") ? WhereType.Or : WhereType.And;
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(whereType, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = item.symbol.Equals("in") ? ConditionalType.Like : ConditionalType.NoLike,
|
||||
FieldValue = isListValue ? it.ToJsonString() : it
|
||||
}));
|
||||
}
|
||||
|
||||
if (item.symbol.Equals("notIn"))
|
||||
{
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = null
|
||||
}));
|
||||
conditionalList.ConditionalList.Add(new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.IsNot,
|
||||
FieldValue = string.Empty
|
||||
}));
|
||||
}
|
||||
|
||||
result.conditionalModel.Add(conditionalList);
|
||||
return result;
|
||||
}
|
||||
conditionalType = item.symbol.Equals("in") ? ConditionalType.In : ConditionalType.NotIn;
|
||||
break;
|
||||
case "null":
|
||||
conditionalType = (item.jnpfKey.Equals(JnpfKeyConst.CALCULATE) || item.jnpfKey.Equals(JnpfKeyConst.NUMINPUT)) ? ConditionalType.EqualNull : ConditionalType.IsNullOrEmpty;
|
||||
break;
|
||||
case "notNull":
|
||||
conditionalType = ConditionalType.IsNot;
|
||||
break;
|
||||
case "between":
|
||||
var condItem = new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>((item.logic.Equals("&&") ? WhereType.And : WhereType.Or), new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.GreaterThanOrEqual,
|
||||
FieldValue = between.First(),
|
||||
FieldValueConvertFunc = it => Convert.ToDateTime(it)
|
||||
}),
|
||||
new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = ConditionalType.LessThanOrEqual,
|
||||
FieldValue = between.Last(),
|
||||
FieldValueConvertFunc = it => Convert.ToDateTime(it)
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
result.conditionalModel.Add(condItem);
|
||||
return result;
|
||||
}
|
||||
|
||||
var resItem = new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel>((item.logic.Equals("&&") ? WhereType.And : WhereType.Or), new ConditionalModel
|
||||
{
|
||||
FieldName = item.field,
|
||||
ConditionalType = conditionalType,
|
||||
FieldValue = item.fieldValue == null ? null : item.fieldValue.ToString()
|
||||
})
|
||||
}
|
||||
};
|
||||
result.conditionalModel.Add(resItem);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,18 @@ public class CodeGenFieldJudgeHelper
|
||||
return column?.searchType ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表查询多选.
|
||||
/// </summary>
|
||||
/// <param name="searchList">模板内查询列表.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool ColumnQueryMultiple(List<IndexSearchFieldModel>? searchList, string fieldName)
|
||||
{
|
||||
var column = searchList?.Find(s => s.prop == fieldName);
|
||||
return (column?.searchMultiple).ParseToBool();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示列.
|
||||
/// </summary>
|
||||
@@ -74,7 +86,7 @@ public class CodeGenFieldJudgeHelper
|
||||
/// <summary>
|
||||
/// 获取是否多选.
|
||||
/// </summary>
|
||||
/// <param name="columnList">模板内控件列表.</param>
|
||||
/// <param name="column">模板内控件.</param>
|
||||
/// <param name="fieldName">字段名称.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMultipleColumn(FieldsModel column, string fieldName)
|
||||
@@ -96,6 +108,25 @@ public class CodeGenFieldJudgeHelper
|
||||
return isMultiple;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控制解析.
|
||||
/// </summary>
|
||||
/// <param name="column"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsControlParsing(FieldsModel column)
|
||||
{
|
||||
bool isExist = false;
|
||||
switch (column?.__config__.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.RELATIONFORM:
|
||||
case JnpfKeyConst.POPUPSELECT:
|
||||
case JnpfKeyConst.USERSSELECT:
|
||||
isExist = true;
|
||||
break;
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否datetime.
|
||||
/// </summary>
|
||||
|
||||
@@ -28,18 +28,10 @@ public class GetCodeGenIndexButtonHelper
|
||||
method = string.Format("scope.row.rowEdit=true");
|
||||
break;
|
||||
default:
|
||||
switch (primaryKeyPolicy)
|
||||
switch (isFlow)
|
||||
{
|
||||
case 2:
|
||||
switch (isFlow)
|
||||
{
|
||||
case true:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.flowTaskId)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.{0})", primaryKey);
|
||||
break;
|
||||
}
|
||||
case true:
|
||||
method = string.Format("updateHandle(scope.row)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("addOrUpdateHandle(scope.row.{0})", primaryKey);
|
||||
@@ -61,23 +53,15 @@ public class GetCodeGenIndexButtonHelper
|
||||
switch (primaryKeyPolicy)
|
||||
{
|
||||
case 2:
|
||||
method = string.Format("goDetail(scope.row.flowTaskId,scope.row.flowState)");
|
||||
method = string.Format("goDetail(scope.row.flowTaskId,scope.row.flowState, scope.row.flowId)");
|
||||
break;
|
||||
default:
|
||||
method = string.Format("goDetail(scope.row.{0},scope.row.flowState)", primaryKey);
|
||||
method = string.Format("goDetail(scope.row.{0},scope.row.flowState, scope.row.flowId)", 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;
|
||||
}
|
||||
method = string.Format("detailHandle(scope.row)", primaryKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -95,14 +79,24 @@ public class GetCodeGenIndexButtonHelper
|
||||
/// <summary>
|
||||
/// 代码生成单表Index列表头部按钮方法.
|
||||
/// </summary>
|
||||
/// <param name="value">按钮类型.</param>
|
||||
/// <param name="isFlow">是否工作流表单.</param>
|
||||
/// <returns></returns>
|
||||
public static string IndexTopButton(string value)
|
||||
public static string IndexTopButton(string value, bool isFlow)
|
||||
{
|
||||
var method = string.Empty;
|
||||
switch (value)
|
||||
{
|
||||
case "add":
|
||||
method = "addOrUpdateHandle()";
|
||||
switch (isFlow)
|
||||
{
|
||||
case true:
|
||||
method = "addHandle()";
|
||||
break;
|
||||
default:
|
||||
method = "addOrUpdateHandle()";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "download":
|
||||
method = "exportData()";
|
||||
@@ -113,6 +107,9 @@ public class GetCodeGenIndexButtonHelper
|
||||
case "upload":
|
||||
method = "handelUpload()";
|
||||
break;
|
||||
case "batchPrint":
|
||||
method = "printDialog()";
|
||||
break;
|
||||
}
|
||||
|
||||
return method;
|
||||
|
||||
@@ -123,9 +123,10 @@ public class CodeGenTargetPathHelper
|
||||
{
|
||||
var frontendPath = Path.Combine(KeyVariable.SystemPath, "CodeGenerate", fileName, "Net");
|
||||
var indexPath = Path.Combine(frontendPath, "html", "PC", tableName, "index.vue");
|
||||
var extraForm = Path.Combine(frontendPath, "html", "PC", tableName, "extraForm.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 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>();
|
||||
@@ -134,6 +135,7 @@ public class CodeGenTargetPathHelper
|
||||
switch (enableFlow)
|
||||
{
|
||||
case 0:
|
||||
pathList.Add(extraForm);
|
||||
if (isDetail)
|
||||
pathList.Add(detailPath);
|
||||
break;
|
||||
@@ -165,6 +167,7 @@ public class CodeGenTargetPathHelper
|
||||
{
|
||||
case 0:
|
||||
pathList.Add(Path.Combine(templatePath, "editorIndex.vue.vm"));
|
||||
pathList.Add(Path.Combine(templatePath, "extraForm.vue.vm"));
|
||||
if (isDetail)
|
||||
pathList.Add(Path.Combine(templatePath, "Detail.vue.vm"));
|
||||
break;
|
||||
@@ -278,7 +281,7 @@ public class CodeGenTargetPathHelper
|
||||
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 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)
|
||||
|
||||
@@ -17,7 +17,7 @@ public class CodeGenUnifiedHandlerHelper
|
||||
var template = new List<FieldsModel>();
|
||||
|
||||
// 循环表单内控件
|
||||
formDataModel.ForEach(item =>
|
||||
foreach (var item in formDataModel)
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
@@ -67,7 +67,7 @@ public class CodeGenUnifiedHandlerHelper
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class CodeGenUnifiedHandlerHelper
|
||||
// dataType = dynamic && templateJson属性有长度,则代表有远端联动
|
||||
if (config.dataType == "dynamic" && config.templateJson?.Count() > 0)
|
||||
{
|
||||
config.templateJson.FindAll(it => it.relationField.Any()).ForEach(items =>
|
||||
config.templateJson.FindAll(it => it.relationField != null && 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;
|
||||
@@ -199,7 +199,7 @@ public class CodeGenUnifiedHandlerHelper
|
||||
{
|
||||
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 =>
|
||||
config.templateJson.FindAll(it => it.relationField != null && 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();
|
||||
@@ -233,27 +233,30 @@ public class CodeGenUnifiedHandlerHelper
|
||||
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 =>
|
||||
item.templateJson?.FindAll(it => it.relationField != null && 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>
|
||||
if (fieldModel != null)
|
||||
{
|
||||
new LinkageConfig()
|
||||
fieldModel.IsLinked = true;
|
||||
List<LinkageConfig> linkageConfigs = new List<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);
|
||||
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 =>
|
||||
item.templateJson?.FindAll(it => it.relationField != null && 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();
|
||||
|
||||
@@ -171,7 +171,11 @@ public class CodeGenFormControlDesignHelper
|
||||
UserRelationAttr = GetUserRelationAttr(children, realisticControls, logic),
|
||||
IsLinked = realisticControl.IsLinked,
|
||||
IsLinkage = realisticControl.IsLinkage,
|
||||
IsRelationForm = childrenConfig.jnpfKey.Equals(JnpfKeyConst.RELATIONFORM)
|
||||
IsRelationForm = childrenConfig.jnpfKey.Equals(JnpfKeyConst.RELATIONFORM),
|
||||
PathType = !string.IsNullOrEmpty(children.pathType) ? string.Format("pathType=\"{0}\" ", children.pathType) : string.Empty,
|
||||
IsAccount = children.isAccount != -1 ? string.Format(":isAccount=\"{0}\" ", children.isAccount) : string.Empty,
|
||||
Folder = !string.IsNullOrEmpty(children.folder) ? string.Format("folder=\"{0}\" ", children.folder) : string.Empty,
|
||||
DefaultCurrent = childrenConfig.defaultCurrent,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -194,6 +198,7 @@ public class CodeGenFormControlDesignHelper
|
||||
required = childrenTableList.Any(it => it.required.Equals(true)),
|
||||
AddType = item.addType,
|
||||
IsRelationForm = childrenTableList.Any(it => it.IsRelationForm.Equals(true)),
|
||||
DefaultCurrent = childrenTableList.Any(it => it.DefaultCurrent.Equals(true)),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -496,7 +501,11 @@ public class CodeGenFormControlDesignHelper
|
||||
UserRelationAttr = GetUserRelationAttr(item, realisticControls, logic),
|
||||
IsLinked = realisticControl.IsLinked,
|
||||
IsLinkage = realisticControl.IsLinkage,
|
||||
IsRelationForm = config.jnpfKey.Equals(JnpfKeyConst.RELATIONFORM)
|
||||
IsRelationForm = config.jnpfKey.Equals(JnpfKeyConst.RELATIONFORM),
|
||||
PathType = !string.IsNullOrEmpty(item.pathType) ? string.Format("pathType=\"{0}\" ", item.pathType) : string.Empty,
|
||||
IsAccount = item.isAccount != -1 ? string.Format(":isAccount=\"{0}\" ", item.isAccount) : string.Empty,
|
||||
Folder = !string.IsNullOrEmpty(item.folder) ? string.Format("folder=\"{0}\" ", item.folder) : string.Empty,
|
||||
DefaultCurrent = config.defaultCurrent,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -507,6 +516,112 @@ public class CodeGenFormControlDesignHelper
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表单默认值控件列表.
|
||||
/// </summary>
|
||||
/// <param name="fieldList">组件列表.</param>
|
||||
/// <param name="searchField">查询字段.</param>
|
||||
/// <param name="isMain">是否主表.</param>
|
||||
/// <returns></returns>
|
||||
public static DefaultFormControlModel DefaultFormControlList(List<FieldsModel> fieldList, List<IndexSearchFieldModel> searchField, string subTableName = null, bool isMain = true)
|
||||
{
|
||||
DefaultFormControlModel model = new DefaultFormControlModel();
|
||||
model.DateField = new List<string>();
|
||||
model.ComSelectList = new List<DefaultComSelectControl>();
|
||||
model.DepSelectList = new List<DefaultDepSelectControl>();
|
||||
model.UserSelectList = new List<DefaultUserSelectControl>();
|
||||
model.SubTabelDefault = new List<DefaultFormControlModel>();
|
||||
|
||||
// 获取表单内存在默认值控件
|
||||
foreach (var item in fieldList)
|
||||
{
|
||||
var config = item.__config__;
|
||||
var search = new IndexSearchFieldModel();
|
||||
switch (isMain && !config.jnpfKey.Equals(JnpfKeyConst.TABLE))
|
||||
{
|
||||
case false:
|
||||
search = searchField?.Find(it => it.__vModel__.Equals(string.Format("{0}-{1}", subTableName, item.__vModel__)));
|
||||
break;
|
||||
default:
|
||||
search = searchField?.Find(it => it.__vModel__.Equals(string.Format("{0}", item.__vModel__)));
|
||||
break;
|
||||
}
|
||||
|
||||
// 未作为查询条件
|
||||
if (search == null)
|
||||
{
|
||||
search = new IndexSearchFieldModel();
|
||||
search.searchMultiple = false;
|
||||
}
|
||||
switch (config.defaultCurrent)
|
||||
{
|
||||
case true:
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
model.SubTabelDefault.Add(DefaultFormControlList(item.__config__.children, searchField, item.__vModel__, false));
|
||||
break;
|
||||
case JnpfKeyConst.DATE:
|
||||
model.DateField.Add(item.__vModel__);
|
||||
break;
|
||||
case JnpfKeyConst.COMSELECT:
|
||||
model.ComSelectList.Add(new DefaultComSelectControl()
|
||||
{
|
||||
IsMultiple = item.multiple,
|
||||
IsSearchMultiple = search.searchMultiple,
|
||||
Field = item.__vModel__
|
||||
});
|
||||
break;
|
||||
case JnpfKeyConst.DEPSELECT:
|
||||
model.DepSelectList.Add(new DefaultDepSelectControl()
|
||||
{
|
||||
IsMultiple = item.multiple,
|
||||
selectType = item.selectType,
|
||||
IsSearchMultiple = search.searchMultiple,
|
||||
Field = item.__vModel__,
|
||||
ableDepIds = item.ableDepIds.ToJsonString(),
|
||||
});
|
||||
break;
|
||||
case JnpfKeyConst.USERSELECT:
|
||||
model.UserSelectList.Add(new DefaultUserSelectControl()
|
||||
{
|
||||
IsMultiple = item.multiple,
|
||||
selectType = item.selectType,
|
||||
IsSearchMultiple = search.searchMultiple,
|
||||
Field = item.__vModel__,
|
||||
ableDepIds = item.ableDepIds.ToJsonString(),
|
||||
ableGroupIds = item.ableGroupIds.ToJsonString(),
|
||||
ablePosIds = item.ablePosIds.ToJsonString(),
|
||||
ableRoleIds = item.ableRoleIds.ToJsonString(),
|
||||
ableUserIds = item.ableUserIds.ToJsonString(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (isMain)
|
||||
{
|
||||
case false:
|
||||
model.SubTableName = subTableName;
|
||||
model.IsExistDate = model.DateField.Any();
|
||||
model.IsExistComSelect = model.ComSelectList.Any();
|
||||
model.IsExistDepSelect = model.DepSelectList.Any();
|
||||
model.IsExistUserSelect = model.UserSelectList.Any();
|
||||
break;
|
||||
default:
|
||||
model.IsExistDate = model.DateField.Any() || model.SubTabelDefault.Any(it => it.DateField.Any());
|
||||
model.IsExistComSelect = model.ComSelectList.Any() || model.SubTabelDefault.Any(it => it.ComSelectList.Any());
|
||||
model.IsExistDepSelect = model.DepSelectList.Any() || model.SubTabelDefault.Any(it => it.DepSelectList.Any());
|
||||
model.IsExistUserSelect = model.UserSelectList.Any() || model.SubTabelDefault.Any(it => it.UserSelectList.Any());
|
||||
model.IsExistSubTable = model.SubTabelDefault.Count > 0 ? true : false;
|
||||
break;
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表单控件选项配置.
|
||||
/// </summary>
|
||||
@@ -1071,6 +1186,40 @@ public class CodeGenFormControlDesignHelper
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表单真实控件-剔除布局控件后.
|
||||
/// </summary>
|
||||
/// <param name="fieldList">组件列表</param>
|
||||
/// <returns></returns>
|
||||
public static List<CodeGenFormRealControlModel> FormRealControl(List<FieldsModel> fieldList)
|
||||
{
|
||||
var list = new List<CodeGenFormRealControlModel>();
|
||||
foreach (var item in fieldList)
|
||||
{
|
||||
var config = item.__config__;
|
||||
switch (config.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
list.Add(new CodeGenFormRealControlModel
|
||||
{
|
||||
jnpfKey = config.jnpfKey,
|
||||
vModel = item.__vModel__,
|
||||
children = FormRealControl(config.children)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
list.Add(new CodeGenFormRealControlModel
|
||||
{
|
||||
jnpfKey = config.jnpfKey,
|
||||
vModel = item.__vModel__,
|
||||
multiple = config.jnpfKey == JnpfKeyConst.CASCADER ? item.props.props.multiple : item.multiple
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表单脚本设计.
|
||||
/// </summary>
|
||||
@@ -1179,6 +1328,12 @@ public class CodeGenFormControlDesignHelper
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<RegListModel> childrenRegList = new List<RegListModel>();
|
||||
|
||||
foreach (var reg in childrenFormScript.FindAll(it => it.RegList != null && it.RegList.Count > 0).Select(it => it.RegList))
|
||||
{
|
||||
childrenRegList.AddRange(reg);
|
||||
}
|
||||
|
||||
formScript.Add(new FormScriptDesignModel()
|
||||
{
|
||||
@@ -1188,6 +1343,7 @@ public class CodeGenFormControlDesignHelper
|
||||
jnpfKey = config.jnpfKey,
|
||||
ChildrenList = childrenFormScript,
|
||||
Required = childrenFormScript.Any(it => it.Required.Equals(true)),
|
||||
RegList = childrenRegList,
|
||||
ShowSummary = item.showSummary,
|
||||
SummaryField = item.summaryField.ToJsonString(),
|
||||
IsDataTransfer = item.addType == 1 ? true : false,
|
||||
@@ -1417,4 +1573,51 @@ public class CodeGenFormControlDesignHelper
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表单json.
|
||||
/// </summary>
|
||||
/// <param name="formScriptDesignModels"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetPropertyJson(List<FormScriptDesignModel> formScriptDesignModels)
|
||||
{
|
||||
List<CodeGenExportPropertyJsonModel>? list = new List<CodeGenExportPropertyJsonModel>();
|
||||
foreach (var item in formScriptDesignModels)
|
||||
{
|
||||
switch (item.jnpfKey)
|
||||
{
|
||||
case JnpfKeyConst.TABLE:
|
||||
list.Add(new CodeGenExportPropertyJsonModel
|
||||
{
|
||||
filedName = item.Placeholder,
|
||||
jnpfKey = item.jnpfKey,
|
||||
filedId = item.OriginalName,
|
||||
required = item.Required,
|
||||
multiple = item.Multiple,
|
||||
});
|
||||
foreach (var subtable in item.ChildrenList)
|
||||
{
|
||||
list.Add(new CodeGenExportPropertyJsonModel
|
||||
{
|
||||
filedName = string.Format("{0}-{1}", item.Placeholder, subtable.Placeholder),
|
||||
jnpfKey = subtable.jnpfKey,
|
||||
filedId = string.Format("{0}-{1}", item.OriginalName, subtable.LowerName),
|
||||
required = subtable.Required,
|
||||
multiple = subtable.Multiple,
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
list.Add(new CodeGenExportPropertyJsonModel
|
||||
{
|
||||
filedName = item.Placeholder,
|
||||
jnpfKey = item.jnpfKey,
|
||||
filedId = item.LowerName,
|
||||
required = item.Required,
|
||||
multiple = item.Multiple,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list.ToJsonString();
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class CodeGenQueryControlClassificationHelper
|
||||
|
||||
var usersSelectList = new List<string>();
|
||||
usersSelectList.Add(JnpfKeyConst.USERSSELECT);
|
||||
listQueryControl["usersSelectList"] = usersSelectList;
|
||||
listQueryControl["usersSelect"] = usersSelectList;
|
||||
|
||||
var treeSelectList = new List<string>();
|
||||
treeSelectList.Add(JnpfKeyConst.TREESELECT);
|
||||
@@ -159,6 +159,10 @@ public class CodeGenQueryControlClassificationHelper
|
||||
var addressList = new List<string>();
|
||||
addressList.Add(JnpfKeyConst.ADDRESS);
|
||||
listQueryControl["address"] = addressList;
|
||||
|
||||
listQueryControl["groupSelect"] = new List<string>() { JnpfKeyConst.GROUPSELECT };
|
||||
|
||||
listQueryControl["roleSelect"] = new List<string>() { JnpfKeyConst.ROLESELECT };
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -166,21 +170,4 @@ public class CodeGenQueryControlClassificationHelper
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user