代码生成添加修改新增加CheckBox
This commit is contained in:
parent
7352c2fea5
commit
d1fc87bcc3
@ -195,6 +195,9 @@ $foreach(item in genTable.Columns)
|
|||||||
$if((item.IsEdit || item.IsInsert))
|
$if((item.IsEdit || item.IsInsert))
|
||||||
$item.ColumnName: undefined,
|
$item.ColumnName: undefined,
|
||||||
$end
|
$end
|
||||||
|
$if((item.HtmlType == "checkbox"))
|
||||||
|
${item.ColumnName}Checked: [],
|
||||||
|
$end
|
||||||
$end
|
$end
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
@ -247,10 +250,19 @@ $end
|
|||||||
this.reset();
|
this.reset();
|
||||||
const id = row.${replaceDto.FistLowerPk} || this.ids;
|
const id = row.${replaceDto.FistLowerPk} || this.ids;
|
||||||
get${genTable.BusinessName}(id).then((res) => {
|
get${genTable.BusinessName}(id).then((res) => {
|
||||||
if (res.code == 200) {
|
const { code, data } = res;
|
||||||
this.form = res.data;
|
if (code == 200) {
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改数据";
|
this.title = "修改数据";
|
||||||
|
|
||||||
|
this.form = {
|
||||||
|
...data,
|
||||||
|
$foreach(item in genTable.Columns)
|
||||||
|
$if(item.HtmlType == "checkbox")
|
||||||
|
${item.ColumnName}Checked: data.${item.columnName} ? data.${item.columnName}.split(',') : [],
|
||||||
|
$end
|
||||||
|
$end
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -288,6 +300,11 @@ $end
|
|||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
this.${refs}refs["form"].validate((valid) => {
|
this.${refs}refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
$foreach(item in genTable.Columns)
|
||||||
|
$if(item.HtmlType == "checkbox")
|
||||||
|
this.form.${item.ColumnName} = this.form.${item.columnName}Checked.toString();
|
||||||
|
$end
|
||||||
|
$end
|
||||||
console.log(JSON.stringify(this.form));
|
console.log(JSON.stringify(this.form));
|
||||||
|
|
||||||
if (this.form.${replaceDto.FistLowerPk} != undefined || this.title === "修改数据") {
|
if (this.form.${replaceDto.FistLowerPk} != undefined || this.title === "修改数据") {
|
||||||
|
|||||||
@ -118,6 +118,21 @@ namespace ZR.CodeGenerator
|
|||||||
sb.AppendLine(" </el-form-item>");
|
sb.AppendLine(" </el-form-item>");
|
||||||
sb.AppendLine(" </el-col>");
|
sb.AppendLine(" </el-col>");
|
||||||
}
|
}
|
||||||
|
else if( dbFieldInfo.HtmlType == GenConstants.HTML_CHECKBOX)
|
||||||
|
{
|
||||||
|
//多选框
|
||||||
|
sb.AppendLine(" <el-col :span=\"12\">");
|
||||||
|
sb.AppendLine($" <el-form-item label=\"{labelName}\" prop=\"{columnName}\">");
|
||||||
|
sb.AppendLine($" <el-checkbox-group v-model=\"form.{columnName}Checked\"> ");
|
||||||
|
if (string.IsNullOrEmpty(dbFieldInfo.DictType))
|
||||||
|
{
|
||||||
|
sb.AppendLine($" <el-checkbox>请选择字典生成</el-checkbox>");
|
||||||
|
}
|
||||||
|
sb.AppendLine($" <el-checkbox v-for=\"item in {columnName}Options\" :key=\"item.dictValue\" :label=\"item.dictValue\">{{{{item.dictLabel}}}}</el-checkbox>");
|
||||||
|
sb.AppendLine(" </el-checkbox-group>");
|
||||||
|
sb.AppendLine(" </el-form-item>");
|
||||||
|
sb.AppendLine(" </el-col>");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
|
string inputNumTxt = CodeGeneratorTool.IsNumber(dbFieldInfo.CsharpType) ? ".number" : "";
|
||||||
|
|||||||
@ -717,6 +717,7 @@ CREATE TABLE `gen_demo` (
|
|||||||
`remark` VARCHAR(200) COMMENT '备注',
|
`remark` VARCHAR(200) COMMENT '备注',
|
||||||
`beginTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
|
`beginTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
|
||||||
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
|
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
|
||||||
|
`feature` varchar(100) NULL COMMENT '特征'
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user