Forráskód Böngészése

feat: 新增按钮权限信息,新增权限接口

lixuan 3 hete
szülő
commit
6612dba997

+ 23 - 0
apps/web-velofex/src/api/core/user.ts

@@ -18,6 +18,17 @@ export namespace UserApi {
     filters?: ApplicationFilter[];
   }
 
+  export interface GetMenuPermissionButtonsParams {
+    menu_code: string;
+  }
+
+  export interface GetMenuPermissionButtonsResult {
+    isSuccess: boolean;
+    code: number;
+    result: string[];
+    isAuthorized: boolean;
+  }
+
   export interface ApplicationModel {
     cellPhone: string;
     client_code: string;
@@ -842,3 +853,15 @@ export async function deleteEnterpriseCustomerApi(data: { code: string }) {
     data,
   );
 }
+
+/**
+ * 获取菜单权限按钮
+ */
+export async function getMenuPermissionButtonsApi(
+  data: UserApi.GetMenuPermissionButtonsParams,
+) {
+  return requestClient.post<UserApi.GetMenuPermissionButtonsResult>(
+    '/api/menubutton/getMenuPermissionButtons',
+    data,
+  );
+}

+ 36 - 3
apps/web-velofex/src/views/dashboard/application-management/index.vue

@@ -18,6 +18,7 @@ import {
 
 import {
   deleteApplicationApi,
+  getMenuPermissionButtonsApi,
   getMyApplicationListApi,
   getPartnersApi,
   type UserApi,
@@ -26,6 +27,7 @@ import {
 import ApplicationModal from './application-modal.vue';
 
 const applicationMenu = ref<Array<{ label: string; value: any }>>([]);
+const permissionButtons = ref<string[]>([]);
 
 const modalOpen = ref(false);
 const modalMode = ref<'add' | 'edit'>('add');
@@ -179,6 +181,23 @@ async function fetchPartners() {
   }
 }
 
+async function fetchMenuPermissionButtons() {
+  if (!isLogin.value) {
+    return;
+  }
+
+  try {
+    const result = await getMenuPermissionButtonsApi({
+      menu_code: 'Sys_Menu_Project',
+    });
+    if (result?.result) {
+      permissionButtons.value = result.result;
+    }
+  } catch (error) {
+    console.error('获取菜单权限按钮失败:', error);
+  }
+}
+
 async function deleteApplication(item: any) {
   if (!isLogin.value) {
     return;
@@ -206,6 +225,7 @@ watch(
     if (newValue) {
       fetchApplicationList();
       fetchPartners();
+      fetchMenuPermissionButtons();
     }
   },
   { immediate: true },
@@ -363,7 +383,12 @@ watch(
           </svg>
           {{ $t('btn.reset') }}
         </Button>
-        <Button class="h-[42px]" type="primary" @click="handleAddNew">
+        <Button
+          v-if="permissionButtons.includes('add')"
+          class="h-[42px]"
+          type="primary"
+          @click="handleAddNew"
+        >
           <img
             alt=""
             class="h-[21.5px] w-[21.5px] cursor-pointer"
@@ -400,10 +425,18 @@ watch(
           {{ item.name }}
         </span>
         <Dropdown
+          v-if="
+            permissionButtons.includes('edit') ||
+            permissionButtons.includes('del')
+          "
           :menu="{
             items: [
-              { key: 'Edit', label: $t('applicationManagement.edit') },
-              { key: 'Remove', label: $t('applicationManagement.remove') },
+              ...(permissionButtons.includes('edit')
+                ? [{ key: 'Edit', label: $t('applicationManagement.edit') }]
+                : []),
+              ...(permissionButtons.includes('del')
+                ? [{ key: 'Remove', label: $t('applicationManagement.remove') }]
+                : []),
             ],
           }"
           placement="bottom"

+ 1 - 0
apps/web-velofex/src/views/dashboard/home/application-management.vue

@@ -90,6 +90,7 @@ watch(
         <div class="text-xs text-[#9A9BA3]">Application Management</div>
       </div>
       <img
+        v-if="props.jurisdiction"
         alt="more"
         class="h-[29px] w-[29px] cursor-pointer"
         src="@/assets/image/home-more.png"

+ 1 - 1
apps/web-velofex/src/views/dashboard/home/delivery-partners.vue

@@ -105,7 +105,7 @@ watch(
       </div>
       <div
         v-else
-        class="mx-auto mt-[-20px] flex flex-col items-center justify-center text-center"
+        class="mx-auto mt-[-40px] flex flex-col items-center justify-center text-center"
       >
         <img
           alt=""

+ 1 - 1
apps/web-velofex/src/views/dashboard/home/sales-partners.vue

@@ -105,7 +105,7 @@ watch(
       </div>
       <div
         v-else
-        class="mt-[10px] flex flex-col items-center justify-center text-center"
+        class="mt-[-25px] flex flex-col items-center justify-center text-center"
       >
         <img
           alt=""