Просмотр исходного кода

feat: 云版详情取消关联cld客户

outaozhen 4 лет назад
Родитель
Сommit
c08d5a8769

+ 2 - 4
src/pages/Customer/Client/components/ClientDetail/Form.jsx

@@ -175,8 +175,7 @@ const ContanctForm = props => {
                 tagType={TagTypeEnum.PERSONTAG}
                 tagColumn={TagDataTypeEnum.CLIENT}
                 checkCallBack={refreshClient}
-                modeType={LabelModeType.column}
-              >
+                modeType={LabelModeType.column}>
                 <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
               </PersonLabel>
             </div>
@@ -203,8 +202,7 @@ const ContanctForm = props => {
                 tagType={TagTypeEnum.TEAMTAG}
                 tagColumn={TagDataTypeEnum.CLIENT}
                 checkCallBack={refreshClient}
-                modeType={LabelModeType.column}
-              >
+                modeType={LabelModeType.column}>
                 <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
               </PersonLabel>
             </div>

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

@@ -85,6 +85,7 @@ const ConnectClient = ({
   const connectClient = async clientId => {
     const { code = -1 } = await apiChangeClient(preUrl, { id: dataId, clientId, ...otherParams })
     if (code === consts.RET_CODE.SUCCESS) {
+      message.success('关联成功')
       onSelect()
       closeModal()
     }

+ 26 - 33
src/pages/Product/Cloud/components/Detail/index.jsx

@@ -1,5 +1,5 @@
 import React, { useState, useEffect } from 'react'
-import { Row, Col, Button } from 'antd'
+import { Row, Col, Button, Tooltip, Modal } from 'antd'
 import { LinkOne, LinkInterrupt } from '@icon-park/react'
 import { connect } from 'umi'
 import { useModal } from '@/components/Modal'
@@ -17,6 +17,7 @@ const Detail = props => {
     updateKey = 'cloud',
     refresh,
     visible,
+    actionPayload,
     dataId = '',
     projectType,
     filterTag = true
@@ -35,12 +36,12 @@ const Detail = props => {
     compilationList: [],
     log: [],
     serviceLog: [],
-    client: []
+    client: {}
   })
   const initData = async id => {
     setState({ ...state, loading: true })
     const {
-      data: { cloudUser = {}, compilationList = [], log = [], serviceLog = [], client = [] },
+      data: { cloudUser = {}, compilationList = [], log = [], serviceLog = [], client = {} },
       code = -1
     } = await apiRoadpricingDetail({ ssoId: id, projectType })
     if (code === consts.RET_CODE.SUCCESS) {
@@ -61,7 +62,7 @@ const Detail = props => {
         <ConnectClient
           onSelect={refreshClient}
           dataId={state.cloudUser.ssoId}
-          // preUrl="RoadPricing"
+          preUrl="RoadPricing"
           showFooter={false}
           otherParams={{ projectType }}
         />
@@ -70,32 +71,22 @@ const Detail = props => {
     })
     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()
-  //   }
-  // }
+  const pricingUnLinkClient = clientId => {
+    Modal.confirm({
+      zIndex: 1002,
+      title: '确认移除',
+      onOk: async () => {
+        await apiRoadPricingUnLinkClient(actionPayload, {
+          id: dataId,
+          clientId,
+          projectPype: projectType
+        })
+        refreshClient()
+      }
+    })
+  }
+
   useEffect(() => {
     shouldUpdate && initData(dataId)
   }, [shouldUpdate])
@@ -119,10 +110,12 @@ const Detail = props => {
                   <ClientDetail client={state.client} filterTag={filterTag} />
                 </div>
                 <div className="text-center mt-6">
-                  <Button type="primary" ghost size="small">
-                    <LinkInterrupt size="14" />
-                    <span className="ml-5px">移除CLD客户</span>
-                  </Button>
+                  <Tooltip placement="right" title="移除CLD客户">
+                    <Button type="primary" ghost size="small" onClick={pricingUnLinkClient}>
+                      <LinkInterrupt size="14" />
+                      <span className="ml-5px">移除CLD客户</span>
+                    </Button>
+                  </Tooltip>
                 </div>
               </>
             ) : (