zlwu 1 год назад
Родитель
Сommit
0479c40907
2 измененных файлов с 34 добавлено и 9 удалено
  1. 9 1
      web/src/views/hq/bgtgl/hallInfo/index.vue
  2. 25 8
      web/src/views/index.vue

+ 9 - 1
web/src/views/hq/bgtgl/hallInfo/index.vue

@@ -58,7 +58,7 @@
         <el-table-column label="报告厅图片" align="center" prop="hallImage" width="200">
           <template #default="scope">
             <div v-if="scope.row.hallImage" class="table-image">
-              <image-preview :src="scope.row.hallImage" :width="50" :height="50" />
+              <image-preview :src="getFirstImage(scope.row.hallImage)" :width="50" :height="50" />
             </div>
             <div v-else class="table-no-image">
               <span class="table-no-image-text">暂无图片</span>
@@ -382,6 +382,14 @@ const cancelView = () => {
   viewDialog.visible = false;
 };
 
+/** 获取第一张图片 */
+const getFirstImage = (hallImage: string) => {
+  if (!hallImage) return '';
+  // 如果有多个图片用逗号分隔,只取第一张
+  const images = hallImage.split(',').filter((img) => img.trim() !== '');
+  return images.length > 0 ? images[0].trim() : '';
+};
+
 onMounted(() => {
   getList();
 });

+ 25 - 8
web/src/views/index.vue

@@ -136,6 +136,7 @@ interface MenuAction {
   status?: string;
   moduleOrder?: number; // 新增:用于模块排序
   menuOrder?: number; // 新增:用于菜单项排序
+  orderNum?: number; // 新增:用于存储菜单的原始排序号
   logoUrl?: string; // 新增:用于存储随机logo图片路径
 }
 
@@ -379,10 +380,11 @@ const flattenMenus = (menus: any[], parentChain: string[] = [], parentPath = '',
       // 1. 组件为Layout或ParentView字符串
       // 2. 组件为Vue对象且没有子菜单(可能是目录)
       // 3. menuType为'M'(目录类型)
-      const isDirectoryMenu = menu.component === 'Layout' ||
-                             menu.component === 'ParentView' ||
-                             (typeof menu.component === 'object' && !hasVisibleChildren) ||
-                             menu.menuType === 'M';
+      const isDirectoryMenu =
+        menu.component === 'Layout' ||
+        menu.component === 'ParentView' ||
+        (typeof menu.component === 'object' && !hasVisibleChildren) ||
+        menu.menuType === 'M';
 
       // 添加工作流菜单的详细调试信息
       if (menu.meta?.title === '工作流' || menu.name === 'Workflow11616') {
@@ -424,12 +426,13 @@ const flattenMenus = (menus: any[], parentChain: string[] = [], parentPath = '',
           status: menu.status || '0',
           moduleOrder: moduleOrder, // 添加模块顺序
           menuOrder: menuIndex, // 添加菜单在当前层级的顺序
+          orderNum: menu.orderNum || 0, // 添加菜单的原始排序号
           logoUrl: getIconPath(iconKey) // 根据icon名称获取对应图标
         };
 
-        // 添加调试日志来验证路径构建
+        // 添加调试日志来验证路径构建和排序
         console.log(
-          `菜单项路径构建: ${menu.meta.title} - 原始path: ${menu.path}, 构建后fullPath: ${fullPath}, parentPath: ${parentPath}, level: ${level}`
+          `菜单项路径构建: ${menu.meta.title} - 原始path: ${menu.path}, 构建后fullPath: ${fullPath}, orderNum: ${menu.orderNum}, parentPath: ${parentPath}, level: ${level}`
         );
 
         result.push(menuAction);
@@ -498,13 +501,27 @@ const groupMenusByModule = (menus: MenuAction[]): MenuModule[] => {
       return;
     }
 
+    // 按orderNum排序前的日志
+    console.log(
+      `${moduleName}模块排序前:`,
+      moduleMenus.map((m) => `${m.title}(${m.orderNum})`)
+    );
+
+    const sortedMenus = moduleMenus.sort((a, b) => (a.orderNum || 0) - (b.orderNum || 0));
+
+    // 按orderNum排序后的日志
+    console.log(
+      `${moduleName}模块排序后:`,
+      sortedMenus.map((m) => `${m.title}(${m.orderNum})`)
+    );
+
     const module: MenuModule = {
       id: `module-${moduleName}`,
       title: moduleName,
       description: `${moduleName}模块包含${moduleMenus.length}个功能`,
       color: moduleColors[colorIndex % moduleColors.length],
-      // 菜单项按原始顺序排序,而不是按名称排序
-      menus: moduleMenus.sort((a, b) => (a.menuOrder || 0) - (b.menuOrder || 0))
+      // 菜单项按原始orderNum排序,确保显示顺序正确
+      menus: sortedMenus
     };
     modules.push(module);
     colorIndex++;