zhangqiOMG 2 سال پیش
والد
کامیت
a8186ecdcd
3فایلهای تغییر یافته به همراه18 افزوده شده و 26 حذف شده
  1. 1 1
      src/HDrpManagement/contractManage/modules/detail.vue
  2. 4 0
      src/HDrpManagement/orderManage/index.vue
  3. 13 25
      src/utils/tool.js

+ 1 - 1
src/HDrpManagement/contractManage/modules/detail.vue

@@ -149,7 +149,7 @@ import productDetailList from '../components/productDetailList/productDetailList
 import addProduct from '../components/productList/addProduct'
 import addProductDetail from '../components/productDetailList/addProduct.vue'
 import addTool from '../components/toolList/addTool'
-import toolList from '../components/toolList/toolList'
+import toolList from '../components/toolList/toolList.vue'
 import addClass from '../components/productClassList/addProduct'
 import productClassList from '../components/productClassList/productClassList.vue'
 import contractClause from '../components/contractClause/contractClause'

+ 4 - 0
src/HDrpManagement/orderManage/index.vue

@@ -14,6 +14,7 @@
       @listData="list">
       <template #titleRight>
           <el-button v-if="tool.checkAuth($route.name,'refreshStock')" style="margin-left:16px" size="small" type="primary" @click="refreshStock">刷新库存</el-button>
+          <el-button style="margin-left:16px" size="small" type="primary" @click="test">测试</el-button>
       </template>
       <template #custom>
         <div class="mt-10">
@@ -186,6 +187,9 @@ export default {
         this.$refs.basicLayout.param.content.where.enddate = ''
       }
       this.$refs.basicLayout.listData()
+    },
+    test () {
+      console.log(this.tool.checkAuth(this.$route.name,'refreshStock'))
     }
   },
   created () {

+ 13 - 25
src/utils/tool.js

@@ -2,32 +2,20 @@ import { Message } from 'element-ui';
 import router from '@/router';
 import api from '@/api/api';
 export default {
-  // 获取应用权限
-  checkAuth (appname,auth) {
-    // console.log(appname)
-    try {
-      let _haveAuth = true
-      
-      let app = JSON.parse(sessionStorage.getItem('activeApp'))
-
-      // 获取当前应用权限
-      let auth_list = app.meta.auth
-
-      // 判断是否拥有权限
-      _haveAuth = auth_list.some(item=>item.option === auth)
+  sleep(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+  },
 
-      return _haveAuth
-      
-    } catch (error) {
-      api.requested({
-        classname:"system.tools",
-        method:"saveWebClientErrLog",
-        content:{
-          "keyname":'auth',
-          "log":JSON.stringify(error)
-        }
-      })
-    }
+  // 获取应用权限
+  async checkAuth (appname,auth) {
+    await this.sleep(3000)
+    let _haveAuth = false
+    let app = JSON.parse(sessionStorage.getItem('activeApp'))
+    // 获取当前应用权限
+    let auth_list = app.meta.auth
+    // 判断是否拥有权限
+    _haveAuth = auth_list.some(item=>item.option === auth)
+    return _haveAuth
   },
 
   // 获取应用表格