|
|
@@ -1,17 +1,16 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
-import { Row, Col, Button, Tooltip, Spin, Modal } from 'antd'
|
|
|
+import { Row, Col, Button, Tooltip, Spin, Modal, Drawer } 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 ConnectClient from '@/pages/Customer/Client/components/ConnectClient'
|
|
|
import { apiRoadpricingDetail, apiRoadPricingUnLinkClient } from '@/services/product'
|
|
|
+import { useModal } from '@/components/ModalStore'
|
|
|
|
|
|
-const Detail = props => {
|
|
|
+const CloudDetail = props => {
|
|
|
const {
|
|
|
dispatch,
|
|
|
updateKey = 'cloud',
|
|
|
@@ -19,10 +18,11 @@ const Detail = props => {
|
|
|
visible,
|
|
|
dataId = '',
|
|
|
projectType,
|
|
|
- filterTag = true
|
|
|
+ filterTag = true,
|
|
|
+ ...resetDrawerProps
|
|
|
} = props
|
|
|
- const { toggleModal, setModalProps } = useModal()
|
|
|
- const shouldUpdate = refresh[updateKey] || false
|
|
|
+ const dispatchModal = useModal()
|
|
|
+ const shouldUpdate = refresh?.[updateKey] || false
|
|
|
const refreshClient = () => {
|
|
|
dispatch({
|
|
|
type: 'refresh/commitAction',
|
|
|
@@ -54,21 +54,13 @@ const Detail = props => {
|
|
|
}
|
|
|
}
|
|
|
const handleConnectClient = () => {
|
|
|
- setModalProps({
|
|
|
- zIndex: 1200,
|
|
|
- width: '60vw',
|
|
|
- modalRender: () => (
|
|
|
- <ConnectClient
|
|
|
- onSelect={refreshClient}
|
|
|
- dataId={state.cloudUser.ssoId}
|
|
|
- preUrl="RoadPricing"
|
|
|
- showFooter={false}
|
|
|
- otherParams={{ projectType }}
|
|
|
- />
|
|
|
- ),
|
|
|
- onCancel: () => toggleModal()
|
|
|
+ dispatchModal('M_CONNECT_CLIENT', {
|
|
|
+ onSelect: refreshClient,
|
|
|
+ dataId: state.cloudUser.ssoId,
|
|
|
+ preUrl: 'RoadPricing',
|
|
|
+ showFooter: false,
|
|
|
+ otherParams: { projectType }
|
|
|
})
|
|
|
- toggleModal(true)
|
|
|
}
|
|
|
// 移除cld客户
|
|
|
const pricingUnLinkClient = clientId => {
|
|
|
@@ -97,72 +89,70 @@ const Detail = props => {
|
|
|
useEffect(() => {
|
|
|
visible && initData(dataId)
|
|
|
}, [visible])
|
|
|
+
|
|
|
return (
|
|
|
- <Spin spinning={state.loading}>
|
|
|
- <div className="sheet-box">
|
|
|
- <Row>
|
|
|
- <Col
|
|
|
- span={9}
|
|
|
- // sm={{ span: 24 }}
|
|
|
- // md={{ span: 24 }}
|
|
|
- // lg={{ span: 9 }}
|
|
|
- // xl={{ span: 9 }}
|
|
|
- className="sheet-box-left">
|
|
|
- <div className="sheet-left-panel pr-4">
|
|
|
- <Form cloudUser={state.cloudUser} updateKey={updateKey} projectType={projectType} />
|
|
|
- {state.cloudUser.cld?.clientId ? (
|
|
|
- <>
|
|
|
- <div className="mt-4">
|
|
|
- <ClientDetail client={state.client} filterTag={filterTag} />
|
|
|
- </div>
|
|
|
+ <Drawer {...resetDrawerProps} visible={visible} className="zh-drawer">
|
|
|
+ <Spin spinning={state.loading}>
|
|
|
+ <div className="sheet-box">
|
|
|
+ <Row>
|
|
|
+ <Col span={9} className="sheet-box-left">
|
|
|
+ <div className="sheet-left-panel pr-4">
|
|
|
+ <Form cloudUser={state.cloudUser} updateKey={updateKey} projectType={projectType} />
|
|
|
+ {state.cloudUser.cld?.clientId ? (
|
|
|
+ <>
|
|
|
+ <div className="mt-4">
|
|
|
+ <ClientDetail client={state.client} filterTag={filterTag} />
|
|
|
+ </div>
|
|
|
+ <div className="text-center mt-6">
|
|
|
+ <Tooltip placement="right" title="移除CLD客户">
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ ghost
|
|
|
+ size="small"
|
|
|
+ onClick={() => {
|
|
|
+ pricingUnLinkClient(state.cloudUser.cld?.clientId)
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <LinkInterrupt size="14" />
|
|
|
+ <span className="ml-5px">移除CLD客户</span>
|
|
|
+ </Button>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
<div className="text-center mt-6">
|
|
|
- <Tooltip placement="right" title="移除CLD客户">
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- ghost
|
|
|
- size="small"
|
|
|
- onClick={() => {
|
|
|
- pricingUnLinkClient(state.cloudUser.cld?.clientId)
|
|
|
- }}>
|
|
|
- <LinkInterrupt size="14" />
|
|
|
- <span className="ml-5px">移除CLD客户</span>
|
|
|
- </Button>
|
|
|
- </Tooltip>
|
|
|
+ <Button type="primary" ghost size="small" onClick={handleConnectClient}>
|
|
|
+ <LinkOne size="14" />
|
|
|
+ <span className="ml-5px">关联CLD客户</span>
|
|
|
+ </Button>
|
|
|
</div>
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <div className="text-center mt-6">
|
|
|
- <Button type="primary" ghost size="small" onClick={handleConnectClient}>
|
|
|
- <LinkOne size="14" />
|
|
|
- <span className="ml-5px">关联CLD客户</span>
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </Col>
|
|
|
- <Col
|
|
|
- span={15}
|
|
|
- // sm={{ span: 24 }}
|
|
|
- // md={{ span: 24 }}
|
|
|
- // lg={{ span: 15 }}
|
|
|
- // xl={{ span: 15 }}
|
|
|
- flex={{ flexDirection: 'column' }}
|
|
|
- className="sheet-box-right">
|
|
|
- <TabList
|
|
|
- compilationList={state.compilationList}
|
|
|
- cloudUser={state.cloudUser}
|
|
|
- projectType={projectType}
|
|
|
- ssoId={state.cloudUser.ssoId}
|
|
|
- />
|
|
|
- <LowerList log={state.log} serviceLog={state.serviceLog} />
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </div>
|
|
|
- </Spin>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ <Col
|
|
|
+ span={15}
|
|
|
+ // sm={{ span: 24 }}
|
|
|
+ // md={{ span: 24 }}
|
|
|
+ // lg={{ span: 15 }}
|
|
|
+ // xl={{ span: 15 }}
|
|
|
+ flex={{ flexDirection: 'column' }}
|
|
|
+ className="sheet-box-right"
|
|
|
+ >
|
|
|
+ <TabList
|
|
|
+ compilationList={state.compilationList}
|
|
|
+ cloudUser={state.cloudUser}
|
|
|
+ projectType={projectType}
|
|
|
+ ssoId={state.cloudUser.ssoId}
|
|
|
+ />
|
|
|
+ <LowerList log={state.log} serviceLog={state.serviceLog} />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+ </Spin>
|
|
|
+ </Drawer>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default connect(({ refresh, single }) => ({
|
|
|
- refresh,
|
|
|
- visible: single.drawer.visible
|
|
|
-}))(Detail)
|
|
|
+export default connect(({ refresh }) => ({
|
|
|
+ refresh
|
|
|
+}))(CloudDetail)
|