优化代码生成额外参数编辑报错,新增排序列

This commit is contained in:
不做码农
2022-05-22 13:50:27 +08:00
parent 99595c1993
commit 64ce449353
15 changed files with 262 additions and 228 deletions

View File

@@ -204,7 +204,7 @@ namespace ZR.Admin.WebApi.Controllers
var genTable = genTableDto.Adapt<GenTable>().ToUpdate(HttpContext);
//将前端额外参数转成字符串存入Options中
genTable.Options = JsonConvert.SerializeObject(genTableDto.Params);
genTable.Options = genTableDto.Params.Adapt<Options>();
DbResult<bool> result = GenTableService.UseTran(() =>
{
int rows = GenTableService.UpdateGenTable(genTable);

View File

@@ -56,8 +56,8 @@ $end
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
.Includes(it => it.Sub.MappingField(z => z.${genTable.SubTableFkName}, () => it.${replaceDto.PKName}))
$end
$if(genTable.SortField != "" && genTable.SortField != null)
.OrderBy("${genTable.SortField} ${genTable.SortType}")
$if(genTable.Options.SortField != "" && genTable.Options.SortField != null)
.OrderBy("${genTable.Options.SortField} ${genTable.Options.SortType}")
$end
.Where(predicate.ToExpression())
.ToPage(parm);
@@ -88,7 +88,7 @@ $end
$end
var response = _${replaceDto.ModelTypeName}Repository.Queryable().Where(predicate.ToExpression())
.ToTree(it => it.Children, it => it.${genTable.TreeParentCode}, 0);
.ToTree(it => it.Children, it => it.${genTable.Options.TreeParentCode}, 0);
return response;
}

View File

@@ -38,7 +38,7 @@ $end
<!-- 数据区域 -->
<el-table v-if="refreshTable" :data="dataList" v-loading="loading" ref="table" border highlight-current-row @selection-change="handleSelectionChange"
:default-expand-all="isExpandAll" row-key="${tool.FirstLowerCase(genTable.TreeCode)}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
:default-expand-all="isExpandAll" row-key="${tool.FirstLowerCase(genTable.Options.TreeCode)}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column type="selection" width="50" align="center"/>
${VueViewListContent}
<el-table-column label="操作" align="center" width="140">
@@ -204,8 +204,8 @@ $end
delete node.children;
}
return {
id: node.${tool.FirstLowerCase(genTable.TreeCode)},
label: node.${tool.FirstLowerCase(genTable.TreeName)},
id: node.${tool.FirstLowerCase(genTable.Options.TreeCode)},
label: node.${tool.FirstLowerCase(genTable.Options.TreeName)},
children: node.children,
};
},

View File

@@ -88,7 +88,7 @@ $end
highlight-current-row
@selection-change="handleSelectionChange"
:default-expand-all="isExpandAll"
row-key="${tool.FirstLowerCase(genTable.TreeCode)}"
row-key="${tool.FirstLowerCase(genTable.Options.TreeCode)}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column type="selection" width="50" align="center"/>

View File

@@ -124,7 +124,7 @@ $elseif(column.HtmlType == "imageUpload")
</template>
</el-table-column>
$elseif(column.HtmlType == "checkbox" || column.HtmlType == "select" || column.HtmlType == "radio")
<el-table-column prop="${columnName}" label="${labelName}" align="center">
<el-table-column prop="${columnName}" label="${labelName}" align="center"${column.sortStr}>
<template #default="scope">
$if(column.HtmlType == "checkbox")
<dict-tag :options="$if(column.DictType != "") ${column.DictType} $else ${column.CsharpFieldFl}Options$end" :value="scope.row.${columnName} ? scope.row.${columnName}.split(',') : []" />
@@ -134,7 +134,7 @@ $end
</template>
</el-table-column>
$else
<el-table-column prop="${columnName}" label="${labelName}" align="center"${showToolTipHtml} />
<el-table-column prop="${columnName}" label="${labelName}" align="center"${showToolTipHtml}${column.sortStr} />
$end
$end
$end