|
|
@@ -2,12 +2,14 @@ import React, { useState, useEffect } from 'react'
|
|
|
import { Row, Col, Button } from 'antd'
|
|
|
import { LinkOne, LinkInterrupt } from '@icon-park/react'
|
|
|
import { connect } from 'umi'
|
|
|
+import { useModal } from '@/components/Modal'
|
|
|
import consts from '@/consts'
|
|
|
import Form from './Form'
|
|
|
import ClientDetail from '@/pages/Customer/Client/components/ClientDetail/Form'
|
|
|
import LowerList from './LowerList'
|
|
|
import TabList from './TabList'
|
|
|
-import { apiRoadpricingDetail } from '@/services/product'
|
|
|
+import ConnectClient from '@/pages/Customer/Client/components/ConnectClient'
|
|
|
+import { apiRoadpricingDetail, apiRoadPricingUnLinkClient } from '@/services/product'
|
|
|
|
|
|
const Detail = props => {
|
|
|
const {
|
|
|
@@ -19,6 +21,13 @@ const Detail = props => {
|
|
|
projectType,
|
|
|
filterTag = true
|
|
|
} = props
|
|
|
+ const { toggleModal, setModalProps } = useModal()
|
|
|
+ const refreshClient = () => {
|
|
|
+ dispatch({
|
|
|
+ type: 'refresh/commitAction',
|
|
|
+ payload: actionPayload
|
|
|
+ })
|
|
|
+ }
|
|
|
const shouldUpdate = refresh[updateKey] || false
|
|
|
const [state, setState] = useState({
|
|
|
loading: false,
|
|
|
@@ -44,6 +53,49 @@ const Detail = props => {
|
|
|
setState({ ...state, cloudUser, compilationList, log, serviceLog, client, loading: false })
|
|
|
}
|
|
|
}
|
|
|
+ const handleConnectClient = () => {
|
|
|
+ setModalProps({
|
|
|
+ zIndex: 1200,
|
|
|
+ width: '60vw',
|
|
|
+ modalRender: () => (
|
|
|
+ <ConnectClient
|
|
|
+ onSelect={refreshClient}
|
|
|
+ dataId={state.cloudUser.ssoId}
|
|
|
+ // preUrl="RoadPricing"
|
|
|
+ showFooter={false}
|
|
|
+ otherParams={{ projectType }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ onCancel: () => toggleModal()
|
|
|
+ })
|
|
|
+ toggleModal(true)
|
|
|
+ }
|
|
|
+ // 关联cld客户
|
|
|
+ // const connectPricingLinkClient = async ssoId => {
|
|
|
+ // const { code = -1 } = await apiRoadPricingLinkClient(preUrl, {
|
|
|
+ // id: dataId,
|
|
|
+ // ssoId,
|
|
|
+ // client_id,
|
|
|
+ // projectPype
|
|
|
+ // })
|
|
|
+ // if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ // onSelect()
|
|
|
+ // closeModal()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // 移除cld客户
|
|
|
+ // const connectPricingUnLinkClient = async ssoId => {
|
|
|
+ // const { code = -1 } = await apiRoadPricingUnLinkClient(preUrl, {
|
|
|
+ // id: dataId,
|
|
|
+ // ssoId,
|
|
|
+ // client_id,
|
|
|
+ // projectPype
|
|
|
+ // })
|
|
|
+ // if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ // onSelect()
|
|
|
+ // closeModal()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
useEffect(() => {
|
|
|
shouldUpdate && initData(dataId)
|
|
|
}, [shouldUpdate])
|
|
|
@@ -58,8 +110,7 @@ const Detail = props => {
|
|
|
md={{ span: 24 }}
|
|
|
lg={{ span: 9 }}
|
|
|
xl={{ span: 9 }}
|
|
|
- className="sheet-box-left"
|
|
|
- >
|
|
|
+ className="sheet-box-left">
|
|
|
<div className="sheet-left-panel pr-4">
|
|
|
<Form cloudUser={state.cloudUser} updateKey={updateKey} projectType={projectType} />
|
|
|
{state.cloudUser.cld?.clientId ? (
|
|
|
@@ -76,7 +127,7 @@ const Detail = props => {
|
|
|
</>
|
|
|
) : (
|
|
|
<div className="text-center mt-6">
|
|
|
- <Button type="primary" ghost size="small">
|
|
|
+ <Button type="primary" ghost size="small" onClick={handleConnectClient}>
|
|
|
<LinkOne size="14" />
|
|
|
<span className="ml-5px">关联CLD客户</span>
|
|
|
</Button>
|
|
|
@@ -90,8 +141,7 @@ const Detail = props => {
|
|
|
lg={{ span: 15 }}
|
|
|
xl={{ span: 15 }}
|
|
|
flex={{ flexDirection: 'column' }}
|
|
|
- className="sheet-box-right"
|
|
|
- >
|
|
|
+ className="sheet-box-right">
|
|
|
<TabList
|
|
|
compilationList={state.compilationList}
|
|
|
cloudUser={state.cloudUser}
|