liuzhenlin 1 неделя назад
Родитель
Сommit
b0a4553c79
5 измененных файлов с 32 добавлено и 31 удалено
  1. 2 0
      .env.production
  2. 6 6
      constants/index.ts
  3. 15 16
      directive/hasPermi.ts
  4. 7 7
      pages/fund/reimbursement/index.vue
  5. 2 2
      pages/home/index.vue

+ 2 - 0
.env.production

@@ -18,5 +18,7 @@ VITE_WORKFLOW = dashoo.labsop.workflow-54000
 VITE_DINGTALK_CORPID = dinga8b316209f5ee42435c2f4657eb6378f
 VITE_DINGTALK_CLIENTID = dingo2thrapshzkv6uny
 
+VITE_SECRET = def456
+
 # 租户ID 
 VITE_TENANT=default

+ 6 - 6
constants/index.ts

@@ -117,13 +117,13 @@ export const TODO_TAB_LIST = [
 
 // 首页常用功能导航列表
 export const HOME_NAV_LIST = [
-  { name: '科研项目', path: '/pages/project/index', icon: '/static/imgs/fund-claim.png' },
-  { name: '经费认领', path: '/pages/fund/claim/index', icon: '/static/imgs/fund-claim.png' },
-  { name: '经费入账', path: '/pages/fund/claim-records/index', icon: '/static/imgs/fund-entry.png' },
-  { name: '经费报销', path: '/pages/fund/reimbursement/index', icon: '/static/imgs/fund-reimburse.png' },
-  { name: '科研成果', path: '/pages/achievement/index', icon: '/static/imgs/fund-reimburse.png' },
+  { name: '科研项目', path: '/pages/project/index', icon: '/static/imgs/fund-claim.png', permission: 'project:list' },
+  // { name: '经费认领', path: '/pages/fund/claim/index', icon: '/static/imgs/fund-claim.png' },
+  { name: '经费入账', path: '/pages/fund/claim-records/index', icon: '/static/imgs/fund-entry.png', permission: 'fund:claim:records:list' },
+  { name: '经费报销', path: '/pages/fund/reimbursement/index', icon: '/static/imgs/fund-reimburse.png', permission: 'fund:reimbursement:list' },
+  { name: '科研成果', path: '/pages/achievement/index', icon: '/static/imgs/fund-reimburse.png', permission: 'achievement:list' },
   // { name: '考核奖励', path: '/pages/fund/reimbursement-remind/index', icon: '/static/imgs/fund-reimburse.png' },
-  { name: '业务审批', path: '/pages/todo/index', icon: '/static/imgs/home-tech.png' }
+  { name: '业务审批', path: '/pages/todo/index', icon: '/static/imgs/home-tech.png', permission: 'todo:list' }
 ];
 
 // 首页模拟通知公告列表

+ 15 - 16
directive/hasPermi.ts

@@ -1,4 +1,4 @@
-import { Session } from '@/utils/storage';
+import { Local } from '@/utils/storage';
 import { CACHE_KEY } from '@/constants/index';
 
 /**
@@ -6,21 +6,20 @@ import { CACHE_KEY } from '@/constants/index';
  * 使用方法:v-hasPermi="['system:user:add']"
  */
 export default {
-    mounted(el: HTMLElement, binding: any) {
-        const { value } = binding;
-        const perms: string[] = Session.get(CACHE_KEY.PERMS) || [];
+  mounted(el: HTMLElement, binding: any) {
+    const { value } = binding;
+    const perms: string[] = Local.get(CACHE_KEY.PERMS) || [];
+    if (value && value instanceof Array && value.length > 0) {
+      const hasPermissions = perms.some(permission => {
+        return (value as string[]).includes(permission);
+      });
 
-        if (value && value instanceof Array && value.length > 0) {
-            const hasPermissions = perms.some(permission => {
-                return (value as string[]).includes(permission);
-            });
-
-            if (!hasPermissions) {
-                // 如果没有权限,则移除元素
-                el.parentNode && el.parentNode.removeChild(el);
-            }
-        } else {
-            console.error(`[v-hasPermi]: 请设置操作权限标签值, 如 v-hasPermi="['system:user:add']"`);
-        }
+      if (!hasPermissions) {
+        // 如果没有权限,则移除元素
+        el.parentNode && el.parentNode.removeChild(el);
+      }
+    } else {
+      console.error(`[v-hasPermi]: 请设置操作权限标签值, 如 v-hasPermi="['system:user:add']"`);
     }
+  }
 };

+ 7 - 7
pages/fund/reimbursement/index.vue

@@ -90,16 +90,16 @@ import FundTabbar from '@/components/FundTabbar.vue';
 
 const rebateApi = useRebateApi();
 
-const tabList = ref([
-  { name: '待审核', type: '05' },
-  { name: '审核中', type: '10' },
-  { name: '已通过', type: '20' },
-  { name: '已拒绝', type: '30' }
-]);
+// const tabList = ref([
+//   { name: '待审核', type: '05' },
+//   { name: '审核中', type: '10' },
+//   { name: '已通过', type: '20' },
+//   { name: '已拒绝', type: '30' }
+// ]);
 const currentTab = ref(0);
 
 const queryParams = ref({
-  status: '05',
+  status: '',
   projectName: '',
   expenseNo: '',
   pageNum: 1,

+ 2 - 2
pages/home/index.vue

@@ -13,7 +13,7 @@
     <view class="card">
       <view class="card-title">常用功能</view>
       <view class="nav">
-        <view class="nav-item" v-for="(item, index) in HOME_NAV_LIST" :key="index" @click="onRouterPush(item.path)">
+        <view class="nav-item" v-for="(item, index) in HOME_NAV_LIST" :key="index" @click="onRouterPush(item.path)" v-hasPermi="[item.permission]">
           <image :src="item.icon" mode="aspectFit" />
           <text>{{ item.name }}</text>
         </view>
@@ -21,7 +21,7 @@
     </view>
 
 
-    <view class="section-box mt20" v-if="todoStore.list.length">
+    <view class="section-box mt20" v-if="todoStore.list.length" v-hasPermi="['todo:list']">
       <view class="section-header flex justify-between align-center">
         <view class="flex align-center">
           <text class="section-title">待办事项</text>