From e8a0a41cb4c28cf8da64ce981daaa955fc080150 Mon Sep 17 00:00:00 2001 From: maxbad <26058031@qq.com> Date: Sun, 7 May 2023 14:16:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=B8=80=E4=BA=9B=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/hggen/views/column_default.go | 2 +- server/internal/logic/admin/menu.go | 9 +++++++++ server/internal/logic/sys/log.go | 2 +- server/internal/logic/sys/login_log.go | 4 ++-- server/internal/logic/sys/serve_log.go | 2 +- web/package.json | 1 + web/src/utils/index.ts | 2 +- web/src/views/develop/addons/index.vue | 19 ++++--------------- .../develop/code/components/PreviewTab.vue | 5 ++++- web/src/views/permission/role/columns.ts | 1 - 10 files changed, 24 insertions(+), 23 deletions(-) diff --git a/server/internal/library/hggen/views/column_default.go b/server/internal/library/hggen/views/column_default.go index 169e93e..1944004 100644 --- a/server/internal/library/hggen/views/column_default.go +++ b/server/internal/library/hggen/views/column_default.go @@ -109,7 +109,7 @@ func setDefault(field *sysin.GenCodesColumnListModel) { setDefaultValue(field) - if field.IsAllowNull == "YES" { + if field.IsAllowNull == "NO" { field.Required = true } diff --git a/server/internal/logic/admin/menu.go b/server/internal/logic/admin/menu.go index 8ba19a0..b3020b5 100644 --- a/server/internal/logic/admin/menu.go +++ b/server/internal/logic/admin/menu.go @@ -346,6 +346,15 @@ func (s *sAdminMenu) GetMenuList(ctx context.Context, memberId int64) (lists rol if err != nil { return role.DynamicRes{}, err } + if len(array) > 0 { + pidList, err := dao.AdminMenu.Ctx(ctx).Fields("pid").WhereIn("id", array).Group("pid").Array() + if err != nil { + return role.DynamicRes{}, err + } + if len(pidList) > 0 { + array = append(pidList, array...) + } + } mod = mod.Where("id", array) } diff --git a/server/internal/logic/sys/log.go b/server/internal/logic/sys/log.go index d8a37ae..afa6bd9 100644 --- a/server/internal/logic/sys/log.go +++ b/server/internal/logic/sys/log.go @@ -99,7 +99,7 @@ func (s *sSysLog) Export(ctx context.Context, in sysin.LogListInp) (err error) { // RealWrite 真实写入 func (s *sSysLog) RealWrite(ctx context.Context, commonLog entity.SysLog) (err error) { - _, err = dao.SysLog.Ctx(ctx).Data(commonLog).Insert() + _, err = dao.SysLog.Ctx(ctx).Data(commonLog).FieldsEx(dao.SysLog.Columns().Id).Insert() return } diff --git a/server/internal/logic/sys/login_log.go b/server/internal/logic/sys/login_log.go index b30c2c3..02b4178 100644 --- a/server/internal/logic/sys/login_log.go +++ b/server/internal/logic/sys/login_log.go @@ -99,7 +99,7 @@ func (s *sSysLoginLog) List(ctx context.Context, in sysin.LoginLogListInp) (list } for _, v := range list { - g.DumpWithType(v) + //g.DumpWithType(v) //// 获取省市编码对应的地区名称 //region, err := location.ParseRegion(ctx, v.SysLogProvinceId, v.SysLogCityId, 0) //if err != nil { @@ -191,6 +191,6 @@ func (s *sSysLoginLog) Push(ctx context.Context, in sysin.LoginLogPushInp) { // RealWrite 真实写入 func (s *sSysLoginLog) RealWrite(ctx context.Context, models entity.SysLoginLog) (err error) { - _, err = dao.SysLoginLog.Ctx(ctx).Data(models).Insert() + _, err = dao.SysLoginLog.Ctx(ctx).Data(models).FieldsEx(dao.SysLoginLog.Columns().Id).Insert() return } diff --git a/server/internal/logic/sys/serve_log.go b/server/internal/logic/sys/serve_log.go index 4e8d1fc..4681463 100644 --- a/server/internal/logic/sys/serve_log.go +++ b/server/internal/logic/sys/serve_log.go @@ -144,6 +144,6 @@ func (s *sSysServeLog) View(ctx context.Context, in sysin.ServeLogViewInp) (res // RealWrite 真实写入 func (s *sSysServeLog) RealWrite(ctx context.Context, models entity.SysServeLog) (err error) { - _, err = dao.SysServeLog.Ctx(ctx).Data(models).Insert() + _, err = dao.SysServeLog.Ctx(ctx).Data(models).FieldsEx(dao.SysServeLog.Columns().Id).Insert() return } diff --git a/web/package.json b/web/package.json index 2fcac1f..24c51dc 100644 --- a/web/package.json +++ b/web/package.json @@ -38,6 +38,7 @@ "date-fns": "^2.28.0", "echarts": "^5.3.2", "element-resize-detector": "^1.2.4", + "highlight.js": "^11.8.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", "mitt": "^2.1.0", diff --git a/web/src/utils/index.ts b/web/src/utils/index.ts index 2b239b8..7b183fc 100644 --- a/web/src/utils/index.ts +++ b/web/src/utils/index.ts @@ -118,7 +118,7 @@ export function getChildrenRouter(routerMap: Array) { * 判断根路由 Router * */ export function isRootRouter(item) { - if (item.meta?.alwaysShow != true && item.children?.length === 1) { + if (item.meta?.alwaysShow != true && item.children?.length === 0) { return true; } diff --git a/web/src/views/develop/addons/index.vue b/web/src/views/develop/addons/index.vue index e37c441..6290384 100644 --- a/web/src/views/develop/addons/index.vue +++ b/web/src/views/develop/addons/index.vue @@ -120,6 +120,7 @@ NIcon, NTag, NIconWrapper, + NAvatar, useMessage, NImage, useDialog, @@ -159,25 +160,13 @@ }); } else { return h( - NIconWrapper, + NAvatar, { size: 48, - borderRadius: 8, + color: '#2D8CF0', }, { - default: () => - h( - NIcon, - { - size: 36, - style: { - marginTop: '-8px', - }, - }, - { - default: () => h(getIconComponent(row.logo)), - } - ), + default: () => h(getIconComponent(row.logo)), } ); } diff --git a/web/src/views/develop/code/components/PreviewTab.vue b/web/src/views/develop/code/components/PreviewTab.vue index 2b92574..3ed6a60 100644 --- a/web/src/views/develop/code/components/PreviewTab.vue +++ b/web/src/views/develop/code/components/PreviewTab.vue @@ -10,7 +10,7 @@ {{ view.path }} - + @@ -19,6 +19,8 @@