发布v2.7.8Beta1 (#1957)
* beta:2.7.8-a 增加自动化创建树形结构 (#1941) * feat: 支持创建树形结构 --------- Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com> * 优化user store部分写法 * Update user.js * feat: 升级版本号 * Dev 278 beta2 (#1954) * 在关闭详情弹窗后 detailFrom为空对象,arr为undefined 使用slice控制台会报错 * 查询不重置pageSize * 优化主题模式相关内容 * 优化弹窗手机端显示 * bugfix:PostgreSQL initdb (#1953) * bugfix:postgresql增加显示指定template --------- Co-authored-by: PiexlMax(奇淼 <165128580+pixelmaxQm@users.noreply.github.com> --------- Co-authored-by: zayn <972858472@qq.com> Co-authored-by: Azir <2075125282@qq.com> Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com> * docs:调整部分代码注释以及代码格式 * feat: 自动化代码字典支持多选 * fix:调整值接收器和指针接收器 * feat: 支持导出表格复制,优化增加方法页面。 * chore:初始化代码规范化。 --------- Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com> Co-authored-by: Azir <2075125282@qq.com> Co-authored-by: zayn <972858472@qq.com> Co-authored-by: Qing Liang <106448173+xue-ding-e@users.noreply.github.com> Co-authored-by: cjb <75364055@qq.com>
This commit is contained in:
parent
80c54ad890
commit
283143e1bf
|
|
@ -70,7 +70,7 @@ func (a *AutoCodePluginApi) Packaged(c *gin.Context) {
|
||||||
response.OkWithMessage(fmt.Sprintf("打包成功,文件路径为:%s", zipPath), c)
|
response.OkWithMessage(fmt.Sprintf("打包成功,文件路径为:%s", zipPath), c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Packaged
|
// InitMenu
|
||||||
// @Tags AutoCodePlugin
|
// @Tags AutoCodePlugin
|
||||||
// @Summary 打包插件
|
// @Summary 打包插件
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
|
|
@ -94,7 +94,7 @@ func (a *AutoCodePluginApi) InitMenu(c *gin.Context) {
|
||||||
response.OkWithMessage("文件变更成功", c)
|
response.OkWithMessage("文件变更成功", c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Packaged
|
// InitAPI
|
||||||
// @Tags AutoCodePlugin
|
// @Tags AutoCodePlugin
|
||||||
// @Summary 打包插件
|
// @Summary 打包插件
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ func (a *AutoCodeTemplateApi) Create(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create
|
// AddFunc
|
||||||
// @Tags AddFunc
|
// @Tags AddFunc
|
||||||
// @Summary 增加方法
|
// @Summary 增加方法
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ func RunWindowsServer() {
|
||||||
|
|
||||||
fmt.Printf(`
|
fmt.Printf(`
|
||||||
欢迎使用 gin-vue-admin
|
欢迎使用 gin-vue-admin
|
||||||
当前版本:v2.7.7
|
当前版本:v2.7.8-beta1
|
||||||
加群方式:微信号:shouzi_1994 QQ群:470239250
|
加群方式:微信号:shouzi_1994 QQ群:470239250
|
||||||
项目地址:https://github.com/flipped-aurora/gin-vue-admin
|
项目地址:https://github.com/flipped-aurora/gin-vue-admin
|
||||||
插件市场:https://plugin.gin-vue-admin.com
|
插件市场:https://plugin.gin-vue-admin.com
|
||||||
|
|
|
||||||
1029
server/docs/docs.go
1029
server/docs/docs.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,7 @@
|
||||||
definitions:
|
definitions:
|
||||||
|
common.JSONMap:
|
||||||
|
additionalProperties: true
|
||||||
|
type: object
|
||||||
config.AliyunOSS:
|
config.AliyunOSS:
|
||||||
properties:
|
properties:
|
||||||
access-key-id:
|
access-key-id:
|
||||||
|
|
@ -150,6 +153,23 @@ definitions:
|
||||||
description: 本地文件存储路径
|
description: 本地文件存储路径
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
config.Minio:
|
||||||
|
properties:
|
||||||
|
access-key-id:
|
||||||
|
type: string
|
||||||
|
access-key-secret:
|
||||||
|
type: string
|
||||||
|
base-path:
|
||||||
|
type: string
|
||||||
|
bucket-name:
|
||||||
|
type: string
|
||||||
|
bucket-url:
|
||||||
|
type: string
|
||||||
|
endpoint:
|
||||||
|
type: string
|
||||||
|
use-ssl:
|
||||||
|
type: boolean
|
||||||
|
type: object
|
||||||
config.Mongo:
|
config.Mongo:
|
||||||
properties:
|
properties:
|
||||||
auth-source:
|
auth-source:
|
||||||
|
|
@ -409,6 +429,9 @@ definitions:
|
||||||
db:
|
db:
|
||||||
description: 单实例模式下redis的哪个数据库
|
description: 单实例模式下redis的哪个数据库
|
||||||
type: integer
|
type: integer
|
||||||
|
name:
|
||||||
|
description: 代表当前实例的名字
|
||||||
|
type: string
|
||||||
password:
|
password:
|
||||||
description: 密码
|
description: 密码
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -454,6 +477,8 @@ definitions:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/definitions/config.Local'
|
- $ref: '#/definitions/config.Local'
|
||||||
description: oss
|
description: oss
|
||||||
|
minio:
|
||||||
|
$ref: '#/definitions/config.Minio'
|
||||||
mongo:
|
mongo:
|
||||||
$ref: '#/definitions/config.Mongo'
|
$ref: '#/definitions/config.Mongo'
|
||||||
mssql:
|
mssql:
|
||||||
|
|
@ -470,6 +495,10 @@ definitions:
|
||||||
$ref: '#/definitions/config.Qiniu'
|
$ref: '#/definitions/config.Qiniu'
|
||||||
redis:
|
redis:
|
||||||
$ref: '#/definitions/config.Redis'
|
$ref: '#/definitions/config.Redis'
|
||||||
|
redis-list:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/config.Redis'
|
||||||
|
type: array
|
||||||
sqlite:
|
sqlite:
|
||||||
$ref: '#/definitions/config.Sqlite'
|
$ref: '#/definitions/config.Sqlite'
|
||||||
system:
|
system:
|
||||||
|
|
@ -597,6 +626,9 @@ definitions:
|
||||||
use-redis:
|
use-redis:
|
||||||
description: 使用redis
|
description: 使用redis
|
||||||
type: boolean
|
type: boolean
|
||||||
|
use-strict-auth:
|
||||||
|
description: 使用树形角色分配模式
|
||||||
|
type: boolean
|
||||||
type: object
|
type: object
|
||||||
config.TencentCOS:
|
config.TencentCOS:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -800,6 +832,156 @@ definitions:
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
request.AutoCode:
|
request.AutoCode:
|
||||||
|
properties:
|
||||||
|
abbreviation:
|
||||||
|
description: Struct简称
|
||||||
|
example: Struct简称
|
||||||
|
type: string
|
||||||
|
autoCreateApiToSql:
|
||||||
|
description: 是否自动创建api
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
autoCreateBtnAuth:
|
||||||
|
description: 是否自动创建按钮权限
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
autoCreateMenuToSql:
|
||||||
|
description: 是否自动创建menu
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
autoCreateResource:
|
||||||
|
description: 是否自动创建资源标识
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
autoMigrate:
|
||||||
|
description: 是否自动迁移表结构
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
businessDB:
|
||||||
|
description: 业务数据库
|
||||||
|
example: 业务数据库
|
||||||
|
type: string
|
||||||
|
description:
|
||||||
|
description: Struct中文名称
|
||||||
|
example: Struct中文名称
|
||||||
|
type: string
|
||||||
|
fields:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/request.AutoCodeField'
|
||||||
|
type: array
|
||||||
|
gvaModel:
|
||||||
|
description: 是否使用gva默认Model
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
humpPackageName:
|
||||||
|
description: go文件名称
|
||||||
|
example: go文件名称
|
||||||
|
type: string
|
||||||
|
isAdd:
|
||||||
|
description: 是否新增
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
isTree:
|
||||||
|
description: 是否树形结构
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
onlyTemplate:
|
||||||
|
description: 是否只生成模板
|
||||||
|
example: false
|
||||||
|
type: boolean
|
||||||
|
package:
|
||||||
|
type: string
|
||||||
|
packageName:
|
||||||
|
description: 文件名称
|
||||||
|
example: 文件名称
|
||||||
|
type: string
|
||||||
|
primaryField:
|
||||||
|
$ref: '#/definitions/request.AutoCodeField'
|
||||||
|
structName:
|
||||||
|
description: Struct名称
|
||||||
|
example: Struct名称
|
||||||
|
type: string
|
||||||
|
tableName:
|
||||||
|
description: 表名
|
||||||
|
example: 表名
|
||||||
|
type: string
|
||||||
|
treeJson:
|
||||||
|
description: 展示的树json字段
|
||||||
|
example: 展示的树json字段
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
request.AutoCodeField:
|
||||||
|
properties:
|
||||||
|
checkDataSource:
|
||||||
|
description: 是否检查数据源
|
||||||
|
type: boolean
|
||||||
|
clearable:
|
||||||
|
description: 是否可清空
|
||||||
|
type: boolean
|
||||||
|
columnName:
|
||||||
|
description: 数据库字段
|
||||||
|
type: string
|
||||||
|
comment:
|
||||||
|
description: 数据库字段描述
|
||||||
|
type: string
|
||||||
|
dataSource:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/request.DataSource'
|
||||||
|
description: 数据源
|
||||||
|
dataTypeLong:
|
||||||
|
description: 数据库字段长度
|
||||||
|
type: string
|
||||||
|
defaultValue:
|
||||||
|
description: 是否必填
|
||||||
|
type: string
|
||||||
|
desc:
|
||||||
|
description: 是否前端详情
|
||||||
|
type: boolean
|
||||||
|
dictType:
|
||||||
|
description: 字典
|
||||||
|
type: string
|
||||||
|
errorText:
|
||||||
|
description: 校验失败文字
|
||||||
|
type: string
|
||||||
|
excel:
|
||||||
|
description: 是否导入/导出
|
||||||
|
type: boolean
|
||||||
|
fieldDesc:
|
||||||
|
description: 中文名
|
||||||
|
type: string
|
||||||
|
fieldIndexType:
|
||||||
|
description: 索引类型
|
||||||
|
type: string
|
||||||
|
fieldJson:
|
||||||
|
description: FieldJson
|
||||||
|
type: string
|
||||||
|
fieldName:
|
||||||
|
description: Field名
|
||||||
|
type: string
|
||||||
|
fieldSearchHide:
|
||||||
|
description: 是否隐藏查询条件
|
||||||
|
type: boolean
|
||||||
|
fieldSearchType:
|
||||||
|
description: 搜索条件
|
||||||
|
type: string
|
||||||
|
fieldType:
|
||||||
|
description: Field数据类型
|
||||||
|
type: string
|
||||||
|
form:
|
||||||
|
description: Front bool `json:"front"` // 是否前端可见
|
||||||
|
type: boolean
|
||||||
|
primaryKey:
|
||||||
|
description: 是否主键
|
||||||
|
type: boolean
|
||||||
|
require:
|
||||||
|
description: 是否必填
|
||||||
|
type: boolean
|
||||||
|
sort:
|
||||||
|
description: 是否增加排序
|
||||||
|
type: boolean
|
||||||
|
table:
|
||||||
|
description: 是否前端表格列
|
||||||
|
type: boolean
|
||||||
type: object
|
type: object
|
||||||
request.CasbinInReceive:
|
request.CasbinInReceive:
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -829,6 +1011,22 @@ definitions:
|
||||||
description: 密码
|
description: 密码
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
request.DataSource:
|
||||||
|
properties:
|
||||||
|
association:
|
||||||
|
description: 关联关系 1 一对一 2 一对多
|
||||||
|
type: integer
|
||||||
|
dbName:
|
||||||
|
type: string
|
||||||
|
hasDeletedAt:
|
||||||
|
type: boolean
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
table:
|
||||||
|
type: string
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
request.Empty:
|
request.Empty:
|
||||||
type: object
|
type: object
|
||||||
request.GetAuthorityId:
|
request.GetAuthorityId:
|
||||||
|
|
@ -843,6 +1041,26 @@ definitions:
|
||||||
description: 主键ID
|
description: 主键ID
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
request.GetUserList:
|
||||||
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
keyword:
|
||||||
|
description: 关键字
|
||||||
|
type: string
|
||||||
|
nickName:
|
||||||
|
type: string
|
||||||
|
page:
|
||||||
|
description: 页码
|
||||||
|
type: integer
|
||||||
|
pageSize:
|
||||||
|
description: 每页大小
|
||||||
|
type: integer
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
request.IdsReq:
|
request.IdsReq:
|
||||||
properties:
|
properties:
|
||||||
ids:
|
ids:
|
||||||
|
|
@ -1577,23 +1795,51 @@ definitions:
|
||||||
description: 用户id
|
description: 用户id
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
system.SysParams:
|
||||||
|
properties:
|
||||||
|
ID:
|
||||||
|
description: 主键ID
|
||||||
|
type: integer
|
||||||
|
createdAt:
|
||||||
|
description: 创建时间
|
||||||
|
type: string
|
||||||
|
desc:
|
||||||
|
description: 参数说明
|
||||||
|
type: string
|
||||||
|
key:
|
||||||
|
description: 参数键
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
description: 参数名称
|
||||||
|
type: string
|
||||||
|
updatedAt:
|
||||||
|
description: 更新时间
|
||||||
|
type: string
|
||||||
|
value:
|
||||||
|
description: 参数值
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
- name
|
||||||
|
- value
|
||||||
|
type: object
|
||||||
system.SysUser:
|
system.SysUser:
|
||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
description: 主键ID
|
description: 主键ID
|
||||||
type: integer
|
type: integer
|
||||||
authorities:
|
authorities:
|
||||||
|
description: 多用户角色
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/system.SysAuthority'
|
$ref: '#/definitions/system.SysAuthority'
|
||||||
type: array
|
type: array
|
||||||
authority:
|
authority:
|
||||||
$ref: '#/definitions/system.SysAuthority'
|
allOf:
|
||||||
|
- $ref: '#/definitions/system.SysAuthority'
|
||||||
|
description: 用户角色
|
||||||
authorityId:
|
authorityId:
|
||||||
description: 用户角色ID
|
description: 用户角色ID
|
||||||
type: integer
|
type: integer
|
||||||
baseColor:
|
|
||||||
description: 基础颜色
|
|
||||||
type: string
|
|
||||||
createdAt:
|
createdAt:
|
||||||
description: 创建时间
|
description: 创建时间
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -1609,12 +1855,13 @@ definitions:
|
||||||
nickName:
|
nickName:
|
||||||
description: 用户昵称
|
description: 用户昵称
|
||||||
type: string
|
type: string
|
||||||
|
originSetting:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/common.JSONMap'
|
||||||
|
description: 配置
|
||||||
phone:
|
phone:
|
||||||
description: 用户手机号
|
description: 用户手机号
|
||||||
type: string
|
type: string
|
||||||
sideMode:
|
|
||||||
description: 用户侧边主题
|
|
||||||
type: string
|
|
||||||
updatedAt:
|
updatedAt:
|
||||||
description: 更新时间
|
description: 更新时间
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -1634,7 +1881,7 @@ info:
|
||||||
contact: {}
|
contact: {}
|
||||||
description: 使用gin+vue进行极速开发的全栈开发基础平台
|
description: 使用gin+vue进行极速开发的全栈开发基础平台
|
||||||
title: Gin-Vue-Admin Swagger API接口文档
|
title: Gin-Vue-Admin Swagger API接口文档
|
||||||
version: v2.7.7
|
version: v2.7.8-beta1
|
||||||
paths:
|
paths:
|
||||||
/api/createApi:
|
/api/createApi:
|
||||||
post:
|
post:
|
||||||
|
|
@ -1812,7 +2059,7 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- SysApi
|
- SysApi
|
||||||
/api/getApiGroups:
|
/api/getApiGroups:
|
||||||
post:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
produces:
|
produces:
|
||||||
|
|
@ -2079,7 +2326,7 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- Authority
|
- Authority
|
||||||
/authority/updateAuthority:
|
/authority/updateAuthority:
|
||||||
post:
|
put:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
parameters:
|
parameters:
|
||||||
|
|
@ -2347,7 +2594,7 @@ paths:
|
||||||
summary: 获取当前表所有字段
|
summary: 获取当前表所有字段
|
||||||
tags:
|
tags:
|
||||||
- AutoCode
|
- AutoCode
|
||||||
/autoCode/getDatabase:
|
/autoCode/getDB:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -2504,6 +2751,54 @@ paths:
|
||||||
summary: 获取package
|
summary: 获取package
|
||||||
tags:
|
tags:
|
||||||
- AutoCodePackage
|
- AutoCodePackage
|
||||||
|
/autoCode/initAPI:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 打包插件成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
additionalProperties: true
|
||||||
|
type: object
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 打包插件
|
||||||
|
tags:
|
||||||
|
- AutoCodePlugin
|
||||||
|
/autoCode/initMenu:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 打包插件成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
additionalProperties: true
|
||||||
|
type: object
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 打包插件
|
||||||
|
tags:
|
||||||
|
- AutoCodePlugin
|
||||||
/autoCode/installPlugin:
|
/autoCode/installPlugin:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
|
|
@ -2567,7 +2862,7 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- AutoCodeTemplate
|
- AutoCodeTemplate
|
||||||
/autoCode/pubPlug:
|
/autoCode/pubPlug:
|
||||||
get:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
parameters:
|
parameters:
|
||||||
|
|
@ -2989,6 +3284,34 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- ExaFileUploadAndDownload
|
- ExaFileUploadAndDownload
|
||||||
/fileUploadAndDownload/findFile:
|
/fileUploadAndDownload/findFile:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- multipart/form-data
|
||||||
|
parameters:
|
||||||
|
- description: Find the file, 查找文件
|
||||||
|
in: formData
|
||||||
|
name: file
|
||||||
|
required: true
|
||||||
|
type: file
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 查找文件,返回包括文件详情
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/response.FileResponse'
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 查找文件
|
||||||
|
tags:
|
||||||
|
- ExaFileUploadAndDownload
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- multipart/form-data
|
- multipart/form-data
|
||||||
|
|
@ -3047,6 +3370,32 @@ paths:
|
||||||
summary: 分页文件列表
|
summary: 分页文件列表
|
||||||
tags:
|
tags:
|
||||||
- ExaFileUploadAndDownload
|
- ExaFileUploadAndDownload
|
||||||
|
/fileUploadAndDownload/importURL:
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- description: 对象
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/example.ExaFileUploadAndDownload'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 导入URL
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 导入URL
|
||||||
|
tags:
|
||||||
|
- ExaFileUploadAndDownload
|
||||||
/fileUploadAndDownload/removeChunk:
|
/fileUploadAndDownload/removeChunk:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
|
|
@ -4553,6 +4902,243 @@ paths:
|
||||||
summary: 分页获取SysOperationRecord列表
|
summary: 分页获取SysOperationRecord列表
|
||||||
tags:
|
tags:
|
||||||
- SysOperationRecord
|
- SysOperationRecord
|
||||||
|
/sysParams/createSysParams:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: 创建参数
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/system.SysParams'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 创建成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 创建参数
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/deleteSysParams:
|
||||||
|
delete:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: 删除参数
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/system.SysParams'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 删除成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 删除参数
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/deleteSysParamsByIds:
|
||||||
|
delete:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 批量删除成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 批量删除参数
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/findSysParams:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: 主键ID
|
||||||
|
in: query
|
||||||
|
name: ID
|
||||||
|
type: integer
|
||||||
|
- description: 创建时间
|
||||||
|
in: query
|
||||||
|
name: createdAt
|
||||||
|
type: string
|
||||||
|
- description: 参数说明
|
||||||
|
in: query
|
||||||
|
name: desc
|
||||||
|
type: string
|
||||||
|
- description: 参数键
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 参数名称
|
||||||
|
in: query
|
||||||
|
name: name
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 更新时间
|
||||||
|
in: query
|
||||||
|
name: updatedAt
|
||||||
|
type: string
|
||||||
|
- description: 参数值
|
||||||
|
in: query
|
||||||
|
name: value
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 查询成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/system.SysParams'
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 用id查询参数
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/getSysParam:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: key
|
||||||
|
in: query
|
||||||
|
name: key
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 获取成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/system.SysParams'
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 根据key获取参数value
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/getSysParamsList:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: endCreatedAt
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: key
|
||||||
|
type: string
|
||||||
|
- description: 关键字
|
||||||
|
in: query
|
||||||
|
name: keyword
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: name
|
||||||
|
type: string
|
||||||
|
- description: 页码
|
||||||
|
in: query
|
||||||
|
name: page
|
||||||
|
type: integer
|
||||||
|
- description: 每页大小
|
||||||
|
in: query
|
||||||
|
name: pageSize
|
||||||
|
type: integer
|
||||||
|
- in: query
|
||||||
|
name: startCreatedAt
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 获取成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/response.PageResult'
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 分页获取参数列表
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
|
/sysParams/updateSysParams:
|
||||||
|
put:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: 更新参数
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/system.SysParams'
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 更新成功
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 更新参数
|
||||||
|
tags:
|
||||||
|
- SysParams
|
||||||
/system/getServerInfo:
|
/system/getServerInfo:
|
||||||
post:
|
post:
|
||||||
produces:
|
produces:
|
||||||
|
|
@ -4672,6 +5258,38 @@ paths:
|
||||||
summary: 设置用户信息
|
summary: 设置用户信息
|
||||||
tags:
|
tags:
|
||||||
- SysUser
|
- SysUser
|
||||||
|
/user/SetSelfSetting:
|
||||||
|
put:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
parameters:
|
||||||
|
- description: 用户配置数据
|
||||||
|
in: body
|
||||||
|
name: data
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
additionalProperties: true
|
||||||
|
type: object
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: 设置用户配置
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/response.Response'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
additionalProperties: true
|
||||||
|
type: object
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: 设置用户配置
|
||||||
|
tags:
|
||||||
|
- SysUser
|
||||||
/user/admin_register:
|
/user/admin_register:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
|
|
@ -4786,7 +5404,7 @@ paths:
|
||||||
name: data
|
name: data
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/request.PageInfo'
|
$ref: '#/definitions/request.GetUserList'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ func init() {
|
||||||
system.RegisterInit(initOrderEnsureTables, &ensureTables{})
|
system.RegisterInit(initOrderEnsureTables, &ensureTables{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ensureTables) InitializerName() string {
|
func (e *ensureTables) InitializerName() string {
|
||||||
return "ensure_tables_created"
|
return "ensure_tables_created"
|
||||||
}
|
}
|
||||||
func (e *ensureTables) InitializeData(ctx context.Context) (next context.Context, err error) {
|
func (e *ensureTables) InitializeData(ctx context.Context) (next context.Context, err error) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
package initialize
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author: 逆光飞翔 191180776@qq.com
|
* @Author: 逆光飞翔 191180776@qq.com
|
||||||
* @Date: 2022-12-08 17:25:49
|
* @Date: 2022-12-08 17:25:49
|
||||||
|
|
@ -6,7 +8,6 @@
|
||||||
* @FilePath: \server\initialize\gorm_mssql.go
|
* @FilePath: \server\initialize\gorm_mssql.go
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
package initialize
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/flipped-aurora/gin-vue-admin/server/config"
|
"github.com/flipped-aurora/gin-vue-admin/server/config"
|
||||||
|
|
@ -44,8 +45,8 @@ func GormMssqlByConfig(m config.Mssql) *gorm.DB {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
mssqlConfig := sqlserver.Config{
|
mssqlConfig := sqlserver.Config{
|
||||||
DSN: m.Dsn(), // DSN data source name
|
DSN: m.Dsn(), // DSN data source name
|
||||||
DefaultStringSize: 191, // string 类型字段的默认长度
|
DefaultStringSize: 191, // string 类型字段的默认长度
|
||||||
}
|
}
|
||||||
if db, err := gorm.Open(sqlserver.New(mssqlConfig), internal.Gorm.Config(m.Prefix, m.Singular)); err != nil {
|
if db, err := gorm.Open(sqlserver.New(mssqlConfig), internal.Gorm.Config(m.Prefix, m.Singular)); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
//go:generate go mod download
|
//go:generate go mod download
|
||||||
|
|
||||||
// @title Gin-Vue-Admin Swagger API接口文档
|
// @title Gin-Vue-Admin Swagger API接口文档
|
||||||
// @version v2.7.7
|
// @version v2.7.8-beta1
|
||||||
// @description 使用gin+vue进行极速开发的全栈开发基础平台
|
// @description 使用gin+vue进行极速开发的全栈开发基础平台
|
||||||
// @securityDefinitions.apikey ApiKeyAuth
|
// @securityDefinitions.apikey ApiKeyAuth
|
||||||
// @in header
|
// @in header
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,10 @@ func (m *JSONMap) Scan(value interface{}) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TreeNode[T any] interface {
|
||||||
|
GetChildren() []T
|
||||||
|
SetChildren(children T)
|
||||||
|
GetID() int
|
||||||
|
GetParentID() int
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ type AutoCode struct {
|
||||||
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu
|
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu
|
||||||
AutoCreateBtnAuth bool `json:"autoCreateBtnAuth" example:"false"` // 是否自动创建按钮权限
|
AutoCreateBtnAuth bool `json:"autoCreateBtnAuth" example:"false"` // 是否自动创建按钮权限
|
||||||
OnlyTemplate bool `json:"onlyTemplate" example:"false"` // 是否只生成模板
|
OnlyTemplate bool `json:"onlyTemplate" example:"false"` // 是否只生成模板
|
||||||
|
IsTree bool `json:"isTree" example:"false"` // 是否树形结构
|
||||||
|
TreeJson string `json:"treeJson" example:"展示的树json字段"` // 展示的树json字段
|
||||||
IsAdd bool `json:"isAdd" example:"false"` // 是否新增
|
IsAdd bool `json:"isAdd" example:"false"` // 是否新增
|
||||||
Fields []*AutoCodeField `json:"fields"`
|
Fields []*AutoCodeField `json:"fields"`
|
||||||
Module string `json:"-"`
|
Module string `json:"-"`
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package request
|
package request
|
||||||
|
|
||||||
// Casbin info structure
|
// CasbinInfo Casbin info structure
|
||||||
type CasbinInfo struct {
|
type CasbinInfo struct {
|
||||||
Path string `json:"path"` // 路径
|
Path string `json:"path"` // 路径
|
||||||
Method string `json:"method"` // 方法
|
Method string `json:"method"` // 方法
|
||||||
}
|
}
|
||||||
|
|
||||||
// Casbin structure for input parameters
|
// CasbinInReceive Casbin structure for input parameters
|
||||||
type CasbinInReceive struct {
|
type CasbinInReceive struct {
|
||||||
AuthorityId uint `json:"authorityId"` // 权限id
|
AuthorityId uint `json:"authorityId"` // 权限id
|
||||||
CasbinInfos []CasbinInfo `json:"casbinInfos"`
|
CasbinInfos []CasbinInfo `json:"casbinInfos"`
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ type InitDB struct {
|
||||||
Password string `json:"password"` // 数据库密码
|
Password string `json:"password"` // 数据库密码
|
||||||
DBName string `json:"dbName" binding:"required"` // 数据库名
|
DBName string `json:"dbName" binding:"required"` // 数据库名
|
||||||
DBPath string `json:"dbPath"` // sqlite数据库文件路径
|
DBPath string `json:"dbPath"` // sqlite数据库文件路径
|
||||||
|
Template string `json:"template"` // postgresql指定template
|
||||||
}
|
}
|
||||||
|
|
||||||
// MysqlEmptyDsn msyql 空数据库 建库链接
|
// MysqlEmptyDsn msyql 空数据库 建库链接
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add menu authority info structure
|
// AddMenuAuthorityInfo Add menu authority info structure
|
||||||
type AddMenuAuthorityInfo struct {
|
type AddMenuAuthorityInfo struct {
|
||||||
Menus []system.SysBaseMenu `json:"menus"`
|
Menus []system.SysBaseMenu `json:"menus"`
|
||||||
AuthorityId uint `json:"authorityId"` // 角色ID
|
AuthorityId uint `json:"authorityId"` // 角色ID
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ type Register struct {
|
||||||
Email string `json:"email" example:"电子邮箱"`
|
Email string `json:"email" example:"电子邮箱"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// User login structure
|
// Login User login structure
|
||||||
type Login struct {
|
type Login struct {
|
||||||
Username string `json:"username"` // 用户名
|
Username string `json:"username"` // 用户名
|
||||||
Password string `json:"password"` // 密码
|
Password string `json:"password"` // 密码
|
||||||
|
|
@ -26,19 +26,19 @@ type Login struct {
|
||||||
CaptchaId string `json:"captchaId"` // 验证码ID
|
CaptchaId string `json:"captchaId"` // 验证码ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify password structure
|
// ChangePasswordReq Modify password structure
|
||||||
type ChangePasswordReq struct {
|
type ChangePasswordReq struct {
|
||||||
ID uint `json:"-"` // 从 JWT 中提取 user id,避免越权
|
ID uint `json:"-"` // 从 JWT 中提取 user id,避免越权
|
||||||
Password string `json:"password"` // 密码
|
Password string `json:"password"` // 密码
|
||||||
NewPassword string `json:"newPassword"` // 新密码
|
NewPassword string `json:"newPassword"` // 新密码
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify user's auth structure
|
// SetUserAuth Modify user's auth structure
|
||||||
type SetUserAuth struct {
|
type SetUserAuth struct {
|
||||||
AuthorityId uint `json:"authorityId"` // 角色ID
|
AuthorityId uint `json:"authorityId"` // 角色ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify user's auth structure
|
// SetUserAuthorities Modify user's auth structure
|
||||||
type SetUserAuthorities struct {
|
type SetUserAuthorities struct {
|
||||||
ID uint
|
ID uint
|
||||||
AuthorityIds []uint `json:"authorityIds"` // 角色ID
|
AuthorityIds []uint `json:"authorityIds"` // 角色ID
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import (
|
||||||
"{{.Module}}/global"
|
"{{.Module}}/global"
|
||||||
"{{.Module}}/model/common/response"
|
"{{.Module}}/model/common/response"
|
||||||
"{{.Module}}/model/{{.Package}}"
|
"{{.Module}}/model/{{.Package}}"
|
||||||
|
{{- if not .IsTree}}
|
||||||
{{.Package}}Req "{{.Module}}/model/{{.Package}}/request"
|
{{.Package}}Req "{{.Module}}/model/{{.Package}}/request"
|
||||||
|
{{- end }}
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
{{- if .AutoCreateResource}}
|
{{- if .AutoCreateResource}}
|
||||||
|
|
@ -142,6 +144,25 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
|
||||||
response.OkWithData(re{{.Abbreviation}}, c)
|
response.OkWithData(re{{.Abbreviation}}, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
// Get{{.StructName}}List 分页获取{{.Description}}列表,Tree模式下不接受参数
|
||||||
|
// @Tags {{.StructName}}
|
||||||
|
// @Summary 分页获取{{.Description}}列表
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @accept application/json
|
||||||
|
// @Produce application/json
|
||||||
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
|
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
||||||
|
func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Context) {
|
||||||
|
list, err := {{.Abbreviation}}Service.Get{{.StructName}}InfoList()
|
||||||
|
if err != nil {
|
||||||
|
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||||
|
response.FailWithMessage("获取失败:" + err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response.OkWithDetailed(list, "获取成功", c)
|
||||||
|
}
|
||||||
|
{{- else }}
|
||||||
// Get{{.StructName}}List 分页获取{{.Description}}列表
|
// Get{{.StructName}}List 分页获取{{.Description}}列表
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
|
|
@ -171,6 +192,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
|
||||||
PageSize: pageInfo.PageSize,
|
PageSize: pageInfo.PageSize,
|
||||||
}, "获取成功", c)
|
}, "获取成功", c)
|
||||||
}
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
||||||
|
|
@ -199,7 +221,6 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}DataSource(c *
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||||
func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}Public(c *gin.Context) {
|
func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}Public(c *gin.Context) {
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ type {{.StructName}} struct {
|
||||||
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
|
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
|
||||||
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
|
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .IsTree }}
|
||||||
|
Children []*{{.StructName}} `json:"children" gorm:"-"` //子节点
|
||||||
|
ParentID int `json:"parentID" gorm:"column:parent_id;comment:父节点"`
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,5 +86,26 @@ func ({{.StructName}}) TableName() string {
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{if .IsTree }}
|
||||||
|
// GetChildren 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetChildren() []*{{.StructName}} {
|
||||||
|
return s.Children
|
||||||
|
}
|
||||||
|
|
||||||
{{ end }}
|
// SetChildren 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) SetChildren(children *{{.StructName}}) {
|
||||||
|
s.Children = append(s.Children, children)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetID 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetID() int {
|
||||||
|
return int({{if not .GvaModel}}*{{- end }}s.{{.PrimaryField.FieldName}})
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetParentID 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetParentID() int {
|
||||||
|
return s.ParentID
|
||||||
|
}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,12 @@ import (
|
||||||
{{- if not .OnlyTemplate }}
|
{{- if not .OnlyTemplate }}
|
||||||
"{{.Module}}/global"
|
"{{.Module}}/global"
|
||||||
"{{.Module}}/model/{{.Package}}"
|
"{{.Module}}/model/{{.Package}}"
|
||||||
|
{{- if not .IsTree}}
|
||||||
{{.Package}}Req "{{.Module}}/model/{{.Package}}/request"
|
{{.Package}}Req "{{.Module}}/model/{{.Package}}/request"
|
||||||
|
{{- else }}
|
||||||
|
"{{.Module}}/utils"
|
||||||
|
"errors"
|
||||||
|
{{- end }}
|
||||||
{{- if .AutoCreateResource }}
|
{{- if .AutoCreateResource }}
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
@ -80,6 +85,17 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service) Create{{.StructName}}({{
|
||||||
// Delete{{.StructName}} 删除{{.Description}}记录
|
// Delete{{.StructName}} 删除{{.Description}}记录
|
||||||
// Author [yourname](https://github.com/yourname)
|
// Author [yourname](https://github.com/yourname)
|
||||||
func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
|
func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
|
||||||
|
{{- if .IsTree }}
|
||||||
|
var count int64
|
||||||
|
err = {{$db}}.Find(&{{.Package}}.{{.StructName}}{},"parent_id = ?",{{.PrimaryField.FieldJson}}).Count(&count).Error
|
||||||
|
if count > 0 {
|
||||||
|
return errors.New("此节点存在子节点不允许删除")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if .AutoCreateResource }}
|
{{- if .AutoCreateResource }}
|
||||||
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
|
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
|
||||||
if err := tx.Model(&{{.Package}}.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).Update("deleted_by", userID).Error; err != nil {
|
if err := tx.Model(&{{.Package}}.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).Update("deleted_by", userID).Error; err != nil {
|
||||||
|
|
@ -129,6 +145,20 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}({{.Pri
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录,Tree模式下不添加分页和搜索
|
||||||
|
// Author [yourname](https://github.com/yourname)
|
||||||
|
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList() (list []*{{.Package}}.{{.StructName}},err error) {
|
||||||
|
// 创建db
|
||||||
|
db := {{$db}}.Model(&{{.Package}}.{{.StructName}}{})
|
||||||
|
var {{.Abbreviation}}s []*{{.Package}}.{{.StructName}}
|
||||||
|
|
||||||
|
err = db.Find(&{{.Abbreviation}}s).Error
|
||||||
|
|
||||||
|
return utils.BuildTree({{.Abbreviation}}s), err
|
||||||
|
}
|
||||||
|
{{- else }}
|
||||||
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
|
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
|
||||||
// Author [yourname](https://github.com/yourname)
|
// Author [yourname](https://github.com/yourname)
|
||||||
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList(info {{.Package}}Req.{{.StructName}}Search) (list []{{.Package}}.{{.StructName}}, total int64, err error) {
|
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList(info {{.Package}}Req.{{.StructName}}Search) (list []{{.Package}}.{{.StructName}}, total int64, err error) {
|
||||||
|
|
@ -193,6 +223,8 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoLis
|
||||||
return {{.Abbreviation}}s, total, err
|
return {{.Abbreviation}}s, total, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}DataSource() (res map[string][]map[string]any, err error) {
|
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}DataSource() (res map[string][]map[string]any, err error) {
|
||||||
res = make(map[string][]map[string]any)
|
res = make(map[string][]map[string]any)
|
||||||
|
|
@ -215,4 +247,4 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}Public(
|
||||||
// 此方法为获取数据源定义的数据
|
// 此方法为获取数据源定义的数据
|
||||||
// 请自行实现
|
// 请自行实现
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "string" }}
|
{{- if eq .FieldType "string" }}
|
||||||
{{- if .DictType}}
|
{{- if .DictType}}
|
||||||
<el-select v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
@ -95,7 +95,7 @@ const {{ $element }}Options = ref([])
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if or .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -165,6 +165,20 @@ getDataSourceFunc()
|
||||||
<div>
|
<div>
|
||||||
<div class="gva-form-box">
|
<div class="gva-form-box">
|
||||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-form-item label="父节点:" prop="parentID" >
|
||||||
|
<el-tree-select
|
||||||
|
v-model="formData.parentID"
|
||||||
|
:data="[rootNode,...tableData]"
|
||||||
|
check-strictly
|
||||||
|
:render-after-expand="false"
|
||||||
|
:props="defaultProps"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
placeholder="根节点"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form }}
|
{{- if .Form }}
|
||||||
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}">
|
||||||
|
|
@ -178,7 +192,7 @@ getDataSourceFunc()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "string" }}
|
{{- if eq .FieldType "string" }}
|
||||||
{{- if .DictType}}
|
{{- if .DictType}}
|
||||||
<el-select v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
@ -239,6 +253,9 @@ import {
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
get{{.StructName}}DataSource,
|
get{{.StructName}}DataSource,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .IsTree }}
|
||||||
|
get{{.StructName}}List,
|
||||||
|
{{- end }}
|
||||||
create{{.StructName}},
|
create{{.StructName}},
|
||||||
update{{.StructName}},
|
update{{.StructName}},
|
||||||
find{{.StructName}}
|
find{{.StructName}}
|
||||||
|
|
@ -277,6 +294,32 @@ import ArrayCtrl from '@/components/arrayCtrl/arrayCtrl.vue'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
const tableData = ref([])
|
||||||
|
|
||||||
|
const defaultProps = {
|
||||||
|
children: "children",
|
||||||
|
label: "{{ .TreeJson }}",
|
||||||
|
value: "{{ .PrimaryField.FieldJson }}"
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootNode = {
|
||||||
|
{{ .PrimaryField.FieldJson }}: 0,
|
||||||
|
{{ .TreeJson }}: '根节点',
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTableData = async() => {
|
||||||
|
const table = await get{{.StructName}}List()
|
||||||
|
if (table.code === 0) {
|
||||||
|
tableData.value = table.data || []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTableData()
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
// 提交按钮loading
|
// 提交按钮loading
|
||||||
const btnLoading = ref(false)
|
const btnLoading = ref(false)
|
||||||
|
|
||||||
|
|
@ -285,6 +328,9 @@ const type = ref('')
|
||||||
const {{ $element }}Options = ref([])
|
const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
|
{{- if .IsTree }}
|
||||||
|
parentID: undefined,
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form }}
|
{{- if .Form }}
|
||||||
{{- if eq .FieldType "bool" }}
|
{{- if eq .FieldType "bool" }}
|
||||||
|
|
@ -297,7 +343,7 @@ const formData = ref({
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if or .DataSource }} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -37,13 +37,7 @@
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -86,7 +80,11 @@
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in scope.row.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else if eq .FieldType "bool" }}
|
{{- else if eq .FieldType "bool" }}
|
||||||
|
|
@ -183,8 +181,14 @@
|
||||||
// 此字段为json结构,可以前端自行控制展示和数据绑定模式 需绑定json的key为 formData.{{.FieldJson}} 后端会按照json的类型进行存取
|
// 此字段为json结构,可以前端自行控制展示和数据绑定模式 需绑定json的key为 formData.{{.FieldJson}} 后端会按照json的类型进行存取
|
||||||
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
|
{{- if .DictType}}
|
||||||
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
{{- else }}
|
||||||
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
||||||
|
|
@ -291,7 +295,7 @@ const {{ $element }}Options = ref([])
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -363,6 +367,7 @@ getDataSourceFunc()
|
||||||
{{- if not .OnlyTemplate}}
|
{{- if not .OnlyTemplate}}
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
{{- if not .IsTree }}
|
||||||
<div class="gva-search-box">
|
<div class="gva-search-box">
|
||||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
||||||
{{- if .GvaModel }}
|
{{- if .GvaModel }}
|
||||||
|
|
@ -397,7 +402,7 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}} multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -415,13 +420,7 @@ getDataSourceFunc()
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -463,7 +462,7 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -475,13 +474,7 @@ getDataSourceFunc()
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -515,9 +508,10 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
{{- end }}
|
||||||
<div class="gva-table-box">
|
<div class="gva-table-box">
|
||||||
<div class="gva-btn-list">
|
<div class="gva-btn-list">
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" icon="plus" @click="openDialog">新增</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" icon="plus" @click="openDialog()">新增</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.batchDelete"{{ end }} icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.batchDelete"{{ end }} icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
|
||||||
{{ if .HasExcel -}}
|
{{ if .HasExcel -}}
|
||||||
<ExportTemplate {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.exportTemplate"{{ end }} template-id="{{$templateID}}" />
|
<ExportTemplate {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.exportTemplate"{{ end }} template-id="{{$templateID}}" />
|
||||||
|
|
@ -538,7 +532,7 @@ getDataSourceFunc()
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
{{ if .GvaModel }}
|
{{ if .GvaModel }}
|
||||||
<el-table-column align="left" label="日期" prop="createdAt" width="180">
|
<el-table-column align="left" label="日期" prop="createdAt" {{- if .IsTree }} min-{{- end }}width="180">
|
||||||
<template #default="scope">{{ "{{ formatDate(scope.row.CreatedAt) }}" }}</template>
|
<template #default="scope">{{ "{{ formatDate(scope.row.CreatedAt) }}" }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -559,7 +553,11 @@ getDataSourceFunc()
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in scope.row.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
|
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else if eq .FieldType "bool" }}
|
{{- else if eq .FieldType "bool" }}
|
||||||
|
|
@ -627,11 +625,14 @@ getDataSourceFunc()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
<el-table-column align="left" label="操作" fixed="right" :min-width="appStore.operateMinWith">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" link class="table-button" @click="openDialog(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>新增子节点</el-button>
|
||||||
|
{{- end }}
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.info"{{ end }} type="primary" link class="table-button" @click="getDetails(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>查看</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.info"{{ end }} type="primary" link class="table-button" @click="getDetails(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>查看</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.edit"{{ end }} type="primary" link icon="edit" class="table-button" @click="update{{.StructName}}Func(scope.row)">编辑</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.edit"{{ end }} type="primary" link icon="edit" class="table-button" @click="update{{.StructName}}Func(scope.row)">编辑</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.delete"{{ end }} type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
<el-button {{ if .IsTree }}v-if="!scope.row.children?.length" {{ end }} {{if $global.AutoCreateBtnAuth }}v-auth="btnAuth.delete"{{ end }} type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -647,7 +648,7 @@ getDataSourceFunc()
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-drawer destroy-on-close size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
<el-drawer destroy-on-close :size="appStore.drawerSize" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<span class="text-lg">{{"{{"}}type==='create'?'新增':'编辑'{{"}}"}}</span>
|
<span class="text-lg">{{"{{"}}type==='create'?'新增':'编辑'{{"}}"}}</span>
|
||||||
|
|
@ -659,6 +660,20 @@ getDataSourceFunc()
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-form-item label="父节点:" prop="parentID" >
|
||||||
|
<el-tree-select
|
||||||
|
v-model="formData.parentID"
|
||||||
|
:data="[rootNode,...tableData]"
|
||||||
|
check-strictly
|
||||||
|
:render-after-expand="false"
|
||||||
|
:props="defaultProps"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
placeholder="根节点"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form}}
|
{{- if .Form}}
|
||||||
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}" >
|
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}" >
|
||||||
|
|
@ -687,7 +702,13 @@ getDataSourceFunc()
|
||||||
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
|
{{- if .DictType}}
|
||||||
|
<el-select multiple v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
{{- else }}
|
||||||
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
||||||
|
|
@ -732,8 +753,23 @@ getDataSourceFunc()
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
<el-drawer destroy-on-close size="800" v-model="detailShow" :show-close="true" :before-close="closeDetailShow" title="查看">
|
<el-drawer destroy-on-close :size="appStore.drawerSize" v-model="detailShow" :show-close="true" :before-close="closeDetailShow" title="查看">
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" border>
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-descriptions-item label="父节点">
|
||||||
|
<el-tree-select
|
||||||
|
v-model="detailFrom.parentID"
|
||||||
|
:data="[rootNode,...tableData]"
|
||||||
|
check-strictly
|
||||||
|
disabled
|
||||||
|
:render-after-expand="false"
|
||||||
|
:props="defaultProps"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
placeholder="根节点"
|
||||||
|
/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Desc }}
|
{{- if .Desc }}
|
||||||
<el-descriptions-item label="{{ .FieldDesc }}">
|
<el-descriptions-item label="{{ .FieldDesc }}">
|
||||||
|
|
@ -747,6 +783,14 @@ getDataSourceFunc()
|
||||||
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
|
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</template>
|
</template>
|
||||||
|
{{- else if .DictType}}
|
||||||
|
<template #default="scope">
|
||||||
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in detailFrom.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
|
{{"{{"}} filterDict(detailFrom.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
|
</template>
|
||||||
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
|
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
|
||||||
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
@ -821,6 +865,7 @@ import { ref, reactive } from 'vue'
|
||||||
// 引入按钮权限标识
|
// 引入按钮权限标识
|
||||||
import { useBtnAuth } from '@/utils/btnAuth'
|
import { useBtnAuth } from '@/utils/btnAuth'
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
import { useAppStore } from "@/pinia"
|
||||||
|
|
||||||
{{if .HasExcel -}}
|
{{if .HasExcel -}}
|
||||||
// 导出组件
|
// 导出组件
|
||||||
|
|
@ -843,6 +888,7 @@ defineOptions({
|
||||||
|
|
||||||
// 提交按钮loading
|
// 提交按钮loading
|
||||||
const btnLoading = ref(false)
|
const btnLoading = ref(false)
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
// 控制更多查询条件显示/隐藏状态
|
// 控制更多查询条件显示/隐藏状态
|
||||||
const showAllQuery = ref(false)
|
const showAllQuery = ref(false)
|
||||||
|
|
@ -852,6 +898,9 @@ const showAllQuery = ref(false)
|
||||||
const {{ $element }}Options = ref([])
|
const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
|
{{- if .IsTree }}
|
||||||
|
parentID:undefined,
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form}}
|
{{- if .Form}}
|
||||||
{{- if eq .FieldType "bool" }}
|
{{- if eq .FieldType "bool" }}
|
||||||
|
|
@ -864,7 +913,7 @@ const formData = ref({
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -999,6 +1048,7 @@ const sortChange = ({ prop, order }) => {
|
||||||
}
|
}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
|
{{- if not .IsTree }}
|
||||||
// 重置
|
// 重置
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
searchInfo.value = {}
|
searchInfo.value = {}
|
||||||
|
|
@ -1040,6 +1090,28 @@ const getTableData = async() => {
|
||||||
pageSize.value = table.data.pageSize
|
pageSize.value = table.data.pageSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{{- else }}
|
||||||
|
// 树选择器配置
|
||||||
|
const defaultProps = {
|
||||||
|
children: "children",
|
||||||
|
label: "{{ .TreeJson }}",
|
||||||
|
value: "{{ .PrimaryField.FieldJson }}"
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootNode = {
|
||||||
|
{{ .PrimaryField.FieldJson }}: 0,
|
||||||
|
{{ .TreeJson }}: '根节点',
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
const getTableData = async() => {
|
||||||
|
const table = await get{{.StructName}}List()
|
||||||
|
if (table.code === 0) {
|
||||||
|
tableData.value = table.data || []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
getTableData()
|
getTableData()
|
||||||
|
|
||||||
|
|
@ -1140,8 +1212,11 @@ const delete{{.StructName}}Func = async (row) => {
|
||||||
const dialogFormVisible = ref(false)
|
const dialogFormVisible = ref(false)
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = () => {
|
const openDialog = ({{- if .IsTree -}}row{{- end -}}) => {
|
||||||
type.value = 'create'
|
type.value = 'create'
|
||||||
|
{{- if .IsTree }}
|
||||||
|
formData.value.parentID = row ? row.{{.PrimaryField.FieldJson}} : undefined
|
||||||
|
{{- end }}
|
||||||
dialogFormVisible.value = true
|
dialogFormVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1161,7 +1236,7 @@ const closeDialog = () => {
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource }} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import (
|
||||||
"{{.Module}}/global"
|
"{{.Module}}/global"
|
||||||
"{{.Module}}/model/common/response"
|
"{{.Module}}/model/common/response"
|
||||||
"{{.Module}}/plugin/{{.Package}}/model"
|
"{{.Module}}/plugin/{{.Package}}/model"
|
||||||
|
{{- if not .IsTree}}
|
||||||
"{{.Module}}/plugin/{{.Package}}/model/request"
|
"{{.Module}}/plugin/{{.Package}}/model/request"
|
||||||
|
{{- end }}
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
{{- if .AutoCreateResource}}
|
{{- if .AutoCreateResource}}
|
||||||
|
|
@ -142,6 +144,25 @@ func (a *{{.Abbreviation}}) Find{{.StructName}}(c *gin.Context) {
|
||||||
response.OkWithData(re{{.Abbreviation}}, c)
|
response.OkWithData(re{{.Abbreviation}}, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
// Get{{.StructName}}List 分页获取{{.Description}}列表
|
||||||
|
// @Tags {{.StructName}}
|
||||||
|
// @Summary 分页获取{{.Description}}列表
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @accept application/json
|
||||||
|
// @Produce application/json
|
||||||
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
|
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
||||||
|
func (a *{{.Abbreviation}}) Get{{.StructName}}List(c *gin.Context) {
|
||||||
|
list, err := service{{ .StructName }}.Get{{.StructName}}InfoList()
|
||||||
|
if err != nil {
|
||||||
|
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||||
|
response.FailWithMessage("获取失败:" + err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response.OkWithDetailed(list, "获取成功", c)
|
||||||
|
}
|
||||||
|
{{- else }}
|
||||||
// Get{{.StructName}}List 分页获取{{.Description}}列表
|
// Get{{.StructName}}List 分页获取{{.Description}}列表
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
|
|
@ -171,6 +192,7 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}List(c *gin.Context) {
|
||||||
PageSize: pageInfo.PageSize,
|
PageSize: pageInfo.PageSize,
|
||||||
}, "获取成功", c)
|
}, "获取成功", c)
|
||||||
}
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
||||||
|
|
@ -197,7 +219,6 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}DataSource(c *gin.Context) {
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||||
func (a *{{.Abbreviation}}) Get{{.StructName}}Public(c *gin.Context) {
|
func (a *{{.Abbreviation}}) Get{{.StructName}}Public(c *gin.Context) {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,10 @@ type {{.StructName}} struct {
|
||||||
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
|
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
|
||||||
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
|
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .IsTree }}
|
||||||
|
Children []*{{.StructName}} `json:"children" gorm:"-"` //子节点
|
||||||
|
ParentID int `json:"parentID" gorm:"column:parent_id;comment:父节点"`
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,4 +84,29 @@ func ({{.StructName}}) TableName() string {
|
||||||
return "{{.TableName}}"
|
return "{{.TableName}}"
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
|
{{if .IsTree }}
|
||||||
|
// GetChildren 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetChildren() []*{{.StructName}} {
|
||||||
|
return s.Children
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetChildren 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) SetChildren(children *{{.StructName}}) {
|
||||||
|
s.Children = append(s.Children, children)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetID 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetID() int {
|
||||||
|
return int({{if not .GvaModel}}*{{- end }}s.{{.PrimaryField.FieldName}})
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetParentID 实现TreeNode接口
|
||||||
|
func (s *{{.StructName}}) GetParentID() int {
|
||||||
|
return s.ParentID
|
||||||
|
}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,17 @@ import (
|
||||||
{{- if not .OnlyTemplate }}
|
{{- if not .OnlyTemplate }}
|
||||||
"{{.Module}}/global"
|
"{{.Module}}/global"
|
||||||
"{{.Module}}/plugin/{{.Package}}/model"
|
"{{.Module}}/plugin/{{.Package}}/model"
|
||||||
|
{{- if not .IsTree }}
|
||||||
"{{.Module}}/plugin/{{.Package}}/model/request"
|
"{{.Module}}/plugin/{{.Package}}/model/request"
|
||||||
|
{{- else }}
|
||||||
|
"errors"
|
||||||
|
{{- end }}
|
||||||
{{- if .AutoCreateResource }}
|
{{- if .AutoCreateResource }}
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
{{- if .IsTree }}
|
||||||
|
"{{.Module}}/utils"
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -88,6 +95,18 @@ func (s *{{.Abbreviation}}) Create{{.StructName}}({{.Abbreviation}} *model.{{.St
|
||||||
// Delete{{.StructName}} 删除{{.Description}}记录
|
// Delete{{.StructName}} 删除{{.Description}}记录
|
||||||
// Author [yourname](https://github.com/yourname)
|
// Author [yourname](https://github.com/yourname)
|
||||||
func (s *{{.Abbreviation}}) Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
|
func (s *{{.Abbreviation}}) Delete{{.StructName}}({{.PrimaryField.FieldJson}} string{{- if .AutoCreateResource -}},userID uint{{- end -}}) (err error) {
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
var count int64
|
||||||
|
err = {{$db}}.Find(&model.{{.StructName}}{},"parent_id = ?",{{.PrimaryField.FieldJson}}).Count(&count).Error
|
||||||
|
if count > 0 {
|
||||||
|
return errors.New("此节点存在子节点不允许删除")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if .AutoCreateResource }}
|
{{- if .AutoCreateResource }}
|
||||||
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
|
err = {{$db}}.Transaction(func(tx *gorm.DB) error {
|
||||||
if err := tx.Model(&model.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).Update("deleted_by", userID).Error; err != nil {
|
if err := tx.Model(&model.{{.StructName}}{}).Where("{{.PrimaryField.ColumnName}} = ?", {{.PrimaryField.FieldJson}}).Update("deleted_by", userID).Error; err != nil {
|
||||||
|
|
@ -137,6 +156,20 @@ func (s *{{.Abbreviation}}) Get{{.StructName}}({{.PrimaryField.FieldJson}} strin
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录,Tree模式下不添加分页和搜索
|
||||||
|
// Author [yourname](https://github.com/yourname)
|
||||||
|
func (s *{{.Abbreviation}}) Get{{.StructName}}InfoList() (list []*model.{{.StructName}},err error) {
|
||||||
|
// 创建db
|
||||||
|
db := {{$db}}.Model(&model.{{.StructName}}{})
|
||||||
|
var {{.Abbreviation}}s []*model.{{.StructName}}
|
||||||
|
|
||||||
|
err = db.Find(&{{.Abbreviation}}s).Error
|
||||||
|
|
||||||
|
return utils.BuildTree({{.Abbreviation}}s), err
|
||||||
|
}
|
||||||
|
{{- else }}
|
||||||
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
|
// Get{{.StructName}}InfoList 分页获取{{.Description}}记录
|
||||||
// Author [yourname](https://github.com/yourname)
|
// Author [yourname](https://github.com/yourname)
|
||||||
func (s *{{.Abbreviation}}) Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (list []model.{{.StructName}}, total int64, err error) {
|
func (s *{{.Abbreviation}}) Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (list []model.{{.StructName}}, total int64, err error) {
|
||||||
|
|
@ -199,7 +232,7 @@ func (s *{{.Abbreviation}}) Get{{.StructName}}InfoList(info request.{{.StructNam
|
||||||
err = db.Find(&{{.Abbreviation}}s).Error
|
err = db.Find(&{{.Abbreviation}}s).Error
|
||||||
return {{.Abbreviation}}s, total, err
|
return {{.Abbreviation}}s, total, err
|
||||||
}
|
}
|
||||||
|
{{- end }}
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
func (s *{{.Abbreviation}})Get{{.StructName}}DataSource() (res map[string][]map[string]any, err error) {
|
func (s *{{.Abbreviation}})Get{{.StructName}}DataSource() (res map[string][]map[string]any, err error) {
|
||||||
res = make(map[string][]map[string]any)
|
res = make(map[string][]map[string]any)
|
||||||
|
|
@ -222,4 +255,4 @@ func (s *{{.Abbreviation}})Get{{.StructName}}DataSource() (res map[string][]map[
|
||||||
func (s *{{.Abbreviation}})Get{{.StructName}}Public() {
|
func (s *{{.Abbreviation}})Get{{.StructName}}Public() {
|
||||||
|
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "string" }}
|
{{- if eq .FieldType "string" }}
|
||||||
{{- if .DictType}}
|
{{- if .DictType}}
|
||||||
<el-select v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
@ -95,7 +95,7 @@ const {{ $element }}Options = ref([])
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if or .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -148,6 +148,7 @@ const {{ $element }}Options = ref([])
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
// 请引用
|
// 请引用
|
||||||
get{{.StructName}}DataSource,
|
get{{.StructName}}DataSource,
|
||||||
|
|
||||||
// 获取数据源
|
// 获取数据源
|
||||||
const dataSource = ref([])
|
const dataSource = ref([])
|
||||||
const getDataSourceFunc = async()=>{
|
const getDataSourceFunc = async()=>{
|
||||||
|
|
@ -159,13 +160,27 @@ const getDataSourceFunc = async()=>{
|
||||||
getDataSourceFunc()
|
getDataSourceFunc()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- if not .OnlyTemplate}}
|
{{- if not .OnlyTemplate }}
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="gva-form-box">
|
<div class="gva-form-box">
|
||||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-form-item label="父节点:" prop="parentID" >
|
||||||
|
<el-tree-select
|
||||||
|
v-model="formData.parentID"
|
||||||
|
:data="[rootNode,...tableData]"
|
||||||
|
check-strictly
|
||||||
|
:render-after-expand="false"
|
||||||
|
:props="defaultProps"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
placeholder="根节点"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form }}
|
{{- if .Form }}
|
||||||
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}">
|
||||||
{{- if .CheckDataSource}}
|
{{- if .CheckDataSource}}
|
||||||
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="formData.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="formData.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
|
@ -177,7 +192,7 @@ getDataSourceFunc()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "string" }}
|
{{- if eq .FieldType "string" }}
|
||||||
{{- if .DictType}}
|
{{- if .DictType}}
|
||||||
<el-select v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
@ -219,13 +234,13 @@ getDataSourceFunc()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="save">保存</el-button>
|
<el-button :loading="btnLoading" type="primary" @click="save">保存</el-button>
|
||||||
<el-button type="primary" @click="back">返回</el-button>
|
<el-button type="primary" @click="back">返回</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -238,10 +253,13 @@ import {
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
get{{.StructName}}DataSource,
|
get{{.StructName}}DataSource,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .IsTree }}
|
||||||
|
get{{.StructName}}List,
|
||||||
|
{{- end }}
|
||||||
create{{.StructName}},
|
create{{.StructName}},
|
||||||
update{{.StructName}},
|
update{{.StructName}},
|
||||||
find{{.StructName}}
|
find{{.StructName}}
|
||||||
} from '@/plugin/{{.Package}}/api/{{.PackageName}}'
|
} from '@/api/{{.Package}}/{{.PackageName}}'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: '{{.StructName}}Form'
|
name: '{{.StructName}}Form'
|
||||||
|
|
@ -272,14 +290,47 @@ import RichEdit from '@/components/richtext/rich-edit.vue'
|
||||||
import ArrayCtrl from '@/components/arrayCtrl/arrayCtrl.vue'
|
import ArrayCtrl from '@/components/arrayCtrl/arrayCtrl.vue'
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
{{- if .IsTree }}
|
||||||
|
const tableData = ref([])
|
||||||
|
|
||||||
|
const defaultProps = {
|
||||||
|
children: "children",
|
||||||
|
label: "{{ .TreeJson }}",
|
||||||
|
value: "{{ .PrimaryField.FieldJson }}"
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootNode = {
|
||||||
|
{{ .PrimaryField.FieldJson }}: 0,
|
||||||
|
{{ .TreeJson }}: '根节点',
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTableData = async() => {
|
||||||
|
const table = await get{{.StructName}}List()
|
||||||
|
if (table.code === 0) {
|
||||||
|
tableData.value = table.data || []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTableData()
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
// 提交按钮loading
|
||||||
|
const btnLoading = ref(false)
|
||||||
|
|
||||||
const type = ref('')
|
const type = ref('')
|
||||||
{{- range $index, $element := .DictTypes}}
|
{{- range $index, $element := .DictTypes}}
|
||||||
const {{ $element }}Options = ref([])
|
const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
|
{{- if .IsTree }}
|
||||||
|
parentID: undefined,
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form }}
|
{{- if .Form }}
|
||||||
{{- if eq .FieldType "bool" }}
|
{{- if eq .FieldType "bool" }}
|
||||||
|
|
@ -292,7 +343,7 @@ const formData = ref({
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if or .DataSource }} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -324,7 +375,6 @@ const formData = ref({
|
||||||
// 验证规则
|
// 验证规则
|
||||||
const rule = reactive({
|
const rule = reactive({
|
||||||
{{- range .Fields }}
|
{{- range .Fields }}
|
||||||
{{- if .Form }}
|
|
||||||
{{- if eq .Require true }}
|
{{- if eq .Require true }}
|
||||||
{{.FieldJson }} : [{
|
{{.FieldJson }} : [{
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -332,7 +382,6 @@ const rule = reactive({
|
||||||
trigger: ['input','blur'],
|
trigger: ['input','blur'],
|
||||||
}],
|
}],
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -369,8 +418,9 @@ const init = async () => {
|
||||||
init()
|
init()
|
||||||
// 保存按钮
|
// 保存按钮
|
||||||
const save = async() => {
|
const save = async() => {
|
||||||
|
btnLoading.value = true
|
||||||
elFormRef.value?.validate( async (valid) => {
|
elFormRef.value?.validate( async (valid) => {
|
||||||
if (!valid) return
|
if (!valid) return btnLoading.value = false
|
||||||
let res
|
let res
|
||||||
switch (type.value) {
|
switch (type.value) {
|
||||||
case 'create':
|
case 'create':
|
||||||
|
|
@ -383,6 +433,7 @@ const save = async() => {
|
||||||
res = await create{{.StructName}}(formData.value)
|
res = await create{{.StructName}}(formData.value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
btnLoading.value = false
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{{- $global := . }}
|
{{- $global := . }}
|
||||||
{{- $templateID := printf "%s_%s" .Package .StructName }}
|
{{- $templateID := printf "%s_%s" .Package .StructName }}
|
||||||
|
|
||||||
{{- if .IsAdd }}
|
{{- if .IsAdd }}
|
||||||
// 请在搜索条件中增加如下代码
|
// 请在搜索条件中增加如下代码
|
||||||
{{- range .Fields}} {{- if .FieldSearchType}} {{- if eq .FieldType "bool" }}
|
{{- range .Fields}} {{- if .FieldSearchType}} {{- if eq .FieldType "bool" }}
|
||||||
|
|
@ -20,7 +19,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -38,13 +37,7 @@
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -87,7 +80,11 @@
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in scope.row.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else if eq .FieldType "bool" }}
|
{{- else if eq .FieldType "bool" }}
|
||||||
|
|
@ -185,8 +182,14 @@
|
||||||
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
|
{{- if .DictType}}
|
||||||
|
<el-select multiple v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
{{- else }}
|
||||||
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
@ -272,6 +275,7 @@
|
||||||
{{- range $index, $element := .DictTypes}}
|
{{- range $index, $element := .DictTypes}}
|
||||||
const {{ $element }}Options = ref([])
|
const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
// setOptions方法中增加如下调用
|
// setOptions方法中增加如下调用
|
||||||
|
|
||||||
{{- range $index, $element := .DictTypes }}
|
{{- range $index, $element := .DictTypes }}
|
||||||
|
|
@ -291,7 +295,7 @@ const {{ $element }}Options = ref([])
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -341,15 +345,18 @@ const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{- if .HasDataSource }}
|
{{- if .HasDataSource }}
|
||||||
// 请引用
|
// 请引用
|
||||||
get{{.StructName}}DataSource,
|
get{{.StructName}}DataSource,
|
||||||
|
|
||||||
// 获取数据源
|
// 获取数据源
|
||||||
const dataSource = ref({})
|
const dataSource = ref({})
|
||||||
const getDataSourceFunc = async()=>{
|
const getDataSourceFunc = async()=>{
|
||||||
const res = await get{{.StructName}}DataSource()
|
const res = await get{{.StructName}}DataSource()
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
dataSource.value = res.data
|
dataSource.value = res.data || []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDataSourceFunc()
|
getDataSourceFunc()
|
||||||
|
|
@ -360,6 +367,7 @@ getDataSourceFunc()
|
||||||
{{- if not .OnlyTemplate}}
|
{{- if not .OnlyTemplate}}
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
{{- if not .IsTree }}
|
||||||
<div class="gva-search-box">
|
<div class="gva-search-box">
|
||||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
||||||
{{- if .GvaModel }}
|
{{- if .GvaModel }}
|
||||||
|
|
@ -394,15 +402,15 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}} multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .CheckDataSource}}
|
{{- else if .CheckDataSource}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="searchInfo.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="searchInfo.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" :clearable="{{.Clearable}}" >
|
||||||
<el-option v-for="(item,key) in dataSource.{{.FieldJson}}" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in dataSource.{{.FieldJson}}" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else}}
|
{{- else}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
|
|
@ -412,13 +420,7 @@ getDataSourceFunc()
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -439,7 +441,6 @@ getDataSourceFunc()
|
||||||
{{- else}}
|
{{- else}}
|
||||||
<el-input v-model="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
</el-form-item>{{ end }}{{ end }}{{ end }}{{ end }}
|
</el-form-item>{{ end }}{{ end }}{{ end }}{{ end }}
|
||||||
|
|
||||||
<template v-if="showAllQuery">
|
<template v-if="showAllQuery">
|
||||||
|
|
@ -461,7 +462,7 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
<el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
<el-select {{if eq .FieldType "array"}}multiple {{end}}v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择" @clear="()=>{searchInfo.{{.FieldJson}}=undefined}">
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -473,13 +474,7 @@ getDataSourceFunc()
|
||||||
—
|
—
|
||||||
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
<el-input v-model.number="searchInfo.end{{.FieldName}}" placeholder="最大值" />
|
||||||
{{- else}}
|
{{- else}}
|
||||||
{{- if .DictType}}
|
|
||||||
<el-select v-model="searchInfo.{{.FieldJson}}" placeholder="请选择" style="width:100%" :clearable="true" >
|
|
||||||
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
{{- else}}
|
|
||||||
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
<el-input v-model.number="searchInfo.{{.FieldJson}}" placeholder="搜索条件" />
|
||||||
{{- end }}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- else if eq .FieldType "time.Time"}}
|
{{- else if eq .FieldType "time.Time"}}
|
||||||
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
{{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
|
||||||
|
|
@ -513,9 +508,10 @@ getDataSourceFunc()
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
{{- end }}
|
||||||
<div class="gva-table-box">
|
<div class="gva-table-box">
|
||||||
<div class="gva-btn-list">
|
<div class="gva-btn-list">
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" icon="plus" @click="openDialog">新增</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" icon="plus" @click="openDialog()">新增</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.batchDelete"{{ end }} icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.batchDelete"{{ end }} icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
|
||||||
{{ if .HasExcel -}}
|
{{ if .HasExcel -}}
|
||||||
<ExportTemplate {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.exportTemplate"{{ end }} template-id="{{$templateID}}" />
|
<ExportTemplate {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.exportTemplate"{{ end }} template-id="{{$templateID}}" />
|
||||||
|
|
@ -536,7 +532,7 @@ getDataSourceFunc()
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
{{ if .GvaModel }}
|
{{ if .GvaModel }}
|
||||||
<el-table-column align="left" label="日期" prop="createdAt" width="180">
|
<el-table-column align="left" label="日期" prop="createdAt" {{- if .IsTree }} min-{{- end }}width="180">
|
||||||
<template #default="scope">{{ "{{ formatDate(scope.row.CreatedAt) }}" }}</template>
|
<template #default="scope">{{ "{{ formatDate(scope.row.CreatedAt) }}" }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -557,7 +553,11 @@ getDataSourceFunc()
|
||||||
{{- else if .DictType}}
|
{{- else if .DictType}}
|
||||||
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in scope.row.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
|
{{"{{"}} filterDict(scope.row.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else if eq .FieldType "bool" }}
|
{{- else if eq .FieldType "bool" }}
|
||||||
|
|
@ -614,22 +614,25 @@ getDataSourceFunc()
|
||||||
[JSON]
|
[JSON]
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else if eq .FieldType "array" }}
|
{{- else if eq .FieldType "array" }}
|
||||||
<el-table-column label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="200">
|
<el-table-column label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<ArrayCtrl v-model="scope.row.{{ .FieldJson }}"/>
|
<ArrayCtrl v-model="scope.row.{{ .FieldJson }}"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120" />
|
<el-table-column {{- if .Sort}} sortable{{- end}} align="left" label="{{.FieldDesc}}" prop="{{.FieldJson}}" width="120" />
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.add"{{ end }} type="primary" link class="table-button" @click="openDialog(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>新增子节点</el-button>
|
||||||
|
{{- end }}
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.info"{{ end }} type="primary" link class="table-button" @click="getDetails(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>查看</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.info"{{ end }} type="primary" link class="table-button" @click="getDetails(scope.row)"><el-icon style="margin-right: 5px"><InfoFilled /></el-icon>查看</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.edit"{{ end }} type="primary" link icon="edit" class="table-button" @click="update{{.StructName}}Func(scope.row)">编辑</el-button>
|
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.edit"{{ end }} type="primary" link icon="edit" class="table-button" @click="update{{.StructName}}Func(scope.row)">编辑</el-button>
|
||||||
<el-button {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.delete"{{ end }} type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
<el-button {{ if .IsTree }}v-if="!scope.row.children?.length"{{ end }} {{ if $global.AutoCreateBtnAuth }}v-auth="btnAuth.delete"{{ end }} type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -650,15 +653,29 @@ getDataSourceFunc()
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<span class="text-lg">{{"{{"}}type==='create'?'新增':'编辑'{{"}}"}}</span>
|
<span class="text-lg">{{"{{"}}type==='create'?'新增':'编辑'{{"}}"}}</span>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
<el-button :loading="btnLoading" type="primary" @click="enterDialog">确 定</el-button>
|
||||||
<el-button @click="closeDialog">取 消</el-button>
|
<el-button @click="closeDialog">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||||
|
{{- if .IsTree }}
|
||||||
|
<el-form-item label="父节点:" prop="parentID" >
|
||||||
|
<el-tree-select
|
||||||
|
v-model="formData.parentID"
|
||||||
|
:data="[rootNode,...tableData]"
|
||||||
|
check-strictly
|
||||||
|
:render-after-expand="false"
|
||||||
|
:props="defaultProps"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
placeholder="根节点"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form}}
|
{{- if .Form}}
|
||||||
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}" >
|
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}" >
|
||||||
{{- if .CheckDataSource}}
|
{{- if .CheckDataSource}}
|
||||||
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="formData.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="formData.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
|
@ -685,7 +702,13 @@ getDataSourceFunc()
|
||||||
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} formData.{{.FieldJson}} {{"}}"}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
|
{{- if .DictType}}
|
||||||
|
<el-select multiple v-model="formData.{{ .FieldJson }}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
|
||||||
|
<el-option v-for="(item,key) in {{ .DictType }}Options" :key="key" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
{{- else }}
|
||||||
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
<ArrayCtrl v-model="formData.{{ .FieldJson }}" editable/>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
<el-input v-model.number="formData.{{ .FieldJson }}" :clearable="{{.Clearable}}" placeholder="请输入{{.FieldDesc}}" />
|
||||||
|
|
@ -730,51 +753,70 @@ getDataSourceFunc()
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<el-drawer destroy-on-close size="800" v-model="detailShow" :show-close="true" :before-close="closeDetailShow" title="查看">
|
||||||
|
<el-descriptions :column="1" border>
|
||||||
<el-drawer destroy-on-close size="800" v-model="detailShow" :show-close="true" :before-close="closeDetailShow" title="查看">
|
{{- if .IsTree }}
|
||||||
<el-descriptions column="1" border>
|
<el-descriptions-item label="父节点">
|
||||||
{{- range .Fields}}
|
<el-tree-select
|
||||||
{{- if .Desc }}
|
v-model="detailFrom.parentID"
|
||||||
<el-descriptions-item label="{{ .FieldDesc }}">
|
:data="[rootNode,...tableData]"
|
||||||
{{- if .CheckDataSource }}
|
check-strictly
|
||||||
<template #default="scope">
|
disabled
|
||||||
{{- if eq .DataSource.Association 2}}
|
:render-after-expand="false"
|
||||||
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}})" :key="key">
|
:props="defaultProps"
|
||||||
{{ "{{ item }}" }}
|
clearable
|
||||||
</el-tag>
|
style="width: 240px"
|
||||||
{{- else }}
|
placeholder="根节点"
|
||||||
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
|
/>
|
||||||
{{- end }}
|
</el-descriptions-item>
|
||||||
</template>
|
{{- end }}
|
||||||
|
{{- range .Fields}}
|
||||||
|
{{- if .Desc }}
|
||||||
|
<el-descriptions-item label="{{ .FieldDesc }}">
|
||||||
|
{{- if .CheckDataSource }}
|
||||||
|
<template #default="scope">
|
||||||
|
{{- if eq .DataSource.Association 2}}
|
||||||
|
<el-tag v-for="(item,key) in filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}})" :key="key">
|
||||||
|
{{ "{{ item }}" }}
|
||||||
|
</el-tag>
|
||||||
|
{{- else }}
|
||||||
|
<span>{{"{{"}} filterDataSource(dataSource.{{.FieldJson}},detailFrom.{{.FieldJson}}) {{"}}"}}</span>
|
||||||
|
{{- end }}
|
||||||
|
</template>
|
||||||
|
{{- else if .DictType}}
|
||||||
|
<template #default="scope">
|
||||||
|
{{if eq .FieldType "array"}}
|
||||||
|
<el-tag class="mr-1" v-for="item in detailFrom.{{.FieldJson}}" :key="item"> {{"{{"}} filterDict(item,{{.DictType}}Options) {{"}}"}}</el-tag>
|
||||||
|
{{- else }}
|
||||||
|
{{"{{"}} filterDict(detailFrom.{{.FieldJson}},{{.DictType}}Options) {{"}}"}}
|
||||||
|
{{end}}
|
||||||
|
</template>
|
||||||
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
|
{{- else if and (ne .FieldType "picture" ) (ne .FieldType "pictures" ) (ne .FieldType "file" ) (ne .FieldType "array" ) }}
|
||||||
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
|
{{"{{"}} detailFrom.{{.FieldJson}} {{"}}"}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- if eq .FieldType "picture" }}
|
{{- if eq .FieldType "picture" }}
|
||||||
<el-image style="width: 50px; height: 50px" :preview-src-list="returnArrImg(detailFrom.{{ .FieldJson }})" :src="getUrl(detailFrom.{{ .FieldJson }})" fit="cover" />
|
<el-image style="width: 50px; height: 50px" :preview-src-list="returnArrImg(detailFrom.{{ .FieldJson }})" :src="getUrl(detailFrom.{{ .FieldJson }})" fit="cover" />
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
<ArrayCtrl v-model="detailFrom.{{ .FieldJson }}"/>
|
<ArrayCtrl v-model="detailFrom.{{ .FieldJson }}"/>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "pictures" }}
|
{{- if eq .FieldType "pictures" }}
|
||||||
<el-image style="width: 50px; height: 50px; margin-right: 10px" :preview-src-list="returnArrImg(detailFrom.{{ .FieldJson }})" :initial-index="index" v-for="(item,index) in detailFrom.{{ .FieldJson }}" :key="index" :src="getUrl(item)" fit="cover" />
|
<el-image style="width: 50px; height: 50px; margin-right: 10px" :preview-src-list="returnArrImg(detailFrom.{{ .FieldJson }})" :initial-index="index" v-for="(item,index) in detailFrom.{{ .FieldJson }}" :key="index" :src="getUrl(item)" fit="cover" />
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "file" }}
|
{{- if eq .FieldType "file" }}
|
||||||
<div class="fileBtn" v-for="(item,index) in detailFrom.{{ .FieldJson }}" :key="index">
|
<div class="fileBtn" v-for="(item,index) in detailFrom.{{ .FieldJson }}" :key="index">
|
||||||
<el-button type="primary" text bg @click="onDownloadFile(item.url)">
|
<el-button type="primary" text bg @click="onDownloadFile(item.url)">
|
||||||
<el-icon style="margin-right: 5px"><Download /></el-icon>
|
<el-icon style="margin-right: 5px"><Download /></el-icon>
|
||||||
{{"{{"}}item.name{{"}}"}}
|
{{"{{"}}item.name{{"}}"}}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</el-descriptions-item>
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</el-descriptions>
|
</el-descriptions-item>
|
||||||
</el-drawer>
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
</el-descriptions>
|
||||||
|
</el-drawer>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -805,7 +847,6 @@ import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||||
import RichEdit from '@/components/richtext/rich-edit.vue'
|
import RichEdit from '@/components/richtext/rich-edit.vue'
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
{{- if .HasFile }}
|
{{- if .HasFile }}
|
||||||
// 文件选择组件
|
// 文件选择组件
|
||||||
import SelectFile from '@/components/selectFile/selectFile.vue'
|
import SelectFile from '@/components/selectFile/selectFile.vue'
|
||||||
|
|
@ -844,6 +885,9 @@ defineOptions({
|
||||||
const btnAuth = useBtnAuth()
|
const btnAuth = useBtnAuth()
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
// 提交按钮loading
|
||||||
|
const btnLoading = ref(false)
|
||||||
|
|
||||||
// 控制更多查询条件显示/隐藏状态
|
// 控制更多查询条件显示/隐藏状态
|
||||||
const showAllQuery = ref(false)
|
const showAllQuery = ref(false)
|
||||||
|
|
||||||
|
|
@ -852,45 +896,48 @@ const showAllQuery = ref(false)
|
||||||
const {{ $element }}Options = ref([])
|
const {{ $element }}Options = ref([])
|
||||||
{{- end }}
|
{{- end }}
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
|
{{- if .IsTree }}
|
||||||
|
parentID:undefined,
|
||||||
|
{{- end }}
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Form}}
|
{{- if .Form}}
|
||||||
{{- if eq .FieldType "bool" }}
|
{{- if eq .FieldType "bool" }}
|
||||||
{{.FieldJson}}: false,
|
{{.FieldJson}}: false,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "string" }}
|
{{- if eq .FieldType "string" }}
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "richtext" }}
|
{{- if eq .FieldType "richtext" }}
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource}} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "float64" }}
|
{{- if eq .FieldType "float64" }}
|
||||||
{{.FieldJson}}: 0,
|
{{.FieldJson}}: 0,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "picture" }}
|
{{- if eq .FieldType "picture" }}
|
||||||
{{.FieldJson}}: "",
|
{{.FieldJson}}: "",
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "video" }}
|
{{- if eq .FieldType "video" }}
|
||||||
{{.FieldJson}}: "",
|
{{.FieldJson}}: "",
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "pictures" }}
|
{{- if eq .FieldType "pictures" }}
|
||||||
{{.FieldJson}}: [],
|
{{.FieldJson}}: [],
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "file" }}
|
{{- if eq .FieldType "file" }}
|
||||||
{{.FieldJson}}: [],
|
{{.FieldJson}}: [],
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "json" }}
|
{{- if eq .FieldType "json" }}
|
||||||
{{.FieldJson}}: {},
|
{{.FieldJson}}: {},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "array" }}
|
{{- if eq .FieldType "array" }}
|
||||||
{{.FieldJson}}: [],
|
{{.FieldJson}}: [],
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -910,7 +957,7 @@ const formData = ref({
|
||||||
// 验证规则
|
// 验证规则
|
||||||
const rule = reactive({
|
const rule = reactive({
|
||||||
{{- range .Fields }}
|
{{- range .Fields }}
|
||||||
{{- if .Form }}
|
{{- if .Form }}
|
||||||
{{- if eq .Require true }}
|
{{- if eq .Require true }}
|
||||||
{{.FieldJson }} : [{
|
{{.FieldJson }} : [{
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -926,7 +973,7 @@ const rule = reactive({
|
||||||
{{- end }}
|
{{- end }}
|
||||||
],
|
],
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -978,13 +1025,13 @@ const searchInfo = ref({})
|
||||||
const sortChange = ({ prop, order }) => {
|
const sortChange = ({ prop, order }) => {
|
||||||
const sortMap = {
|
const sortMap = {
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .Table}}
|
{{- if .Table}}
|
||||||
{{- if and .Sort}}
|
{{- if and .Sort}}
|
||||||
{{- if not (eq .ColumnName "")}}
|
{{- if not (eq .ColumnName "")}}
|
||||||
{{.FieldJson}}: '{{.ColumnName}}',
|
{{.FieldJson}}: '{{.ColumnName}}',
|
||||||
{{- end}}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -999,6 +1046,7 @@ const sortChange = ({ prop, order }) => {
|
||||||
}
|
}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
|
{{- if not .IsTree }}
|
||||||
// 重置
|
// 重置
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
searchInfo.value = {}
|
searchInfo.value = {}
|
||||||
|
|
@ -1040,6 +1088,28 @@ const getTableData = async() => {
|
||||||
pageSize.value = table.data.pageSize
|
pageSize.value = table.data.pageSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{{- else }}
|
||||||
|
// 树选择器配置
|
||||||
|
const defaultProps = {
|
||||||
|
children: "children",
|
||||||
|
label: "{{ .TreeJson }}",
|
||||||
|
value: "{{ .PrimaryField.FieldJson }}"
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootNode = {
|
||||||
|
{{ .PrimaryField.FieldJson }}: 0,
|
||||||
|
{{ .TreeJson }}: '根节点',
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
const getTableData = async() => {
|
||||||
|
const table = await get{{.StructName}}List()
|
||||||
|
if (table.code === 0) {
|
||||||
|
tableData.value = table.data || []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
getTableData()
|
getTableData()
|
||||||
|
|
||||||
|
|
@ -1140,8 +1210,11 @@ const delete{{.StructName}}Func = async (row) => {
|
||||||
const dialogFormVisible = ref(false)
|
const dialogFormVisible = ref(false)
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = () => {
|
const openDialog = ({{- if .IsTree -}}row{{- end -}}) => {
|
||||||
type.value = 'create'
|
type.value = 'create'
|
||||||
|
{{- if .IsTree }}
|
||||||
|
formData.value.parentID = row ? row.{{.PrimaryField.FieldJson}} : undefined
|
||||||
|
{{- end }}
|
||||||
dialogFormVisible.value = true
|
dialogFormVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1161,7 +1234,7 @@ const closeDialog = () => {
|
||||||
{{.FieldJson}}: '',
|
{{.FieldJson}}: '',
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "int" }}
|
{{- if eq .FieldType "int" }}
|
||||||
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
|
{{.FieldJson}}: {{- if .DataSource }} undefined{{ else }} 0{{- end }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq .FieldType "time.Time" }}
|
{{- if eq .FieldType "time.Time" }}
|
||||||
{{.FieldJson}}: new Date(),
|
{{.FieldJson}}: new Date(),
|
||||||
|
|
@ -1193,8 +1266,9 @@ const closeDialog = () => {
|
||||||
}
|
}
|
||||||
// 弹窗确定
|
// 弹窗确定
|
||||||
const enterDialog = async () => {
|
const enterDialog = async () => {
|
||||||
|
btnLoading.value = true
|
||||||
elFormRef.value?.validate( async (valid) => {
|
elFormRef.value?.validate( async (valid) => {
|
||||||
if (!valid) return
|
if (!valid) return btnLoading.value = false
|
||||||
let res
|
let res
|
||||||
switch (type.value) {
|
switch (type.value) {
|
||||||
case 'create':
|
case 'create':
|
||||||
|
|
@ -1207,6 +1281,7 @@ const enterDialog = async () => {
|
||||||
res = await create{{.StructName}}(formData.value)
|
res = await create{{.StructName}}(formData.value)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
btnLoading.value = false
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|
@ -1223,7 +1298,6 @@ const downloadFile = (url) => {
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
const detailFrom = ref({})
|
const detailFrom = ref({})
|
||||||
|
|
||||||
// 查看详情控制标记
|
// 查看详情控制标记
|
||||||
|
|
@ -1284,5 +1358,6 @@ defineOptions({
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
</style>
|
</style>
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- end}}
|
|
||||||
|
{{- end }}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func (e *FileUploadAndDownloadService) CreateFileChunk(id uint, fileChunkPath st
|
||||||
func (e *FileUploadAndDownloadService) DeleteFileChunk(fileMd5 string, filePath string) error {
|
func (e *FileUploadAndDownloadService) DeleteFileChunk(fileMd5 string, filePath string) error {
|
||||||
var chunks []example.ExaFileChunk
|
var chunks []example.ExaFileChunk
|
||||||
var file example.ExaFile
|
var file example.ExaFile
|
||||||
err := global.GVA_DB.Where("file_md5 = ? ", fileMd5).First(&file).
|
err := global.GVA_DB.Where("file_md5 = ?", fileMd5).First(&file).
|
||||||
Updates(map[string]interface{}{
|
Updates(map[string]interface{}{
|
||||||
"IsFinish": true,
|
"IsFinish": true,
|
||||||
"file_path": filePath,
|
"file_path": filePath,
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ func (casbinService *CasbinService) AddPolicies(db *gorm.DB, rules [][]string) e
|
||||||
return db.Create(&casbinRules).Error
|
return db.Create(&casbinRules).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (CasbinService *CasbinService) FreshCasbin() (err error) {
|
func (casbinService *CasbinService) FreshCasbin() (err error) {
|
||||||
e := CasbinService.Casbin()
|
e := casbinService.Casbin()
|
||||||
err = e.LoadPolicy()
|
err = e.LoadPolicy()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,12 @@ func (h PgsqlInitHandler) EnsureDB(ctx context.Context, conf *request.InitDB) (n
|
||||||
} // 如果没有数据库名, 则跳出初始化数据
|
} // 如果没有数据库名, 则跳出初始化数据
|
||||||
|
|
||||||
dsn := conf.PgsqlEmptyDsn()
|
dsn := conf.PgsqlEmptyDsn()
|
||||||
createSql := fmt.Sprintf("CREATE DATABASE %s;", c.Dbname)
|
var createSql string
|
||||||
|
if conf.Template != "" {
|
||||||
|
createSql = fmt.Sprintf("CREATE DATABASE %s WITH TEMPLATE %s;", c.Dbname, conf.Template)
|
||||||
|
} else {
|
||||||
|
createSql = fmt.Sprintf("CREATE DATABASE %s;", c.Dbname)
|
||||||
|
}
|
||||||
if err = createDatabase(dsn, "pgx", createSql); err != nil {
|
if err = createDatabase(dsn, "pgx", createSql); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} // 创建数据库
|
} // 创建数据库
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func (i *initExaFileMysql) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&example.ExaFileUploadAndDownload{})
|
return db.Migrator().HasTable(&example.ExaFileUploadAndDownload{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initExaFileMysql) InitializerName() string {
|
func (i *initExaFileMysql) InitializerName() string {
|
||||||
return example.ExaFileUploadAndDownload{}.TableName()
|
return example.ExaFileUploadAndDownload{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ func init() {
|
||||||
system.RegisterInit(initOrderApi, &initApi{})
|
system.RegisterInit(initOrderApi, &initApi{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initApi) InitializerName() string {
|
func (i *initApi) InitializerName() string {
|
||||||
return sysModel.SysApi{}.TableName()
|
return sysModel.SysApi{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ func init() {
|
||||||
system.RegisterInit(initOrderApiIgnore, &initApiIgnore{})
|
system.RegisterInit(initOrderApiIgnore, &initApiIgnore{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initApiIgnore) InitializerName() string {
|
func (i *initApiIgnore) InitializerName() string {
|
||||||
return sysModel.SysIgnoreApi{}.TableName()
|
return sysModel.SysIgnoreApi{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func (i *initMenuAuthority) TableCreated(ctx context.Context) bool {
|
||||||
return false // always replace
|
return false // always replace
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initMenuAuthority) InitializerName() string {
|
func (i *initMenuAuthority) InitializerName() string {
|
||||||
return "sys_menu_authorities"
|
return "sys_menu_authorities"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,11 +35,12 @@ func (i *initMenuAuthority) InitializeData(ctx context.Context) (next context.Co
|
||||||
if !ok {
|
if !ok {
|
||||||
return ctx, system.ErrMissingDBContext
|
return ctx, system.ErrMissingDBContext
|
||||||
}
|
}
|
||||||
authorities, ok := ctx.Value(initAuthority{}.InitializerName()).([]sysModel.SysAuthority)
|
initAuth := &initAuthority{}
|
||||||
|
authorities, ok := ctx.Value(initAuth.InitializerName()).([]sysModel.SysAuthority)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ctx, errors.Wrap(system.ErrMissingDependentContext, "创建 [菜单-权限] 关联失败, 未找到权限表初始化数据")
|
return ctx, errors.Wrap(system.ErrMissingDependentContext, "创建 [菜单-权限] 关联失败, 未找到权限表初始化数据")
|
||||||
}
|
}
|
||||||
menus, ok := ctx.Value(initMenu{}.InitializerName()).([]sysModel.SysBaseMenu)
|
menus, ok := ctx.Value(new(initMenu).InitializerName()).([]sysModel.SysBaseMenu)
|
||||||
if !ok {
|
if !ok {
|
||||||
return next, errors.Wrap(errors.New(""), "创建 [菜单-权限] 关联失败, 未找到菜单表初始化数据")
|
return next, errors.Wrap(errors.New(""), "创建 [菜单-权限] 关联失败, 未找到菜单表初始化数据")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func (i *initAuthority) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&sysModel.SysAuthority{})
|
return db.Migrator().HasTable(&sysModel.SysAuthority{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initAuthority) InitializerName() string {
|
func (i *initAuthority) InitializerName() string {
|
||||||
return sysModel.SysAuthority{}.TableName()
|
return sysModel.SysAuthority{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func (i *initCasbin) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&adapter.CasbinRule{})
|
return db.Migrator().HasTable(&adapter.CasbinRule{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initCasbin) InitializerName() string {
|
func (i *initCasbin) InitializerName() string {
|
||||||
var entity adapter.CasbinRule
|
var entity adapter.CasbinRule
|
||||||
return entity.TableName()
|
return entity.TableName()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func (i *initDict) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&sysModel.SysDictionary{})
|
return db.Migrator().HasTable(&sysModel.SysDictionary{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initDict) InitializerName() string {
|
func (i *initDict) InitializerName() string {
|
||||||
return sysModel.SysDictionary{}.TableName()
|
return sysModel.SysDictionary{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func (i *initDictDetail) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&sysModel.SysDictionaryDetail{})
|
return db.Migrator().HasTable(&sysModel.SysDictionaryDetail{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initDictDetail) InitializerName() string {
|
func (i *initDictDetail) InitializerName() string {
|
||||||
return sysModel.SysDictionaryDetail{}.TableName()
|
return sysModel.SysDictionaryDetail{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ func (i *initDictDetail) InitializeData(ctx context.Context) (context.Context, e
|
||||||
if !ok {
|
if !ok {
|
||||||
return ctx, system.ErrMissingDBContext
|
return ctx, system.ErrMissingDBContext
|
||||||
}
|
}
|
||||||
dicts, ok := ctx.Value(initDict{}.InitializerName()).([]sysModel.SysDictionary)
|
dicts, ok := ctx.Value(new(initDict).InitializerName()).([]sysModel.SysDictionary)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ctx, errors.Wrap(system.ErrMissingDependentContext,
|
return ctx, errors.Wrap(system.ErrMissingDependentContext,
|
||||||
fmt.Sprintf("未找到 %s 表初始化数据", sysModel.SysDictionary{}.TableName()))
|
fmt.Sprintf("未找到 %s 表初始化数据", sysModel.SysDictionary{}.TableName()))
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ func init() {
|
||||||
system.RegisterInit(initOrderExcelTemplate, &initExcelTemplate{})
|
system.RegisterInit(initOrderExcelTemplate, &initExcelTemplate{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initExcelTemplate) InitializerName() string {
|
func (i *initExcelTemplate) InitializerName() string {
|
||||||
return "sys_export_templates"
|
return "sys_export_templates"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ func init() {
|
||||||
system.RegisterInit(initOrderMenu, &initMenu{})
|
system.RegisterInit(initOrderMenu, &initMenu{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initMenu) InitializerName() string {
|
func (i *initMenu) InitializerName() string {
|
||||||
return SysBaseMenu{}.TableName()
|
return SysBaseMenu{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ func (i *initUser) TableCreated(ctx context.Context) bool {
|
||||||
return db.Migrator().HasTable(&sysModel.SysUser{})
|
return db.Migrator().HasTable(&sysModel.SysUser{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i initUser) InitializerName() string {
|
func (i *initUser) InitializerName() string {
|
||||||
return sysModel.SysUser{}.TableName()
|
return sysModel.SysUser{}.TableName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ func (i *initUser) InitializeData(ctx context.Context) (next context.Context, er
|
||||||
return ctx, errors.Wrap(err, sysModel.SysUser{}.TableName()+"表数据初始化失败!")
|
return ctx, errors.Wrap(err, sysModel.SysUser{}.TableName()+"表数据初始化失败!")
|
||||||
}
|
}
|
||||||
next = context.WithValue(ctx, i.InitializerName(), entities)
|
next = context.WithValue(ctx, i.InitializerName(), entities)
|
||||||
authorityEntities, ok := ctx.Value(initAuthority{}.InitializerName()).([]sysModel.SysAuthority)
|
authorityEntities, ok := ctx.Value(new(initAuthority).InitializerName()).([]sysModel.SysAuthority)
|
||||||
if !ok {
|
if !ok {
|
||||||
return next, errors.Wrap(system.ErrMissingDependentContext, "创建 [用户-权限] 关联失败, 未找到权限表初始化数据")
|
return next, errors.Wrap(system.ErrMissingDependentContext, "创建 [用户-权限] 关联失败, 未找到权限表初始化数据")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func CreateApiStructAst(apis []system.SysApi) *[]ast.Expr {
|
||||||
return &apiElts
|
return &apiElts
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否存在Import
|
// CheckImport 检查是否存在Import
|
||||||
func CheckImport(file *ast.File, importPath string) bool {
|
func CheckImport(file *ast.File, importPath string) bool {
|
||||||
for _, imp := range file.Imports {
|
for _, imp := range file.Imports {
|
||||||
// Remove quotes around the import path
|
// Remove quotes around the import path
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 自动为 gorm.go 注册一个自动迁移
|
// AddRegisterTablesAst 自动为 gorm.go 注册一个自动迁移
|
||||||
func AddRegisterTablesAst(path, funcName, pk, varName, dbName, model string) {
|
func AddRegisterTablesAst(path, funcName, pk, varName, dbName, model string) {
|
||||||
modelPk := fmt.Sprintf("github.com/flipped-aurora/gin-vue-admin/server/model/%s", pk)
|
modelPk := fmt.Sprintf("github.com/flipped-aurora/gin-vue-admin/server/model/%s", pk)
|
||||||
src, err := os.ReadFile(path)
|
src, err := os.ReadFile(path)
|
||||||
|
|
@ -147,7 +147,7 @@ func addAutoMigrate(astBody *ast.BlockStmt, dbname string, pk string, model stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 为automigrate增加实参
|
// NeedAppendModel 为automigrate增加实参
|
||||||
func NeedAppendModel(callNode ast.Node, pk string, model string) bool {
|
func NeedAppendModel(callNode ast.Node, pk string, model string) bool {
|
||||||
flag := true
|
flag := true
|
||||||
ast.Inspect(callNode, func(node ast.Node) bool {
|
ast.Inspect(callNode, func(node ast.Node) bool {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -67,7 +68,7 @@ func MaheHump(s string) string {
|
||||||
return strings.Join(words, "")
|
return strings.Join(words, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 随机字符串
|
// RandomString 随机字符串
|
||||||
func RandomString(n int) string {
|
func RandomString(n int) string {
|
||||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||||
b := make([]rune, n)
|
b := make([]rune, n)
|
||||||
|
|
@ -80,3 +81,28 @@ func RandomString(n int) string {
|
||||||
func RandomInt(min, max int) int {
|
func RandomInt(min, max int) int {
|
||||||
return min + rand.Intn(max-min)
|
return min + rand.Intn(max-min)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BuildTree 用于构建一个树形结构
|
||||||
|
func BuildTree[T common.TreeNode[T]](nodes []T) []T {
|
||||||
|
nodeMap := make(map[int]T)
|
||||||
|
// 创建一个基本map
|
||||||
|
for i := range nodes {
|
||||||
|
nodeMap[nodes[i].GetID()] = nodes[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range nodes {
|
||||||
|
if nodes[i].GetParentID() != 0 {
|
||||||
|
parent := nodeMap[nodes[i].GetParentID()]
|
||||||
|
parent.SetChildren(nodes[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootNodes []T
|
||||||
|
|
||||||
|
for i := range nodeMap {
|
||||||
|
if nodeMap[i].GetParentID() == 0 {
|
||||||
|
rootNodes = append(rootNodes, nodeMap[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootNodes
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func (j *JWT) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims {
|
||||||
return claims
|
return claims
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个token
|
// CreateToken 创建一个token
|
||||||
func (j *JWT) CreateToken(claims request.CustomClaims) (string, error) {
|
func (j *JWT) CreateToken(claims request.CustomClaims) (string, error) {
|
||||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||||
return token.SignedString(j.SigningKey)
|
return token.SignedString(j.SigningKey)
|
||||||
|
|
@ -57,7 +57,7 @@ func (j *JWT) CreateTokenByOldToken(oldToken string, claims request.CustomClaims
|
||||||
return v.(string), err
|
return v.(string), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析 token
|
// ParseToken 解析 token
|
||||||
func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error) {
|
func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error) {
|
||||||
token, err := jwt.ParseWithClaims(tokenString, &request.CustomClaims{}, func(token *jwt.Token) (i interface{}, e error) {
|
token, err := jwt.ParseWithClaims(tokenString, &request.CustomClaims{}, func(token *jwt.Token) (i interface{}, e error) {
|
||||||
return j.SigningKey, nil
|
return j.SigningKey, nil
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ func (t *timer) AddTaskByFunc(cronName string, spec string, fun func(), taskName
|
||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTaskByFuncWithSeconds 通过函数的方法使用WithSeconds添加任务
|
// AddTaskByFuncWithSecond 通过函数的方法使用WithSeconds添加任务
|
||||||
func (t *timer) AddTaskByFuncWithSecond(cronName string, spec string, fun func(), taskName string, option ...cron.Option) (cron.EntryID, error) {
|
func (t *timer) AddTaskByFuncWithSecond(cronName string, spec string, fun func(), taskName string, option ...cron.Option) (cron.EntryID, error) {
|
||||||
t.Lock()
|
t.Lock()
|
||||||
defer t.Unlock()
|
defer t.Unlock()
|
||||||
|
|
@ -186,7 +186,7 @@ func (t *timer) StopCron(cronName string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove 从cronName 删除指定任务
|
// RemoveTask 从cronName 删除指定任务
|
||||||
func (t *timer) RemoveTask(cronName string, id int) {
|
func (t *timer) RemoveTask(cronName string, id int) {
|
||||||
t.Lock()
|
t.Lock()
|
||||||
defer t.Unlock()
|
defer t.Unlock()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gin-vue-admin",
|
"name": "gin-vue-admin",
|
||||||
"version": "2.7.7",
|
"version": "2.7.8-beta1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "node openDocument.js && vite --host --mode development",
|
"serve": "node openDocument.js && vite --host --mode development",
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
"@vue-office/excel": "^1.7.11",
|
"@vue-office/excel": "^1.7.11",
|
||||||
"@vue-office/pdf": "^2.0.2",
|
"@vue-office/pdf": "^2.0.2",
|
||||||
"@vueuse/core": "^11.0.3",
|
"@vueuse/core": "^11.0.3",
|
||||||
|
"@vueuse/integrations": "^12.0.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
"ace-builds": "^1.36.4",
|
"ace-builds": "^1.36.4",
|
||||||
|
|
@ -27,7 +28,6 @@
|
||||||
"echarts": "5.5.1",
|
"echarts": "5.5.1",
|
||||||
"element-plus": "^2.8.5",
|
"element-plus": "^2.8.5",
|
||||||
"highlight.js": "^11.10.0",
|
"highlight.js": "^11.10.0",
|
||||||
"js-cookie": "^3.0.5",
|
|
||||||
"marked": "14.1.1",
|
"marked": "14.1.1",
|
||||||
"marked-highlight": "^2.1.4",
|
"marked-highlight": "^2.1.4",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
"sortablejs": "^1.15.3",
|
"sortablejs": "^1.15.3",
|
||||||
"spark-md5": "^3.0.2",
|
"spark-md5": "^3.0.2",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.10",
|
||||||
|
"universal-cookie": "^7",
|
||||||
"vform3-builds": "^3.0.10",
|
"vform3-builds": "^3.0.10",
|
||||||
"vite-auto-import-svg": "^1.1.0",
|
"vite-auto-import-svg": "^1.1.0",
|
||||||
"vue": "^3.5.7",
|
"vue": "^3.5.7",
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,11 @@
|
||||||
const quickArr = [
|
const quickArr = [
|
||||||
{
|
{
|
||||||
label: '亮色主题',
|
label: '亮色主题',
|
||||||
func: () => changeMode('light')
|
func: () => changeMode(false)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '暗色主题',
|
label: '暗色主题',
|
||||||
func: () => changeMode('dark')
|
func: () => changeMode(true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '退出登录',
|
label: '退出登录',
|
||||||
|
|
@ -135,12 +135,8 @@
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeMode = (e) => {
|
const changeMode = (darkMode) => {
|
||||||
if (e === null) {
|
appStore.toggleTheme(darkMode)
|
||||||
appStore.toggleTheme(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
appStore.toggleTheme(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-drawer v-model="drawer" title="媒体库" size="650px">
|
<el-drawer v-model="drawer" title="媒体库" :size="appStore.drawerSize">
|
||||||
<warning-bar title="点击“文件名/备注”可以编辑文件名或者备注内容。" />
|
<warning-bar title="点击“文件名/备注”可以编辑文件名或者备注内容。" />
|
||||||
<div class="gva-btn-list gap-2">
|
<div class="gva-btn-list gap-2">
|
||||||
<upload-common :image-common="imageCommon" @on-success="getImageList" />
|
<upload-common :image-common="imageCommon" @on-success="getImageList" />
|
||||||
|
|
@ -124,6 +124,9 @@
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
||||||
import selectComponent from '@/components/selectImage/selectComponent.vue'
|
import selectComponent from '@/components/selectImage/selectComponent.vue'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const imageUrl = ref('')
|
const imageUrl = ref('')
|
||||||
const imageCommon = ref('')
|
const imageCommon = ref('')
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export const viteLogo = (env) => {
|
||||||
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
|
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
console.log(greenText(`> 当前版本:v2.7.7`))
|
console.log(greenText(`> 当前版本:vv2.7.8-beta1`))
|
||||||
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
|
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
|
||||||
console.log(
|
console.log(
|
||||||
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
|
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default {
|
||||||
register(app)
|
register(app)
|
||||||
console.log(`
|
console.log(`
|
||||||
欢迎使用 Gin-Vue-Admin
|
欢迎使用 Gin-Vue-Admin
|
||||||
当前版本:v2.7.7
|
当前版本:v2.7.8-beta1
|
||||||
加群方式:微信:shouzi_1994 QQ群:622360840
|
加群方式:微信:shouzi_1994 QQ群:622360840
|
||||||
项目地址:https://github.com/flipped-aurora/gin-vue-admin
|
项目地址:https://github.com/flipped-aurora/gin-vue-admin
|
||||||
插件市场:https://plugin.gin-vue-admin.com
|
插件市场:https://plugin.gin-vue-admin.com
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { useAppStore } from '@/pinia'
|
||||||
export default function useChartOption(sourceOption) {
|
export default function useChartOption(sourceOption) {
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const isDark = computed(() => {
|
const isDark = computed(() => {
|
||||||
return appStore.theme === 'dark'
|
return appStore.isDark
|
||||||
})
|
})
|
||||||
const chartOption = computed(() => {
|
const chartOption = computed(() => {
|
||||||
return sourceOption(isDark.value)
|
return sourceOption(isDark.value)
|
||||||
|
|
|
||||||
|
|
@ -64,4 +64,4 @@
|
||||||
"/src/plugin/announcement/form/info.vue": "InfoForm",
|
"/src/plugin/announcement/form/info.vue": "InfoForm",
|
||||||
"/src/plugin/announcement/view/info.vue": "Info",
|
"/src/plugin/announcement/view/info.vue": "Info",
|
||||||
"/src/plugin/email/view/index.vue": "Email"
|
"/src/plugin/email/view/index.vue": "Email"
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { ref, watchEffect, reactive } from 'vue'
|
import { ref, watchEffect, reactive } from 'vue'
|
||||||
import { setBodyPrimaryColor } from '@/utils/format'
|
import { setBodyPrimaryColor } from '@/utils/format'
|
||||||
|
import { useDark, usePreferredDark } from '@vueuse/core'
|
||||||
|
|
||||||
export const useAppStore = defineStore('app', () => {
|
export const useAppStore = defineStore('app', () => {
|
||||||
const device = ref('')
|
const device = ref('')
|
||||||
|
const drawerSize = ref('')
|
||||||
|
const operateMinWith = ref('240')
|
||||||
const config = reactive({
|
const config = reactive({
|
||||||
weakness: false,
|
weakness: false,
|
||||||
grey: false,
|
grey: false,
|
||||||
|
|
@ -16,14 +20,17 @@ export const useAppStore = defineStore('app', () => {
|
||||||
side_mode: 'normal'
|
side_mode: 'normal'
|
||||||
})
|
})
|
||||||
|
|
||||||
const theme = ref('auto')
|
const isDark = useDark({
|
||||||
|
selector: 'html',
|
||||||
|
attribute: 'class',
|
||||||
|
valueDark: 'dark',
|
||||||
|
valueLight: 'light',
|
||||||
|
})
|
||||||
|
|
||||||
const toggleTheme = (dark) => {
|
const preferredDark = usePreferredDark()
|
||||||
if (dark) {
|
|
||||||
theme.value = 'dark'
|
const toggleTheme = (darkMode) => {
|
||||||
} else {
|
isDark.value = darkMode
|
||||||
theme.value = 'light'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleWeakness = (e) => {
|
const toggleWeakness = (e) => {
|
||||||
|
|
@ -43,6 +50,13 @@ export const useAppStore = defineStore('app', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleDevice = (e) => {
|
const toggleDevice = (e) => {
|
||||||
|
if(e === 'mobile'){
|
||||||
|
drawerSize.value = '100%'
|
||||||
|
operateMinWith.value = '80'
|
||||||
|
}else {
|
||||||
|
drawerSize.value = '800'
|
||||||
|
operateMinWith.value = '240'
|
||||||
|
}
|
||||||
device.value = e
|
device.value = e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,15 +64,14 @@ export const useAppStore = defineStore('app', () => {
|
||||||
config.darkMode = e
|
config.darkMode = e
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleDarkModeAuto = () => {
|
// 监听系统主题变化
|
||||||
// 处理浏览器主题
|
watchEffect(() => {
|
||||||
const darkQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
if (config.darkMode === 'auto') {
|
||||||
const dark = darkQuery.matches
|
isDark.value = preferredDark.value
|
||||||
toggleTheme(dark)
|
return
|
||||||
darkQuery.addEventListener('change', (e) => {
|
}
|
||||||
toggleTheme(e.matches)
|
isDark.value = config.darkMode === 'dark'
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const toggleConfigSideWidth = (e) => {
|
const toggleConfigSideWidth = (e) => {
|
||||||
config.layout_side_width = e
|
config.layout_side_width = e
|
||||||
|
|
@ -76,55 +89,26 @@ export const useAppStore = defineStore('app', () => {
|
||||||
config.show_watermark = e
|
config.show_watermark = e
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleSideModel = (e) => {
|
const toggleSideMode = (e) => {
|
||||||
config.side_mode = e
|
config.side_mode = e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 监听色弱模式和灰色模式
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (theme.value === 'dark') {
|
document.documentElement.classList.toggle('html-weakenss', config.weakness)
|
||||||
document.documentElement.classList.add('dark')
|
document.documentElement.classList.toggle('html-grey', config.grey)
|
||||||
document.documentElement.classList.remove('light')
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add('light')
|
|
||||||
document.documentElement.classList.remove('dark')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
watchEffect(() => {
|
|
||||||
// 色弱模式监听处理
|
|
||||||
if (config.weakness) {
|
|
||||||
document.documentElement.classList.add('html-weakenss')
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.remove('html-weakenss')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
watchEffect(() => {
|
|
||||||
// 灰色模式监听处理
|
|
||||||
if (config.grey) {
|
|
||||||
document.documentElement.classList.add('html-grey')
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.remove('html-grey')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 监听主题色
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (config.darkMode === 'auto') {
|
setBodyPrimaryColor(config.primaryColor, isDark.value ? 'dark' : 'light')
|
||||||
toggleDarkModeAuto()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.darkMode === 'dark') {
|
|
||||||
toggleTheme(true)
|
|
||||||
} else {
|
|
||||||
toggleTheme(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
watchEffect(() => {
|
|
||||||
setBodyPrimaryColor(config.primaryColor, theme.value)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme,
|
isDark,
|
||||||
device,
|
device,
|
||||||
|
drawerSize,
|
||||||
|
operateMinWith,
|
||||||
config,
|
config,
|
||||||
toggleTheme,
|
toggleTheme,
|
||||||
toggleDevice,
|
toggleDevice,
|
||||||
|
|
@ -137,6 +121,6 @@ export const useAppStore = defineStore('app', () => {
|
||||||
toggleConfigSideCollapsedWidth,
|
toggleConfigSideCollapsedWidth,
|
||||||
toggleConfigSideItemHeight,
|
toggleConfigSideItemHeight,
|
||||||
toggleConfigWatermark,
|
toggleConfigWatermark,
|
||||||
toggleSideModel
|
toggleSideMode
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ import { jsonInBlacklist } from '@/api/jwt'
|
||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { ElLoading, ElMessage } from 'element-plus'
|
import { ElLoading, ElMessage } from 'element-plus'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { ref, watch } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { useRouterStore } from './router'
|
import { useRouterStore } from './router'
|
||||||
import cookie from 'js-cookie'
|
import { useCookies } from '@vueuse/integrations/useCookies'
|
||||||
|
import { useStorage } from '@vueuse/core'
|
||||||
|
|
||||||
import { useAppStore } from '@/pinia'
|
import { useAppStore } from '@/pinia'
|
||||||
|
|
||||||
|
|
@ -19,9 +20,10 @@ export const useUserStore = defineStore('user', () => {
|
||||||
headerImg: '',
|
headerImg: '',
|
||||||
authority: {}
|
authority: {}
|
||||||
})
|
})
|
||||||
const token = ref(
|
const token = useStorage('token', '')
|
||||||
window.localStorage.getItem('token') || cookie.get('x-token') || ''
|
const xToken = useCookies('x-token')
|
||||||
)
|
const currentToken = computed(() => token.value || xToken.value || '')
|
||||||
|
|
||||||
const setUserInfo = (val) => {
|
const setUserInfo = (val) => {
|
||||||
userInfo.value = val
|
userInfo.value = val
|
||||||
if (val.originSetting) {
|
if (val.originSetting) {
|
||||||
|
|
@ -33,11 +35,11 @@ export const useUserStore = defineStore('user', () => {
|
||||||
|
|
||||||
const setToken = (val) => {
|
const setToken = (val) => {
|
||||||
token.value = val
|
token.value = val
|
||||||
|
xToken.value = val
|
||||||
}
|
}
|
||||||
|
|
||||||
const NeedInit = async () => {
|
const NeedInit = async () => {
|
||||||
token.value = ''
|
await ClearStorage()
|
||||||
window.localStorage.removeItem('token')
|
|
||||||
await router.push({ name: 'Init', replace: true })
|
await router.push({ name: 'Init', replace: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,49 +59,49 @@ export const useUserStore = defineStore('user', () => {
|
||||||
}
|
}
|
||||||
/* 登录*/
|
/* 登录*/
|
||||||
const LoginIn = async (loginInfo) => {
|
const LoginIn = async (loginInfo) => {
|
||||||
loadingInstance.value = ElLoading.service({
|
try {
|
||||||
fullscreen: true,
|
loadingInstance.value = ElLoading.service({
|
||||||
text: '登录中,请稍候...'
|
fullscreen: true,
|
||||||
})
|
text: '登录中,请稍候...'
|
||||||
|
})
|
||||||
|
|
||||||
const res = await login(loginInfo)
|
const res = await login(loginInfo)
|
||||||
|
|
||||||
|
if (res.code !== 0) {
|
||||||
|
ElMessage.error(res.message || '登录失败')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 登陆成功,设置用户信息和权限相关信息
|
||||||
|
setUserInfo(res.data.user)
|
||||||
|
setToken(res.data.token)
|
||||||
|
|
||||||
// 登陆失败,直接返回
|
// 初始化路由信息
|
||||||
if (res.code !== 0) {
|
const routerStore = useRouterStore()
|
||||||
loadingInstance.value.close()
|
await routerStore.SetAsyncRouter()
|
||||||
|
const asyncRouters = routerStore.asyncRouters
|
||||||
|
|
||||||
|
// 注册到路由表里
|
||||||
|
asyncRouters.forEach((asyncRouter) => {
|
||||||
|
router.addRoute(asyncRouter)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!router.hasRoute(userInfo.value.authority.defaultRouter)) {
|
||||||
|
ElMessage.error('请联系管理员进行授权')
|
||||||
|
} else {
|
||||||
|
await router.replace({ name: userInfo.value.authority.defaultRouter })
|
||||||
|
}
|
||||||
|
|
||||||
|
const isWindows = /windows/i.test(navigator.userAgent)
|
||||||
|
window.localStorage.setItem('osType', isWindows ? 'WIN' : 'MAC')
|
||||||
|
|
||||||
|
// 全部操作均结束,关闭loading并返回
|
||||||
|
return true
|
||||||
|
} catch (error) {
|
||||||
|
console.error('LoginIn error:', error)
|
||||||
return false
|
return false
|
||||||
|
} finally {
|
||||||
|
loadingInstance.value?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登陆成功,设置用户信息和权限相关信息
|
|
||||||
setUserInfo(res.data.user)
|
|
||||||
setToken(res.data.token)
|
|
||||||
|
|
||||||
// 初始化路由信息
|
|
||||||
const routerStore = useRouterStore()
|
|
||||||
await routerStore.SetAsyncRouter()
|
|
||||||
const asyncRouters = routerStore.asyncRouters
|
|
||||||
|
|
||||||
// 注册到路由表里
|
|
||||||
asyncRouters.forEach((asyncRouter) => {
|
|
||||||
router.addRoute(asyncRouter)
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!router.hasRoute(userInfo.value.authority.defaultRouter)) {
|
|
||||||
ElMessage.error('请联系管理员进行授权')
|
|
||||||
} else {
|
|
||||||
await router.replace({ name: userInfo.value.authority.defaultRouter })
|
|
||||||
}
|
|
||||||
|
|
||||||
const isWin = ref(/windows/i.test(navigator.userAgent))
|
|
||||||
if (isWin.value) {
|
|
||||||
window.localStorage.setItem('osType', 'WIN')
|
|
||||||
} else {
|
|
||||||
window.localStorage.setItem('osType', 'MAC')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 全部操作均结束,关闭loading并返回
|
|
||||||
loadingInstance.value.close()
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
/* 登出*/
|
/* 登出*/
|
||||||
const LoginOut = async () => {
|
const LoginOut = async () => {
|
||||||
|
|
@ -119,22 +121,14 @@ export const useUserStore = defineStore('user', () => {
|
||||||
/* 清理数据 */
|
/* 清理数据 */
|
||||||
const ClearStorage = async () => {
|
const ClearStorage = async () => {
|
||||||
token.value = ''
|
token.value = ''
|
||||||
|
xToken.value = ''
|
||||||
sessionStorage.clear()
|
sessionStorage.clear()
|
||||||
window.localStorage.removeItem('token')
|
|
||||||
cookie.remove('x-token')
|
|
||||||
localStorage.removeItem('originSetting')
|
localStorage.removeItem('originSetting')
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
|
||||||
() => token.value,
|
|
||||||
() => {
|
|
||||||
window.localStorage.setItem('token', token.value)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userInfo,
|
userInfo,
|
||||||
token,
|
token: currentToken,
|
||||||
NeedInit,
|
NeedInit,
|
||||||
ResetUserInfo,
|
ResetUserInfo,
|
||||||
GetUserInfo,
|
GetUserInfo,
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const dotColor = computed(() => {
|
const dotColor = computed(() => {
|
||||||
console.log(appStore.theme)
|
return appStore.isDark ? '#333' : '#E5E8EF'
|
||||||
return appStore.theme === 'dark' ? '#333' : '#E5E8EF'
|
|
||||||
})
|
})
|
||||||
const graphicFactory = (side) => {
|
const graphicFactory = (side) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,12 @@
|
||||||
placeholder="请输入sqlite数据库文件存放路径"
|
placeholder="请输入sqlite数据库文件存放路径"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.dbType === 'pgsql'" label="template">
|
||||||
|
<el-input
|
||||||
|
v-model="form.template"
|
||||||
|
placeholder="请输入postgresql指定template"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="primary" @click="onSubmit">立即初始化</el-button>
|
<el-button type="primary" @click="onSubmit">立即初始化</el-button>
|
||||||
|
|
@ -192,7 +198,8 @@
|
||||||
userName: 'postgres',
|
userName: 'postgres',
|
||||||
password: '',
|
password: '',
|
||||||
dbName: 'gva',
|
dbName: 'gva',
|
||||||
dbPath: ''
|
dbPath: '',
|
||||||
|
template: 'template0'
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
>
|
>
|
||||||
<div class="flex items-center cursor-pointer flex-1">
|
<div class="flex items-center cursor-pointer flex-1">
|
||||||
<div
|
<div
|
||||||
class="flex items-center cursor-pointer min-w-48"
|
class="flex items-center cursor-pointer"
|
||||||
|
:class="isMobile ? '' : 'min-w-48'"
|
||||||
@click="router.push({ path: '/' })"
|
@click="router.push({ path: '/' })"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,9 @@
|
||||||
effect="dark"
|
effect="dark"
|
||||||
content="切换主题"
|
content="切换主题"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
:disabled="appStore.theme === 'auto'"
|
|
||||||
>
|
>
|
||||||
<el-icon
|
<el-icon
|
||||||
v-if="appStore.theme === 'dark'"
|
v-if="appStore.isDark"
|
||||||
class="w-8 h-8 shadow rounded-full border border-gray-600 cursor-pointer border-solid"
|
class="w-8 h-8 shadow rounded-full border border-gray-600 cursor-pointer border-solid"
|
||||||
@click="appStore.toggleTheme(false)"
|
@click="appStore.toggleTheme(false)"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
import { useAppStore } from '@/pinia'
|
import { useAppStore } from '@/pinia'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const { config, theme, device } = storeToRefs(appStore)
|
const { config, isDark, device } = storeToRefs(appStore)
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'GvaLayout'
|
name: 'GvaLayout'
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
font.color =
|
font.color =
|
||||||
theme.value === 'dark' ? 'rgba(255,255,255, .15)' : 'rgba(0, 0, 0, .15)'
|
isDark.value ? 'rgba(255,255,255, .15)' : 'rgba(0, 0, 0, .15)'
|
||||||
})
|
})
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
v-model="config.side_mode"
|
v-model="config.side_mode"
|
||||||
:options="sideModes"
|
:options="sideModes"
|
||||||
size="default"
|
size="default"
|
||||||
@change="appStore.toggleSideModel"
|
@change="appStore.toggleSideMode"
|
||||||
/>
|
/>
|
||||||
<!-- <el-select
|
<!-- <el-select
|
||||||
v-model="config.side_mode"
|
v-model="config.side_mode"
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="left" fixed="right" label="操作" width="200">
|
<el-table-column align="left" fixed="right" label="操作" :min-width="appStore.operateMinWith">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
icon="edit"
|
icon="edit"
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="syncApiFlag"
|
v-model="syncApiFlag"
|
||||||
size="80%"
|
:size="appStore.drawerSize"
|
||||||
:before-close="closeSyncDialog"
|
:before-close="closeSyncDialog"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
>
|
>
|
||||||
|
|
@ -341,7 +341,7 @@
|
||||||
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="dialogFormVisible"
|
v-model="dialogFormVisible"
|
||||||
size="60%"
|
:size="appStore.drawerSize"
|
||||||
:before-close="closeDialog"
|
:before-close="closeDialog"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
>
|
>
|
||||||
|
|
@ -420,11 +420,14 @@
|
||||||
import ExportTemplate from '@/components/exportExcel/exportTemplate.vue'
|
import ExportTemplate from '@/components/exportExcel/exportTemplate.vue'
|
||||||
import ImportExcel from '@/components/exportExcel/importExcel.vue'
|
import ImportExcel from '@/components/exportExcel/importExcel.vue'
|
||||||
import { butler } from '@/api/autoCode'
|
import { butler } from '@/api/autoCode'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Api'
|
name: 'Api'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const methodFilter = (value) => {
|
const methodFilter = (value) => {
|
||||||
const target = methodOptions.value.filter((item) => item.value === value)[0]
|
const target = methodOptions.value.filter((item) => item.value === value)[0]
|
||||||
return target && `${target.label}`
|
return target && `${target.label}`
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<!-- 新增角色弹窗 -->
|
<!-- 新增角色弹窗 -->
|
||||||
<el-drawer v-model="authorityFormVisible" :show-close="false">
|
<el-drawer v-model="authorityFormVisible" :size="appStore.drawerSize" :show-close="false">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<span class="text-lg">{{ authorityTitleForm }}</span>
|
<span class="text-lg">{{ authorityTitleForm }}</span>
|
||||||
|
|
@ -114,8 +114,7 @@
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-if="drawer"
|
v-if="drawer"
|
||||||
v-model="drawer"
|
v-model="drawer"
|
||||||
:with-header="false"
|
:size="appStore.drawerSize"
|
||||||
size="40%"
|
|
||||||
title="角色配置"
|
title="角色配置"
|
||||||
>
|
>
|
||||||
<el-tabs :before-leave="autoEnter" type="border-card">
|
<el-tabs :before-leave="autoEnter" type="border-card">
|
||||||
|
|
@ -154,6 +153,7 @@
|
||||||
|
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { useAppStore } from "@/pinia"
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Authority'
|
name: 'Authority'
|
||||||
|
|
@ -175,6 +175,7 @@
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
const dialogType = ref('add')
|
const dialogType = ref('add')
|
||||||
const activeRow = ref({})
|
const activeRow = ref({})
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const authorityTitleForm = ref('新增角色')
|
const authorityTitleForm = ref('新增角色')
|
||||||
const authorityFormVisible = ref(false)
|
const authorityFormVisible = ref(false)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="drawerFormVisible"
|
v-model="drawerFormVisible"
|
||||||
size="30%"
|
:size="appStore.drawerSize"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:before-close="closeDrawer"
|
:before-close="closeDrawer"
|
||||||
>
|
>
|
||||||
|
|
@ -120,11 +120,14 @@
|
||||||
|
|
||||||
import sysDictionaryDetail from './sysDictionaryDetail.vue'
|
import sysDictionaryDetail from './sysDictionaryDetail.vue'
|
||||||
import { Edit } from '@element-plus/icons-vue'
|
import { Edit } from '@element-plus/icons-vue'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'SysDictionary'
|
name: 'SysDictionary'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const selectID = ref(0)
|
const selectID = ref(0)
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
width="120"
|
width="120"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-table-column align="left" label="操作" width="180">
|
<el-table-column align="left" label="操作" :min-width="appStore.operateMinWith">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="drawerFormVisible"
|
v-model="drawerFormVisible"
|
||||||
size="30%"
|
:size="appStore.drawerSize"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:before-close="closeDrawer"
|
:before-close="closeDrawer"
|
||||||
>
|
>
|
||||||
|
|
@ -156,11 +156,14 @@
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { formatBoolean, formatDate } from '@/utils/format'
|
import { formatBoolean, formatDate } from '@/utils/format'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'SysDictionaryDetail'
|
name: 'SysDictionaryDetail'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
sysDictionaryID: {
|
sysDictionaryID: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
min-width="360"
|
min-width="360"
|
||||||
prop="component"
|
prop="component"
|
||||||
/>
|
/>
|
||||||
<el-table-column align="left" fixed="right" label="操作" width="300">
|
<el-table-column align="left" fixed="right" label="操作" :min-width="appStore.operateMinWith">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
</div>
|
</div>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="dialogFormVisible"
|
v-model="dialogFormVisible"
|
||||||
size="60%"
|
:size="appStore.drawerSize"
|
||||||
:before-close="handleClose"
|
:before-close="handleClose"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
>
|
>
|
||||||
|
|
@ -423,11 +423,14 @@
|
||||||
import ComponentsCascader from '@/view/superAdmin/menu/components/components-cascader.vue'
|
import ComponentsCascader from '@/view/superAdmin/menu/components/components-cascader.vue'
|
||||||
|
|
||||||
import pathInfo from '@/pathInfo.json'
|
import pathInfo from '@/pathInfo.json'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Menus'
|
name: 'Menus'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
path: [{ required: true, message: '请输入菜单name', trigger: 'blur' }],
|
path: [{ required: true, message: '请输入菜单name', trigger: 'blur' }],
|
||||||
component: [{ required: true, message: '请输入文件路径', trigger: 'blur' }],
|
component: [{ required: true, message: '请输入文件路径', trigger: 'blur' }],
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" min-width="250" fixed="right">
|
<el-table-column label="操作" :min-width="appStore.operateMinWith" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
</div>
|
</div>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="addUserDialog"
|
v-model="addUserDialog"
|
||||||
size="60%"
|
:size="appStore.drawerSize"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
|
@ -236,11 +236,14 @@
|
||||||
import { nextTick, ref, watch } from 'vue'
|
import { nextTick, ref, watch } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||||
|
import { useAppStore } from "@/pinia";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'User'
|
name: 'User'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const searchInfo = ref({
|
const searchInfo = ref({
|
||||||
username: '',
|
username: '',
|
||||||
nickname: '',
|
nickname: '',
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
<el-select
|
<el-select
|
||||||
v-model="middleDate.dictType"
|
v-model="middleDate.dictType"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="middleDate.fieldType !== 'string'"
|
:disabled="middleDate.fieldType !== 'string' && middleDate.fieldType !== 'array'"
|
||||||
placeholder="请选择字典"
|
placeholder="请选择字典"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,26 @@
|
||||||
<el-checkbox v-model="form.onlyTemplate" />
|
<el-checkbox v-model="form.onlyTemplate" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="9">
|
||||||
|
<el-form-item>
|
||||||
|
<template #label>
|
||||||
|
<el-tooltip
|
||||||
|
content="注:会自动创建parentID来进行父子关系关联,仅支持主键为int类型"
|
||||||
|
placement="bottom"
|
||||||
|
effect="light"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
树型结构 <el-icon><QuestionFilled /></el-icon>
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<el-checkbox v-model="form.isTree" />
|
||||||
|
<el-input v-model="form.treeJson" :disabled="!form.isTree" placeholder="前端展示json属性"></el-input>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1024,6 +1044,8 @@
|
||||||
gvaModel: true,
|
gvaModel: true,
|
||||||
autoCreateResource: false,
|
autoCreateResource: false,
|
||||||
onlyTemplate: false,
|
onlyTemplate: false,
|
||||||
|
isTree: false,
|
||||||
|
treeJson: "",
|
||||||
fields: []
|
fields: []
|
||||||
})
|
})
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
|
|
@ -1137,6 +1159,13 @@
|
||||||
}
|
}
|
||||||
const autoCodeForm = ref(null)
|
const autoCodeForm = ref(null)
|
||||||
const enterForm = async (isPreview) => {
|
const enterForm = async (isPreview) => {
|
||||||
|
if (form.value.isTree && !form.value.treeJson){
|
||||||
|
ElMessage({
|
||||||
|
type: 'error',
|
||||||
|
message: '请填写树型结构的前端展示json属性'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (!form.value.onlyTemplate) {
|
if (!form.value.onlyTemplate) {
|
||||||
if (form.value.fields.length <= 0) {
|
if (form.value.fields.length <= 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
|
|
@ -1445,6 +1474,8 @@
|
||||||
gvaModel: true,
|
gvaModel: true,
|
||||||
autoCreateResource: false,
|
autoCreateResource: false,
|
||||||
onlyTemplate: false,
|
onlyTemplate: false,
|
||||||
|
isTree: false,
|
||||||
|
treeJson: "",
|
||||||
fields: []
|
fields: []
|
||||||
}
|
}
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|
|
||||||
|
|
@ -148,49 +148,64 @@
|
||||||
:model="autoFunc"
|
:model="autoFunc"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="包名:">
|
<el-row :gutter="12">
|
||||||
<el-input
|
<el-col :span="8">
|
||||||
v-model="autoFunc.package"
|
<el-form-item label="包名:">
|
||||||
placeholder="请输入包名"
|
<el-input
|
||||||
disabled
|
v-model="autoFunc.package"
|
||||||
/>
|
placeholder="请输入包名"
|
||||||
</el-form-item>
|
disabled
|
||||||
<el-form-item label="结构体名:">
|
/>
|
||||||
<el-input
|
</el-form-item>
|
||||||
v-model="autoFunc.structName"
|
</el-col>
|
||||||
placeholder="请输入结构体名"
|
<el-col :span="8">
|
||||||
disabled
|
<el-form-item label="结构体名:">
|
||||||
/>
|
<el-input
|
||||||
</el-form-item>
|
v-model="autoFunc.structName"
|
||||||
<el-form-item label="前端文件名:">
|
placeholder="请输入结构体名"
|
||||||
<el-input
|
disabled
|
||||||
v-model="autoFunc.packageName"
|
/>
|
||||||
placeholder="请输入文件名"
|
</el-form-item>
|
||||||
disabled
|
</el-col>
|
||||||
/>
|
<el-col :span="8">
|
||||||
</el-form-item>
|
<el-form-item label="前端文件名:">
|
||||||
<el-form-item label="后端文件名:">
|
<el-input
|
||||||
<el-input
|
v-model="autoFunc.packageName"
|
||||||
v-model="autoFunc.humpPackageName"
|
placeholder="请输入文件名"
|
||||||
placeholder="请输入文件名"
|
disabled
|
||||||
disabled
|
/>
|
||||||
/>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="描述:">
|
</el-row>
|
||||||
<el-input
|
<el-row :gutter="12">
|
||||||
v-model="autoFunc.description"
|
<el-col :span="8">
|
||||||
placeholder="请输入描述"
|
<el-form-item label="后端文件名:">
|
||||||
disabled
|
<el-input
|
||||||
/>
|
v-model="autoFunc.humpPackageName"
|
||||||
</el-form-item>
|
placeholder="请输入文件名"
|
||||||
<el-form-item label="缩写:">
|
disabled
|
||||||
<el-input
|
/>
|
||||||
v-model="autoFunc.abbreviation"
|
</el-form-item>
|
||||||
placeholder="请输入缩写"
|
</el-col>
|
||||||
disabled
|
<el-col :span="8">
|
||||||
/>
|
<el-form-item label="描述:">
|
||||||
</el-form-item>
|
<el-input
|
||||||
|
v-model="autoFunc.description"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="缩写:">
|
||||||
|
<el-input
|
||||||
|
v-model="autoFunc.abbreviation"
|
||||||
|
placeholder="请输入缩写"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-form-item label="是否AI填充:">
|
<el-form-item label="是否AI填充:">
|
||||||
<el-switch v-model="autoFunc.isAi" />
|
<el-switch v-model="autoFunc.isAi" />
|
||||||
<span class="text-sm text-red-600 p-2"
|
<span class="text-sm text-red-600 p-2"
|
||||||
|
|
@ -378,7 +393,7 @@
|
||||||
funcFlag.value = true
|
funcFlag.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const funcFlag = ref(false)
|
const funcFlag = ref(true)
|
||||||
|
|
||||||
const closeFunc = () => {
|
const closeFunc = () => {
|
||||||
funcFlag.value = false
|
funcFlag.value = false
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,18 @@
|
||||||
label="模板信息"
|
label="模板信息"
|
||||||
prop="templateInfo"
|
prop="templateInfo"
|
||||||
min-width="120"
|
min-width="120"
|
||||||
|
show-overflow-tooltip
|
||||||
/>
|
/>
|
||||||
<el-table-column align="left" label="操作" min-width="120">
|
<el-table-column align="left" label="操作" min-width="280">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
icon="documentCopy"
|
||||||
|
class="table-button"
|
||||||
|
@click="copyFunc(scope.row)"
|
||||||
|
>复制</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
|
|
@ -834,6 +843,28 @@ JOINS模式下不支持导入
|
||||||
// 行为控制标记(弹窗内部需要增还是改)
|
// 行为控制标记(弹窗内部需要增还是改)
|
||||||
const type = ref('')
|
const type = ref('')
|
||||||
|
|
||||||
|
// 复制
|
||||||
|
const copyFunc = async (row) => {
|
||||||
|
let copyData
|
||||||
|
const res = await findSysExportTemplate({ ID: row.ID })
|
||||||
|
if (res.code === 0) {
|
||||||
|
copyData = JSON.parse(JSON.stringify(res.data.resysExportTemplate))
|
||||||
|
if (!copyData.conditions) {
|
||||||
|
copyData.conditions = []
|
||||||
|
}
|
||||||
|
if (!copyData.joinTemplate) {
|
||||||
|
copyData.joinTemplate = []
|
||||||
|
}
|
||||||
|
delete copyData.ID
|
||||||
|
delete copyData.CreatedAt
|
||||||
|
delete copyData.UpdatedAt
|
||||||
|
copyData.templateID = copyData.templateID + '_copy'
|
||||||
|
copyData.name = copyData.name + '_copy'
|
||||||
|
formData.value = copyData
|
||||||
|
dialogFormVisible.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 更新行
|
// 更新行
|
||||||
const updateSysExportTemplateFunc = async (row) => {
|
const updateSysExportTemplateFunc = async (row) => {
|
||||||
const res = await findSysExportTemplate({ ID: row.ID })
|
const res = await findSysExportTemplate({ ID: row.ID })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue