优化代码生成模板
This commit is contained in:
@@ -166,42 +166,42 @@ namespace ZR.CodeGenerator
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vue 查询表单
|
||||
/// </summary>
|
||||
/// <param name="dbFieldInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static string TplQueryFormHtml(GenTableColumn dbFieldInfo)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
string columnName = dbFieldInfo.CsharpFieldFl;
|
||||
string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, dbFieldInfo.CsharpField);
|
||||
if (!dbFieldInfo.IsQuery) return sb.ToString();
|
||||
if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME)
|
||||
{
|
||||
sb.AppendLine($" <el-form-item label=\"{labelName}\">");
|
||||
sb.AppendLine($" <el-date-picker v-model=\"dateRange{dbFieldInfo.CsharpField}\" style=\"width: 240px\" value-format=\"yyyy-MM-dd\" type=\"daterange\" range-separator=\"-\" start-placeholder=\"开始日期\"");
|
||||
sb.AppendLine($" end-placeholder=\"结束日期\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" :picker-options=\"{{ firstDayOfWeek: 1}}\"></el-date-picker>");
|
||||
sb.AppendLine(" </el-form-item>");
|
||||
}
|
||||
else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT || dbFieldInfo.HtmlType == GenConstants.HTML_RADIO)
|
||||
{
|
||||
sb.AppendLine($" <el-form-item label=\"{labelName}\" prop=\"{columnName}\">");
|
||||
sb.AppendLine($" <el-select v-model=\"queryParams.{columnName}\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" >");
|
||||
sb.AppendLine($" <el-option v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\"></el-option>");
|
||||
sb.AppendLine(" </el-select>");
|
||||
sb.AppendLine(" </el-form-item>");
|
||||
}
|
||||
else
|
||||
{
|
||||
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
|
||||
sb.AppendLine($" <el-form-item label=\"{ labelName}\" prop=\"{columnName}\">");
|
||||
sb.AppendLine($" <el-input v-model{inputNumTxt}=\"queryParams.{columnName}\" placeholder=\"请输入{dbFieldInfo.ColumnComment}\" />");
|
||||
sb.AppendLine(" </el-form-item>");
|
||||
}
|
||||
///// <summary>
|
||||
///// Vue 查询表单
|
||||
///// </summary>
|
||||
///// <param name="dbFieldInfo"></param>
|
||||
///// <returns></returns>
|
||||
//public static string TplQueryFormHtml(GenTableColumn dbFieldInfo)
|
||||
//{
|
||||
// StringBuilder sb = new();
|
||||
// string columnName = dbFieldInfo.CsharpFieldFl;
|
||||
// string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, dbFieldInfo.CsharpField);
|
||||
// if (!dbFieldInfo.IsQuery) return sb.ToString();
|
||||
// if (dbFieldInfo.HtmlType == GenConstants.HTML_DATETIME)
|
||||
// {
|
||||
// sb.AppendLine($" <el-form-item label=\"{labelName}\">");
|
||||
// sb.AppendLine($" <el-date-picker v-model=\"dateRange{dbFieldInfo.CsharpField}\" style=\"width: 240px\" value-format=\"yyyy-MM-dd\" type=\"daterange\" range-separator=\"-\" start-placeholder=\"开始日期\"");
|
||||
// sb.AppendLine($" end-placeholder=\"结束日期\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" :picker-options=\"{{ firstDayOfWeek: 1}}\"></el-date-picker>");
|
||||
// sb.AppendLine(" </el-form-item>");
|
||||
// }
|
||||
// else if (dbFieldInfo.HtmlType == GenConstants.HTML_SELECT || dbFieldInfo.HtmlType == GenConstants.HTML_RADIO)
|
||||
// {
|
||||
// sb.AppendLine($" <el-form-item label=\"{labelName}\" prop=\"{columnName}\">");
|
||||
// sb.AppendLine($" <el-select v-model=\"queryParams.{columnName}\" placeholder=\"请选择{dbFieldInfo.ColumnComment}\" >");
|
||||
// sb.AppendLine($" <el-option v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\"></el-option>");
|
||||
// sb.AppendLine(" </el-select>");
|
||||
// sb.AppendLine(" </el-form-item>");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
|
||||
// sb.AppendLine($" <el-form-item label=\"{ labelName}\" prop=\"{columnName}\">");
|
||||
// sb.AppendLine($" <el-input v-model{inputNumTxt}=\"queryParams.{columnName}\" placeholder=\"请输入{dbFieldInfo.ColumnComment}\" />");
|
||||
// sb.AppendLine(" </el-form-item>");
|
||||
// }
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
// return sb.ToString();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Vue 查询列表
|
||||
|
||||
Reference in New Issue
Block a user