Ver código fonte

feat(menu): 动态生成汇很多船务公司菜单项

- 在 Aside.vue 中使用 store.state.menu 替代静态菜单项
- 在 main.js 中添加汇很多船务公司的特有菜单项
- 更新 router/index.js 中的路由名称
- 在 store/index.js 中添加动态菜单项的初始状态
- 修正 crewSchoolInfoManage.vue 中的图片路径
wzg 8 meses atrás
pai
commit
67087db970

+ 6 - 2
src/layout/Aside.vue

@@ -7,7 +7,11 @@
     active-text-color="#ffd04b"
     :router="true"
   >
-    <el-sub-menu v-for="(item, index) in menu" :key="item" :index="index + ''">
+    <el-sub-menu
+      v-for="(item, index) in store.state.menu"
+      :key="item"
+      :index="index + ''"
+    >
       <template v-slot:title>
         <el-icon :size="18">
           <component :is="item.icon" />
@@ -154,7 +158,7 @@ if (store.state.shippingCompany === "汇很多船务公司") {
   });
   menu.value.at(-1).items.push({
     path: "/workStation/shipyardManage",
-    name: "船舶坞修管理",
+    name: "船管理",
   });
   menu.value.at(-1).items.push({
     path: "/workStation/terminalServiceStaffManage",

+ 34 - 0
src/main.js

@@ -37,6 +37,7 @@ router.beforeEach(async (to, from, next) => {
   if (id) {
     store.commit("changeLogin", true);
     store.commit("changeShippingCompany", localStorage.shippingCompany);
+
     if (0 === to.matched.length) {
       next("/index");
     } else if (to.path == "/login" || to.path == "/") {
@@ -63,6 +64,39 @@ router.afterEach((to, from) => {
   document.title = "船务公司 - " + title;
   store.commit("setCurrentMenuItem", to.path);
   store.commit("changefirstTitle", title);
+  if (
+    store.state.shippingCompany === "汇很多船务公司" &&
+    store.state.menu.at(-1).items.length === 2
+  ) {
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/oilPriceManage",
+      name: "油价管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/legalAidManage",
+      name: "法律援助管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/annualInspectionNoticeManage",
+      name: "年检通知管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/crewSchoolTrainingNoticeManage",
+      name: "培训通知管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/newEnergyPolicyManage",
+      name: "新能源政策管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/shipyardManage",
+      name: "船厂管理",
+    });
+    store.state.menu.at(-1).items.push({
+      path: "/workStation/terminalServiceStaffManage",
+      name: "码头人员管理",
+    });
+  }
 });
 
 app.use(router).use(store).mount("#app");

+ 1 - 1
src/router/index.js

@@ -226,7 +226,7 @@ const router = createRouter({
       path: "/workStation/newEnergyPolicyManage",
       name: "newEnergyPolicyManage",
       meta: {
-        title: "新能源船舶政策解读",
+        title: "新能源政策管理",
       },
       component: () => import("../views/workStation/newEnergyPolicyManage.vue"),
     },

+ 96 - 0
src/store/index.js

@@ -22,6 +22,102 @@ const store = createStore({
     shipCertCacheUrl,
     versions: [],
     keepAliveList: ["shipList", "shipOwnerList"],
+    menu: [
+      {
+        icon: "Fold",
+        title: "海事总台",
+        items: [
+          {
+            path: "/index",
+            name: "总台",
+          },
+        ],
+      },
+      {
+        icon: "Notification",
+        title: "海事公告",
+        items: [
+          {
+            path: "/marineManage/marineNotice",
+            name: "海事公告",
+          },
+        ],
+      },
+      {
+        icon: "User",
+        title: "船员管理",
+        items: [
+          {
+            path: "/shipOwnerManage/shipOwnerList",
+            name: "船员列表",
+          },
+        ],
+      },
+      {
+        icon: "Ship",
+        title: "船舶管理",
+        items: [
+          {
+            path: "/shipManage/shipList",
+            name: "船舶列表",
+          },
+        ],
+      },
+      {
+        icon: "FolderChecked",
+        title: "消防安检",
+        items: [
+          {
+            path: "/fireSafetyManage/fireSafetyTemplateList",
+            name: "消防安检模板列表",
+          },
+          {
+            path: "/fireSafetyManage/checkFireSafetyExamineList",
+            name: "消防安检审核列表",
+          },
+          {
+            path: "/fireSafetyManage/fireSafetyHistoryCheckList",
+            name: "历史消防安检列表",
+          },
+        ],
+      },
+      {
+        icon: "FolderChecked",
+        title: "船舶安检",
+        items: [
+          {
+            path: "/shipSecurityManage/shipCheckTemplateList",
+            name: "安检模板列表",
+          },
+          {
+            path: "/shipSecurityManage/checkShipList",
+            name: "船舶安检列表",
+          },
+          {
+            path: "/shipSecurityManage/checkShipExamineList",
+            name: "安检审核列表",
+          },
+          {
+            path: "/shipSecurityManage/shipCheckHistoryList",
+            name: "历史安检列表",
+          },
+        ],
+      },
+      {
+        icon: "Document",
+        title: "工作站",
+        items: [
+          {
+            path: "/workStation/certsManage",
+            name: "证书管理",
+          },
+          {
+            path: "/workStation/insuranceManage",
+            name: "保险管理",
+          },
+        ],
+      },
+    ],
   },
   mutations: {
     changefirstTitle(state, text) {

+ 2 - 2
src/views/workStation/crewSchoolInfoManage.vue

@@ -39,8 +39,8 @@
             <span class="label">学校图片:</span>
             <div class="image-container">
               <el-image
-                :src="schoolInfo.crewSchoolImgFileKey"
-                :preview-src-list="[schoolInfo.crewSchoolImgFileKey]"
+                :src="schoolInfo.crewSchoolImgUrl"
+                :preview-src-list="[schoolInfo.crewSchoolImgUrl]"
                 fit="cover"
                 class="school-image"
               />