diff --git a/server/internal/logic/sys/im_file.go b/server/internal/logic/sys/im_file.go index f477289..6e1adc0 100644 --- a/server/internal/logic/sys/im_file.go +++ b/server/internal/logic/sys/im_file.go @@ -8,6 +8,7 @@ package sys import ( "context" "hotgo/internal/consts" + "hotgo/internal/library/contexts" "hotgo/internal/model/entity" "hotgo/internal/model/input/sysin" "hotgo/internal/service" @@ -47,6 +48,9 @@ func (s *sSysImFile) List(ctx context.Context, in *sysin.ImFileListInp) (list [] for _, item := range list { item.TenantId = tenant.Id item.TenantName = tenant.Name + if !contexts.IsCompanyDept(ctx) { + item.Location = "" + } } return } @@ -68,6 +72,9 @@ func (s *sSysImFile) View(ctx context.Context, in *sysin.ImFileViewInp) (res *sy } res.TenantId = tenant.Id res.TenantName = tenant.Name + if !contexts.IsCompanyDept(ctx) { + res.Location = "" + } if err = db.Model("im_filemsglinks").Safe().Ctx(ctx). Fields("id", "createdat created_at", "fileid file_id", "COALESCE(msgid,0) msg_id", "COALESCE(topic,'') topic", "COALESCE(userid,0) user_id"). Where("fileid", in.Id). @@ -139,6 +146,9 @@ func (s *sSysImFile) CleanupOrphan(ctx context.Context, in *sysin.ImFileCleanupO return nil, gerror.Wrap(err, "标记IM孤儿文件失败,请稍后重试!") } res.Count = len(ids) + if !contexts.IsCompanyDept(ctx) { + res.Locations = []string{} + } _ = writeImAdminAudit(ctx, tenant.Id, "im_file_cleanup_orphan", "im_file", 0, "success", g.Map{ "days": in.Days, "limit": in.Limit, "count": res.Count, }) diff --git a/server/storage/data/generate/im_feedback_config_menu.sql b/server/storage/data/generate/im_feedback_config_menu.sql index 0746731..a9753c8 100644 --- a/server/storage/data/generate/im_feedback_config_menu.sql +++ b/server/storage/data/generate/im_feedback_config_menu.sql @@ -1,12 +1,31 @@ +SET NAMES utf8mb4; SET @now := NOW(); -SET @imRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imManager' LIMIT 1); -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`) -SELECT NULL, @imRootId, '意见反馈配置', 'imFeedbackConfigIndex', 'feedback-config/index', '', '2', '', '/imFeedbackConfig/get', '', '/imFeedbackConfig/index', '1', 'imManager', '0', '0', '', '0', '0', '0', '2', CONCAT('tr_', @imRootId, ' '), '84', '', '1', @now, @now +INSERT INTO `hg_admin_menu` (`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`) +SELECT 0, '工作台管理', 'workbenchManager', '/workbench', 'AppstoreOutlined', 1, '/workbench/config/index', '', '', 'LAYOUT', 1, '', 1, 0, '', 0, 0, 0, 1, '', 126, '附加功能独立管理入口', 1, @now, @now +WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'workbenchManager'); + +SET @workbenchRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'workbenchManager' LIMIT 1); + +INSERT INTO `hg_admin_menu` (`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`) +SELECT @workbenchRootId, '意见反馈配置', 'imFeedbackConfigIndex', 'feedback-config/index', '', 2, '', '/imFeedbackConfig/get', '', '/imFeedbackConfig/index', 1, 'workbenchManager', 0, 0, '', 0, 0, 0, 2, CONCAT('tr_', @workbenchRootId, ' '), 30, '', 1, @now, @now WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imFeedbackConfigIndex'); SET @imFeedbackConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imFeedbackConfigIndex' LIMIT 1); -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`) -SELECT NULL, @imFeedbackConfigId, '反馈配置更新', 'imFeedbackConfigUpdate', '', '', '3', '', '/imFeedbackConfig/update', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @imFeedbackConfigId, ' '), '10', '', '1', @now, @now +UPDATE `hg_admin_menu` +SET `pid`=@workbenchRootId, `path`='feedback-config/index', `active_menu`='workbenchManager', + `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=30, + `status`=1, `hidden`=0, `updated_at`=@now +WHERE `id`=@imFeedbackConfigId; + +INSERT INTO `hg_admin_menu` (`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`) +SELECT @imFeedbackConfigId, '反馈配置更新', 'imFeedbackConfigUpdate', '', '', 3, '', '/imFeedbackConfig/update', '', '', 1, '', 0, 0, '', 0, 1, 0, 3, CONCAT('tr_', @workbenchRootId, ' tr_', @imFeedbackConfigId, ' '), 10, '', 1, @now, @now WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imFeedbackConfigUpdate'); + +UPDATE `hg_admin_menu` +SET `level`=3, `tree`=CONCAT('tr_', @workbenchRootId, ' tr_', @imFeedbackConfigId, ' '), `updated_at`=@now +WHERE `pid`=@imFeedbackConfigId AND `type`=3; + +INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) +SELECT `role_id`, @workbenchRootId FROM `hg_admin_role_menu` WHERE `menu_id`=@imFeedbackConfigId; diff --git a/server/storage/data/generate/im_mailbox_config_menu.sql b/server/storage/data/generate/im_mailbox_config_menu.sql index 2bd9eed..9a77336 100644 --- a/server/storage/data/generate/im_mailbox_config_menu.sql +++ b/server/storage/data/generate/im_mailbox_config_menu.sql @@ -1,12 +1,31 @@ +SET NAMES utf8mb4; SET @now := NOW(); -SET @imRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imManager' LIMIT 1); -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`) -SELECT NULL, @imRootId, '总经理信箱配置', 'imMailboxConfigIndex', 'mailbox-config/index', '', '2', '', '/imMailboxConfig/get', '', '/imMailboxConfig/index', '1', 'imManager', '0', '0', '', '0', '0', '0', '2', CONCAT('tr_', @imRootId, ' '), '83', '', '1', @now, @now +INSERT INTO `hg_admin_menu` (`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`) +SELECT 0, '工作台管理', 'workbenchManager', '/workbench', 'AppstoreOutlined', 1, '/workbench/config/index', '', '', 'LAYOUT', 1, '', 1, 0, '', 0, 0, 0, 1, '', 126, '附加功能独立管理入口', 1, @now, @now +WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'workbenchManager'); + +SET @workbenchRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'workbenchManager' LIMIT 1); + +INSERT INTO `hg_admin_menu` (`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`) +SELECT @workbenchRootId, '总经理信箱配置', 'imMailboxConfigIndex', 'mailbox-config/index', '', 2, '', '/imMailboxConfig/get', '', '/imMailboxConfig/index', 1, 'workbenchManager', 0, 0, '', 0, 0, 0, 2, CONCAT('tr_', @workbenchRootId, ' '), 20, '', 1, @now, @now WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imMailboxConfigIndex'); SET @imMailboxConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imMailboxConfigIndex' LIMIT 1); -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`) -SELECT NULL, @imMailboxConfigId, '信箱配置更新', 'imMailboxConfigUpdate', '', '', '3', '', '/imMailboxConfig/update', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @imMailboxConfigId, ' '), '10', '', '1', @now, @now +UPDATE `hg_admin_menu` +SET `pid`=@workbenchRootId, `path`='mailbox-config/index', `active_menu`='workbenchManager', + `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=20, + `status`=1, `hidden`=0, `updated_at`=@now +WHERE `id`=@imMailboxConfigId; + +INSERT INTO `hg_admin_menu` (`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`) +SELECT @imMailboxConfigId, '信箱配置更新', 'imMailboxConfigUpdate', '', '', 3, '', '/imMailboxConfig/update', '', '', 1, '', 0, 0, '', 0, 1, 0, 3, CONCAT('tr_', @workbenchRootId, ' tr_', @imMailboxConfigId, ' '), 10, '', 1, @now, @now WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imMailboxConfigUpdate'); + +UPDATE `hg_admin_menu` +SET `level`=3, `tree`=CONCAT('tr_', @workbenchRootId, ' tr_', @imMailboxConfigId, ' '), `updated_at`=@now +WHERE `pid`=@imMailboxConfigId AND `type`=3; + +INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) +SELECT `role_id`, @workbenchRootId FROM `hg_admin_role_menu` WHERE `menu_id`=@imMailboxConfigId; diff --git a/server/storage/data/generate/im_menu_hierarchy.sql b/server/storage/data/generate/im_menu_hierarchy.sql index cc4d8ab..f956eee 100644 --- a/server/storage/data/generate/im_menu_hierarchy.sql +++ b/server/storage/data/generate/im_menu_hierarchy.sql @@ -63,12 +63,9 @@ UPDATE `hg_admin_menu` SET `pid`=@auditId, `path`='task-dashboard/index', `level UPDATE `hg_admin_menu` SET `pid`=@settingsId, `title`='商户管理', `path`='tenant/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=10, `updated_at`=@now WHERE `name`='imTenantIndex'; UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='security-policy/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=20, `updated_at`=@now WHERE `name`='imSecurityPolicyIndex'; UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='file-policy/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=30, `updated_at`=@now WHERE `name`='imFilePolicyIndex'; -UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='workbench/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=40, `updated_at`=@now WHERE `name`='imWorkbenchIndex'; UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='external-config/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=50, `updated_at`=@now WHERE `name`='imExternalConfigIndex'; UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='notification/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=60, `updated_at`=@now WHERE `name`='imNotificationIndex'; UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='app-release/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=70, `updated_at`=@now WHERE `name`='imAppReleaseIndex'; -UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='mailbox-config/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=80, `updated_at`=@now WHERE `name`='imMailboxConfigIndex'; -UPDATE `hg_admin_menu` SET `pid`=@settingsId, `path`='feedback-config/index', `level`=3, `tree`=CONCAT('tr_', @imRootId, ' tr_', @settingsId, ' '), `sort`=90, `updated_at`=@now WHERE `name`='imFeedbackConfigIndex'; -- Remove one-page wrapper directories after their page has been moved. UPDATE `hg_admin_menu` SET `status`=2, `hidden`=1, `updated_at`=@now @@ -92,3 +89,23 @@ JOIN `hg_admin_menu` section ON section.`id` = page.`pid` LEFT JOIN `hg_admin_role_menu` existing ON existing.`role_id` = rm.`role_id` AND existing.`menu_id` = section.`id` WHERE section.`id` IN (@peopleId, @contentId, @auditId, @settingsId) AND existing.`menu_id` IS NULL; + +-- Optional features use their own top-level menu and can be replaced independently. +INSERT INTO `hg_admin_menu` (`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`) +SELECT 0, '工作台管理', 'workbenchManager', '/workbench', 'AppstoreOutlined', 1, '/workbench/config/index', '', '', 'LAYOUT', 1, '', 1, 0, '', 0, 0, 0, 1, '', 126, '附加功能独立管理入口', 1, @now, @now +WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'workbenchManager'); + +SET @workbenchRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'workbenchManager' LIMIT 1); +SET @workbenchId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchIndex' LIMIT 1); +SET @mailboxConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imMailboxConfigIndex' LIMIT 1); +SET @feedbackConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imFeedbackConfigIndex' LIMIT 1); + +UPDATE `hg_admin_menu` SET `pid`=0, `title`='工作台管理', `path`='/workbench', `icon`='AppstoreOutlined', `type`=1, `redirect`='/workbench/config/index', `component`='LAYOUT', `always_show`=1, `active_menu`='', `is_root`=1, `hidden`=0, `level`=1, `tree`=CONCAT('tr_', `id`, ' '), `sort`=126, `status`=1, `updated_at`=@now WHERE `id`=@workbenchRootId; +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `title`='工作台配置', `path`='config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=10, `status`=1, `hidden`=0, `updated_at`=@now WHERE `id`=@workbenchId; +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `path`='mailbox-config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=20, `status`=1, `hidden`=0, `updated_at`=@now WHERE `id`=@mailboxConfigId; +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `path`='feedback-config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=30, `status`=1, `hidden`=0, `updated_at`=@now WHERE `id`=@feedbackConfigId; +UPDATE `hg_admin_menu` SET `level`=3, `tree`=CONCAT('tr_', @workbenchRootId, ' tr_', @workbenchId, ' '), `updated_at`=@now WHERE `pid`=@workbenchId AND `type`=3; +UPDATE `hg_admin_menu` child JOIN `hg_admin_menu` page ON page.`id`=child.`pid` SET child.`level`=3, child.`tree`=CONCAT('tr_', @workbenchRootId, ' tr_', page.`id`, ' '), child.`updated_at`=@now WHERE page.`id` IN (@mailboxConfigId, @feedbackConfigId) AND child.`type`=3; + +INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) +SELECT `role_id`, @workbenchRootId FROM `hg_admin_role_menu` WHERE `menu_id` IN (@workbenchId, @mailboxConfigId, @feedbackConfigId); diff --git a/server/storage/data/generate/im_menu_title_repair.sql b/server/storage/data/generate/im_menu_title_repair.sql index af4156b..da41e76 100644 --- a/server/storage/data/generate/im_menu_title_repair.sql +++ b/server/storage/data/generate/im_menu_title_repair.sql @@ -83,6 +83,7 @@ UPDATE `hg_admin_menu` SET `title` = '更新配置' WHERE `name` = 'imExternalCo UPDATE `hg_admin_menu` SET `title` = '检查配置' WHERE `name` = 'imExternalConfigCheck'; UPDATE `hg_admin_menu` SET `title` = '工作台配置' WHERE `name` = 'imWorkbenchIndex'; +UPDATE `hg_admin_menu` SET `title` = '工作台管理' WHERE `name` = 'workbenchManager'; UPDATE `hg_admin_menu` SET `title` = '模块编辑' WHERE `name` = 'imWorkbenchEdit'; UPDATE `hg_admin_menu` SET `title` = '模块删除' WHERE `name` = 'imWorkbenchDelete'; UPDATE `hg_admin_menu` SET `title` = '模块排序' WHERE `name` = 'imWorkbenchReorder'; diff --git a/server/storage/data/generate/im_missing_menu_patch.sql b/server/storage/data/generate/im_missing_menu_patch.sql index 1082ca3..a991f51 100644 --- a/server/storage/data/generate/im_missing_menu_patch.sql +++ b/server/storage/data/generate/im_missing_menu_patch.sql @@ -79,3 +79,17 @@ WHERE parent_id IS NOT NULL INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) SELECT 1, `id` FROM `hg_admin_menu` WHERE `name` LIKE 'im%' OR `path` LIKE '/im%' OR `path` LIKE 'im/%'; + +-- Move replaceable workbench features out of the core IM menu. +INSERT INTO `hg_admin_menu` (`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`) +SELECT 0, '工作台管理', 'workbenchManager', '/workbench', 'AppstoreOutlined', 1, '/workbench/config/index', '', '', 'LAYOUT', 1, '', 1, 0, '', 0, 0, 0, 1, '', 126, '附加功能独立管理入口', 1, @now, @now +WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name`='workbenchManager'); + +SET @workbenchRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name`='workbenchManager' LIMIT 1); +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `path`='config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=10, `updated_at`=@now WHERE `id`=@workbenchId; +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `path`='mailbox-config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=20, `updated_at`=@now WHERE `id`=@mailboxConfigId; +UPDATE `hg_admin_menu` SET `pid`=@workbenchRootId, `path`='feedback-config/index', `active_menu`='workbenchManager', `level`=2, `tree`=CONCAT('tr_', @workbenchRootId, ' '), `sort`=30, `updated_at`=@now WHERE `id`=@feedbackConfigId; +UPDATE `hg_admin_menu` child JOIN `hg_admin_menu` page ON page.`id`=child.`pid` SET child.`level`=3, child.`tree`=CONCAT('tr_', @workbenchRootId, ' tr_', page.`id`, ' '), child.`updated_at`=@now WHERE page.`id` IN (@workbenchId, @mailboxConfigId, @feedbackConfigId) AND child.`type`=3; + +INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) +SELECT `role_id`, @workbenchRootId FROM `hg_admin_role_menu` WHERE `menu_id` IN (@workbenchId, @mailboxConfigId, @feedbackConfigId); diff --git a/server/storage/data/generate/im_workbench_menu.sql b/server/storage/data/generate/im_workbench_menu.sql index c08e824..805d7d3 100644 --- a/server/storage/data/generate/im_workbench_menu.sql +++ b/server/storage/data/generate/im_workbench_menu.sql @@ -1,20 +1,76 @@ +-- Keep optional workbench features outside the core IM menu tree. +SET NAMES utf8mb4; SET @now := NOW(); -SET @imRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imManager' LIMIT 1); -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`) -SELECT NULL, @imRootId, '工作台配置', 'imWorkbenchIndex', 'workbench/index', '', '2', '', '/imWorkbench/list', '', '/imWorkbench/index', '1', 'imManager', '0', '0', '', '0', '0', '0', '2', CONCAT('tr_', @imRootId, ' '), '80', '', '1', @now, @now -WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchIndex'); +INSERT INTO `hg_admin_menu` (`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`) +SELECT 0, '工作台管理', 'workbenchManager', '/workbench', 'AppstoreOutlined', 1, '/workbench/config/index', '', '', 'LAYOUT', 1, '', 1, 0, '', 0, 0, 0, 1, '', 126, '附加功能独立管理入口', 1, @now, @now +WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'workbenchManager'); + +SET @workbenchRootId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'workbenchManager' LIMIT 1); + +UPDATE `hg_admin_menu` +SET `pid` = 0, `title` = '工作台管理', `path` = '/workbench', `icon` = 'AppstoreOutlined', + `type` = 1, `redirect` = '/workbench/config/index', `component` = 'LAYOUT', + `always_show` = 1, `active_menu` = '', `is_root` = 1, `hidden` = 0, + `level` = 1, `tree` = CONCAT('tr_', `id`, ' '), `sort` = 126, `status` = 1, + `updated_at` = @now +WHERE `id` = @workbenchRootId; + +INSERT INTO `hg_admin_menu` (`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`) +SELECT @workbenchRootId, '工作台配置', 'imWorkbenchIndex', 'config/index', '', 2, '', '/imWorkbench/list', '', '/imWorkbench/index', 1, 'workbenchManager', 0, 0, '', 0, 0, 0, 2, CONCAT('tr_', @workbenchRootId, ' '), 10, '', 1, @now, @now +WHERE @workbenchRootId IS NOT NULL + AND NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchIndex'); SET @imWorkbenchId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchIndex' LIMIT 1); -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`) -SELECT NULL, @imWorkbenchId, '工作台编辑', 'imWorkbenchEdit', '', '', '3', '', '/imWorkbench/edit', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @imWorkbenchId, ' '), '10', '', '1', @now, @now -WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchEdit'); +UPDATE `hg_admin_menu` +SET `pid` = @workbenchRootId, `title` = '工作台配置', `path` = 'config/index', + `type` = 2, `permissions` = '/imWorkbench/list', `component` = '/imWorkbench/index', + `always_show` = 1, `active_menu` = 'workbenchManager', `is_root` = 0, `hidden` = 0, + `level` = 2, `tree` = CONCAT('tr_', @workbenchRootId, ' '), `sort` = 10, `status` = 1, + `updated_at` = @now +WHERE `id` = @imWorkbenchId; -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`) -SELECT NULL, @imWorkbenchId, '工作台禁用', 'imWorkbenchDelete', '', '', '3', '', '/imWorkbench/delete', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @imWorkbenchId, ' '), '20', '', '1', @now, @now -WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchDelete'); +INSERT INTO `hg_admin_menu` (`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`) +SELECT @imWorkbenchId, item.title, item.name, '', '', 3, '', item.permissions, '', '', 1, '', 0, 0, '', 0, 1, 0, 3, CONCAT('tr_', @workbenchRootId, ' tr_', @imWorkbenchId, ' '), item.sort, '', 1, @now, @now +FROM ( + SELECT '模块编辑' title, 'imWorkbenchEdit' name, '/imWorkbench/edit' permissions, 10 sort UNION ALL + SELECT '模块删除', 'imWorkbenchDelete', '/imWorkbench/delete', 20 UNION ALL + SELECT '模块排序', 'imWorkbenchReorder', '/imWorkbench/reorder', 30 +) item +WHERE @imWorkbenchId IS NOT NULL + AND NOT EXISTS (SELECT 1 FROM `hg_admin_menu` menu WHERE menu.`name` = item.name); -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`) -SELECT NULL, @imWorkbenchId, '工作台排序', 'imWorkbenchReorder', '', '', '3', '', '/imWorkbench/reorder', '', '', '1', '', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @imWorkbenchId, ' '), '30', '', '1', @now, @now -WHERE NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = 'imWorkbenchReorder'); +UPDATE `hg_admin_menu` +SET `level` = 3, `tree` = CONCAT('tr_', @workbenchRootId, ' tr_', @imWorkbenchId, ' '), + `hidden` = 1, `updated_at` = @now +WHERE `pid` = @imWorkbenchId AND `type` = 3; + +SET @mailboxConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imMailboxConfigIndex' LIMIT 1); +SET @feedbackConfigId := (SELECT `id` FROM `hg_admin_menu` WHERE `name` = 'imFeedbackConfigIndex' LIMIT 1); + +UPDATE `hg_admin_menu` +SET `pid` = @workbenchRootId, `path` = 'mailbox-config/index', `active_menu` = 'workbenchManager', + `level` = 2, `tree` = CONCAT('tr_', @workbenchRootId, ' '), `sort` = 20, + `status` = 1, `hidden` = 0, `updated_at` = @now +WHERE `id` = @mailboxConfigId; + +UPDATE `hg_admin_menu` +SET `pid` = @workbenchRootId, `path` = 'feedback-config/index', `active_menu` = 'workbenchManager', + `level` = 2, `tree` = CONCAT('tr_', @workbenchRootId, ' '), `sort` = 30, + `status` = 1, `hidden` = 0, `updated_at` = @now +WHERE `id` = @feedbackConfigId; + +UPDATE `hg_admin_menu` child +JOIN `hg_admin_menu` page ON page.`id` = child.`pid` +SET child.`level` = 3, + child.`tree` = CONCAT('tr_', @workbenchRootId, ' tr_', page.`id`, ' '), + child.`updated_at` = @now +WHERE page.`id` IN (@mailboxConfigId, @feedbackConfigId) + AND child.`type` = 3; + +-- Preserve access for every role which could already open a workbench feature. +INSERT IGNORE INTO `hg_admin_role_menu` (`role_id`, `menu_id`) +SELECT `role_id`, @workbenchRootId +FROM `hg_admin_role_menu` +WHERE `menu_id` IN (@imWorkbenchId, @mailboxConfigId, @feedbackConfigId); diff --git a/web/src/views/imFile/index.vue b/web/src/views/imFile/index.vue index 9c89964..4939618 100644 --- a/web/src/views/imFile/index.vue +++ b/web/src/views/imFile/index.vue @@ -22,7 +22,7 @@ isPlatformAdmin.value; } + const visibleColumns = computed(() => + isPlatformAdmin.value ? columns : columns.filter((column) => column.key !== 'location') + ); + const actionColumn = reactive({ width: 220, title: '操作', @@ -92,7 +96,7 @@ }); }, }); - const scrollX = computed(() => adaTableScrollX(columns, actionColumn.width)); + const scrollX = computed(() => adaTableScrollX(visibleColumns.value, actionColumn.width)); const [register, { setFieldsValue }] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, diff --git a/web/src/views/imFile/view.vue b/web/src/views/imFile/view.vue index e09339b..5c29d0b 100644 --- a/web/src/views/imFile/view.vue +++ b/web/src/views/imFile/view.vue @@ -18,7 +18,7 @@ {{ formValue.linkCount }} {{ formValue.createdAt }} {{ formValue.updatedAt }} - + {{ formValue.location || '-' }} @@ -38,6 +38,7 @@ import { computed, ref } from 'vue'; import { useDictStore } from '@/store/modules/dict'; import { useProjectSettingStore } from '@/store/modules/projectSetting'; + import { useUserStore } from '@/store/modules/user'; import { BasicTable } from '@/components/Table'; import { adaModalWidth } from '@/utils/hotgo'; import { linkColumns, newState, State } from './model'; @@ -45,6 +46,8 @@ const dict = useDictStore(); const settingStore = useProjectSettingStore(); + const userStore = useUserStore(); + const isPlatformAdmin = computed(() => userStore.isCompanyDept); const showModal = ref(false); const loading = ref(false); const formValue = ref(newState(null)); diff --git a/web/src/views/imWorkOrder/index.vue b/web/src/views/imWorkOrder/index.vue index 7a2588b..57be53c 100644 --- a/web/src/views/imWorkOrder/index.vue +++ b/web/src/views/imWorkOrder/index.vue @@ -50,7 +50,7 @@ } const actionColumn = reactive({ - width: 240, + width: 440, title: '操作', key: 'action', fixed: 'right',