diff --git a/server/api/v1/system/sys_api.go b/server/api/v1/system/sys_api.go index 18c79fa65..d1360e401 100644 --- a/server/api/v1/system/sys_api.go +++ b/server/api/v1/system/sys_api.go @@ -74,7 +74,7 @@ func (s *SystemApiApi) SyncApi(c *gin.Context) { // @accept application/json // @Produce application/json // @Success 200 {object} response.Response{msg=string} "获取API分组" -// @Router /api/getApiGroups [post] +// @Router /api/getApiGroups [get] func (s *SystemApiApi) GetApiGroups(c *gin.Context) { groups, apiGroupMap, err := apiService.GetApiGroups() if err != nil { diff --git a/server/config.yaml b/server/config.yaml index 32aff73de..f530a39fd 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -1,259 +1,224 @@ -# github.com/flipped-aurora/gin-vue-admin/server Global Configuration - -# jwt configuration -jwt: - signing-key: qmPlus - expires-time: 7d - buffer-time: 1d - issuer: qmPlus -# zap logger configuration -zap: - level: info - format: console - prefix: "[github.com/flipped-aurora/gin-vue-admin/server]" - director: log - show-line: true - encode-level: LowercaseColorLevelEncoder - stacktrace-key: stacktrace - log-in-console: true - retention-day: -1 - -# redis configuration -redis: - #是否使用redis集群模式 - useCluster: false - #使用集群模式addr和db默认无效 - addr: 127.0.0.1:6379 - password: "" - db: 0 - clusterAddrs: - - "172.21.0.3:7000" - - "172.21.0.4:7001" - - "172.21.0.2:7002" - - -# mongo configuration -mongo: - coll: '' - options: '' - database: '' - username: '' - password: '' - auth-source: '' - min-pool-size: 0 - max-pool-size: 100 - socket-timeout-ms: 0 - connect-timeout-ms: 0 - is-zap: false - hosts: - - host: '' - port: '' - -# email configuration -email: - to: xxx@qq.com - port: 465 - from: xxx@163.com - host: smtp.163.com - is-ssl: true - secret: xxx - nickname: test - -# system configuration -system: - env: local # 修改为public可以关闭路由日志输出 - addr: 8888 - db-type: mysql - oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置 - use-redis: false # 使用redis - use-mongo: false # 使用mongo - use-multipoint: false - # IP限制次数 一个小时15000次 - iplimit-count: 15000 - # IP限制一个小时 - iplimit-time: 3600 - # 路由全局前缀 - router-prefix: "" - -# captcha configuration +aliyun-oss: + endpoint: yourEndpoint + access-key-id: yourAccessKeyId + access-key-secret: yourAccessKeySecret + bucket-name: yourBucketName + bucket-url: yourBucketUrl + base-path: yourBasePath +autocode: + web: web/src + root: D:\Projects\Go\gin-vue-admin + server: server + module: github.com/flipped-aurora/gin-vue-admin/server + ai-path: "" +aws-s3: + bucket: xxxxx-10005608 + region: ap-shanghai + endpoint: "" + secret-id: your-secret-id + secret-key: your-secret-key + base-url: https://gin.vue.admin + path-prefix: github.com/flipped-aurora/gin-vue-admin/server + s3-force-path-style: false + disable-ssl: false captcha: - key-long: 6 - img-width: 240 - img-height: 80 - open-captcha: 0 # 0代表一直开启,大于0代表限制次数 - open-captcha-timeout: 3600 # open-captcha大于0时才生效 - -# mysql connect configuration -# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master) -mysql: - path: "" - port: "" - config: "" - db-name: "" - username: "" - password: "" - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false - -# pgsql connect configuration -# 未初始化之前请勿手动修改数据库信息!!!如果一定要手动初始化请看(https://gin-vue-admin.com/docs/first_master) -pgsql: - path: "" - port: "" - config: "" - db-name: "" - username: "" - password: "" - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false -oracle: - path: "" - port: "" - config: "" - db-name: "" - username: "" - password: "" - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false -mssql: - path: "" - port: "" - config: "" - db-name: "" - username: "" - password: "" - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false -sqlite: - path: "" - port: "" - config: "" - db-name: "" - username: "" - password: "" - max-idle-conns: 10 - max-open-conns: 100 - log-mode: "" - log-zap: false + key-long: 6 + img-width: 240 + img-height: 80 + open-captcha: 0 + open-captcha-timeout: 3600 +cloudflare-r2: + bucket: xxxx0bucket + base-url: https://gin.vue.admin.com + path: uploads + account-id: xxx_account_id + access-key-id: xxx_key_id + secret-access-key: xxx_secret_key +cors: + mode: strict-whitelist + whitelist: + - allow-origin: example1.com + allow-methods: POST, GET + allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id + expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type + allow-credentials: true + - allow-origin: example2.com + allow-methods: GET, POST + allow-headers: content-type + expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type + allow-credentials: true db-list: - - disable: true # 是否禁用 - type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle - alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一 - path: "" + - type: "" + alias-name: "" + prefix: "" + port: "" + config: "" + db-name: "" + username: "" + password: "" + path: "" + engine: "" + log-mode: "" + max-idle-conns: 10 + max-open-conns: 100 + singular: false + log-zap: false + disable: true +disk-list: + - mount-point: / +email: + to: xxx@qq.com + from: xxx@163.com + host: smtp.163.com + secret: xxx + nickname: test + port: 465 + is-ssl: true +excel: + dir: ./resource/excel/ +hua-wei-obs: + path: you-path + bucket: you-bucket + endpoint: you-endpoint + access-key: you-access-key + secret-key: you-secret-key +jwt: + signing-key: 04e6f54d-2fcf-4cf1-8bad-4332e8a64466 + expires-time: 7d + buffer-time: 1d + issuer: qmPlus +language: + language: en + dir: ./resource/lang/ +local: + path: uploads/file + store-path: uploads/file +mongo: + coll: "" + options: "" + database: "" + username: "" + password: "" + auth-source: "" + min-pool-size: 0 + max-pool-size: 100 + socket-timeout-ms: 0 + connect-timeout-ms: 0 + is-zap: false + hosts: + - host: "" + port: "" +mssql: + prefix: "" port: "" config: "" db-name: "" username: "" password: "" + path: "" + engine: "" + log-mode: "" max-idle-conns: 10 max-open-conns: 100 + singular: false + log-zap: false +mysql: + prefix: "" + port: "3306" + config: charset=utf8mb4&parseTime=True&loc=Local + db-name: gva_tms + username: mhassan + password: P@$$w0rD + path: 127.0.0.1 + engine: "" + log-mode: error + max-idle-conns: 10 + max-open-conns: 100 + singular: false + log-zap: false +oracle: + prefix: "" + port: "" + config: "" + db-name: "" + username: "" + password: "" + path: "" + engine: "" log-mode: "" + max-idle-conns: 10 + max-open-conns: 100 + singular: false + log-zap: false +pgsql: + prefix: "" + port: "" + config: "" + db-name: "" + username: "" + password: "" + path: "" + engine: "" + log-mode: "" + max-idle-conns: 10 + max-open-conns: 100 + singular: false log-zap: false - -# local configuration -local: - path: uploads/file - store-path: uploads/file - -# autocode configuration -autocode: - web: web/src - root: "" # root 自动适配项目根目录, 请不要手动配置,他会在项目加载的时候识别出根路径 - server: server - module: 'github.com/flipped-aurora/gin-vue-admin/server' - ai-path: "" # AI服务路径 - -# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址) qiniu: - zone: ZoneHuaDong - bucket: "" - img-path: "" - use-https: false - access-key: "" - secret-key: "" - use-cdn-domains: false - -# aliyun oss configuration -aliyun-oss: - endpoint: yourEndpoint - access-key-id: yourAccessKeyId - access-key-secret: yourAccessKeySecret - bucket-name: yourBucketName - bucket-url: yourBucketUrl - base-path: yourBasePath - -# tencent cos configuration + zone: ZoneHuaDong + bucket: "" + img-path: "" + access-key: "" + secret-key: "" + use-https: false + use-cdn-domains: false +redis: + addr: 127.0.0.1:6379 + password: "" + db: 0 + useCluster: false + clusterAddrs: + - 172.21.0.3:7000 + - 172.21.0.4:7001 + - 172.21.0.2:7002 +sqlite: + prefix: "" + port: "" + config: "" + db-name: "" + username: "" + password: "" + path: "" + engine: "" + log-mode: "" + max-idle-conns: 10 + max-open-conns: 100 + singular: false + log-zap: false +system: + db-type: mysql + oss-type: local + router-prefix: "" + addr: 8888 + iplimit-count: 15000 + iplimit-time: 3600 + use-multipoint: false + use-redis: false + use-mongo: false tencent-cos: - bucket: xxxxx-10005608 - region: ap-shanghai - secret-id: your-secret-id - secret-key: your-secret-key - base-url: https://gin.vue.admin - path-prefix: github.com/flipped-aurora/gin-vue-admin/server - -# aws s3 configuration (minio compatible) -aws-s3: - bucket: xxxxx-10005608 - region: ap-shanghai - endpoint: "" - s3-force-path-style: false - disable-ssl: false - secret-id: your-secret-id - secret-key: your-secret-key - base-url: https://gin.vue.admin - path-prefix: github.com/flipped-aurora/gin-vue-admin/server - -# cloudflare r2 configuration -cloudflare-r2: - bucket: xxxx0bucket - base-url: https://gin.vue.admin.com - path: uploads - account-id: xxx_account_id - access-key-id: xxx_key_id - secret-access-key: xxx_secret_key - -# huawei obs configuration -hua-wei-obs: - path: you-path - bucket: you-bucket - endpoint: you-endpoint - access-key: you-access-key - secret-key: you-secret-key - -# excel configuration -excel: - dir: ./resource/excel/ - -# disk usage configuration -disk-list: - - mount-point: "/" - -# 跨域配置 -# 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用 -cors: - mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝 - whitelist: - - allow-origin: example1.com - allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id - allow-methods: POST, GET - expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type - - allow-credentials: true # 布尔值 - - allow-origin: example2.com - allow-headers: content-type - allow-methods: GET, POST - expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type - allow-credentials: true # 布尔值 - -# added by mohamed hassan to support multi language -language: - language: en - dir: ./resource/lang/ \ No newline at end of file + bucket: xxxxx-10005608 + region: ap-shanghai + secret-id: your-secret-id + secret-key: your-secret-key + base-url: https://gin.vue.admin + path-prefix: github.com/flipped-aurora/gin-vue-admin/server +zap: + level: info + prefix: '[github.com/flipped-aurora/gin-vue-admin/server]' + format: console + director: log + encode-level: LowercaseColorLevelEncoder + stacktrace-key: stacktrace + show-line: true + log-in-console: true + retention-day: -1 diff --git a/server/core/server.go b/server/core/server.go index 55b693777..850b0cac4 100644 --- a/server/core/server.go +++ b/server/core/server.go @@ -2,6 +2,7 @@ package core import ( "fmt" + "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/initialize" "github.com/flipped-aurora/gin-vue-admin/server/service/system" @@ -38,7 +39,7 @@ func RunWindowsServer() { fmt.Printf(` %s gin-vue-admin - %s:v2.7.1 + %s:v2.7.2 加群方式:微信号:shouzi_1994 QQ群:470239250 项目地址:https://github.com/flipped-aurora/gin-vue-admin 插件市场:https://plugin.gin-vue-admin.com diff --git a/server/docs/docs.go b/server/docs/docs.go index f3e8847bf..18173cfa6 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -8087,7 +8087,7 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ - Version: "v2.7.1", + Version: "v2.7.2", Host: "", BasePath: "", Schemes: []string{}, diff --git a/server/docs/swagger.json b/server/docs/swagger.json index d7facd264..ebc667710 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -4,7 +4,7 @@ "description": "使用gin+vue进行极速开发的全栈开发基础平台", "title": "Gin-Vue-Admin Swagger API接口文档", "contact": {}, - "version": "v2.7.1" + "version": "v2.7.2" }, "paths": { "/api/createApi": { diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index ac18f4dbc..5575f9942 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -1634,7 +1634,7 @@ info: contact: {} description: 使用gin+vue进行极速开发的全栈开发基础平台 title: Gin-Vue-Admin Swagger API接口文档 - version: v2.7.1 + version: v2.7.2 paths: /api/createApi: post: diff --git a/server/main.go b/server/main.go index 7304ce12a..f491aa589 100644 --- a/server/main.go +++ b/server/main.go @@ -16,7 +16,7 @@ import ( //go:generate go mod download // @title Gin-Vue-Admin Swagger API接口文档 -// @version v2.7.1 +// @version v2.7.2 // @description 使用gin+vue进行极速开发的全栈开发基础平台 // @securityDefinitions.apikey ApiKeyAuth // @in header diff --git a/server/model/system/request/sys_auto_code.go b/server/model/system/request/sys_auto_code.go index dfd5d8f0b..b6b61bdd0 100644 --- a/server/model/system/request/sys_auto_code.go +++ b/server/model/system/request/sys_auto_code.go @@ -24,9 +24,9 @@ type AutoCode struct { AutoCreateResource bool `json:"autoCreateResource" example:"false"` // 是否自动创建资源标识 AutoCreateApiToSql bool `json:"autoCreateApiToSql" example:"false"` // 是否自动创建api AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu + AutoCreateBtnAuth bool `json:"autoCreateBtnAuth" example:"false"` // 是否自动创建按钮权限 Fields []*AutoCodeField `json:"fields"` DictTypes []string `json:"-"` - FrontFields []*AutoCodeField `json:"-"` PrimaryField *AutoCodeField `json:"primaryField"` DataSourceMap map[string]*DataSource `json:"-"` HasPic bool `json:"-"` @@ -114,7 +114,6 @@ func (r *AutoCode) Pretreatment() error { } // test length := len(r.Fields) dict := make(map[string]string, length) - r.FrontFields = make([]*AutoCodeField, 0, length) r.DataSourceMap = make(map[string]*DataSource, length) for i := 0; i < length; i++ { if r.Fields[i].DictType != "" { @@ -123,9 +122,6 @@ func (r *AutoCode) Pretreatment() error { if r.Fields[i].Sort { r.NeedSort = true } - if r.Fields[i].Front { - r.FrontFields = append(r.FrontFields, r.Fields[i]) - } switch r.Fields[i].FieldType { case "file": r.HasFile = true @@ -204,17 +200,20 @@ func (r *AutoCode) History() SysAutoHistoryCreate { } type AutoCodeField struct { - FieldName string `json:"fieldName"` // Field名 - FieldDesc string `json:"fieldDesc"` // 中文名 - FieldType string `json:"fieldType"` // Field数据类型 - FieldJson string `json:"fieldJson"` // FieldJson - DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度 - Comment string `json:"comment"` // 数据库字段描述 - ColumnName string `json:"columnName"` // 数据库字段 - FieldSearchType string `json:"fieldSearchType"` // 搜索条件 - FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件 - DictType string `json:"dictType"` // 字典 - Front bool `json:"front"` // 是否前端可见 + FieldName string `json:"fieldName"` // Field名 + FieldDesc string `json:"fieldDesc"` // 中文名 + FieldType string `json:"fieldType"` // Field数据类型 + FieldJson string `json:"fieldJson"` // FieldJson + DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度 + Comment string `json:"comment"` // 数据库字段描述 + ColumnName string `json:"columnName"` // 数据库字段 + FieldSearchType string `json:"fieldSearchType"` // 搜索条件 + FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件 + DictType string `json:"dictType"` // 字典 + //Front bool `json:"front"` // 是否前端可见 + Form bool `json:"form"` // 是否前端新建/编辑 + Table bool `json:"table"` // 是否前端表格列 + Desc bool `json:"desc"` // 是否前端详情 Require bool `json:"require"` // 是否必填 DefaultValue string `json:"defaultValue"` // 是否必填 ErrorText string `json:"errorText"` // 校验失败文字 diff --git a/server/model/system/request/sys_casbin.go b/server/model/system/request/sys_casbin.go index 0c07ae604..ef8c823cb 100644 --- a/server/model/system/request/sys_casbin.go +++ b/server/model/system/request/sys_casbin.go @@ -17,10 +17,11 @@ func DefaultCasbin() []CasbinInfo { {Path: "/menu/getMenu", Method: "POST"}, {Path: "/jwt/jsonInBlacklist", Method: "POST"}, {Path: "/base/login", Method: "POST"}, - {Path: "/user/admin_register", Method: "POST"}, {Path: "/user/changePassword", Method: "POST"}, {Path: "/user/setUserAuthority", Method: "POST"}, - {Path: "/user/setUserInfo", Method: "PUT"}, {Path: "/user/getUserInfo", Method: "GET"}, + {Path: "/user/setSelfInfo", Method: "PUT"}, + {Path: "/fileUploadAndDownload/upload", Method: "POST"}, + {Path: "/sysDictionary/findSysDictionary", Method: "GET"}, } } diff --git a/server/resource/function/api.js.tpl b/server/resource/function/api.js.tpl new file mode 100644 index 000000000..524e8320f --- /dev/null +++ b/server/resource/function/api.js.tpl @@ -0,0 +1,34 @@ +{{if .IsPlugin}} +// {{.FuncName}} 等待开发的的{{.Description}}接口 +// @Tags {{.StructName}} +// @Summary 等待开发的的{{.Description}}接口 +// @accept application/json +// @Produce application/json +// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表" +// @Success 200 {object} response.Response{data=object,msg=string} "获取成功" +// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}] +export const {{.Router}} = () => { + return service({ + url: '/{{.Abbreviation}}/{{.Router}}', + method: '{{.Method}}' + }) +} + +{{- else -}} + +// {{.FuncName}} 等待开发的的{{.Description}}接口 +// @Tags {{.StructName}} +// @Summary 等待开发的的{{.Description}}接口 +// @accept application/json +// @Produce application/json +// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功" +// @Success 200 {object} response.Response{data=object,msg=string} "成功" +// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}] +export const {{.Router}} = () => { + return service({ + url: '/{{.Abbreviation}}/{{.Router}}', + method: '{{.Method}}' + }) +} + +{{- end -}} \ No newline at end of file diff --git a/server/resource/package/server/model/request/request.go.tpl b/server/resource/package/server/model/request/request.go.tpl index 10408fd66..a8d510e02 100644 --- a/server/resource/package/server/model/request/request.go.tpl +++ b/server/resource/package/server/model/request/request.go.tpl @@ -16,14 +16,8 @@ type {{.StructName}}Search struct{ Start{{.FieldName}} *{{.FieldType}} `json:"start{{.FieldName}}" form:"start{{.FieldName}}"` End{{.FieldName}} *{{.FieldType}} `json:"end{{.FieldName}}" form:"end{{.FieldName}}"` {{- else }} - {{- if eq .FieldType "enum" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}"` - {{- else if eq .FieldType "picture" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else if eq .FieldType "video" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else if eq .FieldType "richtext" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` + {{- if or (eq .FieldType "enum") (eq .FieldType "picture") (eq .FieldType "pictures") (eq .FieldType "video") (eq .FieldType "richtext") (eq .FieldType "json") }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` {{- else if ne .FieldType "string" }} {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` {{- else }} diff --git a/server/resource/package/server/service/service.go.tpl b/server/resource/package/server/service/service.go.tpl index 625f9756e..b2ca1bc9e 100644 --- a/server/resource/package/server/service/service.go.tpl +++ b/server/resource/package/server/service/service.go.tpl @@ -93,9 +93,13 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoLis {{- end }} {{- range .Fields}} {{- if .FieldSearchType}} - {{- if or (eq .FieldType "string") (eq .FieldType "enum") (eq .FieldType "picture") (eq .FieldType "video") (eq .FieldType "richtext") }} + {{- if or (eq .FieldType "string") (eq .FieldType "enum") (eq .FieldType "pictures") (eq .FieldType "picture") (eq .FieldType "video") (eq .FieldType "richtext") (eq .FieldType "json") }} if info.{{.FieldName}} != "" { + {{- if or (eq .FieldType "enum") (eq .FieldType "string") }} db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+ {{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }}) + {{- else}} + // 数据类型为复杂类型,请根据业务需求自行实现复杂类型的查询业务 + {{- end}} } {{- else if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}} if info.Start{{.FieldName}} != nil && info.End{{.FieldName}} != nil { diff --git a/server/resource/package/web/view/form.vue.tpl b/server/resource/package/web/view/form.vue.tpl index 2ef27dcdd..cb615c51b 100644 --- a/server/resource/package/web/view/form.vue.tpl +++ b/server/resource/package/web/view/form.vue.tpl @@ -4,7 +4,8 @@
{{- range .Fields}} - + {{- if .Form }} + {{- if .CheckDataSource}} @@ -57,6 +58,7 @@ {{- end }} {{- end }} + {{- end }} {{- end }} {{ "{{ t('general.save') }}" }} @@ -110,6 +112,7 @@ const {{ $element }}Options = ref([]) {{- end }} const formData = ref({ {{- range .Fields}} + {{- if .Form }} {{- if eq .FieldType "bool" }} {{.FieldJson}}: false, {{- end }} @@ -146,6 +149,7 @@ const formData = ref({ {{- if eq .FieldType "array" }} {{.FieldJson}}: [], {{- end }} + {{- end }} {{- end }} }) // 验证规则 diff --git a/server/resource/package/web/view/table.vue.tpl b/server/resource/package/web/view/table.vue.tpl index 61cd832ac..6ee95ed0a 100644 --- a/server/resource/package/web/view/table.vue.tpl +++ b/server/resource/package/web/view/table.vue.tpl @@ -1,4 +1,4 @@ -{{- $top := . -}} +{{- $global := . }} {{ end }} - {{- range .FrontFields}} + {{- range .Fields}} + {{- if .Table}} {{- if .CheckDataSource }} +<<<<<<< HEAD {{- else }} +======= {{- end }} {{- end }} - @@ -278,8 +281,14 @@ +<<<<<<< HEAD {{- range .FrontFields}} +======= + {{- range .Fields}} + {{- if .Form}} + +>>>>>>> main {{- if .CheckDataSource}} @@ -348,8 +357,39 @@ {{- end }} {{- end }} + {{- end }} + + + + {{- range .Fields}} + {{- if .Desc }} + + {{- if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) }} + {{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}} + {{- else }} + {{- if eq .FieldType "picture" }} + + {{- end }} + {{- if eq .FieldType "pictures" }} + + {{- end }} + {{- if eq .FieldType "file" }} +
+ + + {{"{{"}}item.name{{"}}"}} + +
+ {{- end }} + {{- end }} +
+ {{- end }} + {{- end }} +
+
+
@@ -386,17 +426,29 @@ import SelectFile from '@/components/selectFile/selectFile.vue' {{- end }} // 全量引入格式化工具 请按需保留 -import { getDictFunc, formatDate, formatBoolean, filterDict ,filterDataSource, ReturnArrImg, onDownloadFile } from '@/utils/format' +import { getDictFunc, formatDate, formatBoolean, filterDict ,filterDataSource, returnArrImg, onDownloadFile } from '@/utils/format' import { ElMessage, ElMessageBox } from 'element-plus' import { ref, reactive } from 'vue' +<<<<<<< HEAD import { useI18n } from 'vue-i18n' // added by mohamed hassan to support multilanguage const i18n = useI18n() // added by mohamed hassan to support multilanguage const { t } = useI18n() // added by mohamed hassan to support multilanguage +======= +{{- if .AutoCreateBtnAuth }} +// 引入按钮权限标识 +import { useBtnAuth } from '@/utils/btnAuth' +{{- end }} +>>>>>>> main defineOptions({ name: '{{.StructName}}' }) +{{- if .AutoCreateBtnAuth }} +// 按钮权限实例化 + const btnAuth = useBtnAuth() +{{- end }} + // 控制更多查询条件显示/隐藏状态 const showAllQuery = ref(false) @@ -405,43 +457,45 @@ const showAllQuery = ref(false) const {{ $element }}Options = ref([]) {{- end }} const formData = ref({ - {{- range .FrontFields}} - {{- if eq .FieldType "bool" }} - {{.FieldJson}}: false, - {{- end }} - {{- if eq .FieldType "string" }} - {{.FieldJson}}: '', - {{- end }} - {{- if eq .FieldType "richtext" }} - {{.FieldJson}}: '', - {{- end }} - {{- if eq .FieldType "int" }} - {{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }}, - {{- end }} - {{- if eq .FieldType "time.Time" }} - {{.FieldJson}}: new Date(), - {{- end }} - {{- if eq .FieldType "float64" }} - {{.FieldJson}}: 0, - {{- end }} - {{- if eq .FieldType "picture" }} - {{.FieldJson}}: "", - {{- end }} - {{- if eq .FieldType "video" }} - {{.FieldJson}}: "", - {{- end }} - {{- if eq .FieldType "pictures" }} - {{.FieldJson}}: [], - {{- end }} - {{- if eq .FieldType "file" }} - {{.FieldJson}}: [], - {{- end }} - {{- if eq .FieldType "json" }} - {{.FieldJson}}: {}, - {{- end }} - {{- if eq .FieldType "array" }} - {{.FieldJson}}: [], - {{- end }} + {{- range .Fields}} + {{- if .Form}} + {{- if eq .FieldType "bool" }} + {{.FieldJson}}: false, + {{- end }} + {{- if eq .FieldType "string" }} + {{.FieldJson}}: '', + {{- end }} + {{- if eq .FieldType "richtext" }} + {{.FieldJson}}: '', + {{- end }} + {{- if eq .FieldType "int" }} + {{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }}, + {{- end }} + {{- if eq .FieldType "time.Time" }} + {{.FieldJson}}: new Date(), + {{- end }} + {{- if eq .FieldType "float64" }} + {{.FieldJson}}: 0, + {{- end }} + {{- if eq .FieldType "picture" }} + {{.FieldJson}}: "", + {{- end }} + {{- if eq .FieldType "video" }} + {{.FieldJson}}: "", + {{- end }} + {{- if eq .FieldType "pictures" }} + {{.FieldJson}}: [], + {{- end }} + {{- if eq .FieldType "file" }} + {{.FieldJson}}: [], + {{- end }} + {{- if eq .FieldType "json" }} + {{.FieldJson}}: {}, + {{- end }} + {{- if eq .FieldType "array" }} + {{.FieldJson}}: [], + {{- end }} + {{- end }} {{- end }} }) @@ -460,7 +514,8 @@ const formData = ref({ // 验证规则 const rule = reactive({ - {{- range .FrontFields }} + {{- range .Fields }} + {{- if .Form }} {{- if eq .Require true }} {{.FieldJson }} : [{ required: true, @@ -476,6 +531,7 @@ const rule = reactive({ {{- end }} ], {{- end }} + {{- end }} {{- end }} }) @@ -493,7 +549,7 @@ const searchRule = reactive({ } }, trigger: 'change' } ], - {{- range .FrontFields }} + {{- range .Fields }} {{- if .FieldSearchType}} {{- if eq .FieldType "time.Time" }} {{.FieldJson }} : [{ validator: (rule, value, callback) => { @@ -526,12 +582,14 @@ const searchInfo = ref({}) // 排序 const sortChange = ({ prop, order }) => { const sortMap = { - {{- range .FrontFields}} + {{- range .Fields}} + {{- if .Table}} {{- if and .Sort}} {{- if not (eq .ColumnName "")}} {{.FieldJson}}: '{{.ColumnName}}', {{- end}} {{- end}} + {{- end}} {{- end}} } @@ -558,7 +616,7 @@ const onSubmit = () => { if (!valid) return page.value = 1 pageSize.value = 10 - {{- range .FrontFields}}{{- if eq .FieldType "bool" }} + {{- range .Fields}}{{- if eq .FieldType "bool" }} if (searchInfo.value.{{.FieldJson}} === ""){ searchInfo.value.{{.FieldJson}}=null }{{ end }}{{ end }} @@ -697,7 +755,8 @@ const openDialog = () => { const closeDialog = () => { dialogFormVisible.value = false formData.value = { - {{- range .FrontFields}} + {{- range .Fields}} + {{- if .Form}} {{- if eq .FieldType "bool" }} {{.FieldJson}}: false, {{- end }} @@ -731,7 +790,8 @@ const closeDialog = () => { {{- if eq .FieldType "json" }} {{.FieldJson}}: {}, {{- end }} - {{- end }} + {{- end }} + {{- end }} } } // 弹窗确定 @@ -765,6 +825,37 @@ const downloadFile = (url) => { window.open(getUrl(url), '_blank') } {{end}} + +const detailFrom = ref({}) + +// 查看详情控制标记 +const detailShow = ref(false) + + +// 打开详情弹窗 +const openDetailShow = () => { + detailShow.value = true +} + + +// 打开详情 +const getDetails = async (row) => { + // 打开弹窗 + const res = await find{{.StructName}}({ {{.PrimaryField.FieldJson}}: row.{{.PrimaryField.FieldJson}} }) + if (res.code === 0) { + detailFrom.value = res.data + openDetailShow() + } +} + + +// 关闭详情弹窗 +const closeDetailShow = () => { + detailShow.value = false + detailFrom.value = {} +} + + diff --git a/web/src/view/layout/aside/combinationMode.vue b/web/src/view/layout/aside/combinationMode.vue index 49484bccf..f8a934188 100644 --- a/web/src/view/layout/aside/combinationMode.vue +++ b/web/src/view/layout/aside/combinationMode.vue @@ -1,10 +1,10 @@