瀏覽代碼

feat: 使用自定义hooks接管巡检列表、弹窗功能逻辑

lanjianrong 4 年之前
父節點
當前提交
f58ee1bdba
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 2
      src/components/Authorization/index.tsx
  2. 1 0
      src/utils/common/customHooks.ts

+ 4 - 2
src/components/Authorization/index.tsx

@@ -1,4 +1,6 @@
-import { tenderStore, userStore } from '@/store/mobx'
+import { tenderStore } from '@/store/mobx'
+import history from '@/utils/history'
+import { storage } from '@/utils/util'
 import { observer } from 'mobx-react'
 import React, { useEffect } from 'react'
 interface Authorization {
@@ -23,7 +25,7 @@ const Authorization: React.FC<Authorization> = ({ type, auth, children }) => {
   // 获取mobx存储的权限
   const permission = tenderStore.permission[type]
 
-  if (permission[auth] === authPass || !!userStore.userInfo.isAdmin) {
+  if (permission[auth] === authPass) {
     return <>{children}</>
   }
   return null

+ 1 - 0
src/utils/common/customHooks.ts

@@ -2,6 +2,7 @@
 import { useState, useEffect } from 'react'
 import { ContractTree } from '@/types/contract'
 import { ListModal } from '@/types/safe'
+import consts from '../consts'
 
 /** 合同树的自定义hook */
 export const useContractTree = (): [ContractTree, (newTree: ContractTree) => void] => {