feat: 优化店铺和公司侧边栏

This commit is contained in:
2026-08-18 21:26:54 +08:00
parent 24ef58a217
commit 9dd4977e09
14 changed files with 414 additions and 376 deletions
-95
View File
@@ -1,95 +0,0 @@
/*
Navicat Premium Dump SQL
Source Server : panel.xyquan.top_13306
Source Server Type : MySQL
Source Server Version : 80406 (8.4.6)
Source Host : panel.xyquan.top:13306
Source Schema : ecom_dmb_dev
Target Server Type : MySQL
Target Server Version : 80406 (8.4.6)
File Encoding : 65001
Date: 28/07/2026 17:46:50
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '菜单 id',
`parent_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '父菜单 id',
`super` tinyint NOT NULL DEFAULT 0 COMMENT '是否超级菜单 (0-否 1-是)',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '菜单名称',
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '菜单标题',
`path` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '路由路径',
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '页面组件',
`redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '从定向地址',
`icon` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '路由图标',
`order` int NULL DEFAULT 0 COMMENT '顺序',
`type` enum('catalog','menu','button','embedded','link') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '菜单类型 (目录,菜单,按钮,内联,外链)',
`visible` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示在菜单中 (0-否 1-是)',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态 (0-禁用 1-启用)',
`keep_alive` tinyint NULL DEFAULT 0 COMMENT '是否缓存',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人 id',
`update_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人 id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_nemu_parent`(`parent_id` ASC) USING BTREE,
INDEX `fk_nemu_creator`(`create_by` ASC) USING BTREE,
INDEX `fk_nemu_updater`(`update_by` ASC) USING BTREE,
CONSTRAINT `fk_nemu_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_nemu_parent` FOREIGN KEY (`parent_id`) REFERENCES `sys_menu` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_nemu_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 14004 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '系统模块-菜单权限表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_menu
-- ----------------------------
INSERT INTO `sys_menu` VALUES (1, NULL, 1, '系统管理', '系统管理', '/system', '', '', 'lucide:settings', 15, 'catalog', 1, 1, 0, '2025-10-06 08:10:11', '2025-10-06 08:10:11', 2, 2);
INSERT INTO `sys_menu` VALUES (2, 1, 1, '系统菜单', '系统菜单', '/platform-admin/menu', 'system/menu/index', '', 'lucide:menu', 7, 'menu', 1, 1, 0, '2025-10-06 11:29:54', '2026-03-31 00:37:36', 2, 2);
INSERT INTO `sys_menu` VALUES (6, NULL, 0, '电商页面', '电商页面', '/ecom', '', '', 'lucide:store', 13, 'catalog', 0, 1, 0, '2025-10-07 12:08:15', '2025-10-07 12:08:15', 2, 2);
INSERT INTO `sys_menu` VALUES (7, NULL, 0, '店铺管理', '店铺管理', 'shop/list', '/ecommerce/shop/list/index', '', 'lucide:store', 5, 'menu', 1, 1, 0, '2025-10-07 12:09:18', '2026-02-13 11:44:00', 2, 2);
INSERT INTO `sys_menu` VALUES (8, NULL, 0, '商品管理', '商品管理', 'product/list', '/ecommerce/product/index', '', 'fluent-mdl2:product', 7, 'menu', 1, 1, 1, '2025-10-08 21:54:44', '2026-02-13 11:44:37', 2, 2);
INSERT INTO `sys_menu` VALUES (9, NULL, 0, '订单管理', '订单管理', 'order/list', '/ecommerce/order/index', '', 'lucide:shopping-cart', 8, 'menu', 1, 1, 0, '2025-10-08 21:56:30', '2026-02-13 11:44:40', 2, 2);
INSERT INTO `sys_menu` VALUES (10, NULL, 0, '推广管理', '推广管理', 'promotion-fee', '/ecommerce/promotion-fee/index', '', 'hugeicons:promotion', 9, 'menu', 1, 1, 0, '2025-10-08 21:57:07', '2026-02-13 11:44:47', 2, 2);
INSERT INTO `sys_menu` VALUES (11, NULL, 0, '配置管理', '配置管理', '/config-management', '', '', 'lucide:settings', 12, 'catalog', 1, 1, 0, '2025-10-08 21:57:40', '2026-02-13 11:45:55', 2, NULL);
INSERT INTO `sys_menu` VALUES (12, 11, 0, '订单状态', '订单状态', '/order-status', '/ecommerce/config/order-status-config/index', '', 'pajamas:status', 11, 'menu', 1, 1, 0, '2025-10-08 21:58:42', '2025-10-12 22:16:39', 2, 2);
INSERT INTO `sys_menu` VALUES (13, 11, 0, '推广费用类型', '推广费用类型', '/promotion-fee-type', '/ecommerce/config/promotion-fee-type-config/index', '', 'lucide:percent', 13, 'menu', 1, 1, 0, '2025-10-08 21:59:38', '2025-10-12 22:16:42', 2, 2);
INSERT INTO `sys_menu` VALUES (14, NULL, 0, '组织管理', '组织管理', '/organization', '', '', 'lucide:building-2', 14, 'catalog', 1, 1, 1, '2025-10-08 22:01:05', '2025-10-08 22:01:05', 2, 2);
INSERT INTO `sys_menu` VALUES (15, 1, 1, '公司管理', '公司管理', '/platform-admin/company', 'organization/company/index', '', 'lucide:building', 14, 'menu', 1, 1, 0, '2025-10-10 23:44:52', '2026-03-31 00:37:36', 2, 2);
INSERT INTO `sys_menu` VALUES (16, 14, 0, '部门管理', '部门管理', '/department', '/organization/department/index', '', 'lucide:users', 15, 'menu', 1, 1, 0, '2025-10-10 23:45:47', '2025-10-12 22:16:08', 2, 2);
INSERT INTO `sys_menu` VALUES (17, 14, 0, '职位管理', '职位管理', '/position', '/organization/position/index', '', 'lucide:tablet', 16, 'menu', 1, 1, 0, '2025-10-10 23:47:18', '2026-03-30 20:40:30', 2, 2);
INSERT INTO `sys_menu` VALUES (23, 14, 0, '账户管理', '账户管理', '/organization/account', '/organization/account/index', '', 'lucide:user', 13, 'menu', 1, 1, 0, '2025-10-17 22:53:11', '2025-10-17 22:53:11', 2, 2);
INSERT INTO `sys_menu` VALUES (24, 1, 1, '平台账户管理', '平台账户管理', '/platform-admin/account-super', 'organization/account-super/index', '', 'lucide:users', 12, 'menu', 1, 1, 0, '2025-10-20 22:08:57', '2026-03-31 00:37:36', 2, 2);
INSERT INTO `sys_menu` VALUES (25, 1, 1, '系统权限', '系统权限', '/platform-admin/permission', 'system/permission/index', '', 'lucide:code-2', 8, 'menu', 1, 1, 0, '2025-10-20 23:00:10', '2026-04-10 23:04:40', 2, 2);
INSERT INTO `sys_menu` VALUES (26, 14, 0, '职位菜单分配', '职位菜单分配', '/organization/position-permission', '/organization/position-permission/index', '', 'lucide:lock', 17, 'menu', 1, 1, 0, '2025-10-30 00:15:38', '2026-03-30 20:40:30', 2, NULL);
INSERT INTO `sys_menu` VALUES (30, NULL, 0, '刷单管理', '刷单管理', 'shop/brush-order', '/ecommerce/brush-order/index', '', 'mdi:ticket-outline', 10, 'menu', 1, 1, 0, '2026-01-11 21:28:14', '2026-02-13 11:45:11', 2, 2);
INSERT INTO `sys_menu` VALUES (32, NULL, 0, '月度目标', '月度目标', 'shop/monthly-target', '/ecommerce/shop/monthly-target/index', '', 'lucide:pie-chart', 11, 'menu', 1, 1, 0, '2026-01-12 22:59:57', '2026-02-13 11:45:48', 2, 2);
INSERT INTO `sys_menu` VALUES (33, 6, 0, '店铺概览', '店铺概览', 'shop/overview/:id', '/ecommerce/shop/overview/index', '', 'gravity-ui:chart-line', 0, 'embedded', 0, 1, 1, '2026-01-14 21:03:36', '2026-01-14 21:03:36', 2, 2);
INSERT INTO `sys_menu` VALUES (34, NULL, 0, '全店概览', '全店概览', '/store-overview', '/dashboard/store-overview/index', '', 'lucide:line-chart', 2, 'menu', 0, 1, 1, '2026-01-25 16:26:41', '2026-01-25 16:26:41', 2, 2);
INSERT INTO `sys_menu` VALUES (35, NULL, 0, '订单导入', '订单导入', '/import/order', '/ecommerce/import/order/index', '', 'lucide:upload', 3, 'menu', 1, 1, 0, '2026-01-26 21:30:57', '2026-01-26 21:30:57', 2, 2);
INSERT INTO `sys_menu` VALUES (36, 11, 0, '字段映射模板', '字段映射模板', '/config-management/field-mapping', '/config/management/field-mapping/index', '', 'lucide:key', 14, 'menu', 1, 1, 1, '2026-03-29 20:19:53', '2026-03-29 20:44:11', NULL, 2);
INSERT INTO `sys_menu` VALUES (37, 11, 0, '订单状态映射模板', '订单状态映射模板', '/config-management/order-status-mapping', '/config/management/order-status-mapping/index', '', 'lucide:star', 15, 'menu', 1, 1, 1, '2026-03-29 20:19:53', '2026-03-29 20:44:11', NULL, 2);
INSERT INTO `sys_menu` VALUES (38, 14, 0, '职位权限分配', '职位权限分配', '/organization/position-permission-assign', '/organization/position-permission-assign/index', '', 'lucide:shield-check', 18, 'menu', 1, 1, 0, '2026-03-30 20:32:28', '2026-03-30 20:40:30', NULL, 2);
INSERT INTO `sys_menu` VALUES (41, 1, 1, '公司菜单管理', '公司菜单管理', '/platform-admin/company-menu-manage', 'system/company-menu-manage/index', '', 'lucide:menu', 20, 'menu', 1, 1, 0, '2026-03-30 21:56:46', '2026-03-31 00:37:36', NULL, 2);
INSERT INTO `sys_menu` VALUES (42, 1, 1, '公司权限管理', '公司权限管理', '/platform-admin/company-permission-manage', 'system/company-permission-manage/index', '', 'lucide:shield-check', 21, 'menu', 1, 1, 0, '2026-03-30 21:56:46', '2026-03-31 00:37:36', NULL, 2);
INSERT INTO `sys_menu` VALUES (43, 6, 0, '商品概览', '商品概览', 'product/overview/:id', '/ecommerce/product/overview/index', '', 'lets-icons:chart', 1, 'embedded', 0, 1, 1, '2026-04-11 18:01:03', '2026-04-11 23:48:01', NULL, 2);
INSERT INTO `sys_menu` VALUES (44, 11, 0, '商品类目', '商品类目', '/category', '/ecommerce/config/category-config/index', '', 'iconamoon:category-bold', 12, 'menu', 1, 1, 0, '2026-04-17 17:28:20', '2026-04-17 17:28:20', NULL, 2);
INSERT INTO `sys_menu` VALUES (45, NULL, 0, '平台管理', '平台管理', '/data/platform', 'ecommerce/platform/list/index', '', 'game-icons:platform', 6, 'menu', 1, 1, 0, '2026-04-22 23:43:42', '2026-04-22 23:52:26', NULL, 2);
INSERT INTO `sys_menu` VALUES (46, 6, 0, '店铺详情', '店铺详情', '/ecom/shop/details/:id', 'ecommerce/shop/details/index', '', 'material-symbols-light:shop-outline', 200, 'embedded', 0, 1, 1, '2026-04-30 03:16:06', '2026-04-30 03:16:06', NULL, 2);
INSERT INTO `sys_menu` VALUES (47, NULL, 0, '工作台', '工作台', '/dashboard/workbench', '/dashboard/workbench/index', '', 'icon-park-outline:workbench', 1, 'menu', 1, 1, 1, '2026-05-11 01:49:58', '2026-05-11 01:49:58', 2, 2);
INSERT INTO `sys_menu` VALUES (48, NULL, 0, '推广导入', '推广导入', '/import/promotion-fee', '/ecommerce/import/promotion-fee/index', '', 'hugeicons:promotion', 4, 'menu', 1, 1, 0, '2026-05-19 22:48:38', '2026-05-19 22:48:38', 2, 2);
INSERT INTO `sys_menu` VALUES (49, NULL, 0, 'OpenApi', '开放接口', '/open', 'BasicLayout', NULL, 'lucide:key-round', 900, 'catalog', 1, 1, 0, '2026-05-25 23:12:47', '2026-05-25 23:12:47', NULL, NULL);
INSERT INTO `sys_menu` VALUES (50, 49, 0, 'OpenApiKeyManagement', 'API Key 管理', '/open/api-key', '/open/api-key/index', NULL, 'lucide:key', 1, 'menu', 1, 1, 0, '2026-05-25 23:12:47', '2026-05-25 23:12:47', NULL, NULL);
INSERT INTO `sys_menu` VALUES (51, 1, 0, '聚合管理', '聚合管理', '/system/order-stat-manage', '/system/order-stat-manage/index', '', 'oui:aggregate', 0, 'menu', 1, 1, 0, '2026-06-04 14:11:10', '2026-06-04 14:11:10', 2, 2);
INSERT INTO `sys_menu` VALUES (52, NULL, 0, '拼多多', '拼多多', '', '', '', 'arcticons:pinduoduo', 0, 'menu', 1, 1, 0, '2026-07-12 15:39:10', '2026-07-12 15:39:10', 2, NULL);
INSERT INTO `sys_menu` VALUES (53, NULL, 0, '淘宝', '淘宝', '', '', '', 'ri:taobao-fill', 0, 'menu', 1, 1, 0, '2026-07-12 15:40:07', '2026-07-12 15:40:07', 2, NULL);
SET FOREIGN_KEY_CHECKS = 1;
@@ -1,128 +0,0 @@
/*
Navicat Premium Dump SQL
Source Server : panel.xyquan.top_13306
Source Server Type : MySQL
Source Server Version : 80406 (8.4.6)
Source Host : panel.xyquan.top:13306
Source Schema : ecom_dmb_dev
Target Server Type : MySQL
Target Server Version : 80406 (8.4.6)
File Encoding : 65001
Date: 28/07/2026 17:46:59
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '权限ID',
`parent_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '父权限ID',
`code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '权限码(唯一标识,如 user:add, order:approve)',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '权限名称(用于显示,如 用户新增、订单审核)',
`type` enum('api','button','data','module') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'api' COMMENT '权限类型(api-接口权限,button-按钮权限,data-数据权限,module-模块分组)',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态:1-启用 0-禁用',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`sort_order` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`update_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人ID',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_code_parent`(`code` ASC, `parent_id` ASC) USING BTREE,
INDEX `fk_permission_creator`(`create_by` ASC) USING BTREE,
INDEX `fk_permission_updater`(`update_by` ASC) USING BTREE,
INDEX `idx_parent_id`(`parent_id` ASC) USING BTREE,
INDEX `idx_sort_order`(`sort_order` ASC) USING BTREE,
CONSTRAINT `fk_permission_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_permission_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_sys_permission_parent` FOREIGN KEY (`parent_id`) REFERENCES `sys_permission` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 5002 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '系统模块-权限定义表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT INTO `sys_permission` VALUES (1, 110, 'system:menu:update', '菜单更新', 'api', 1, '系统管理-菜单更新', 11, '2025-10-20 23:00:57', '2026-04-10 13:19:42', 2, 2);
INSERT INTO `sys_permission` VALUES (2, 110, 'system:menu:create', '菜单创建', 'api', 1, '系统管理-菜单创建', 12, '2025-10-20 23:01:35', '2026-04-10 13:19:42', 2, 2);
INSERT INTO `sys_permission` VALUES (3, 110, 'system:menu:delete', '菜单删除', 'api', 1, '系统管理-菜单删除', 13, '2025-10-26 22:25:48', '2026-04-10 13:19:42', 2, 2);
INSERT INTO `sys_permission` VALUES (4, 111, 'system:user:read', '用户查看', 'api', 1, '系统管理-用户查看', 21, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (5, 111, 'system:user:create', '用户创建', 'api', 1, '系统管理-用户创建', 22, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (6, 111, 'system:user:update', '用户更新', 'api', 1, '系统管理-用户更新', 23, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (7, 111, 'system:user:delete', '用户删除', 'api', 1, '系统管理-用户删除', 24, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (8, 110, 'system:menu:read', '菜单查看', 'api', 1, '系统管理-菜单查看', 14, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (9, 114, 'system:permission:read', '权限查看', 'api', 1, '系统管理-权限查看', 41, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (10, 112, 'system:position:manage', '职位管理', 'api', 1, '系统管理-职位管理', 31, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (11, 113, 'system:company:manage', '公司管理', 'api', 1, '系统管理-公司管理', 32, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (12, 120, 'org:company:read', '公司查看', 'api', 1, '组织管理-公司查看', 201, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (13, 120, 'org:company:create', '公司创建', 'api', 1, '组织管理-公司创建', 202, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (14, 120, 'org:company:update', '公司更新', 'api', 1, '组织管理-公司更新', 203, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (15, 120, 'org:company:delete', '公司删除', 'api', 1, '组织管理-公司删除', 204, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (16, 121, 'org:department:read', '部门查看', 'api', 1, '组织管理-部门查看', 211, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (17, 121, 'org:department:manage', '部门管理', 'api', 1, '组织管理-部门管理', 212, '2026-03-30 21:14:31', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (18, 122, 'org:position:read', '职位查看', 'api', 1, '组织管理-职位查看', 221, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (19, 122, 'org:position:manage', '职位管理', 'api', 1, '组织管理-职位管理', 222, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (20, 123, 'org:member:read', '成员查看', 'api', 1, '组织管理-成员查看', 231, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (21, 123, 'org:member:manage', '成员管理', 'api', 1, '组织管理-成员管理', 232, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (22, 124, 'org:company-menu:assign', '公司菜单分配', 'api', 1, '组织管理-公司菜单分配', 241, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (23, 125, 'org:company-permission:assign', '公司权限分配', 'api', 1, '组织管理-公司权限分配', 251, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (24, 124, 'org:position-menu:assign', '职位菜单分配', 'api', 1, '组织管理-职位菜单分配', 242, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (25, 125, 'org:position-permission:assign', '职位权限分配', 'api', 1, '组织管理-职位权限分配', 252, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (26, 131, 'ecom:order:read', '订单查看', 'api', 1, '电商业务-订单查看', 311, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (27, 131, 'ecom:order:create', '订单创建', 'api', 1, '电商业务-订单创建', 312, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (28, 131, 'ecom:order:update', '订单更新', 'api', 1, '电商业务-订单更新', 313, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (29, 131, 'ecom:order:delete', '订单删除', 'api', 1, '电商业务-订单删除', 314, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (30, 131, 'ecom:order:import', '订单导入', 'api', 1, '电商业务-订单导入', 315, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (31, 131, 'ecom:order:export', '订单导出', 'api', 1, '电商业务-订单导出', 316, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (32, 130, 'ecom:product:read', '商品查看', 'api', 1, '电商业务-商品查看', 301, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (33, 130, 'ecom:product:create', '商品创建', 'api', 1, '电商业务-商品创建', 302, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (34, 130, 'ecom:product:update', '商品更新', 'api', 1, '电商业务-商品更新', 303, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (35, 130, 'ecom:product:delete', '商品删除', 'api', 1, '电商业务-商品删除', 304, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (36, 132, 'ecom:shop:read', '店铺查看', 'api', 1, '电商业务-店铺查看', 321, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (37, 132, 'ecom:shop:manage', '店铺管理', 'api', 1, '电商业务-店铺管理', 322, '2026-03-30 21:14:31', '2026-04-10 13:19:43', NULL, NULL);
INSERT INTO `sys_permission` VALUES (38, 140, 'data:import', '数据导入', 'api', 1, '数据管理-数据导入', 401, '2026-03-30 21:14:31', '2026-04-10 13:20:25', NULL, NULL);
INSERT INTO `sys_permission` VALUES (39, 141, 'data:export', '数据导出', 'api', 1, '数据管理-数据导出', 411, '2026-03-30 21:14:31', '2026-04-10 13:20:25', NULL, NULL);
INSERT INTO `sys_permission` VALUES (40, 120, 'org:company:manage', '公司账户管理', 'api', 1, '组织管理-公司账户管理(创建、查询、更新、删除账户)', 205, '2026-04-09 16:35:41', '2026-04-10 13:20:25', NULL, NULL);
INSERT INTO `sys_permission` VALUES (41, 131, 'ecom:order:manage', '订单管理', 'api', 1, '', 317, '2026-04-09 17:33:12', '2026-04-10 13:19:43', 2, NULL);
INSERT INTO `sys_permission` VALUES (100, NULL, 'MODULE:system', '系统管理', 'module', 1, '系统管理模块(平台超管专用)', 10, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (101, NULL, 'MODULE:org', '组织架构', 'module', 1, '组织架构模块(公司管理)', 20, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (102, NULL, 'MODULE:ecom', '电商业务', 'module', 1, '电商业务模块', 30, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (103, NULL, 'MODULE:data', '数据操作', 'module', 1, '数据操作模块', 40, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (110, 100, 'system:menu', '菜单权限', 'module', 1, NULL, 100, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (111, 100, 'system:user', '用户权限', 'module', 1, NULL, 110, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (112, 100, 'system:position', '职位权限', 'module', 1, NULL, 120, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (113, 100, 'system:company', '公司权限', 'module', 1, NULL, 130, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (114, 100, 'system:permission', '权限管理', 'module', 1, NULL, 140, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (120, 101, 'org:company', '公司管理', 'module', 1, NULL, 200, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (121, 101, 'org:department', '部门管理', 'module', 1, NULL, 210, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (122, 101, 'org:position', '职位管理', 'module', 1, NULL, 220, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (123, 101, 'org:member', '成员管理', 'module', 1, NULL, 230, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (124, 101, 'org:company-menu', '菜单分配', 'module', 1, NULL, 240, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (125, 101, 'org:company-permission', '权限分配', 'module', 1, NULL, 250, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (130, 102, 'ecom:product', '商品管理', 'module', 1, NULL, 300, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (131, 102, 'ecom:order', '订单管理', 'module', 1, NULL, 310, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (132, 102, 'ecom:shop', '店铺管理', 'module', 1, NULL, 320, '2026-04-10 13:19:42', '2026-04-10 13:19:42', NULL, NULL);
INSERT INTO `sys_permission` VALUES (140, 103, 'data:import-group', '数据导入', 'module', 1, NULL, 400, '2026-04-10 13:19:42', '2026-04-10 13:20:25', NULL, NULL);
INSERT INTO `sys_permission` VALUES (141, 103, 'data:export-group', '数据导出', 'module', 1, NULL, 410, '2026-04-10 13:19:42', '2026-04-10 13:20:25', NULL, NULL);
INSERT INTO `sys_permission` VALUES (142, NULL, 'ecom:category:read', '查询类目列表/树', 'api', 1, NULL, 0, '2026-04-18 10:56:01', '2026-04-18 10:56:01', NULL, NULL);
INSERT INTO `sys_permission` VALUES (143, NULL, 'ecom:category:manage', '管理类目(增删改)', 'api', 1, NULL, 0, '2026-04-18 10:56:01', '2026-04-18 10:56:01', NULL, NULL);
INSERT INTO `sys_permission` VALUES (144, 102, 'ecom:platform', '平台管理', 'module', 1, NULL, 330, '2026-04-22 23:43:41', '2026-04-22 23:43:41', NULL, NULL);
INSERT INTO `sys_permission` VALUES (145, 144, 'ecom:platform:read', '平台查看', 'api', 1, NULL, 331, '2026-04-22 23:43:41', '2026-04-22 23:43:41', NULL, NULL);
INSERT INTO `sys_permission` VALUES (146, 144, 'ecom:platform:manage', '平台管理', 'api', 1, NULL, 332, '2026-04-22 23:43:41', '2026-04-22 23:43:41', NULL, NULL);
INSERT INTO `sys_permission` VALUES (147, NULL, 'open:api-key:manage', 'API Key管理', 'api', 1, '开放接口-API Key管理', 900, '2026-05-25 23:12:47', '2026-05-25 23:12:47', NULL, NULL);
INSERT INTO `sys_permission` VALUES (148, NULL, 'MODULE:open', '开放接口', 'module', 1, '开放接口能力模块(API Key 可绑定权限)', 905, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (149, 148, 'open:scope:order:import', '开放-订单导入', 'api', 1, 'POST /open/v1/ec/order/batch-import', 10, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (150, 148, 'open:scope:order:read', '开放-订单字段查询', 'api', 1, 'GET /open/v1/ec/order/fields', 20, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (151, 148, 'open:scope:promotion_fee:import', '开放-推广费导入', 'api', 1, 'POST /open/v1/ec/promotion-fee/batch-import', 30, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (152, 148, 'open:scope:promotion_fee:read', '开放-推广费字段查询', 'api', 1, 'GET /open/v1/ec/promotion-fee/fields', 40, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (153, 148, 'open:scope:import_task:read', '开放-导入任务查询', 'api', 1, 'GET /open/v1/ec/import-task/detail/{id}', 50, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (154, 148, 'open:scope:meta:read', '开放-元数据查询', 'api', 1, 'shop/order-status/promotion-fee-type 等元数据', 60, '2026-05-25 23:27:12', '2026-05-25 23:27:12', NULL, NULL);
INSERT INTO `sys_permission` VALUES (1012, 100, 'system:license:read', '授权查看', 'api', 1, '系统设置-授权查看', 150, '2026-07-28 17:40:29', '2026-07-28 17:40:29', NULL, NULL);
INSERT INTO `sys_permission` VALUES (1013, 100, 'system:license:manage', '授权管理', 'api', 1, '系统设置-授权激活/更新', 151, '2026-07-28 17:40:29', '2026-07-28 17:40:29', NULL, NULL);
SET FOREIGN_KEY_CHECKS = 1;
@@ -0,0 +1,87 @@
import { computed, ref } from 'vue';
import { defineStore } from 'pinia';
/** 三套业务侧栏各自一份布局,互不影响 */
export type ColSidebarKind = 'company' | 'ec-shop' | 'pdd-shop';
export interface ColSidebarLayout {
/** 展开宽度(百分比) */
width: number;
collapsed: boolean;
}
const DEFAULT_LAYOUT: ColSidebarLayout = {
width: 22,
collapsed: false,
};
function createDefaultLayouts(): Record<ColSidebarKind, ColSidebarLayout> {
return {
'ec-shop': { ...DEFAULT_LAYOUT },
'pdd-shop': { ...DEFAULT_LAYOUT },
company: { ...DEFAULT_LAYOUT },
};
}
function clampWidth(width: number) {
if (!Number.isFinite(width)) return DEFAULT_LAYOUT.width;
return Math.min(50, Math.max(10, Math.round(width * 10) / 10));
}
/**
* 内部店铺 / 拼多多 / 公司侧栏的展开与宽度,localStorage 持久化。
*/
export const useColSidebarLayoutStore = defineStore(
'col-sidebar-layout',
() => {
const layouts = ref(createDefaultLayouts());
function layoutOf(kind: ColSidebarKind): ColSidebarLayout {
const current = layouts.value[kind];
if (current) return current;
const created = { ...DEFAULT_LAYOUT };
layouts.value[kind] = created;
return created;
}
function setWidth(kind: ColSidebarKind, width: number) {
layoutOf(kind).width = clampWidth(width);
}
function setCollapsed(kind: ColSidebarKind, collapsed: boolean) {
layoutOf(kind).collapsed = collapsed;
}
function $reset() {
// 本机布局偏好,登出不清
}
return {
layouts,
layoutOf,
setWidth,
setCollapsed,
$reset,
};
},
{
persist: {
pick: ['layouts'],
},
},
);
/** 给 ColPage 用的双向绑定(宽 + 收起) */
export function useColSidebarLayout(kind: ColSidebarKind) {
const store = useColSidebarLayoutStore();
const width = computed({
get: () => store.layoutOf(kind).width,
set: (value) => store.setWidth(kind, value),
});
const collapsed = computed({
get: () => store.layoutOf(kind).collapsed,
set: (value) => store.setCollapsed(kind, value),
});
return { width, collapsed };
}
@@ -1,3 +1,4 @@
export * from './auth';
export * from './col-sidebar-layout';
export * from './import-task';
export * from './realtime';
@@ -3,17 +3,19 @@ import type { PddShopVO } from '#/api/channel/pdd/shop';
import { ColPage } from '@vben/common-ui';
import { useColSidebarLayout } from '#/store/col-sidebar-layout';
import PddShopSidebarList from '#/views/channel/pdd/components/PddShopSidebarList.vue';
defineOptions({ name: 'PddShopColPage' });
/** 拼多多渠道店侧栏:展开/宽度走全局持久化,跨页面共用 */
withDefaults(
defineProps<{
/** undefined = 全部渠道店铺 */
selectedShopId?: number;
showAddAction?: boolean;
autoContentHeight?: boolean;
leftWidth?: number;
leftMinWidth?: number;
leftMaxWidth?: number;
leftCollapsedWidth?: number;
@@ -25,10 +27,9 @@ withDefaults(
{
showAddAction: false,
autoContentHeight: true,
leftWidth: 22,
leftMinWidth: 16,
leftMaxWidth: 36,
leftCollapsedWidth: 5,
leftCollapsedWidth: 3,
leftCollapsible: true,
resizable: true,
splitHandle: false,
@@ -41,39 +42,64 @@ const emit = defineEmits<{
select: [shop: PddShopVO.Info | null];
addForShop: [shopId: number];
}>();
const { width: leftWidth, collapsed: leftCollapsed } =
useColSidebarLayout('pdd-shop');
</script>
<template>
<ColPage
:auto-content-height="autoContentHeight"
:left-width="leftWidth"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
<PddShopSidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-shop-id="selectedShopId"
:show-add-action="showAddAction"
@collapse="collapse"
@expand="expand"
@update:selected-shop-id="emit('update:selectedShopId', $event)"
@select="emit('select', $event)"
@add-for-shop="emit('addForShop', $event)"
/>
</div>
</template>
<div class="pdd-shop-col-page h-full min-h-0">
<ColPage
v-model:left-width="leftWidth"
v-model:left-collapsed="leftCollapsed"
:auto-content-height="autoContentHeight"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div
class="flex h-full min-h-0 flex-col"
:class="
isCollapsed
? 'shop-sidebar-collapsed-mark min-w-[56px] overflow-visible'
: 'min-w-0 overflow-hidden'
"
>
<PddShopSidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-shop-id="selectedShopId"
:show-add-action="showAddAction"
@collapse="collapse"
@expand="expand"
@update:selected-shop-id="emit('update:selectedShopId', $event)"
@select="emit('select', $event)"
@add-for-shop="emit('addForShop', $event)"
/>
</div>
</template>
<slot />
</ColPage>
<slot />
</ColPage>
</div>
</template>
<style scoped>
/* 收起态:logo 36 + p-0.5 + ring-2 + offset-1,固定 56px */
.pdd-shop-col-page :deep([data-panel]:has(.shop-sidebar-collapsed-mark)),
.pdd-shop-col-page :deep([data-panel-group-direction] > *:first-child:has(.shop-sidebar-collapsed-mark)) {
flex: 0 0 56px !important;
width: 56px !important;
min-width: 56px !important;
max-width: 56px !important;
overflow: visible;
}
</style>
@@ -140,7 +140,7 @@ onMounted(() => {
</Tooltip>
<div
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1.5 pb-1 pt-2"
>
<Tooltip title="全部店铺">
<button
@@ -378,6 +378,7 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
:deep(.pdd-shop-sidebar-collapsed-spin .ant-spin-container) {
@@ -385,5 +386,6 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
</style>
@@ -3,15 +3,17 @@ import type { CompanyVO } from '#/api/company/types';
import { ColPage } from '@vben/common-ui';
import { useColSidebarLayout } from '#/store/col-sidebar-layout';
import CompanySidebarList from '#/views/company/components/CompanySidebarList.vue';
defineOptions({ name: 'CompanyColPage' });
/** 公司侧栏:展开/宽度走全局持久化,跨页面共用 */
withDefaults(
defineProps<{
selectedCompanyId?: number;
autoContentHeight?: boolean;
leftWidth?: number;
leftMinWidth?: number;
leftMaxWidth?: number;
leftCollapsedWidth?: number;
@@ -22,10 +24,9 @@ withDefaults(
}>(),
{
autoContentHeight: true,
leftWidth: 22,
leftMinWidth: 16,
leftMaxWidth: 36,
leftCollapsedWidth: 5,
leftCollapsedWidth: 3,
leftCollapsible: true,
resizable: true,
splitHandle: false,
@@ -37,37 +38,62 @@ const emit = defineEmits<{
'update:selectedCompanyId': [id: number | undefined];
select: [company: CompanyVO.CompanyInfoVO];
}>();
const { width: leftWidth, collapsed: leftCollapsed } =
useColSidebarLayout('company');
</script>
<template>
<ColPage
:auto-content-height="autoContentHeight"
:left-width="leftWidth"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
<CompanySidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-company-id="selectedCompanyId"
@collapse="collapse"
@expand="expand"
@update:selected-company-id="emit('update:selectedCompanyId', $event)"
@select="emit('select', $event)"
/>
</div>
</template>
<div class="company-col-page h-full min-h-0">
<ColPage
v-model:left-width="leftWidth"
v-model:left-collapsed="leftCollapsed"
:auto-content-height="autoContentHeight"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div
class="flex h-full min-h-0 flex-col"
:class="
isCollapsed
? 'company-sidebar-collapsed-mark min-w-[56px] overflow-visible'
: 'min-w-0 overflow-hidden'
"
>
<CompanySidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-company-id="selectedCompanyId"
@collapse="collapse"
@expand="expand"
@update:selected-company-id="emit('update:selectedCompanyId', $event)"
@select="emit('select', $event)"
/>
</div>
</template>
<slot />
</ColPage>
<slot />
</ColPage>
</div>
</template>
<style scoped>
/* 收起态:logo 36 + p-0.5 + ring-2 + offset-1,固定 56px */
.company-col-page :deep([data-panel]:has(.company-sidebar-collapsed-mark)),
.company-col-page :deep([data-panel-group-direction] > *:first-child:has(.company-sidebar-collapsed-mark)) {
flex: 0 0 56px !important;
width: 56px !important;
min-width: 56px !important;
max-width: 56px !important;
overflow: visible;
}
</style>
@@ -22,6 +22,7 @@ const props = withDefaults(
const BuildingIcon = createIconifyIcon('lucide:building-2');
/** 无 logo 时用名称首字;仍无则显示公司图标 */
const fallbackText = computed(() => {
const text = props.name?.trim();
return text ? text.charAt(0).toUpperCase() : '';
@@ -34,9 +35,14 @@ const fallbackText = computed(() => {
:src="logo"
:alt="name"
shape="square"
class="company-logo-avatar shrink-0 !rounded-md !bg-muted"
class="company-logo-avatar shrink-0 !rounded-md !bg-slate-200 !text-slate-700 dark:!bg-slate-600 dark:!text-slate-100"
>
<span v-if="fallbackText" class="text-xs font-medium">{{ fallbackText }}</span>
<span
v-if="fallbackText"
class="company-logo-avatar__text text-xs font-semibold"
>
{{ fallbackText }}
</span>
<BuildingIcon v-else class="h-4 w-4 text-muted-foreground" />
</Avatar>
</template>
@@ -48,8 +54,9 @@ const fallbackText = computed(() => {
justify-content: center !important;
}
.company-logo-avatar span {
.company-logo-avatar__text {
display: block;
line-height: 1;
color: inherit;
}
</style>
@@ -25,8 +25,11 @@ defineOptions({ name: 'CompanySidebarList' });
const props = withDefaults(
defineProps<{
selectedCompanyId?: number;
/** 填满父容器宽度(ColPage 左栏);默认固定 320px */
fluid?: boolean;
/** 显示标题栏收起按钮(配合 ColPage collapse) */
showCollapseAction?: boolean;
/** 窄栏模式:仅展示 logo 列表(ColPage 收起态) */
collapsed?: boolean;
}>(),
{
@@ -122,7 +125,7 @@ onMounted(() => {
</Tooltip>
<div
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1.5 pb-1 pt-2"
>
<Spin
:spinning="companiesLoading"
@@ -319,6 +322,7 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
:deep(.company-sidebar-collapsed-spin .ant-spin-container) {
@@ -326,5 +330,6 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
</style>
@@ -3,18 +3,19 @@ import type { ShopVO } from '#/api/ec/shop/types';
import { ColPage } from '@vben/common-ui';
import { useColSidebarLayout } from '#/store/col-sidebar-layout';
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
defineOptions({ name: 'EcShopColPage' });
/** 内部店铺侧栏:展开/宽度走全局持久化,跨页面共用 */
withDefaults(
defineProps<{
/** undefined = 全部店铺 */
selectedShopId?: number;
showAddAction?: boolean;
autoContentHeight?: boolean;
/** 左栏默认宽度(百分比) */
leftWidth?: number;
leftMinWidth?: number;
leftMaxWidth?: number;
leftCollapsedWidth?: number;
@@ -24,12 +25,11 @@ withDefaults(
splitLine?: boolean;
}>(),
{
showAddAction: true,
showAddAction: false,
autoContentHeight: true,
leftWidth: 22,
leftMinWidth: 16,
leftMaxWidth: 36,
leftCollapsedWidth: 5,
leftCollapsedWidth: 3,
leftCollapsible: true,
resizable: true,
splitHandle: false,
@@ -42,39 +42,64 @@ const emit = defineEmits<{
select: [shop: ShopVO.Info | null];
addForShop: [shopId: number];
}>();
const { width: leftWidth, collapsed: leftCollapsed } =
useColSidebarLayout('ec-shop');
</script>
<template>
<ColPage
:auto-content-height="autoContentHeight"
:left-width="leftWidth"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
<ShopSidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-shop-id="selectedShopId"
:show-add-action="showAddAction"
@collapse="collapse"
@expand="expand"
@update:selected-shop-id="emit('update:selectedShopId', $event)"
@select="emit('select', $event)"
@add-for-shop="emit('addForShop', $event)"
/>
</div>
</template>
<div class="ec-shop-col-page h-full min-h-0">
<ColPage
v-model:left-width="leftWidth"
v-model:left-collapsed="leftCollapsed"
:auto-content-height="autoContentHeight"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div
class="flex h-full min-h-0 flex-col"
:class="
isCollapsed
? 'shop-sidebar-collapsed-mark min-w-[56px] overflow-visible'
: 'min-w-0 overflow-hidden'
"
>
<ShopSidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-shop-id="selectedShopId"
:show-add-action="showAddAction"
@collapse="collapse"
@expand="expand"
@update:selected-shop-id="emit('update:selectedShopId', $event)"
@select="emit('select', $event)"
@add-for-shop="emit('addForShop', $event)"
/>
</div>
</template>
<slot />
</ColPage>
<slot />
</ColPage>
</div>
</template>
<style scoped>
/* 收起态:logo 36 + p-0.5 + ring-2 + offset-1,固定 56px */
.ec-shop-col-page :deep([data-panel]:has(.shop-sidebar-collapsed-mark)),
.ec-shop-col-page :deep([data-panel-group-direction] > *:first-child:has(.shop-sidebar-collapsed-mark)) {
flex: 0 0 56px !important;
width: 56px !important;
min-width: 56px !important;
max-width: 56px !important;
overflow: visible;
}
</style>
@@ -35,11 +35,11 @@ const fallbackText = computed(() => {
:src="logo"
:alt="name"
shape="square"
class="shop-logo-avatar shrink-0 !rounded-md !bg-muted"
class="shop-logo-avatar shrink-0 !rounded-md !bg-slate-200 !text-slate-700 dark:!bg-slate-600 dark:!text-slate-100"
>
<span
v-if="fallbackText"
class="shop-logo-avatar__text text-xs font-medium"
class="shop-logo-avatar__text text-xs font-semibold"
>
{{ fallbackText }}
</span>
@@ -57,5 +57,6 @@ const fallbackText = computed(() => {
.shop-logo-avatar__text {
display: block;
line-height: 1;
color: inherit;
}
</style>
@@ -42,7 +42,7 @@ const props = withDefaults(
}>(),
{
selectedShopId: undefined,
showAddAction: true,
showAddAction: false,
fluid: false,
showCollapseAction: false,
collapsed: false,
@@ -59,7 +59,6 @@ const emit = defineEmits<{
}>();
const StoreIcon = createIconifyIcon('lucide:store');
const PlusIcon = createIconifyIcon('lucide:plus');
const PanelCloseIcon = createIconifyIcon('lucide:panel-left-close');
const PanelOpenIcon = createIconifyIcon('lucide:panel-left-open');
const ChevronUpIcon = createIconifyIcon('lucide:chevron-up');
@@ -146,15 +145,6 @@ function selectShop(shop: ShopVO.Info) {
emit('select', shop);
}
function handleAdd(shopId: number) {
const shop = shops.value.find((s) => s.id === shopId) ?? null;
emit('update:selectedShopId', shopId);
if (shop) {
emit('select', shop);
}
emit('addForShop', shopId);
}
onMounted(() => {
void loadPlatformOptions();
void searchShops();
@@ -174,7 +164,7 @@ onMounted(() => {
</Tooltip>
<div
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1.5 pb-1 pt-2"
>
<Tooltip title="全部店铺">
<button
@@ -344,39 +334,21 @@ onMounted(() => {
"
@click="selectShop(shop)"
>
<div class="flex items-start gap-2">
<div class="flex items-center gap-2">
<ShopLogoAvatar
:logo="shop.logo"
:name="shop.name"
:size="36"
/>
<div class="flex min-w-0 flex-1 items-start justify-between gap-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">{{ shop.name }}</div>
<div
v-if="shop.platformCode || shop.platformName"
class="mt-1"
>
<Tag
class="m-0"
:color="getPlatformTagColor(shop.platformCode)"
>
{{
getPlatformLabel(shop.platformCode, shop.platformName)
}}
</Tag>
</div>
</div>
<Button
v-if="showAddAction"
type="link"
size="small"
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
@click.stop="handleAdd(shop.id)"
<div class="flex min-w-0 flex-1 items-center justify-between gap-2">
<span class="min-w-0 truncate text-sm font-medium">{{ shop.name }}</span>
<Tag
v-if="shop.platformCode || shop.platformName"
class="m-0 shrink-0"
:color="getPlatformTagColor(shop.platformCode)"
>
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
添加
</Button>
{{ getPlatformLabel(shop.platformCode, shop.platformName) }}
</Tag>
</div>
</div>
</Card>
@@ -422,6 +394,7 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
:deep(.shop-sidebar-collapsed-spin .ant-spin-container) {
@@ -429,5 +402,6 @@ onMounted(() => {
width: 100%;
flex-direction: column;
align-items: center;
overflow: visible;
}
</style>
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { ColPageProps } from './types';
import { computed, ref, useSlots } from 'vue';
import { computed, nextTick, onMounted, ref, unref, useSlots, watch } from 'vue';
import {
ResizableHandle,
@@ -18,12 +18,34 @@ defineOptions({
const props = withDefaults(defineProps<ColPageProps>(), {
leftWidth: 30,
leftCollapsed: false,
rightWidth: 70,
resizable: true,
});
const emit = defineEmits<{
'update:leftWidth': [width: number];
'update:leftCollapsed': [collapsed: boolean];
}>();
const delegatedProps = computed(() => {
const { leftWidth: _, ...delegated } = props;
const {
leftWidth: _leftWidth,
leftMinWidth: _leftMinWidth,
leftMaxWidth: _leftMaxWidth,
leftCollapsedWidth: _leftCollapsedWidth,
leftCollapsible: _leftCollapsible,
leftCollapsed: _leftCollapsed,
rightWidth: _rightWidth,
rightMinWidth: _rightMinWidth,
rightMaxWidth: _rightMaxWidth,
rightCollapsedWidth: _rightCollapsedWidth,
rightCollapsible: _rightCollapsible,
resizable: _resizable,
splitLine: _splitLine,
splitHandle: _splitHandle,
...delegated
} = props;
return delegated;
});
@@ -41,6 +63,32 @@ const delegatedSlots = computed(() => {
});
const leftPanelRef = ref<InstanceType<typeof ResizablePanel>>();
/** 自身操作引起的回写,避免与外部 v-model 互相触发 */
const suppressExternalSync = ref(false);
const leftDefaultSize = computed(() =>
props.leftCollapsed
? (props.leftCollapsedWidth ?? 0)
: props.leftWidth,
);
const rightDefaultSize = computed(() =>
props.leftCollapsed
? 100 - (props.leftCollapsedWidth ?? 0)
: props.rightWidth,
);
function isLeftCollapsed() {
return !!unref(leftPanelRef.value?.isCollapsed);
}
function runAsSelfApply(apply: () => void) {
suppressExternalSync.value = true;
apply();
void nextTick(() => {
suppressExternalSync.value = false;
});
}
function expandLeft() {
leftPanelRef.value?.expand();
@@ -50,6 +98,56 @@ function collapseLeft() {
leftPanelRef.value?.collapse();
}
function applyCollapsed(collapsed: boolean) {
const panel = leftPanelRef.value;
if (!panel) return;
if (collapsed) {
panel.collapse();
return;
}
panel.expand();
void nextTick(() => panel.resize(props.leftWidth));
}
function onLeftCollapse() {
runAsSelfApply(() => emit('update:leftCollapsed', true));
}
function onLeftExpand() {
runAsSelfApply(() => emit('update:leftCollapsed', false));
}
/** 收起过程中的尺寸不写入展开宽度 */
function onLeftResize(size: number) {
const collapsedSize = props.leftCollapsedWidth ?? 0;
if (isLeftCollapsed() || size <= collapsedSize + 0.51) return;
if (Math.abs(size - props.leftWidth) < 0.15) return;
runAsSelfApply(() => emit('update:leftWidth', size));
}
watch(
() => props.leftCollapsed,
(collapsed) => {
if (suppressExternalSync.value) return;
applyCollapsed(collapsed);
},
);
watch(
() => props.leftWidth,
(width) => {
if (suppressExternalSync.value || isLeftCollapsed()) return;
const current = leftPanelRef.value?.getSize();
if (current == null || Math.abs(current - width) < 0.3) return;
leftPanelRef.value?.resize(width);
},
);
onMounted(() => {
if (!props.leftCollapsed) return;
void nextTick(() => applyCollapsed(true));
});
defineExpose({
expandLeft,
collapseLeft,
@@ -68,12 +166,16 @@ defineExpose({
<ResizablePanelGroup class="w-full" direction="horizontal">
<ResizablePanel
id="col-page-left"
ref="leftPanelRef"
:collapsed-size="leftCollapsedWidth"
:collapsible="leftCollapsible"
:default-size="leftWidth"
:default-size="leftDefaultSize"
:max-size="leftMaxWidth"
:min-size="leftMinWidth"
@collapse="onLeftCollapse"
@expand="onLeftExpand"
@resize="onLeftResize"
>
<template #default="slotProps">
<slot
@@ -92,9 +194,10 @@ defineExpose({
:with-handle="splitHandle"
/>
<ResizablePanel
id="col-page-right"
:collapsed-size="rightCollapsedWidth"
:collapsible="rightCollapsible"
:default-size="rightWidth"
:default-size="rightDefaultSize"
:max-size="rightMaxWidth"
:min-size="rightMinWidth"
>
@@ -2,7 +2,7 @@ import type { PageProps } from '../page/types';
export interface ColPageProps extends PageProps {
/**
* 左侧宽度
* 左侧宽度(百分比 1-100)。配合 `update:leftWidth` 可做受控/持久化。
* @default 30
*/
leftWidth?: number;
@@ -10,6 +10,10 @@ export interface ColPageProps extends PageProps {
leftMaxWidth?: number;
leftCollapsedWidth?: number;
leftCollapsible?: boolean;
/**
* 左侧是否收起。配合 `update:leftCollapsed` 可做受控/持久化。
*/
leftCollapsed?: boolean;
/**
* 右侧宽度
* @default 70