mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 04:29:32 +00:00
增加自动化代码图片功能
This commit is contained in:
@@ -11,10 +11,10 @@ type {{.StructName}} struct {
|
||||
global.GVA_MODEL {{- range .Fields}}
|
||||
{{- if eq .FieldType "enum" }}
|
||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};"`
|
||||
{{- else if eq .FieldType "picture" }}
|
||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
|
||||
{{- else if ne .FieldType "string" }}
|
||||
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
|
||||
{{- else if qe .FieldType "picture" }}
|
||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
|
||||
{{- else }}
|
||||
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
|
||||
{{- end }} {{- end }}
|
||||
|
||||
@@ -62,7 +62,7 @@ import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
{{- if eq .FieldType "picture" }}
|
||||
{{- if .HasPic }}
|
||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||
{{- end }}
|
||||
const route = useRoute()
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
</el-select>
|
||||
{{- end }}
|
||||
{{- if eq .FieldType "picture" }}
|
||||
<SelectImage v-model="formData.{{ .FieldJson }}" />
|
||||
<SelectImage v-model="getUrl(formData.{{ .FieldJson }})" />
|
||||
{{- end }}
|
||||
</el-form-item>
|
||||
{{- end }}
|
||||
@@ -200,8 +200,9 @@ import {
|
||||
get{{.StructName}}List
|
||||
} from '@/api/{{.PackageName}}'
|
||||
|
||||
{{- if eq .FieldType "picture" }}
|
||||
{{- if .HasPic }}
|
||||
// 图片选择组件
|
||||
import { getUrl } from '@/utils/image'
|
||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||
{{- end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user