({\n")
for _, v := range dictTypeList {
// 字段映射字典
@@ -120,14 +109,17 @@ func (l *gCurd) generateWebModelDictOptions(ctx context.Context, in *CurdPreview
}
awaitLoadOptions = fmt.Sprintf("%s '%s',\n", awaitLoadOptions, v.Type)
+ interfaceOptionsBuffer.WriteString(" " + v.Type + ": Option[]; \n")
constOptionsBuffer.WriteString(" " + v.Type + ": [],\n")
}
+ interfaceOptionsBuffer.WriteString("};\n")
constOptionsBuffer.WriteString("});\n")
loadOptionsBuffer := bytes.NewBuffer(nil)
loadOptionsBuffer.WriteString(fmt.Sprintf(ModelLoadOptionsTemplate, awaitLoadOptions, switchLoadOptions))
+ options["interface"] = interfaceOptionsBuffer.String()
options["const"] = constOptionsBuffer.String()
options["load"] = loadOptionsBuffer.String()
diff --git a/server/internal/logic/admin/role.go b/server/internal/logic/admin/role.go
index 08d468b..132df2f 100644
--- a/server/internal/logic/admin/role.go
+++ b/server/internal/logic/admin/role.go
@@ -197,7 +197,7 @@ func (s *sAdminRole) Edit(ctx context.Context, in *adminin.RoleEditInp) (err err
}
func updateRoleChildrenTree(ctx context.Context, _id int64, _level int, _tree string) (err error) {
- var list []*entity.AdminDept
+ var list []*entity.AdminRole
if err = dao.AdminRole.Ctx(ctx).Where("pid", _id).Scan(&list); err != nil {
return
}
diff --git a/server/internal/logic/sys/dict_data.go b/server/internal/logic/sys/dict_data.go
index 29f2111..ff4f438 100644
--- a/server/internal/logic/sys/dict_data.go
+++ b/server/internal/logic/sys/dict_data.go
@@ -147,10 +147,6 @@ func (s *sSysDictData) GetTypes(ctx context.Context, id int64) (types []string,
// Select 获取列表
func (s *sSysDictData) Select(ctx context.Context, in *sysin.DataSelectInp) (list sysin.DataSelectModel, err error) {
mod := dao.SysDictData.Ctx(ctx).Where("type", in.Type)
- if in.Type != "" {
- mod = mod.Where("type", in.Type)
- }
-
if err = mod.Order("sort asc,id desc").Scan(&list); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return
diff --git a/server/internal/logic/sys/log.go b/server/internal/logic/sys/log.go
index 68432c9..fd31a84 100644
--- a/server/internal/logic/sys/log.go
+++ b/server/internal/logic/sys/log.go
@@ -18,6 +18,7 @@ import (
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
+ "hotgo/internal/library/hgorm/handler"
"hotgo/internal/library/hgorm/hook"
"hotgo/internal/library/location"
"hotgo/internal/library/queue"
@@ -236,7 +237,7 @@ func (s *sSysLog) AnalysisLog(ctx context.Context) entity.SysLog {
// View 获取指定字典类型信息
func (s *sSysLog) View(ctx context.Context, in *sysin.LogViewInp) (res *sysin.LogViewModel, err error) {
- if err = dao.SysLog.Ctx(ctx).Hook(hook.CityLabel).Where("id", in.Id).Scan(&res); err != nil {
+ if err = dao.SysLog.Ctx(ctx).Handler(handler.FilterAuth).Hook(hook.CityLabel).Where("id", in.Id).Scan(&res); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return
}
@@ -253,13 +254,13 @@ func (s *sSysLog) View(ctx context.Context, in *sysin.LogViewInp) (res *sysin.Lo
// Delete 删除
func (s *sSysLog) Delete(ctx context.Context, in *sysin.LogDeleteInp) (err error) {
- _, err = dao.SysLog.Ctx(ctx).Where("id", in.Id).Delete()
+ _, err = dao.SysLog.Ctx(ctx).Handler(handler.FilterAuth).Where("id", in.Id).Delete()
return
}
// List 列表
func (s *sSysLog) List(ctx context.Context, in *sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error) {
- mod := dao.SysLog.Ctx(ctx).FieldsEx("get_data", "header_data", "post_data")
+ mod := dao.SysLog.Ctx(ctx).Handler(handler.FilterAuth).FieldsEx("get_data", "header_data", "post_data")
// 访问路径
if in.Url != "" {
diff --git a/server/internal/service/sys.go b/server/internal/service/sys.go
index 3a7f081..36008ba 100644
--- a/server/internal/service/sys.go
+++ b/server/internal/service/sys.go
@@ -18,6 +18,167 @@ import (
)
type (
+ ISysCurdDemo interface {
+ // Model 生成演示ORM模型
+ Model(ctx context.Context, option ...*handler.Option) *gdb.Model
+ // List 获取生成演示列表
+ List(ctx context.Context, in *sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
+ // Export 导出生成演示
+ Export(ctx context.Context, in *sysin.CurdDemoListInp) (err error)
+ // Edit 修改/新增生成演示
+ Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err error)
+ // Delete 删除生成演示
+ Delete(ctx context.Context, in *sysin.CurdDemoDeleteInp) (err error)
+ // MaxSort 获取生成演示最大排序
+ MaxSort(ctx context.Context, in *sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
+ // View 获取生成演示指定信息
+ View(ctx context.Context, in *sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
+ // Status 更新生成演示状态
+ Status(ctx context.Context, in *sysin.CurdDemoStatusInp) (err error)
+ // Switch 更新生成演示开关
+ Switch(ctx context.Context, in *sysin.CurdDemoSwitchInp) (err error)
+ }
+ ISysDictData interface {
+ // Delete 删除
+ Delete(ctx context.Context, in *sysin.DictDataDeleteInp) error
+ // Edit 修改/新增
+ Edit(ctx context.Context, in *sysin.DictDataEditInp) (err error)
+ // List 获取列表
+ List(ctx context.Context, in *sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
+ // GetId 获取指定类型的ID
+ GetId(ctx context.Context, t string) (id int64, err error)
+ // GetType 获取指定ID的类型标识
+ GetType(ctx context.Context, id int64) (types string, err error)
+ // GetTypes 获取指定ID的所有类型标识,包含下级
+ GetTypes(ctx context.Context, id int64) (types []string, err error)
+ // Select 获取列表
+ Select(ctx context.Context, in *sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
+ }
+ ISysEmsLog interface {
+ // Delete 删除
+ Delete(ctx context.Context, in *sysin.EmsLogDeleteInp) (err error)
+ // Edit 修改/新增
+ Edit(ctx context.Context, in *sysin.EmsLogEditInp) (err error)
+ // Status 更新部门状态
+ Status(ctx context.Context, in *sysin.EmsLogStatusInp) (err error)
+ // View 获取指定字典类型信息
+ View(ctx context.Context, in *sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
+ // List 获取列表
+ List(ctx context.Context, in *sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
+ // Send 发送邮件
+ Send(ctx context.Context, in *sysin.SendEmsInp) (err error)
+ // GetTemplate 获取指定邮件模板
+ GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
+ // AllowSend 是否允许发送
+ AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
+ // NowDayCount 当天发送次数
+ NowDayCount(ctx context.Context, event, email string) (count int, err error)
+ // VerifyCode 效验验证码
+ VerifyCode(ctx context.Context, in *sysin.VerifyEmsCodeInp) (err error)
+ }
+ ISysLoginLog interface {
+ // Model 登录日志Orm模型
+ Model(ctx context.Context) *gdb.Model
+ // List 获取登录日志列表
+ List(ctx context.Context, in *sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
+ // Export 导出登录日志
+ Export(ctx context.Context, in *sysin.LoginLogListInp) (err error)
+ // Delete 删除登录日志
+ Delete(ctx context.Context, in *sysin.LoginLogDeleteInp) (err error)
+ // View 获取登录日志指定信息
+ View(ctx context.Context, in *sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
+ // Push 推送登录日志
+ Push(ctx context.Context, in *sysin.LoginLogPushInp)
+ // RealWrite 真实写入
+ RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
+ }
+ ISysAddons interface {
+ // List 获取列表
+ List(ctx context.Context, in *sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
+ // Selects 选项
+ Selects(ctx context.Context, in *sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
+ // Build 提交生成
+ Build(ctx context.Context, in *sysin.AddonsBuildInp) (err error)
+ // Install 安装模块
+ Install(ctx context.Context, in *sysin.AddonsInstallInp) (err error)
+ // Upgrade 更新模块
+ Upgrade(ctx context.Context, in *sysin.AddonsUpgradeInp) (err error)
+ // UnInstall 卸载模块
+ UnInstall(ctx context.Context, in *sysin.AddonsUnInstallInp) (err error)
+ }
+ ISysAttachment interface {
+ // Model ORM模型
+ Model(ctx context.Context, option ...*handler.Option) *gdb.Model
+ // Delete 删除附件
+ Delete(ctx context.Context, in *sysin.AttachmentDeleteInp) (err error)
+ // View 获取附件信息
+ View(ctx context.Context, in *sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
+ // List 获取附件列表
+ List(ctx context.Context, in *sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
+ // ClearKind 清空上传类型
+ ClearKind(ctx context.Context, in *sysin.AttachmentClearKindInp) (err error)
+ }
+ ISysCron interface {
+ StartCron(ctx context.Context)
+ // Delete 删除
+ Delete(ctx context.Context, in *sysin.CronDeleteInp) (err error)
+ // Edit 修改/新增
+ Edit(ctx context.Context, in *sysin.CronEditInp) (err error)
+ // Status 更新状态
+ Status(ctx context.Context, in *sysin.CronStatusInp) (err error)
+ // MaxSort 最大排序
+ MaxSort(ctx context.Context, in *sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
+ // View 获取指定信息
+ View(ctx context.Context, in *sysin.CronViewInp) (res *sysin.CronViewModel, err error)
+ // List 获取列表
+ List(ctx context.Context, in *sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
+ // GetName 获取分组名称
+ GetName(ctx context.Context, id int64) (name string, err error)
+ // OnlineExec 在线执行
+ OnlineExec(ctx context.Context, in *sysin.OnlineExecInp) (err error)
+ // DispatchLog 查看指定任务的调度日志
+ DispatchLog(ctx context.Context, in *sysin.DispatchLogInp) (res *sysin.DispatchLogModel, err error)
+ }
+ ISysServeLicense interface {
+ // Model 服务许可证ORM模型
+ Model(ctx context.Context, option ...*handler.Option) *gdb.Model
+ // List 获取服务许可证列表
+ List(ctx context.Context, in *sysin.ServeLicenseListInp) (list []*sysin.ServeLicenseListModel, totalCount int, err error)
+ // Export 导出服务许可证
+ Export(ctx context.Context, in *sysin.ServeLicenseListInp) (err error)
+ // Edit 修改/新增服务许可证
+ Edit(ctx context.Context, in *sysin.ServeLicenseEditInp) (err error)
+ // Delete 删除服务许可证
+ Delete(ctx context.Context, in *sysin.ServeLicenseDeleteInp) (err error)
+ // View 获取服务许可证指定信息
+ View(ctx context.Context, in *sysin.ServeLicenseViewInp) (res *sysin.ServeLicenseViewModel, err error)
+ // Status 更新服务许可证状态
+ Status(ctx context.Context, in *sysin.ServeLicenseStatusInp) (err error)
+ // AssignRouter 分配服务许可证路由
+ AssignRouter(ctx context.Context, in *sysin.ServeLicenseAssignRouterInp) (err error)
+ }
+ ISysSmsLog interface {
+ // Delete 删除
+ Delete(ctx context.Context, in *sysin.SmsLogDeleteInp) (err error)
+ // Edit 修改/新增
+ Edit(ctx context.Context, in *sysin.SmsLogEditInp) (err error)
+ // Status 更新短信状态
+ Status(ctx context.Context, in *sysin.SmsLogStatusInp) (err error)
+ // View 获取指定字典类型信息
+ View(ctx context.Context, in *sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
+ // List 获取列表
+ List(ctx context.Context, in *sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
+ // SendCode 发送验证码
+ SendCode(ctx context.Context, in *sysin.SendCodeInp) (err error)
+ // GetTemplate 获取指定短信模板
+ GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
+ // AllowSend 是否允许发送
+ AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
+ // NowDayCount 当天发送次数
+ NowDayCount(ctx context.Context, event, mobile string) (count int, err error)
+ // VerifyCode 效验验证码
+ VerifyCode(ctx context.Context, in *sysin.VerifyCodeInp) (err error)
+ }
ISysAddonsConfig interface {
// GetConfigByGroup 获取指定分组的配置
GetConfigByGroup(ctx context.Context, in *sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
@@ -46,6 +207,58 @@ type (
// ClusterSync 集群同步
ClusterSync(ctx context.Context, message *gredis.Message)
}
+ ISysLog interface {
+ // Export 导出
+ Export(ctx context.Context, in *sysin.LogListInp) (err error)
+ // RealWrite 真实写入
+ RealWrite(ctx context.Context, log entity.SysLog) (err error)
+ // AutoLog 根据配置自动记录请求日志
+ AutoLog(ctx context.Context) error
+ // AnalysisLog 解析日志数据
+ AnalysisLog(ctx context.Context) entity.SysLog
+ // View 获取指定字典类型信息
+ View(ctx context.Context, in *sysin.LogViewInp) (res *sysin.LogViewModel, err error)
+ // Delete 删除
+ Delete(ctx context.Context, in *sysin.LogDeleteInp) (err error)
+ // List 列表
+ List(ctx context.Context, in *sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
+ }
+ ISysProvinces interface {
+ // Tree 关系树选项列表
+ Tree(ctx context.Context) (list []*sysin.ProvincesTree, err error)
+ // Delete 删除省市区数据
+ Delete(ctx context.Context, in *sysin.ProvincesDeleteInp) (err error)
+ // Edit 修改/新增省市区数据
+ Edit(ctx context.Context, in *sysin.ProvincesEditInp) (err error)
+ // Status 更新省市区状态
+ Status(ctx context.Context, in *sysin.ProvincesStatusInp) (err error)
+ // MaxSort 最大排序
+ MaxSort(ctx context.Context, in *sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
+ // View 获取省市区信息
+ View(ctx context.Context, in *sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
+ // List 获取列表
+ List(ctx context.Context, in *sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
+ // ChildrenList 获取省市区下级列表
+ ChildrenList(ctx context.Context, in *sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
+ // UniqueId 获取省市区下级列表
+ UniqueId(ctx context.Context, in *sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
+ // Select 省市区选项
+ Select(ctx context.Context, in *sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
+ }
+ ISysServeLog interface {
+ // Model 服务日志Orm模型
+ Model(ctx context.Context) *gdb.Model
+ // List 获取服务日志列表
+ List(ctx context.Context, in *sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
+ // Export 导出服务日志
+ Export(ctx context.Context, in *sysin.ServeLogListInp) (err error)
+ // Delete 删除服务日志
+ Delete(ctx context.Context, in *sysin.ServeLogDeleteInp) (err error)
+ // View 获取服务日志指定信息
+ View(ctx context.Context, in *sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
+ // RealWrite 真实写入
+ RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
+ }
ISysConfig interface {
// InitConfig 初始化系统配置
InitConfig(ctx context.Context)
@@ -104,64 +317,6 @@ type (
// Select 选项
Select(ctx context.Context, in *sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
}
- ISysCurdDemo interface {
- // Model 生成演示ORM模型
- Model(ctx context.Context, option ...*handler.Option) *gdb.Model
- // List 获取生成演示列表
- List(ctx context.Context, in *sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
- // Export 导出生成演示
- Export(ctx context.Context, in *sysin.CurdDemoListInp) (err error)
- // Edit 修改/新增生成演示
- Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err error)
- // Delete 删除生成演示
- Delete(ctx context.Context, in *sysin.CurdDemoDeleteInp) (err error)
- // MaxSort 获取生成演示最大排序
- MaxSort(ctx context.Context, in *sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
- // View 获取生成演示指定信息
- View(ctx context.Context, in *sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
- // Status 更新生成演示状态
- Status(ctx context.Context, in *sysin.CurdDemoStatusInp) (err error)
- // Switch 更新生成演示开关
- Switch(ctx context.Context, in *sysin.CurdDemoSwitchInp) (err error)
- }
- ISysLog interface {
- // Export 导出
- Export(ctx context.Context, in *sysin.LogListInp) (err error)
- // RealWrite 真实写入
- RealWrite(ctx context.Context, log entity.SysLog) (err error)
- // AutoLog 根据配置自动记录请求日志
- AutoLog(ctx context.Context) error
- // AnalysisLog 解析日志数据
- AnalysisLog(ctx context.Context) entity.SysLog
- // View 获取指定字典类型信息
- View(ctx context.Context, in *sysin.LogViewInp) (res *sysin.LogViewModel, err error)
- // Delete 删除
- Delete(ctx context.Context, in *sysin.LogDeleteInp) (err error)
- // List 列表
- List(ctx context.Context, in *sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
- }
- ISysSmsLog interface {
- // Delete 删除
- Delete(ctx context.Context, in *sysin.SmsLogDeleteInp) (err error)
- // Edit 修改/新增
- Edit(ctx context.Context, in *sysin.SmsLogEditInp) (err error)
- // Status 更新短信状态
- Status(ctx context.Context, in *sysin.SmsLogStatusInp) (err error)
- // View 获取指定字典类型信息
- View(ctx context.Context, in *sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
- // List 获取列表
- List(ctx context.Context, in *sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
- // SendCode 发送验证码
- SendCode(ctx context.Context, in *sysin.SendCodeInp) (err error)
- // GetTemplate 获取指定短信模板
- GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
- // AllowSend 是否允许发送
- AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
- // NowDayCount 当天发送次数
- NowDayCount(ctx context.Context, event, mobile string) (count int, err error)
- // VerifyCode 效验验证码
- VerifyCode(ctx context.Context, in *sysin.VerifyCodeInp) (err error)
- }
ISysDictType interface {
// Tree 树
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
@@ -172,28 +327,6 @@ type (
// TreeSelect 获取类型关系树选项
TreeSelect(ctx context.Context, in *sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
}
- ISysEmsLog interface {
- // Delete 删除
- Delete(ctx context.Context, in *sysin.EmsLogDeleteInp) (err error)
- // Edit 修改/新增
- Edit(ctx context.Context, in *sysin.EmsLogEditInp) (err error)
- // Status 更新部门状态
- Status(ctx context.Context, in *sysin.EmsLogStatusInp) (err error)
- // View 获取指定字典类型信息
- View(ctx context.Context, in *sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
- // List 获取列表
- List(ctx context.Context, in *sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
- // Send 发送邮件
- Send(ctx context.Context, in *sysin.SendEmsInp) (err error)
- // GetTemplate 获取指定邮件模板
- GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
- // AllowSend 是否允许发送
- AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
- // NowDayCount 当天发送次数
- NowDayCount(ctx context.Context, event, email string) (count int, err error)
- // VerifyCode 效验验证码
- VerifyCode(ctx context.Context, in *sysin.VerifyEmsCodeInp) (err error)
- }
ISysGenCodes interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.GenCodesDeleteInp) (err error)
@@ -220,206 +353,29 @@ type (
// Build 提交生成
Build(ctx context.Context, in *sysin.GenCodesBuildInp) (err error)
}
- ISysProvinces interface {
- // Tree 关系树选项列表
- Tree(ctx context.Context) (list []*sysin.ProvincesTree, err error)
- // Delete 删除省市区数据
- Delete(ctx context.Context, in *sysin.ProvincesDeleteInp) (err error)
- // Edit 修改/新增省市区数据
- Edit(ctx context.Context, in *sysin.ProvincesEditInp) (err error)
- // Status 更新省市区状态
- Status(ctx context.Context, in *sysin.ProvincesStatusInp) (err error)
- // MaxSort 最大排序
- MaxSort(ctx context.Context, in *sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
- // View 获取省市区信息
- View(ctx context.Context, in *sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
- // List 获取列表
- List(ctx context.Context, in *sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
- // ChildrenList 获取省市区下级列表
- ChildrenList(ctx context.Context, in *sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
- // UniqueId 获取省市区下级列表
- UniqueId(ctx context.Context, in *sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
- // Select 省市区选项
- Select(ctx context.Context, in *sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
- }
- ISysServeLog interface {
- // Model 服务日志Orm模型
- Model(ctx context.Context) *gdb.Model
- // List 获取服务日志列表
- List(ctx context.Context, in *sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
- // Export 导出服务日志
- Export(ctx context.Context, in *sysin.ServeLogListInp) (err error)
- // Delete 删除服务日志
- Delete(ctx context.Context, in *sysin.ServeLogDeleteInp) (err error)
- // View 获取服务日志指定信息
- View(ctx context.Context, in *sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
- // RealWrite 真实写入
- RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
- }
- ISysAddons interface {
- // List 获取列表
- List(ctx context.Context, in *sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
- // Selects 选项
- Selects(ctx context.Context, in *sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
- // Build 提交生成
- Build(ctx context.Context, in *sysin.AddonsBuildInp) (err error)
- // Install 安装模块
- Install(ctx context.Context, in *sysin.AddonsInstallInp) (err error)
- // Upgrade 更新模块
- Upgrade(ctx context.Context, in *sysin.AddonsUpgradeInp) (err error)
- // UnInstall 卸载模块
- UnInstall(ctx context.Context, in *sysin.AddonsUnInstallInp) (err error)
- }
- ISysAttachment interface {
- // Model ORM模型
- Model(ctx context.Context, option ...*handler.Option) *gdb.Model
- // Delete 删除附件
- Delete(ctx context.Context, in *sysin.AttachmentDeleteInp) (err error)
- // View 获取附件信息
- View(ctx context.Context, in *sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
- // List 获取附件列表
- List(ctx context.Context, in *sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
- // ClearKind 清空上传类型
- ClearKind(ctx context.Context, in *sysin.AttachmentClearKindInp) (err error)
- }
- ISysCron interface {
- StartCron(ctx context.Context)
- // Delete 删除
- Delete(ctx context.Context, in *sysin.CronDeleteInp) (err error)
- // Edit 修改/新增
- Edit(ctx context.Context, in *sysin.CronEditInp) (err error)
- // Status 更新状态
- Status(ctx context.Context, in *sysin.CronStatusInp) (err error)
- // MaxSort 最大排序
- MaxSort(ctx context.Context, in *sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
- // View 获取指定信息
- View(ctx context.Context, in *sysin.CronViewInp) (res *sysin.CronViewModel, err error)
- // List 获取列表
- List(ctx context.Context, in *sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
- // GetName 获取分组名称
- GetName(ctx context.Context, id int64) (name string, err error)
- // OnlineExec 在线执行
- OnlineExec(ctx context.Context, in *sysin.OnlineExecInp) (err error)
- // DispatchLog 查看指定任务的调度日志
- DispatchLog(ctx context.Context, in *sysin.DispatchLogInp) (res *sysin.DispatchLogModel, err error)
- }
- ISysDictData interface {
- // Delete 删除
- Delete(ctx context.Context, in *sysin.DictDataDeleteInp) error
- // Edit 修改/新增
- Edit(ctx context.Context, in *sysin.DictDataEditInp) (err error)
- // List 获取列表
- List(ctx context.Context, in *sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
- // GetId 获取指定类型的ID
- GetId(ctx context.Context, t string) (id int64, err error)
- // GetType 获取指定ID的类型标识
- GetType(ctx context.Context, id int64) (types string, err error)
- // GetTypes 获取指定ID的所有类型标识,包含下级
- GetTypes(ctx context.Context, id int64) (types []string, err error)
- // Select 获取列表
- Select(ctx context.Context, in *sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
- }
- ISysLoginLog interface {
- // Model 登录日志Orm模型
- Model(ctx context.Context) *gdb.Model
- // List 获取登录日志列表
- List(ctx context.Context, in *sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
- // Export 导出登录日志
- Export(ctx context.Context, in *sysin.LoginLogListInp) (err error)
- // Delete 删除登录日志
- Delete(ctx context.Context, in *sysin.LoginLogDeleteInp) (err error)
- // View 获取登录日志指定信息
- View(ctx context.Context, in *sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
- // Push 推送登录日志
- Push(ctx context.Context, in *sysin.LoginLogPushInp)
- // RealWrite 真实写入
- RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
- }
- ISysServeLicense interface {
- // Model 服务许可证ORM模型
- Model(ctx context.Context, option ...*handler.Option) *gdb.Model
- // List 获取服务许可证列表
- List(ctx context.Context, in *sysin.ServeLicenseListInp) (list []*sysin.ServeLicenseListModel, totalCount int, err error)
- // Export 导出服务许可证
- Export(ctx context.Context, in *sysin.ServeLicenseListInp) (err error)
- // Edit 修改/新增服务许可证
- Edit(ctx context.Context, in *sysin.ServeLicenseEditInp) (err error)
- // Delete 删除服务许可证
- Delete(ctx context.Context, in *sysin.ServeLicenseDeleteInp) (err error)
- // View 获取服务许可证指定信息
- View(ctx context.Context, in *sysin.ServeLicenseViewInp) (res *sysin.ServeLicenseViewModel, err error)
- // Status 更新服务许可证状态
- Status(ctx context.Context, in *sysin.ServeLicenseStatusInp) (err error)
- // AssignRouter 分配服务许可证路由
- AssignRouter(ctx context.Context, in *sysin.ServeLicenseAssignRouterInp) (err error)
- }
)
var (
+ localSysAddons ISysAddons
+ localSysAttachment ISysAttachment
localSysCurdDemo ISysCurdDemo
- localSysLog ISysLog
+ localSysDictData ISysDictData
+ localSysEmsLog ISysEmsLog
+ localSysLoginLog ISysLoginLog
+ localSysAddonsConfig ISysAddonsConfig
+ localSysBlacklist ISysBlacklist
+ localSysCron ISysCron
+ localSysServeLicense ISysServeLicense
localSysSmsLog ISysSmsLog
+ localSysConfig ISysConfig
+ localSysCronGroup ISysCronGroup
+ localSysLog ISysLog
localSysProvinces ISysProvinces
localSysServeLog ISysServeLog
localSysDictType ISysDictType
- localSysEmsLog ISysEmsLog
localSysGenCodes ISysGenCodes
- localSysDictData ISysDictData
- localSysLoginLog ISysLoginLog
- localSysServeLicense ISysServeLicense
- localSysAddons ISysAddons
- localSysAttachment ISysAttachment
- localSysCron ISysCron
- localSysCronGroup ISysCronGroup
- localSysAddonsConfig ISysAddonsConfig
- localSysBlacklist ISysBlacklist
- localSysConfig ISysConfig
)
-func SysDictData() ISysDictData {
- if localSysDictData == nil {
- panic("implement not found for interface ISysDictData, forgot register?")
- }
- return localSysDictData
-}
-
-func RegisterSysDictData(i ISysDictData) {
- localSysDictData = i
-}
-
-func SysLoginLog() ISysLoginLog {
- if localSysLoginLog == nil {
- panic("implement not found for interface ISysLoginLog, forgot register?")
- }
- return localSysLoginLog
-}
-
-func RegisterSysLoginLog(i ISysLoginLog) {
- localSysLoginLog = i
-}
-
-func SysServeLicense() ISysServeLicense {
- if localSysServeLicense == nil {
- panic("implement not found for interface ISysServeLicense, forgot register?")
- }
- return localSysServeLicense
-}
-
-func RegisterSysServeLicense(i ISysServeLicense) {
- localSysServeLicense = i
-}
-
-func SysAddons() ISysAddons {
- if localSysAddons == nil {
- panic("implement not found for interface ISysAddons, forgot register?")
- }
- return localSysAddons
-}
-
-func RegisterSysAddons(i ISysAddons) {
- localSysAddons = i
-}
-
func SysAttachment() ISysAttachment {
if localSysAttachment == nil {
panic("implement not found for interface ISysAttachment, forgot register?")
@@ -431,61 +387,6 @@ func RegisterSysAttachment(i ISysAttachment) {
localSysAttachment = i
}
-func SysCron() ISysCron {
- if localSysCron == nil {
- panic("implement not found for interface ISysCron, forgot register?")
- }
- return localSysCron
-}
-
-func RegisterSysCron(i ISysCron) {
- localSysCron = i
-}
-
-func SysCronGroup() ISysCronGroup {
- if localSysCronGroup == nil {
- panic("implement not found for interface ISysCronGroup, forgot register?")
- }
- return localSysCronGroup
-}
-
-func RegisterSysCronGroup(i ISysCronGroup) {
- localSysCronGroup = i
-}
-
-func SysAddonsConfig() ISysAddonsConfig {
- if localSysAddonsConfig == nil {
- panic("implement not found for interface ISysAddonsConfig, forgot register?")
- }
- return localSysAddonsConfig
-}
-
-func RegisterSysAddonsConfig(i ISysAddonsConfig) {
- localSysAddonsConfig = i
-}
-
-func SysBlacklist() ISysBlacklist {
- if localSysBlacklist == nil {
- panic("implement not found for interface ISysBlacklist, forgot register?")
- }
- return localSysBlacklist
-}
-
-func RegisterSysBlacklist(i ISysBlacklist) {
- localSysBlacklist = i
-}
-
-func SysConfig() ISysConfig {
- if localSysConfig == nil {
- panic("implement not found for interface ISysConfig, forgot register?")
- }
- return localSysConfig
-}
-
-func RegisterSysConfig(i ISysConfig) {
- localSysConfig = i
-}
-
func SysCurdDemo() ISysCurdDemo {
if localSysCurdDemo == nil {
panic("implement not found for interface ISysCurdDemo, forgot register?")
@@ -497,15 +398,81 @@ func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = i
}
-func SysLog() ISysLog {
- if localSysLog == nil {
- panic("implement not found for interface ISysLog, forgot register?")
+func SysDictData() ISysDictData {
+ if localSysDictData == nil {
+ panic("implement not found for interface ISysDictData, forgot register?")
}
- return localSysLog
+ return localSysDictData
}
-func RegisterSysLog(i ISysLog) {
- localSysLog = i
+func RegisterSysDictData(i ISysDictData) {
+ localSysDictData = i
+}
+
+func SysEmsLog() ISysEmsLog {
+ if localSysEmsLog == nil {
+ panic("implement not found for interface ISysEmsLog, forgot register?")
+ }
+ return localSysEmsLog
+}
+
+func RegisterSysEmsLog(i ISysEmsLog) {
+ localSysEmsLog = i
+}
+
+func SysLoginLog() ISysLoginLog {
+ if localSysLoginLog == nil {
+ panic("implement not found for interface ISysLoginLog, forgot register?")
+ }
+ return localSysLoginLog
+}
+
+func RegisterSysLoginLog(i ISysLoginLog) {
+ localSysLoginLog = i
+}
+
+func SysAddons() ISysAddons {
+ if localSysAddons == nil {
+ panic("implement not found for interface ISysAddons, forgot register?")
+ }
+ return localSysAddons
+}
+
+func RegisterSysAddons(i ISysAddons) {
+ localSysAddons = i
+}
+
+func SysBlacklist() ISysBlacklist {
+ if localSysBlacklist == nil {
+ panic("implement not found for interface ISysBlacklist, forgot register?")
+ }
+ return localSysBlacklist
+}
+
+func RegisterSysBlacklist(i ISysBlacklist) {
+ localSysBlacklist = i
+}
+
+func SysCron() ISysCron {
+ if localSysCron == nil {
+ panic("implement not found for interface ISysCron, forgot register?")
+ }
+ return localSysCron
+}
+
+func RegisterSysCron(i ISysCron) {
+ localSysCron = i
+}
+
+func SysServeLicense() ISysServeLicense {
+ if localSysServeLicense == nil {
+ panic("implement not found for interface ISysServeLicense, forgot register?")
+ }
+ return localSysServeLicense
+}
+
+func RegisterSysServeLicense(i ISysServeLicense) {
+ localSysServeLicense = i
}
func SysSmsLog() ISysSmsLog {
@@ -519,6 +486,39 @@ func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
}
+func SysAddonsConfig() ISysAddonsConfig {
+ if localSysAddonsConfig == nil {
+ panic("implement not found for interface ISysAddonsConfig, forgot register?")
+ }
+ return localSysAddonsConfig
+}
+
+func RegisterSysAddonsConfig(i ISysAddonsConfig) {
+ localSysAddonsConfig = i
+}
+
+func SysCronGroup() ISysCronGroup {
+ if localSysCronGroup == nil {
+ panic("implement not found for interface ISysCronGroup, forgot register?")
+ }
+ return localSysCronGroup
+}
+
+func RegisterSysCronGroup(i ISysCronGroup) {
+ localSysCronGroup = i
+}
+
+func SysLog() ISysLog {
+ if localSysLog == nil {
+ panic("implement not found for interface ISysLog, forgot register?")
+ }
+ return localSysLog
+}
+
+func RegisterSysLog(i ISysLog) {
+ localSysLog = i
+}
+
func SysProvinces() ISysProvinces {
if localSysProvinces == nil {
panic("implement not found for interface ISysProvinces, forgot register?")
@@ -541,26 +541,15 @@ func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
}
-func SysDictType() ISysDictType {
- if localSysDictType == nil {
- panic("implement not found for interface ISysDictType, forgot register?")
+func SysConfig() ISysConfig {
+ if localSysConfig == nil {
+ panic("implement not found for interface ISysConfig, forgot register?")
}
- return localSysDictType
+ return localSysConfig
}
-func RegisterSysDictType(i ISysDictType) {
- localSysDictType = i
-}
-
-func SysEmsLog() ISysEmsLog {
- if localSysEmsLog == nil {
- panic("implement not found for interface ISysEmsLog, forgot register?")
- }
- return localSysEmsLog
-}
-
-func RegisterSysEmsLog(i ISysEmsLog) {
- localSysEmsLog = i
+func RegisterSysConfig(i ISysConfig) {
+ localSysConfig = i
}
func SysGenCodes() ISysGenCodes {
@@ -573,3 +562,14 @@ func SysGenCodes() ISysGenCodes {
func RegisterSysGenCodes(i ISysGenCodes) {
localSysGenCodes = i
}
+
+func SysDictType() ISysDictType {
+ if localSysDictType == nil {
+ panic("implement not found for interface ISysDictType, forgot register?")
+ }
+ return localSysDictType
+}
+
+func RegisterSysDictType(i ISysDictType) {
+ localSysDictType = i
+}
diff --git a/server/resource/generate/default/curd/source.sql.template b/server/resource/generate/default/curd/source.sql.template
index c94b001..967eff6 100644
--- a/server/resource/generate/default/curd/source.sql.template
+++ b/server/resource/generate/default/curd/source.sql.template
@@ -23,7 +23,7 @@ SET @now := now();
-- 菜单目录
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, '@{.options.Menu.Pid}', '@{.tableComment}', '@{.varName | LcFirst}', '/@{.varName | LcFirst}', '@{.options.Menu.Icon}', '1', '', '', '', '@{.mainComponent}', '1', '', '0', '0', '', '0', '0', '0', '1', '', '@{.options.Menu.Sort}', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, '@{.options.Menu.Pid}', '@{.tableComment}', '@{.varName | LcFirst}', '/@{.varName | LcFirst}', '@{.options.Menu.Icon}', '1', '', '', '', '@{.mainComponent}', '1', '', '0', '0', '', '0', '0', '0', '@{.dirLevel}', '@{.dirTree}', '@{.options.Menu.Sort}', '', '1', @now, @now);
SET @dirId = LAST_INSERT_ID();
@@ -31,41 +31,41 @@ SET @dirId = LAST_INSERT_ID();
-- 菜单页面
-- 列表
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '@{.tableComment}列表', '@{.varName | LcFirst}Index', 'index', '', '2', '', '/@{.apiPrefix}/list', '', '/@{.componentPrefix}/index', '1', '', '0', '0', '', '0', '0', '0', '2', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '@{.tableComment}列表', '@{.varName | LcFirst}Index', 'index', '', '2', '', '/@{.apiPrefix}/list', '', '/@{.componentPrefix}/index', '1', '', '0', '0', '', '0', '0', '0', '@{.listLevel}', CONCAT('@{.dirTree}tr_', @dirId,' '), '10', '', '1', @now, @now);
SET @listId = LAST_INSERT_ID();
@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) }
-- 详情
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '@{.tableComment}详情', '@{.varName | LcFirst}View', 'view/:id?', '', '2', '', '/@{.apiPrefix}/view', '', '/@{.componentPrefix}/view', '0', '@{.varName | LcFirst}Index', '0', '0', '', '0', '1', '0', '2', '', '20', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '@{.tableComment}详情', '@{.varName | LcFirst}View', '', '', '3', '', '/@{.apiPrefix}/view', '', '', '1', '', '0', '0', '', '0', '1', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '10', '', '1', @now, @now);
@{end}
-- 菜单按钮
@{ if eq .options.Step.HasEdit true }
-- 编辑
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '编辑/新增@{.tableComment}', '@{.varName | LcFirst}Edit', '', '', '3', '', '/@{.apiPrefix}/edit', '', '', '1', '', '0', '0', '', '0', '1', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '编辑/新增@{.tableComment}', '@{.varName | LcFirst}Edit', '', '', '3', '', '/@{.apiPrefix}/edit', '', '', '1', '', '0', '0', '', '0', '1', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '20', '', '1', @now, @now);
@{end}
SET @editId = LAST_INSERT_ID();
@{ if and (eq .options.Step.HasEdit true) (eq .options.Step.HasMaxSort true) }
-- 获取最大排序
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @editId, '获取@{.tableComment}最大排序', '@{.varName | LcFirst}MaxSort', '', '', '3', '', '/@{.apiPrefix}/maxSort', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @editId, '获取@{.tableComment}最大排序', '@{.varName | LcFirst}MaxSort', '', '', '3', '', '/@{.apiPrefix}/maxSort', '', '', '1', '', '0', '0', '', '0', '0', '0', '@{.sortLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId, ' tr_', @editId,' '), '30', '', '1', @now, @now);
@{end}
@{ if eq .options.Step.HasDel true }
-- 删除
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '删除@{.tableComment}', '@{.varName | LcFirst}Delete', '', '', '3', '', '/@{.apiPrefix}/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '删除@{.tableComment}', '@{.varName | LcFirst}Delete', '', '', '3', '', '/@{.apiPrefix}/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '40', '', '1', @now, @now);
@{end}
@{ if eq .options.Step.HasStatus true }
-- 更新状态
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '修改@{.tableComment}状态', '@{.varName | LcFirst}Status', '', '', '3', '', '/@{.apiPrefix}/status', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '修改@{.tableComment}状态', '@{.varName | LcFirst}Status', '', '', '3', '', '/@{.apiPrefix}/status', '', '', '1', '', '0', '0', '', '0', '0', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '50', '', '1', @now, @now);
@{end}
@{ if eq .options.Step.HasSwitch true }
-- 操作开关
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '操作@{.tableComment}开关', '@{.varName | LcFirst}Switch', '', '', '3', '', '/@{.apiPrefix}/switch', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '操作@{.tableComment}开关', '@{.varName | LcFirst}Switch', '', '', '3', '', '/@{.apiPrefix}/switch', '', '', '1', '', '0', '0', '', '0', '0', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '60', '', '1', @now, @now);
@{end}
@{ if eq .options.Step.HasExport true }
-- 导出
-INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '导出@{.tableComment}', '@{.varName | LcFirst}Export', '', '', '3', '', '/@{.apiPrefix}/export', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `@{.menuTable}` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '导出@{.tableComment}', '@{.varName | LcFirst}Export', '', '', '3', '', '/@{.apiPrefix}/export', '', '', '1', '', '0', '0', '', '0', '0', '0', '@{.btnLevel}', CONCAT('@{.dirTree}tr_', @dirId, ' tr_', @listId,' '), '70', '', '1', @now, @now);
@{end}
COMMIT;
\ No newline at end of file
diff --git a/server/resource/generate/default/curd/web.edit.vue.template b/server/resource/generate/default/curd/web.edit.vue.template
index 6cc800b..3f523fe 100644
--- a/server/resource/generate/default/curd/web.edit.vue.template
+++ b/server/resource/generate/default/curd/web.edit.vue.template
@@ -2,24 +2,28 @@
-
-@{.formItem}
-
+
+
+ @{.formItem}
+
+
取消
@@ -33,37 +37,18 @@
diff --git a/server/resource/generate/default/curd/web.index.vue.template b/server/resource/generate/default/curd/web.index.vue.template
index 8fc6782..7bb6404 100644
--- a/server/resource/generate/default/curd/web.index.vue.template
+++ b/server/resource/generate/default/curd/web.index.vue.template
@@ -76,12 +76,8 @@
-@{ if eq .options.Step.HasEdit true } @{end}
+@{ if eq .options.Step.HasEdit true } @{end}
+@{ if eq .options.Step.HasView true } @{end}
@@ -92,21 +88,21 @@
import { BasicForm, useForm } from '@/components/Form/index';
import { usePermission } from '@/hooks/web/usePermission';
@{.apiImport}
- import { State, columns, schemas, options, newState } from './model';
+ import { columns, schemas, options } from './model';
@{.iconsImport}
-@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } import { useRouter } from 'vue-router';@{end}
import { getOptionLabel } from '@/utils/hotgo';
@{ if eq .options.Step.HasEdit true } import Edit from './edit.vue';@{end}
- const { hasPermission } = usePermission();
-@{ if or (eq .options.Step.HasView true) (eq .options.Step.HasEdit true) } const router = useRouter();@{end}
- const actionRef = ref();
+@{ if eq .options.Step.HasView true } import View from './view.vue';@{end}
+
const dialog = useDialog();
const message = useMessage();
+ const { hasPermission } = usePermission();
+ const actionRef = ref();
const searchFormRef = ref({});
+ const viewRef = ref();
+ const editRef = ref();
const batchDeleteDisabled = ref(true);
const checkedIds = ref([]);
- const showModal = ref(false);
- const formParams = ref();
const actionColumn = reactive({
width: 300,
@@ -169,15 +165,6 @@
const loadDataTable = async (res) => {
return await List({ ...searchFormRef.value?.formModel, ...res });
};
-@{ if eq .options.Step.HasAdd true }
- function addTable() {
- showModal.value = true;
- formParams.value = newState(null);
- }@{end}
-@{ if or (eq .options.Step.HasAdd true) (eq .options.Step.HasEdit true) }
- function updateShowModal(value) {
- showModal.value = value;
- }@{end}
@{ if eq .options.Step.HasCheck true } function onCheckedRow(rowKeys) {
batchDeleteDisabled.value = rowKeys.length <= 0;
@@ -187,14 +174,17 @@
function reloadTable() {
actionRef.value.reload();
}
-@{ if eq .options.Step.HasView true }
- function handleView(record: Recordable) {
- router.push({ name: '@{.varName | LcFirst}View', params: { id: record.@{.pk.TsName} } });
+@{ if eq .options.Step.HasAdd true }
+ function addTable() {
+ editRef.value.openModal(null);
}@{end}
@{ if eq .options.Step.HasEdit true }
function handleEdit(record: Recordable) {
- showModal.value = true;
- formParams.value = newState(record as State);
+ editRef.value.openModal(record);
+ }@{end}
+@{ if eq .options.Step.HasView true }
+ function handleView(record: Recordable) {
+ viewRef.value.openModal(record);
}@{end}
@{ if eq .options.Step.HasDel true } function handleDelete(record: Recordable) {
@@ -209,9 +199,6 @@
reloadTable();
});
},
- onNegativeClick: () => {
- // message.error('取消');
- },
});
}@{end}
@@ -229,9 +216,6 @@
reloadTable();
});
},
- onNegativeClick: () => {
- // message.error('取消');
- },
});
}@{end}
diff --git a/server/resource/generate/default/curd/web.model.ts.template b/server/resource/generate/default/curd/web.model.ts.template
index ae0d193..002a751 100644
--- a/server/resource/generate/default/curd/web.model.ts.template
+++ b/server/resource/generate/default/curd/web.model.ts.template
@@ -8,24 +8,25 @@ import { isArray, isNullObject } from '@/utils/is';
import { getFileExt } from '@/utils/urlUtils';
import { defRangeShortcuts, defShortcuts, formatToDate } from '@/utils/dateUtil';
import { validate } from '@/utils/validateUtil';
-import { getOptionLabel, getOptionTag, Options, errorImg } from '@/utils/hotgo';
+import { getOptionLabel, getOptionTag, Option, Options, errorImg } from '@/utils/hotgo';
@{ if eq .options.Step.HasSwitch true }
import { usePermission } from '@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const $message = window['$message'];
@{end}
-
@{.state}
-@{.defaultState}
-
-export function newState(state: State | null): State {
+export function newState(state: State | Record | null): State {
if (state !== null) {
- return cloneDeep(state);
+ if (state instanceof State) {
+ return cloneDeep(state);
+ }
+ return new State(state);
}
- return cloneDeep(defaultState);
+ return new State();
}
+@{.dictOptions.interface}
@{.dictOptions.const}
@{.rules}
@{.formSchema}
diff --git a/server/resource/generate/default/curd/web.view.vue.template b/server/resource/generate/default/curd/web.view.vue.template
index 24928dd..3e8e773 100644
--- a/server/resource/generate/default/curd/web.view.vue.template
+++ b/server/resource/generate/default/curd/web.view.vue.template
@@ -1,28 +1,33 @@
-
-
-
-@{.item}
-
-
+
+
+
+ 生成演示详情
+
+ 关闭
+
+
+ @{.item}
+
+
+
+
diff --git a/server/storage/data/generate/curd_demo_menu.sql b/server/storage/data/generate/curd_demo_menu.sql
index 4c719e5..799dec5 100644
--- a/server/storage/data/generate/curd_demo_menu.sql
+++ b/server/storage/data/generate/curd_demo_menu.sql
@@ -1,7 +1,7 @@
-- hotgo自动生成菜单权限SQL 通常情况下只在首次生成代码时自动执行一次
--- 如需再次执行请先手动删除生成的菜单权限和在SQL文件:E:\Users\Administrator\Desktop\gosrc\hotgo\server\resource\data\generate\curd_demo_menu.sql
--- Version: 2.1.0
--- Date: 2023-01-18 15:19:42
+-- 如需再次执行请先手动删除生成的菜单权限和在SQL文件:C:\Users\Administrator\Desktop\gosrc\hotgo_dev\server\storage\data\generate\curd_demo_menu.sql
+-- Version: 2.11.5
+-- Date: 2023-12-29 18:18:21
-- Link https://github.com/bufanyun/hotgo
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@@ -23,7 +23,7 @@ SET @now := now();
-- 菜单目录
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, '2097', '生成演示', 'curdDemo', '/curdDemo', 'MenuOutlined', '1', '', '', '', 'ParentLayout', '1', '', '0', '0', '', '0', '0', '0', '1', '', '200', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, '2097', '生成演示', 'curdDemo', '/curdDemo', 'MenuOutlined', '1', '', '', '', 'ParentLayout', '1', '', '0', '0', '', '0', '0', '0', '2', 'tr_2097 ', '200', '', '1', @now, @now);
SET @dirId = LAST_INSERT_ID();
@@ -31,41 +31,41 @@ SET @dirId = LAST_INSERT_ID();
-- 菜单页面
-- 列表
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '生成演示列表', 'curdDemoIndex', 'index', '', '2', '', '/curdDemo/list', '', '/curdDemo/index', '1', '', '0', '0', '', '0', '0', '0', '2', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '生成演示列表', 'curdDemoIndex', 'index', '', '2', '', '/curdDemo/list', '', '/curdDemo/index', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_2097 tr_', @dirId,' '), '10', '', '1', @now, @now);
SET @listId = LAST_INSERT_ID();
-- 详情
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @dirId, '生成演示详情', 'curdDemoView', 'view/:id?', '', '2', '', '/curdDemo/view', '', '/curdDemo/view', '0', 'curdDemoIndex', '0', '0', '', '0', '1', '0', '2', '', '20', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '生成演示详情', 'curdDemoView', '', '', '3', '', '/curdDemo/view', '', '', '1', '', '0', '0', '', '0', '1', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '10', '', '1', @now, @now);
-- 菜单按钮
-- 编辑
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '编辑/新增生成演示', 'curdDemoEdit', '', '', '3', '', '/curdDemo/edit', '', '', '1', '', '0', '0', '', '0', '1', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '编辑/新增生成演示', 'curdDemoEdit', '', '', '3', '', '/curdDemo/edit', '', '', '1', '', '0', '0', '', '0', '1', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '20', '', '1', @now, @now);
SET @editId = LAST_INSERT_ID();
-- 获取最大排序
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @editId, '获取生成演示最大排序', 'curdDemoMaxSort', '', '', '3', '', '/curdDemo/maxSort', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @editId, '获取生成演示最大排序', 'curdDemoMaxSort', '', '', '3', '', '/curdDemo/maxSort', '', '', '1', '', '0', '0', '', '0', '0', '0', '5', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId, ' tr_', @editId,' '), '30', '', '1', @now, @now);
-- 删除
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '删除生成演示', 'curdDemoDelete', '', '', '3', '', '/curdDemo/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '删除生成演示', 'curdDemoDelete', '', '', '3', '', '/curdDemo/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '40', '', '1', @now, @now);
-- 更新状态
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '修改生成演示状态', 'curdDemoStatus', '', '', '3', '', '/curdDemo/status', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '修改生成演示状态', 'curdDemoStatus', '', '', '3', '', '/curdDemo/status', '', '', '1', '', '0', '0', '', '0', '0', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '50', '', '1', @now, @now);
-- 操作开关
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '操作生成演示开关', 'curdDemoSwitch', '', '', '3', '', '/curdDemo/switch', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '操作生成演示开关', 'curdDemoSwitch', '', '', '3', '', '/curdDemo/switch', '', '', '1', '', '0', '0', '', '0', '0', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '60', '', '1', @now, @now);
-- 导出
-INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '导出生成演示', 'curdDemoExport', '', '', '3', '', '/curdDemo/export', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', '', '10', '', '1', @now, @now);
+INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) VALUES (NULL, @listId, '导出生成演示', 'curdDemoExport', '', '', '3', '', '/curdDemo/export', '', '', '1', '', '0', '0', '', '0', '0', '0', '4', CONCAT('tr_2097 tr_', @dirId, ' tr_', @listId,' '), '70', '', '1', @now, @now);
COMMIT;
\ No newline at end of file
diff --git a/web/.eslintrc.js b/web/.eslintrc.js
index 489ca2b..a4c04aa 100644
--- a/web/.eslintrc.js
+++ b/web/.eslintrc.js
@@ -37,19 +37,12 @@ module.exports = defineConfig({
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
- '@typescript-eslint/no-unused-vars': [
- 'error',
- {
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- },
- ],
+ '@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '.*', args: 'none' }],
'no-unused-vars': [
'error',
- {
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- },
+ // we are only using this rule to check for unused arguments since TS
+ // catches unused variables but not args.
+ { varsIgnorePattern: '.*', args: 'none' },
],
'space-before-function-paren': 'off',
diff --git a/web/package.json b/web/package.json
index a55dc1f..aeffa72 100644
--- a/web/package.json
+++ b/web/package.json
@@ -1,6 +1,6 @@
{
"name": "hotgo",
- "version": "2.11.5",
+ "version": "2.12.1",
"author": {
"name": "MengShuai",
"email": "133814250@qq.com",
@@ -28,39 +28,39 @@
"test prod gzip": "http-server dist --cors --gzip -c-1"
},
"dependencies": {
- "@vicons/antd": "^0.10.0",
- "@vicons/ionicons5": "^0.10.0",
- "@vueup/vue-quill": "^1.1.0",
- "@vueuse/core": "^5.3.0",
+ "@vicons/antd": "^0.12.0",
+ "@vicons/ionicons5": "^0.12.0",
+ "@vueup/vue-quill": "^1.2.0",
+ "@vueuse/core": "^10.7.1",
"axios": "^0.21.4",
"date-fns": "^2.28.0",
"echarts": "^5.3.2",
"element-resize-detector": "^1.2.4",
"highlight.js": "^11.8.0",
"lodash-es": "^4.17.21",
- "naive-ui": "^2.34.3",
- "pinia": "^2.0.14",
+ "naive-ui": "^2.36.0",
+ "pinia": "^2.1.7",
"qrcode.vue": "3.3.3",
"qs": "^6.10.3",
- "quill-image-uploader": "^1.2.4",
+ "quill-image-uploader": "^1.3.0",
"quill-magic-url": "^4.2.0",
"throttle-debounce": "^5.0.0",
- "vue": "^3.2.35",
- "vue-router": "^4.0.15",
- "vue-types": "^4.1.1",
+ "vue": "^3.4.0",
+ "vue-router": "^4.2.5",
+ "vue-types": "^5.1.1",
"vue3-json-viewer": "^2.2.2",
"vuedraggable": "^4.1.0",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
- "@commitlint/cli": "^12.1.4",
- "@commitlint/config-conventional": "^12.1.4",
- "@types/lodash": "^4.14.182",
- "@types/node": "^15.14.9",
- "@typescript-eslint/eslint-plugin": "^4.33.0",
- "@typescript-eslint/parser": "^4.33.0",
- "@vitejs/plugin-vue": "^1.10.2",
- "@vitejs/plugin-vue-jsx": "^1.3.10",
+ "@commitlint/cli": "^17.7.0",
+ "@commitlint/config-conventional": "^17.7.0",
+ "@types/lodash": "^4.14.197",
+ "@types/node": "^18.17.4",
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
+ "@typescript-eslint/parser": "^5.62.0",
+ "@vitejs/plugin-vue": "^3.2.0",
+ "@vitejs/plugin-vue-jsx": "^2.1.1",
"@vue/compiler-sfc": "^3.2.33",
"@vue/eslint-config-typescript": "^7.0.0",
"autoprefixer": "^10.4.7",
@@ -93,11 +93,11 @@
"tailwindcss": "^2.2.19",
"typescript": "^4.6.4",
"unplugin-vue-components": "^0.17.21",
- "vite": "^2.9.8",
- "vite-plugin-compression": "^0.3.6",
+ "vite": "^4.2.7",
+ "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^2.1.2",
"vite-plugin-require-transform": "^1.0.5",
- "vite-plugin-style-import": "^1.4.1",
+ "vite-plugin-style-import": "^2.0.0",
"vite-plugin-top-level-await": "^1.2.2",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vue-eslint-parser": "^7.11.0"
@@ -134,6 +134,6 @@
},
"homepage": "https://github.com/bufanyun/hotgo",
"engines": {
- "node": "^12 || >=14"
+ "node": ">=16"
}
}
diff --git a/web/src/api/base/index.ts b/web/src/api/base/index.ts
index be5dbb6..7e0209b 100644
--- a/web/src/api/base/index.ts
+++ b/web/src/api/base/index.ts
@@ -1,4 +1,5 @@
import { http } from '@/utils/http/axios';
+import { useUserStoreWidthOut } from '@/store/modules/user';
// 获取验证码
export function GetCaptcha() {
@@ -10,9 +11,15 @@ export function GetCaptcha() {
// 上传图片
export function UploadImage(params) {
+ const useUserStore = useUserStoreWidthOut();
+ const headers = {
+ Authorization: useUserStore.token,
+ uploadType: 'default',
+ };
return http.request({
- url: '/upload/image',
+ url: '/upload/file',
method: 'post',
params,
+ headers,
});
}
diff --git a/web/src/components/FileChooser/index.vue b/web/src/components/FileChooser/index.vue
index 4fe98f7..6d054f4 100644
--- a/web/src/components/FileChooser/index.vue
+++ b/web/src/components/FileChooser/index.vue
@@ -83,7 +83,7 @@
ref="fileUploadRef"
:width="dialogWidth"
:finish-call="handleFinishCall"
- max-upload="20"
+ :max-upload="20"
/>
diff --git a/web/src/utils/http/axios/index.ts b/web/src/utils/http/axios/index.ts
index 5cd1333..ba51207 100644
--- a/web/src/utils/http/axios/index.ts
+++ b/web/src/utils/http/axios/index.ts
@@ -9,8 +9,8 @@ import { PageEnum } from '@/enums/pageEnum';
import { useGlobSetting } from '@/hooks/setting';
-import { isString } from '@/utils/is/';
-import { deepMerge, isUrl } from '@/utils';
+import { isString, isUrl } from '@/utils/is/';
+import { deepMerge } from '@/utils';
import { setObjToUrlParams } from '@/utils/urlUtils';
import { CreateAxiosOptions, RequestOptions, Result } from './types';
diff --git a/web/src/utils/index.ts b/web/src/utils/index.ts
index f64d223..31e55f2 100644
--- a/web/src/utils/index.ts
+++ b/web/src/utils/index.ts
@@ -250,9 +250,35 @@ export function lighten(color: string, amount: number) {
)}${addLight(color.substring(4, 6), amount)}`;
}
-/**
- * 判断是否 url
- * */
-export function isUrl(url: string) {
- return /^(http|https):\/\//g.test(url);
+// 获取树的所有节点key
+export function getAllExpandKeys(treeData: any): any[] {
+ let expandedKeys = [];
+ const expandKeys = (items: any[]) => {
+ items.forEach((item: any) => {
+ expandedKeys.push(item.key);
+ if (item.children && item.children.length > 0) {
+ expandKeys(item.children);
+ }
+ });
+ };
+
+ expandKeys(unref(treeData));
+
+ // 去重并转换为数组
+ expandedKeys = Array.from(new Set(expandedKeys));
+ return expandedKeys;
+}
+
+// 从树中查找指定ID
+export function findTreeDataById(data: any[], id: number | string) {
+ for (const item of data) {
+ if (item.id === id) {
+ return item;
+ }
+ if (item.children) {
+ const found = findTreeDataById(item.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
}
diff --git a/web/src/utils/propTypes.ts b/web/src/utils/propTypes.ts
index a61be72..6c4173e 100644
--- a/web/src/utils/propTypes.ts
+++ b/web/src/utils/propTypes.ts
@@ -1,33 +1,50 @@
import { CSSProperties, VNodeChild } from 'vue';
-import { createTypes, VueTypeValidableDef, VueTypesInterface } from 'vue-types';
+import {
+ createTypes,
+ VueTypeExtendCallback,
+ VueTypeValidableDef,
+ VueTypesInterface,
+} from 'vue-types';
export type VueNode = VNodeChild | JSX.Element;
-type PropTypes = VueTypesInterface & {
+type ExtendedPropTypes = VueTypesInterface & {
readonly style: VueTypeValidableDef;
readonly VNodeChild: VueTypeValidableDef;
};
-const propTypes = createTypes({
- func: undefined,
- bool: undefined,
- string: undefined,
- number: undefined,
- object: undefined,
- integer: undefined,
-}) as PropTypes;
+class CustomVueTypes
+ extends (createTypes({
+ func: undefined,
+ bool: undefined,
+ string: undefined,
+ number: undefined,
+ object: undefined,
+ integer: undefined,
+ }) as VueTypesInterface)
+ implements ExtendedPropTypes
+{
+ static extend(types: VueTypeExtendCallback[]): CustomVueTypes {
+ return types.reduce((result, { name, ...callbacks }) => {
+ result[name] = { getter: true, ...callbacks };
+ return result;
+ }, this);
+ }
-propTypes.extend([
+ readonly style!: VueTypeValidableDef;
+ readonly VNodeChild!: VueTypeValidableDef;
+}
+
+const propTypes = CustomVueTypes.extend([
{
name: 'style',
- getter: true,
type: [String, Object],
default: undefined,
},
{
name: 'VNodeChild',
- getter: true,
type: undefined,
},
]);
+
export { propTypes };
diff --git a/web/src/views/curdDemo/edit.vue b/web/src/views/curdDemo/edit.vue
index f2f8bd6..eba5941 100644
--- a/web/src/views/curdDemo/edit.vue
+++ b/web/src/views/curdDemo/edit.vue
@@ -2,65 +2,69 @@
-
-
-
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
+
取消
@@ -73,44 +77,25 @@
\ No newline at end of file
diff --git a/web/src/views/curdDemo/index.vue b/web/src/views/curdDemo/index.vue
index 3c6b606..102c989 100644
--- a/web/src/views/curdDemo/index.vue
+++ b/web/src/views/curdDemo/index.vue
@@ -76,12 +76,8 @@
-
+
+
@@ -92,21 +88,21 @@
import { BasicForm, useForm } from '@/components/Form/index';
import { usePermission } from '@/hooks/web/usePermission';
import { List, Export, Delete, Status } from '@/api/curdDemo';
- import { State, columns, schemas, options, newState } from './model';
+ import { columns, schemas, options } from './model';
import { PlusOutlined, ExportOutlined, DeleteOutlined } from '@vicons/antd';
- import { useRouter } from 'vue-router';
import { getOptionLabel } from '@/utils/hotgo';
import Edit from './edit.vue';
- const { hasPermission } = usePermission();
- const router = useRouter();
- const actionRef = ref();
+ import View from './view.vue';
+
const dialog = useDialog();
const message = useMessage();
+ const { hasPermission } = usePermission();
+ const actionRef = ref();
const searchFormRef = ref({});
+ const viewRef = ref();
+ const editRef = ref();
const batchDeleteDisabled = ref(true);
const checkedIds = ref([]);
- const showModal = ref(false);
- const formParams = ref();
const actionColumn = reactive({
width: 300,
@@ -170,15 +166,6 @@
return await List({ ...searchFormRef.value?.formModel, ...res });
};
- function addTable() {
- showModal.value = true;
- formParams.value = newState(null);
- }
-
- function updateShowModal(value) {
- showModal.value = value;
- }
-
function onCheckedRow(rowKeys) {
batchDeleteDisabled.value = rowKeys.length <= 0;
checkedIds.value = rowKeys;
@@ -188,13 +175,16 @@
actionRef.value.reload();
}
- function handleView(record: Recordable) {
- router.push({ name: 'curdDemoView', params: { id: record.id } });
+ function addTable() {
+ editRef.value.openModal(null);
}
function handleEdit(record: Recordable) {
- showModal.value = true;
- formParams.value = newState(record as State);
+ editRef.value.openModal(record);
+ }
+
+ function handleView(record: Recordable) {
+ viewRef.value.openModal(record);
}
function handleDelete(record: Recordable) {
@@ -209,9 +199,6 @@
reloadTable();
});
},
- onNegativeClick: () => {
- // message.error('取消');
- },
});
}
@@ -229,9 +216,6 @@
reloadTable();
});
},
- onNegativeClick: () => {
- // message.error('取消');
- },
});
}
diff --git a/web/src/views/curdDemo/model.ts b/web/src/views/curdDemo/model.ts
index df475dd..0539aa4 100644
--- a/web/src/views/curdDemo/model.ts
+++ b/web/src/views/curdDemo/model.ts
@@ -8,59 +8,46 @@ import { isArray, isNullObject } from '@/utils/is';
import { getFileExt } from '@/utils/urlUtils';
import { defRangeShortcuts, defShortcuts, formatToDate } from '@/utils/dateUtil';
import { validate } from '@/utils/validateUtil';
-import { getOptionLabel, getOptionTag, Options, errorImg } from '@/utils/hotgo';
+import { getOptionLabel, getOptionTag, Option, Options, errorImg } from '@/utils/hotgo';
import { usePermission } from '@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const $message = window['$message'];
-
-export interface State {
- id: number;
- categoryId: number;
- title: string;
- description: string;
- content: string;
- image: string;
- attachfile: string;
- cityId: number;
- switch: number;
- sort: number;
- status: number;
- createdBy: number;
- updatedBy: number;
- createdAt: string;
- updatedAt: string;
- deletedAt: string;
+export class State {
+ public id = 0; // ID
+ public categoryId = 0; // 分类ID
+ public title = ''; // 标题
+ public description = ''; // 描述
+ public content = ''; // 内容
+ public image = ''; // 单图
+ public attachfile = ''; // 附件
+ public cityId = 0; // 所在城市
+ public switch = 1; // 显示开关
+ public sort = 0; // 排序
+ public status = 1; // 状态
+ public createdBy = 0; // 创建者
+ public updatedBy = 0; // 更新者
+ public createdAt = ''; // 创建时间
+ public updatedAt = ''; // 修改时间
+ public deletedAt = ''; // 删除时间
}
-export const defaultState: State = {
- id: 0,
- categoryId: 0,
- title: '',
- description: '',
- content: '',
- image: '',
- attachfile: '',
- cityId: 0,
- switch: 1,
- sort: 0,
- status: 1,
- createdBy: 0,
- updatedBy: 0,
- createdAt: '',
- updatedAt: '',
- deletedAt: '',
+export function newState(state: State | Record | null): State {
+ if (state !== null) {
+ if (state instanceof State) {
+ return cloneDeep(state);
+ }
+ return new State(state);
+ }
+ return new State();
+}
+
+export interface IOptions extends Options {
+ sys_normal_disable: Option[];
};
-export function newState(state: State | null): State {
- if (state !== null) {
- return cloneDeep(state);
- }
- return cloneDeep(defaultState);
-}
-
-export const options = ref({
+export const options = ref({
sys_normal_disable: [],
});
diff --git a/web/src/views/curdDemo/view.vue b/web/src/views/curdDemo/view.vue
index 7d58052..250ba8c 100644
--- a/web/src/views/curdDemo/view.vue
+++ b/web/src/views/curdDemo/view.vue
@@ -1,11 +1,14 @@
-
-
-
-
+
+
+
+ 生成演示详情
+
+ 关闭
+
+
+
分类ID
{{ formValue.categoryId }}
@@ -69,23 +72,25 @@
-
-
+
+
+
+
diff --git a/web/src/views/develop/code/components/BaseInfo.vue b/web/src/views/develop/code/components/BaseInfo.vue
index bc924ed..5d67f26 100644
--- a/web/src/views/develop/code/components/BaseInfo.vue
+++ b/web/src/views/develop/code/components/BaseInfo.vue
@@ -234,7 +234,7 @@
关联表数量建议在三个以下
-
+
diff --git a/web/src/views/org/user/list.vue b/web/src/views/org/user/list.vue
index 995fe93..fce1b71 100644
--- a/web/src/views/org/user/list.vue
+++ b/web/src/views/org/user/list.vue
@@ -69,6 +69,7 @@
-
+