From 05980c69ee3f21349983e795f15bb83bb10df534 Mon Sep 17 00:00:00 2001
From: hansonyu183 <95766183@qq.com>
Date: Mon, 22 Jun 2020 22:13:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:AutoCode=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E7=9A=84=E8=A1=A8=E6=A0=BC=E4=B8=8D=E6=98=BE=E7=A4=BAbool?=
=?UTF-8?q?=E5=80=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
修复:多了个}
---
server/resource/template/fe/table.vue.tpl | 23 ++++++++++++++---------
server/resource/template/te/model.go.tpl | 3 +--
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/server/resource/template/fe/table.vue.tpl b/server/resource/template/fe/table.vue.tpl
index c6fedf49..464c44a6 100644
--- a/server/resource/template/fe/table.vue.tpl
+++ b/server/resource/template/fe/table.vue.tpl
@@ -2,9 +2,7 @@
- {{- range .Fields}}
- {{- if .FieldSearchType}}
- {{- if eq .FieldType "bool" }}
+ {{- range .Fields}} {{- if .FieldSearchType}} {{- if eq .FieldType "bool" }}
@@ -28,10 +26,7 @@
{{- else }}
-
- {{ end }}
- {{ end }}
- {{ end }}
+ {{ end }} {{ end }} {{ end }}
查询
@@ -52,8 +47,11 @@
{{ "{{scope.row.CreatedAt|formatDate}}" }}
- {{range .Fields}}
-
+ {{range .Fields}} {{- if eq .FieldType "bool" }}
+
+ {{ "{{scope.row."}}{{.FieldJson}}{{"|formatBoolean}}" }}
+ {{- else }}
+ {{ end }}
{{ end }}
@@ -124,6 +122,13 @@ export default {
} else {
return "";
}
+ },
+ formatBoolean: function(bool) {
+ if (bool != null) {
+ return bool ? "是" :"否";
+ } else {
+ return "";
+ }
}
},
methods: {
diff --git a/server/resource/template/te/model.go.tpl b/server/resource/template/te/model.go.tpl
index 0a51ad59..ed429ab6 100644
--- a/server/resource/template/te/model.go.tpl
+++ b/server/resource/template/te/model.go.tpl
@@ -13,5 +13,4 @@ type {{.StructName}} struct {
{{- else }}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`
{{- end }} {{- end }}
-}
-}
+}
\ No newline at end of file