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

feat: 大司空抽屉的数据刷新

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

+ 7 - 1
src/pages/Product/Road/Enterprise/components/Detail/TabList.jsx

@@ -7,6 +7,11 @@ const EnterpriseTabList = props => {
   const { authUsers, compilationList } = props
   const { TabPane } = Tabs
   const tRef = useRef(null)
+  const isUpgradeEnum = {
+    true: '开通',
+    false: '未开通',
+    undefined: ''
+  }
   const columns = [
     {
       title: '产品',
@@ -17,7 +22,8 @@ const EnterpriseTabList = props => {
     {
       title: '状态',
       dataIndex: 'isUpgrade',
-      width: '8%'
+      width: '8%',
+      render: isUpgrade => <span>{isUpgradeEnum[isUpgrade]}</span>
     },
     {
       title: '限期',

+ 2 - 11
src/pages/Product/Road/Enterprise/components/Detail/index.jsx

@@ -13,7 +13,7 @@ import { useModal } from '@/components/ModalStore'
 const EnterpriseDetail = props => {
   const {
     dispatch,
-    updateKey = 'personal',
+    updateKey = 'enterprise',
     refresh,
     visible,
     dataId = '',
@@ -40,12 +40,6 @@ const EnterpriseDetail = props => {
       }
     })
   }
-  // const refreshClient = () => {
-  //   dispatch({
-  //     type: 'refresh/commitAction',
-  //     payload: updateKey
-  //   })
-  // }
   const initData = async id => {
     setState({ ...state, loading: true })
     const {
@@ -62,10 +56,7 @@ const EnterpriseDetail = props => {
     } = await apiRoadcompanyDetail({ companyId: id })
     if (code === consts.RET_CODE.SUCCESS) {
       if (shouldUpdate) {
-        dispatch({
-          type: 'refresh/commitAction',
-          payload: updateKey
-        })
+        refreshDetail()
       }
       setState({
         ...state,

+ 5 - 3
src/pages/Product/Road/Personal/components/Detail/TabList.jsx

@@ -18,7 +18,8 @@ const PersonalTabList = props => {
     compilationList,
     cloudUser: { online_list = [], mobile, username },
     projectType,
-    ssoId
+    ssoId,
+    actionPayload = { main: 'personal' }
   } = props
   const isUpgradeEnum = {
     true: '已升级',
@@ -51,7 +52,7 @@ const PersonalTabList = props => {
       // 刷新数据
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'personal'
+        payload: actionPayload
       })
     }
   }
@@ -67,7 +68,7 @@ const PersonalTabList = props => {
       dataIndex: 'lock',
       onFilter: true,
       width: '8%',
-      render: lock => <span>{lockEnum[lock]}</span>
+      render: lock => <span>{isUpgradeEnum[lock]}</span>
     },
     {
       title: '专业版',
@@ -269,6 +270,7 @@ const PersonalTabList = props => {
         type={roadPricingUpgradev2.type}
         onCancel={() => setRoadPricingUpgradev2({ ...roadPricingUpgradev2, visible: false })}
         projectType={projectType}
+        actionPayload={actionPayload}
         ssoId={ssoId}
         cloudUser={{ mobile, username }}
         compilationId={roadPricingUpgradev2.compilationId}

+ 3 - 2
src/pages/Product/Road/Personal/components/Detail/UpgradeModal.jsx

@@ -26,7 +26,8 @@ const UpgradeModal = props => {
     lock,
     upgradeType,
     cloudUser,
-    deadline
+    deadline,
+    actionPayload
   } = props
   const [form] = Form.useForm()
   const dispatch = useDispatch()
@@ -63,7 +64,7 @@ const UpgradeModal = props => {
       form.resetFields()
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'personal'
+        payload: actionPayload
       })
     })
   }

+ 10 - 7
src/pages/Product/Road/Personal/components/Detail/index.jsx

@@ -32,10 +32,13 @@ const PersonalDetail = props => {
   })
   const dispatchModal = useModal()
   const shouldUpdate = refresh?.[updateKey] || false
-  const refreshClient = () => {
+  const refreshDetail = () => {
     dispatch({
       type: 'refresh/commitAction',
-      payload: updateKey
+      payload: {
+        main: updateKey,
+        target: dataId
+      }
     })
   }
   const initData = async id => {
@@ -46,10 +49,7 @@ const PersonalDetail = props => {
     } = await apiRoadpricingDetailV2({ ssoId: id, projectType })
     if (code === consts.RET_CODE.SUCCESS) {
       if (shouldUpdate) {
-        dispatch({
-          type: 'refresh/commitAction',
-          payload: updateKey
-        })
+        refreshDetail()
       }
       setState({ ...state, cloudUser, compilationList, log, serviceLog, client, loading: false })
     }
@@ -77,7 +77,10 @@ const PersonalDetail = props => {
         if (code === consts.RET_CODE.SUCCESS) {
           dispatch({
             type: 'refresh/commitAction',
-            payload: updateKey
+            payload: {
+              main: updateKey,
+              target: dataId
+            }
           })
         }
       }

+ 4 - 0
src/services/product.js

@@ -186,3 +186,7 @@ export async function apiRoadPricingUnLinkCustomer(params) {
     data: params
   })
 }
+/** 大司空2.0企业版编辑企业 */
+export async function apiRoadUpdateCompany(payload) {
+  return request('/RoadPricingv2/company/update', { method: 'POST', data: { ...payload } })
+}