outaozhen %!s(int64=5) %!d(string=hai) anos
pai
achega
92d574409a

+ 3 - 3
src/pages/Customer/Client/components/ConnectClient/index.jsx

@@ -9,7 +9,7 @@ import consts from '@/basic/consts'
 import { formatValues } from '@/components/LazyCascader'
 import AddClient from '../AddClient'
 
-const ConnectClient = ({ dataId, onSelect, preUrl }) => {
+const ConnectClient = ({ dataId, onSelect, preUrl, postUrl }) => {
   const dispatch = useDispatch()
   const scrollRef = useRef()
   const [state, setState] = useState({
@@ -72,9 +72,9 @@ const ConnectClient = ({ dataId, onSelect, preUrl }) => {
     }
   }
 
-  // 商机关联联系人
+  // 商机/软件锁关联联系人
   const connectClient = async clientId => {
-    const { code = -1 } = await linkBusiWithClient({ id: dataId, clientId })
+    const { code = -1 } = await linkBusiWithClient(postUrl, { id: dataId, clientId })
     if (code === consts.RET_CODE.SUCCESS) {
       onSelect()
       closeModal()

+ 22 - 23
src/pages/Product/Lock/Lockstore/components/ChangeClient/index.jsx

@@ -7,57 +7,56 @@ import { useDispatch } from 'dva'
 import ConnectClient from '@/pages/Customer/Client/components/ConnectClient'
 import styles from './index.less'
 
-export const ChangeCompMap = {
-  LONGLE: {
-    key: 'software',
-    title: '联系人'
-  }
-}
-
 const ChangeClient = props => {
   const dispatch = useDispatch()
-  const { toggleModal, setModalProps } = useModal()
-  const {
-    dataSource: { longleId, clientId, clientName, actionPayload = ChangeCompMap.LONGLE.key }
-  } = props
+  const { toggleModal, setModalProps, toggleDrawer, setDrawerProps } = useModal()
+  const { clientName = '', dataId, clientId, actionPayload } = props.dataSource
   const refreshClient = () => {
     dispatch({
       type: 'refresh/commitAction',
-      payload: 'clientlist'
+      payload: actionPayload
     })
   }
-  const handleConnectClient = () => {
+  const handleConnectCustomer = () => {
     setModalProps({
       width: '60vw',
       modalRender: () => (
-        <ConnectClient
-          onSelect={refreshClient}
-          id={longleId}
-          clientId={clientId}
-          preUrl={actionPayload}
-        />
+        <ConnectClient onSelect={refreshClient} id={dataId} postUrl="/software/changeClient" />
       ),
       onCancel: () => toggleModal()
     })
     toggleModal()
   }
   const notValueRender = (
-    <div onClick={handleConnectClient} className={styles.notCompanyContent}>
+    <div onClick={handleConnectCustomer} className={styles.notCompanyContent}>
       <LinkOne size="14" />
       <span className="ml-5px">关联联系人</span>
     </div>
   )
-
+  const handleCompanyClick = () => {
+    toggleDrawer()
+    setDrawerProps({
+      closable: true,
+      onClose: () => toggleDrawer(),
+      bodyStyle: {
+        height: '100vh',
+        overflowY: 'hidden'
+      }
+    })
+    toggleDrawer()
+  }
   const normalValueRender = (
     <Card size="small">
       <div className="flex justify-between">
-        <div className={styles.nameContent}>{clientName}</div>
+        <div className={styles.nameContent} onClick={handleCompanyClick}>
+          {clientName}
+        </div>
         <div className="max-w-55px">
           <Tooltip
             placement="right"
             title="更换联系人"
             className="ml-5px"
-            onClick={handleConnectClient}>
+            onClick={handleConnectCustomer}>
             <span className={styles.switchIcon}>
               <Switch />
             </span>