代码生成器支持直接使用字典

修复查询涉及sql关键字时sql语句报错问题
This commit is contained in:
QM303176530
2020-07-18 14:27:03 +08:00
parent 0f7a6a548f
commit de1d090c31
3 changed files with 28 additions and 10 deletions
+21 -4
View File
@@ -52,7 +52,14 @@
<el-table-column label="日期" width="180">
<template slot-scope="scope">{{ "{{scope.row.CreatedAt|formatDate}}" }}</template>
</el-table-column>
{{range .Fields}} {{- if eq .FieldType "bool" }}
{{range .Fields}}
{{- if .DictType}}
<el-table-column label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
<template slot-scope="scope">
{{"{{"}}filterDict(scope.row.{{.FieldJson}},"{{.DictType}}"){{"}}"}}
</template>
</el-table-column>
{{- else if eq .FieldType "bool" }}
<el-table-column label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
<template slot-scope="scope">{{ "{{scope.row."}}{{.FieldJson}}{{"|formatBoolean}}" }}</template>
</el-table-column> {{- else }}
@@ -117,6 +124,11 @@ export default {
type: "",
deleteVisible: false,
multipleSelection: [],
{{- range .Fields}}
{{- if .DictType }}
{{.DictType}}Options:[],
{{ end -}}
{{end -}}
formData: {
{{range .Fields}}{{.FieldJson}}:null,{{ end }}
}
@@ -222,9 +234,14 @@ export default {
this.dialogFormVisible = true;
}
},
created() {
this.getTableData();
}
async created() {
await this.getTableData();
{{- range .Fields -}}
{{- if .DictType -}}
await this.getDict("{{.DictType}}")
{{- end -}}
{{- end -}}
}
};
</script>