Przeglądaj źródła

feat: 软件锁新版接收+刷新列表

outaozhen 5 lat temu
rodzic
commit
d11ee6f883

+ 2 - 1
src/pages/Product/Lock/Lockstore/components/ReceiveLock.jsx

@@ -7,7 +7,7 @@ import { ProductLabel } from '../index'
 import ProTable from '@ant-design/pro-table'
 import CustomModal from '@/components/Modal/src/components/CustomModal'
 
-const ReceiveLock = () => {
+const ReceiveLock = ({ refresh }) => {
   const tRef = useRef()
 
   const receiveLongle = async (name, id) => {
@@ -15,6 +15,7 @@ const ReceiveLock = () => {
     if (code === consts.RET_CODE.SUCCESS) {
       message.success(`锁(${name})接收成功`)
       tRef.current?.reload()
+      refresh()
     }
   }
 

+ 2 - 1
src/pages/Product/Lock/Lockstore/components/ReceiveNewLock.jsx

@@ -7,7 +7,7 @@ import { ProductLabel } from '../index'
 import ProTable from '@ant-design/pro-table'
 import CustomModal from '@/components/Modal/src/components/CustomModal'
 
-const ReceiveNewLock = () => {
+const ReceiveNewLock = ({ refresh }) => {
   const tRef = useRef()
 
   const receiveLongle = async (name, id) => {
@@ -15,6 +15,7 @@ const ReceiveNewLock = () => {
     if (code === consts.RET_CODE.SUCCESS) {
       message.success(`锁(${name})接收成功`)
       tRef.current?.reload()
+      refresh()
     }
   }
 

+ 5 - 5
src/pages/Product/Lock/Lockstore/index.jsx

@@ -71,7 +71,7 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
   const showReceiveLockModal = () => {
     setModalProps({
       width: '60vw',
-      modalRender: () => <ReceiveLock />,
+      modalRender: () => <ReceiveLock refresh={refreshData} />,
       onCancel: () => toggleModal()
     })
     toggleModal()
@@ -79,7 +79,7 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
   const showReceiveNewLockModal = () => {
     setModalProps({
       width: '60vw',
-      modalRender: () => <ReceiveNewLock />,
+      modalRender: () => <ReceiveNewLock refresh={refreshData} />,
       onCancel: () => toggleModal()
     })
     toggleModal()
@@ -105,9 +105,9 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
   }
 
   // 刷新
-  // const refreshData = () => {
-  //   tRef.current.reload()
-  // }
+  const refreshData = () => {
+    tRef.current.reload()
+  }
 
   useEffect(() => {
     if (shouldUpdate) {