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

fix: 锁库记录删除权限

lanjianrong 4 éve
szülő
commit
2ed217c45f

+ 23 - 12
src/pages/Product/Lock/LockStore/components/LocksDetail/TabList.jsx

@@ -9,6 +9,7 @@ import ClientDetail from '@/pages/Customer/Client/components/ClientDetail'
 import { servicelogEnum, showProductsStatus, showNewLongleStatus, showMarkStatus } from './consts'
 import { useDispatch } from 'dva'
 import { useModal } from '@/components/Modal'
+import { useAccess } from '@/.umi/plugin-access/access'
 
 const RenderLongleCon = ({ longleService }) => {
   return (
@@ -39,6 +40,7 @@ const LockTabList = props => {
     upgradeProduct,
     updateKey
   } = props
+  const hasAddPerm = useAccess()?.validatePermByType('lockstore_delete_record')
   // 双重解构
   // const { longleId, keyNum, clientId, status, stockStatus, sellStatus } = props.longle
   const { toggleDrawer, setDrawerProps } = useModal()
@@ -118,7 +120,8 @@ const LockTabList = props => {
                         {servicelogEnum[item.status]}{' '}
                         <span
                           className="textPurple text-hex-967bbd cursor-pointer"
-                          onClick={handleClientClick}>
+                          onClick={handleClientClick}
+                        >
                           {item.client}
                         </span>
                         <br />
@@ -132,15 +135,17 @@ const LockTabList = props => {
                       </Col>
                       <Col span="16">
                         <RenderLongleCon longleService={item} />
-                        {item.status === 3 ||
-                        item.status === 4 ||
-                        item.status === 5 ||
-                        item.status === 9 ? (
+                        {hasAddPerm &&
+                        (item.status === 3 ||
+                          item.status === 4 ||
+                          item.status === 5 ||
+                          item.status === 9) ? (
                           <Popconfirm
                             title="确认删除"
                             onConfirm={() => delLonglelog(item.id)}
                             okText="确认"
-                            cancelText="取消">
+                            cancelText="取消"
+                          >
                             <Button className="mt-2" type="primary" ghost size="small" danger>
                               删除
                             </Button>
@@ -164,7 +169,8 @@ const LockTabList = props => {
             className="mr-3px"
             onClick={() =>
               setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.RECEIVE })
-            }>
+            }
+          >
             接收
           </Button>
         ) : null}
@@ -176,7 +182,8 @@ const LockTabList = props => {
             className="mr-3px"
             onClick={() =>
               setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.SALE })
-            }>
+            }
+          >
             借销赠
           </Button>
         ) : null}
@@ -187,7 +194,8 @@ const LockTabList = props => {
           className="mr-1"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.UPDATE })
-          }>
+          }
+        >
           升级
         </Button> */}
         {sellStatus === 0 ? (
@@ -202,7 +210,8 @@ const LockTabList = props => {
                 visible: true,
                 type: lockTypeEnum.CHANGE
               })
-            }>
+            }
+          >
             更换
           </Button>
         ) : null}
@@ -213,7 +222,8 @@ const LockTabList = props => {
           className="mr-1"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.RECOVER })
-          }>
+          }
+        >
           收回
         </Button>
         <Button
@@ -222,7 +232,8 @@ const LockTabList = props => {
           size="small"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.REMARK })
-          }>
+          }
+        >
           备注
         </Button>