|
@@ -0,0 +1,76 @@
|
|
|
|
|
+import React from 'react'
|
|
|
|
|
+import { Switch, LinkOne } from '@icon-park/react'
|
|
|
|
|
+import { useModal } from '@/components/Modal'
|
|
|
|
|
+import { Card, Tooltip } from 'antd'
|
|
|
|
|
+import consts from '@/basic/consts'
|
|
|
|
|
+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 refreshClient = () => {
|
|
|
|
|
+ dispatch({
|
|
|
|
|
+ type: 'refresh/commitAction',
|
|
|
|
|
+ payload: 'clientlist'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ const handleConnectClient = () => {
|
|
|
|
|
+ setModalProps({
|
|
|
|
|
+ width: '60vw',
|
|
|
|
|
+ modalRender: () => (
|
|
|
|
|
+ <ConnectClient
|
|
|
|
|
+ onSelect={refreshClient}
|
|
|
|
|
+ id={longleId}
|
|
|
|
|
+ clientId={clientId}
|
|
|
|
|
+ preUrl={actionPayload}
|
|
|
|
|
+ />
|
|
|
|
|
+ ),
|
|
|
|
|
+ onCancel: () => toggleModal()
|
|
|
|
|
+ })
|
|
|
|
|
+ toggleModal()
|
|
|
|
|
+ }
|
|
|
|
|
+ const notValueRender = (
|
|
|
|
|
+ <div onClick={handleConnectClient} className={styles.notCompanyContent}>
|
|
|
|
|
+ <LinkOne size="14" />
|
|
|
|
|
+ <span className="ml-5px">关联联系人</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ const normalValueRender = (
|
|
|
|
|
+ <Card size="small">
|
|
|
|
|
+ <div className="flex justify-between">
|
|
|
|
|
+ <div className={styles.nameContent}>{clientName}</div>
|
|
|
|
|
+ <div className="max-w-55px">
|
|
|
|
|
+ <Tooltip
|
|
|
|
|
+ placement="right"
|
|
|
|
|
+ title="更换联系人"
|
|
|
|
|
+ className="ml-5px"
|
|
|
|
|
+ onClick={handleConnectClient}>
|
|
|
|
|
+ <span className={styles.switchIcon}>
|
|
|
|
|
+ <Switch />
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </Tooltip>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Card>
|
|
|
|
|
+ )
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className={styles.companyInput}>
|
|
|
|
|
+ {clientId !== consts.ENCRYPTION_ZERO ? normalValueRender : notValueRender}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export default ChangeClient
|