From 61a2db936dcbc3d5aebe8ff850bcaab76e3b3785 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 15 六月 2026 11:09:18 +0800
Subject: [PATCH] 合并恢复

---
 src/directive/permission/hasPermi.ts |   31 +++++
 src/pages/index.vue                  |   30 +++---
 src/pages/works.vue                  |  115 ++++++++++++++--------
 src/utils/permission.ts              |   40 +++++++
 src/directive/permission/hasRole.ts  |   31 +++++
 src/config.js                        |    4 
 src/manifest.json                    |    4 
 7 files changed, 182 insertions(+), 73 deletions(-)

diff --git a/src/config.js b/src/config.js
index 5fb847f..27244b3 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,7 +1,7 @@
 // 搴旂敤鍏ㄥ眬閰嶇疆
 const config = {
-  baseUrl: "https://122701huey826.vicp.fun",
-  fileUrl: "http://122701huey826.vicp.fun",
+  baseUrl: "http://1.15.17.182:9048",
+  fileUrl: "http://1.15.17.182:9049",
   // 搴旂敤淇℃伅
   appInfo: {
     // 搴旂敤鍚嶇О
diff --git a/src/directive/permission/hasPermi.ts b/src/directive/permission/hasPermi.ts
index 7227930..efac852 100644
--- a/src/directive/permission/hasPermi.ts
+++ b/src/directive/permission/hasPermi.ts
@@ -1,7 +1,30 @@
+/**
+* v-hasPermi 鎿嶄綔鏉冮檺澶勭悊
+* Copyright (c) 2019 ruoyi
+*/
+
+import useUserStore from '@/store/modules/user'
+
 import type { Directive } from "vue";
-
 const vHasPermi: Directive = {
-  mounted() {}
-};
+  mounted(el, binding, vnode) {
+    const { value } = binding
+    const all_permission = "*:*:*";
+    const permissions = useUserStore().permissions
 
-export default vHasPermi;
+    if (value && value instanceof Array && value.length > 0) {
+      const permissionFlag = value
+
+      const hasPermissions = permissions.some(permission => {
+        return all_permission === permission || permissionFlag.includes(permission)
+      })
+
+      if (!hasPermissions) {
+        el.parentNode && el.parentNode.removeChild(el)
+      }
+    } else {
+      throw new Error(`璇疯缃搷浣滄潈闄愭爣绛惧�糮)
+    }
+  }
+}
+export default vHasPermi
diff --git a/src/directive/permission/hasRole.ts b/src/directive/permission/hasRole.ts
index d4a5cc7..94a2b50 100644
--- a/src/directive/permission/hasRole.ts
+++ b/src/directive/permission/hasRole.ts
@@ -1,7 +1,30 @@
+/**
+* v-hasRole 瑙掕壊鏉冮檺澶勭悊
+* Copyright (c) 2019 ruoyi
+*/
+
+import useUserStore from '@/store/modules/user'
 import type { Directive } from "vue";
-
 const vHasRole: Directive = {
-  mounted() {}
-};
+  mounted(el, binding, vnode) {
+    const { value } = binding
+    const super_admin = "admin";
+    const roles = useUserStore().roles
 
-export default vHasRole;
+    if (value && value instanceof Array && value.length > 0) {
+      const roleFlag = value
+
+      const hasRole = roles.some(role => {
+        return super_admin === role || roleFlag.includes(role)
+      })
+
+      if (!hasRole) {
+        el.parentNode && el.parentNode.removeChild(el)
+      }
+    } else {
+      throw new Error(`璇疯缃鑹叉潈闄愭爣绛惧�糮)
+    }
+  }
+}
+
+export default vHasRole;
\ No newline at end of file
diff --git a/src/manifest.json b/src/manifest.json
index acdeac9..d0d0ccf 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,6 +1,6 @@
 {
-    "name" : "涓叴瀹炲己",
-    "appid" : "__UNI__1F2DCE1",
+    "name" : "淇℃伅绠$悊Pro-OA",
+    "appid" : "__UNI__751174B",
     "description" : "",
     "versionName" : "1.1.5",
     "versionCode" : 100,
diff --git a/src/pages/index.vue b/src/pages/index.vue
index a1beef3..2d253b2 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -230,21 +230,21 @@
     icon: "/static/images/icon/shengchanbaogong.svg",
     action: "scan",
   },
-  // {
-  //   label: "璁惧宸℃",
-  //   icon: "/static/images/icon/xunjianshangchuan.svg",
-  //   route: "/pages/inspectionUpload/index",
-  // },
-  // {
-  //   label: "璁惧淇濆吇",
-  //   icon: "/static/images/icon/shebeibaoyang.svg",
-  //   route: "/pages/equipmentManagement/upkeep/index",
-  // },
-  // {
-  //   label: "璁惧鎶ヤ慨",
-  //   icon: "/static/images/icon/shebeibaoxiu.svg",
-  //   route: "/pages/equipmentManagement/repair/index",
-  // },
+  {
+    label: "璁惧宸℃",
+    icon: "/static/images/icon/xunjianshangchuan.svg",
+    route: "/pages/inspectionUpload/index",
+  },
+  {
+    label: "璁惧淇濆吇",
+    icon: "/static/images/icon/shebeibaoyang.svg",
+    route: "/pages/equipmentManagement/upkeep/index",
+  },
+  {
+    label: "璁惧鎶ヤ慨",
+    icon: "/static/images/icon/shebeibaoxiu.svg",
+    route: "/pages/equipmentManagement/repair/index",
+  },
 ];
 const quickTools = ref([...quickToolSource]);
 const allowedMenuTitles = ref(new Set());
diff --git a/src/pages/works.vue b/src/pages/works.vue
index 41d6798..65fd28a 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -1,5 +1,28 @@
 <template>
   <view class="content">
+    <!-- OA鍔炲叕妯″潡 -->
+    <view class="common-module oa-module"
+          v-if="hasOaItems">
+      <view class="module-header">
+        <view class="module-title-container">
+          <text class="module-title">OA鍔炲叕</text>
+        </view>
+      </view>
+      <view class="module-content">
+        <up-grid :border="false"
+                 col="4">
+          <up-grid-item v-for="(item, index) in oaItems"
+                        :key="index"
+                        @click="handleCommonItemClick(item)">
+            <view class="icon-container">
+              <image :src="item.icon"
+                     class="item-icon"></image>
+            </view>
+            <text class="item-label">{{item.label}}</text>
+          </up-grid-item>
+        </up-grid>
+      </view>
+    </view>
     <!-- 鍗忓悓鍔炲叕妯″潡 -->
     <view class="common-module collaboration-module"
           v-if="hasCollaborationItems">
@@ -208,27 +231,28 @@
       </view>
     </view>
     <!-- 鍞悗鏈嶅姟妯″潡 -->
-<!--    <view class="common-module after-sales-module"-->
-<!--          v-if="hasAfterSalesServiceItems">-->
-<!--      <view class="module-header">-->
-<!--        <view class="module-title-container">-->
-<!--          <text class="module-title">鍞悗鏈嶅姟</text>-->
-<!--        </view>-->
-<!--      </view>-->
-<!--      <view class="module-content">-->
-<!--        <up-grid :border="false"-->
-<!--                 col="4">-->
-<!--          <up-grid-item v-for="(item, index) in afterSalesServiceItems"-->
-<!--                        :key="index"-->
-<!--                        @click="handleCommonItemClick(item)">-->
-<!--            <view class="icon-container">-->
-<!--              <image :src="item.icon" class="item-icon"></image>-->
-<!--            </view>-->
-<!--            <text class="item-label">{{item.label}}</text>-->
-<!--          </up-grid-item>-->
-<!--        </up-grid>-->
-<!--      </view>-->
-<!--    </view>-->
+    <view class="common-module after-sales-module"
+          v-if="hasAfterSalesServiceItems">
+      <view class="module-header">
+        <view class="module-title-container">
+          <text class="module-title">鍞悗鏈嶅姟</text>
+        </view>
+      </view>
+      <view class="module-content">
+        <up-grid :border="false"
+                 col="4">
+          <up-grid-item v-for="(item, index) in afterSalesServiceItems"
+                        :key="index"
+                        @click="handleCommonItemClick(item)">
+            <view class="icon-container">
+              <image :src="item.icon"
+                     class="item-icon"></image>
+            </view>
+            <text class="item-label">{{item.label}}</text>
+          </up-grid-item>
+        </up-grid>
+      </view>
+    </view>
     <!-- 璐ㄩ噺绠$悊妯″潡 -->
     <view class="common-module collaboration-module"
           v-if="hasQualityItems">
@@ -276,28 +300,28 @@
       </view>
     </view>
     <!-- 瀹夊叏鐢熶骇妯″潡 -->
-<!--    <view class="common-module collaboration-module"-->
-<!--          v-if="hasSafetyItems">-->
-<!--      <view class="module-header">-->
-<!--        <view class="module-title-container">-->
-<!--          <text class="module-title">瀹夊叏鐢熶骇</text>-->
-<!--        </view>-->
-<!--      </view>-->
-<!--      <view class="module-content">-->
-<!--        <up-grid :border="false"-->
-<!--                 col="4">-->
-<!--          <up-grid-item v-for="(item, index) in safetyItems"-->
-<!--                        :key="index"-->
-<!--                        @click="handleCommonItemClick(item)">-->
-<!--            <view class="icon-container">-->
-<!--              <image :src="item.icon" class="item-icon"></image>-->
-<!--            </view>-->
-<!--            <text class="item-label">{{item.label}}</text>-->
-<!--          </up-grid-item>-->
-<!--        </up-grid>-->
-<!--      </view>-->
-<!--    </view>-->
-
+    <view class="common-module collaboration-module"
+          v-if="hasSafetyItems">
+      <view class="module-header">
+        <view class="module-title-container">
+          <text class="module-title">瀹夊叏鐢熶骇</text>
+        </view>
+      </view>
+      <view class="module-content">
+        <up-grid :border="false"
+                 col="4">
+          <up-grid-item v-for="(item, index) in safetyItems"
+                        :key="index"
+                        @click="handleCommonItemClick(item)">
+            <view class="icon-container">
+              <image :src="item.icon"
+                     class="item-icon"></image>
+            </view>
+            <text class="item-label">{{item.label}}</text>
+          </up-grid-item>
+        </up-grid>
+      </view>
+    </view>
     <DownloadProgressMask />
   </view>
 </template>
@@ -535,6 +559,11 @@
       label: "瀹夊叏鍩硅鑰冩牳",
     },
   ]);
+  // OA鍔炲叕鍔熻兘鏁版嵁锛堢函鍓嶇閰嶇疆锛屼笉鍙備笌鍚庣鏉冮檺杩囨护锛�
+  const oaItems = reactive(
+    OA_WORKBENCH_ITEMS.map(item => ({ ...item }))
+  );
+
   // 鍗忓悓鍔炲叕鍔熻兘鏁版嵁
   const collaborationItems = reactive([
     {
diff --git a/src/utils/permission.ts b/src/utils/permission.ts
index 68d3b84..3d6c5cd 100644
--- a/src/utils/permission.ts
+++ b/src/utils/permission.ts
@@ -1,10 +1,28 @@
+import useUserStore from '@/store/modules/user'
+
 /**
  * 瀛楃鏉冮檺鏍¢獙
  * @param {Array} value 鏍¢獙鍊�
  * @returns {Boolean}
  */
 export function checkPermi(value:Array<string>) {
-  return true
+  if (value && value instanceof Array && value.length > 0) {
+    const permissions:Array<string> = useUserStore().permissions
+    const permissionDatas = value
+    const all_permission = "*:*:*"
+
+    const hasPermission = permissions.some(permission => {
+      return all_permission === permission || permissionDatas.includes(permission)
+    })
+
+    if (!hasPermission) {
+      return false
+    }
+    return true
+  } else {
+    console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
+    return false
+  }
 }
 
 /**
@@ -13,5 +31,21 @@
  * @returns {Boolean}
  */
 export function checkRole(value:Array<string>) {
-  return true
-}
+  if (value && value instanceof Array && value.length > 0) {
+    const roles:Array<string> = useUserStore().roles
+    const permissionRoles = value
+    const super_admin = "admin"
+
+    const hasRole = roles.some(role => {
+      return super_admin === role || permissionRoles.includes(role)
+    })
+
+    if (!hasRole) {
+      return false
+    }
+    return true
+  } else {
+    console.error(`need roles! Like checkRole="['admin','editor']"`)
+    return false
+  }
+}
\ No newline at end of file

--
Gitblit v1.9.3