优化代码生成
This commit is contained in:
parent
8a83782282
commit
2c9fc950f3
@ -105,6 +105,7 @@ $end
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 操作类型 1、add 2、edit
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否展开,默认全部折叠
|
||||
@ -245,6 +246,7 @@ $end
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
this.opertype = 1;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
@ -269,6 +271,7 @@ $end
|
||||
if (code == 200) {
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
this.opertype = 2;
|
||||
|
||||
this.form = {
|
||||
...data,
|
||||
@ -327,7 +330,7 @@ $end
|
||||
$end
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.${replaceDto.FistLowerPk} != undefined && this.title === "修改数据") {
|
||||
if (this.form.${replaceDto.FistLowerPk} != undefined && this.opertype === 2) {
|
||||
update${genTable.BusinessName}(this.form)
|
||||
.then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
|
||||
@ -102,6 +102,8 @@ $end
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 操作类型 1、add 2、edit
|
||||
opertype: 0,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
@ -240,6 +242,7 @@ $end
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加";
|
||||
this.opertype = 1;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
@ -264,6 +267,7 @@ $end
|
||||
if (code == 200) {
|
||||
this.open = true;
|
||||
this.title = "修改数据";
|
||||
this.opertype = 2;
|
||||
|
||||
this.form = {
|
||||
...data,
|
||||
@ -322,7 +326,7 @@ $end
|
||||
$end
|
||||
console.log(JSON.stringify(this.form));
|
||||
|
||||
if (this.form.${replaceDto.FistLowerPk} != undefined && this.title === "修改数据") {
|
||||
if (this.form.${replaceDto.FistLowerPk} != undefined && this.opertype === 2) {
|
||||
update${genTable.BusinessName}(this.form)
|
||||
.then((res) => {
|
||||
this.msgSuccess("修改成功");
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ZR.CodeGenerator
|
||||
string columnName = dbFieldInfo.CsharpFieldFl;
|
||||
string labelName = CodeGeneratorTool.GetLabelName(dbFieldInfo.ColumnComment, columnName);
|
||||
string labelDisabled = dbFieldInfo.IsPk ? ":disabled=\"true\"" : "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new();
|
||||
string value = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? "parseInt(item.dictValue)" : "item.dictValue";
|
||||
|
||||
if (GenConstants.inputDtoNoField.Any(f => f.Contains(dbFieldInfo.CsharpField, StringComparison.OrdinalIgnoreCase)))
|
||||
@ -31,7 +31,7 @@ namespace ZR.CodeGenerator
|
||||
}
|
||||
if (!dbFieldInfo.IsInsert && !dbFieldInfo.IsEdit)
|
||||
{
|
||||
sb.AppendLine(" <el-col v-if=\"title == '修改数据'\" :lg=\"12\">");
|
||||
sb.AppendLine(" <el-col :lg=\"12\" v-if=\"opertype == 2\">");
|
||||
sb.AppendLine($" <el-form-item label=\"{labelName}\">{{{{form.{columnName}}}}}</el-form-item>");
|
||||
sb.AppendLine(" </el-col>");
|
||||
return sb.ToString();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user