Parcourir la source

feat: 新软件接收

outaozhen il y a 5 ans
Parent
commit
9978054318

+ 2 - 17
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockModal.jsx

@@ -7,7 +7,7 @@ import { queryClient } from '@/services/customer'
 import { queryLock } from '@/services/lock'
 import consts from '@/basic/consts'
 import { useDebounceFn } from 'ahooks'
-import { apiSoftwareAddLonglelog, apiReceiveLock } from '@/services/lock'
+import { apiSoftwareAddLonglelog } from '@/services/lock'
 import { useDispatch, connect } from 'umi'
 
 export const lockTypeEnum = {
@@ -118,10 +118,7 @@ const LockModal = props => {
   }, [visible, type])
 
   const handleonOk = () => {
-    if (type === lockTypeEnum.RECEIVE) {
-      receiveLongle(longleId)
-    }
-    return form.validateFields().then(values => {
+    form.validateFields().then(values => {
       onConfirm({ ...values, status: type })
     })
   }
@@ -167,18 +164,6 @@ const LockModal = props => {
     })
   }
 
-  // 接收新软件锁
-  const receiveLongle = async id => {
-    const { code = -1 } = await apiReceiveLock({ id })
-    if (code === consts.RET_CODE.SUCCESS) {
-      onCancel()
-    }
-    dispatch({
-      type: 'refresh/commitAction',
-      payload: 'longle'
-    })
-  }
-
   const handleListScroll = () => {
     // 未滚动到底部
     if (

+ 18 - 7
src/pages/Product/Lock/Lockstore/components/ReceiveLock.jsx

@@ -4,7 +4,7 @@ import React, { useRef } from 'react'
 import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
 import { CloseOutlined } from '@ant-design/icons'
 import consts from '@/basic/consts'
-import { apiReceiveOldLock, queryOldLockList } from '@/services/lock'
+import { apiReceiveOldLock, apiReceiveLock, queryOldLockList } from '@/services/lock'
 import { ProductLabel } from '../index'
 import ProTable from '@ant-design/pro-table'
 
@@ -17,11 +17,20 @@ const ReceiveLock = () => {
     })
   }
 
-  const receiveLongle = async (name, id) => {
-    const { code = -1 } = await apiReceiveOldLock({ id })
-    if (code === consts.RET_CODE.SUCCESS) {
-      message.success(`锁(${name})接收成功`)
-      tRef.current?.reload()
+  const receiveLongle = async (name, id, departmentName) => {
+    if (departmentName !== null) {
+      const { code = -1 } = await apiReceiveLock({ id })
+      if (code === consts.RET_CODE.SUCCESS) {
+        message.success(`锁(${name})接收成功`)
+        tRef.current?.reload()
+      }
+    }
+    if (departmentName === null) {
+      const { code = -1 } = await apiReceiveOldLock({ id })
+      if (code === consts.RET_CODE.SUCCESS) {
+        message.success(`锁(${name})接收成功`)
+        tRef.current?.reload()
+      }
     }
   }
 
@@ -48,7 +57,9 @@ const ReceiveLock = () => {
       dataIndex: 'opreate',
       title: '操作',
       render: (_, record) => (
-        <Button size="small" onClick={() => receiveLongle(record.keyNum, record.id)}>
+        <Button
+          size="small"
+          onClick={() => receiveLongle(record.keyNum, record.id, record.departmentName)}>
           接收
         </Button>
       )