feat:update gen

This commit is contained in:
zhangwenjian committed 2020-09-12 01:07:35 +08:00
1 parent 8a7a9db7fd
commit 2d15f91f2e
15 files changed
+220 -256

No files matched your search

+1 -1
View File
@@ -77,7 +77,7 @@ func Delete{{.ClassName}}(c *gin.Context) {
var data models.{{.ClassName}}
data.UpdateBy = tools.GetUserIdStr(c)
IDS := tools.IdsStrToIdsIntGroup("{{.PkJsonField}}", c)
IDS := tools.GetDeleteIds(c)
_, err := data.BatchDelete(IDS)
tools.HasError(err, msg.DeletedFail, 500)
app.OK(c, nil, msg.DeletedSuccess)
+2 -2
View File
@@ -20,12 +20,12 @@ type {{.ClassName}} struct {
{{ range .Columns -}}
{{$x := .Pk}}
{{- if ($x) }}
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};primary_key"` // {{.ColumnComment}}
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};primary_key;AUTO_INCREMENT;comment:{{.ColumnComment}}"` // {{.ColumnComment}}
{{- else if eq .GoField "CreatedAt" -}}
{{- else if eq .GoField "UpdatedAt" -}}
{{- else if eq .GoField "DeletedAt" -}}
{{- else }}
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};"` // {{.ColumnComment}}{{end -}}
{{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};comment:{{.ColumnComment}}"` // {{.ColumnComment}}{{end -}}
{{- end }}
DataScope string `json:"dataScope" gorm:"-"`
Params string `json:"params" gorm:"-"`
+34 -2
View File
@@ -185,6 +185,12 @@
:label="dict.dictValue"
>{{"{{"}} dict.dictLabel {{"}}"}}</el-radio>
</el-radio-group>
{{- else if eq "file" .HtmlType -}}
<el-input
v-model="form.{{.JsonField}}"
placeholder="图片"
/>
<el-button type="primary" @click="fileShow{{.GoField}}">选择文件</el-button>
{{- else if eq "datetime" .HtmlType -}}
<el-date-picker
v-model="form.{{.JsonField}}"
@@ -209,6 +215,7 @@
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<FileChoose ref="fileChoose" :dialog-form-visible="fileOpen" @confirm="getImgList" @close="fileClose" />
</el-card>
</template>
</BasicLayout>
@@ -223,8 +230,13 @@
{{ end -}}
{{- end -}}
import FileChoose from '@/components/FileChoose'
export default {
name: 'Config',
name: '{{.ClassName}}',
components: {
FileChoose
},
data() {
return {
// 遮罩层
@@ -242,6 +254,8 @@
// 是否显示弹出层
open: false,
isEdit: false,
fileOpen: false,
fileIndex: undefined,
// 类型数据字典
typeOptions: [],
{{.ModuleName}}List: [],
@@ -334,6 +348,12 @@
}
this.resetForm('form')
},
getImgList: function() {
this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl
},
fileClose: function() {
this.fileOpen = false
},
{{range .Columns}}
{{- if ne .DictType "" -}}
{{.JsonField}}Format(row) {
@@ -356,6 +376,15 @@
},
{{ end -}}
{{- end -}}
// 文件
{{range .Columns}}
{{- if ne .HtmlType "file" -}}
fileShow{{.GoField}}: function() {
this.fileOpen = true
this.fileIndex = '{{.JsonField}}'
},
{{ end -}}
{{- end -}}
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageIndex = 1
@@ -422,7 +451,10 @@
},
/** 删除按钮操作 */
handleDelete(row) {
const Ids = row.{{.PkJsonField}} || this.ids
var Ids = row.{{.PkJsonField}} || this.ids
if (this.ids.length === 0) {
Ids = [Ids]
}
this.$confirm('是否确认删除编号为"' + Ids + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',