소스 검색

feat: 优化云版目录结构

lanjianrong 5 년 전
부모
커밋
c196f7fe5e

+ 4 - 4
config/routes.js

@@ -117,22 +117,22 @@ export default [
           {
             path: '/product/cloud/building',
             name: 'build',
-            component: './Product/Cloud/Building'
+            component: './Product/Cloud'
           },
           {
             path: '/product/cloud/curing',
             name: 'curing',
-            component: './Product/Cloud/Curing'
+            component: './Product/Cloud'
           },
           {
             path: '/product/cloud/highway',
             name: 'highway',
-            component: './Product/Cloud/Highway'
+            component: './Product/Cloud'
           },
           {
             path: '/product/cloud/gs',
             name: 'gs',
-            component: './Product/Cloud/Gs'
+            component: './Product/Cloud'
           }
         ]
       }

+ 0 - 8
src/pages/Product/Cloud/Curing/index.jsx

@@ -1,8 +0,0 @@
-import React from 'react'
-import { CloudTable } from '../Building'
-
-const Curing = () => {
-  return <CloudTable columnStateType="CURING" />
-}
-
-export default Curing

+ 0 - 8
src/pages/Product/Cloud/Gs/index.jsx

@@ -1,8 +0,0 @@
-import React from 'react'
-import { CloudTable } from '../Building'
-
-const Curing = () => {
-  return <CloudTable columnStateType="GS" />
-}
-
-export default Curing

+ 0 - 8
src/pages/Product/Cloud/Highway/index.jsx

@@ -1,8 +0,0 @@
-import React from 'react'
-import { CloudTable } from '../Building'
-
-const Curing = () => {
-  return <CloudTable columnStateType="HIGHWAY" />
-}
-
-export default Curing

+ 6 - 8
src/pages/Product/Cloud/Building/index.jsx

@@ -5,7 +5,7 @@ import { dayjsFormat, refactorSortField } from '@/utils/utils'
 import { queryRoadpricingList } from '@/services/product'
 import { Input, Tag, Tooltip } from 'antd'
 import consts from '@/consts'
-import { useSelector, useDispatch } from 'umi'
+import { useLocation, useSelector, useDispatch } from 'umi'
 
 export const roadpricingEnum = {
   CURING: 1, // 养护云
@@ -14,7 +14,9 @@ export const roadpricingEnum = {
   GS: 4 // 大司空概算
 }
 
-export const CloudTable = ({ columnStateType }) => {
+const Cloud = () => {
+  const { pathname = '' } = useLocation()
+  const columnStateType = pathname?.match(/\/([^/]*)$/)[1]?.toUpperCase()
   const dispatch = useDispatch()
   const { cloud } = useSelector(state => ({
     cloud: state.cloud,
@@ -130,7 +132,7 @@ export const CloudTable = ({ columnStateType }) => {
                   {record.online_list?.map(
                     (item, i) =>
                       i < 10 && (
-                        <div className="flex justify-between">
+                        <div className="flex justify-between" key={item.dateString}>
                           <span>{item.online_times}</span>
                           <span className="ml-4">{item.dateString}</span>
                         </div>
@@ -245,8 +247,4 @@ export const CloudTable = ({ columnStateType }) => {
   )
 }
 
-const Building = () => {
-  return <CloudTable columnStateType="BUILDING" />
-}
-
-export default Building
+export default Cloud

+ 1 - 1
src/pages/Product/Cloud/model.js

@@ -1,6 +1,6 @@
 import consts from '@/consts'
 import { queryCompilationList } from '@/services/product'
-import { roadpricingEnum } from './Building'
+import { roadpricingEnum } from './index'
 
 export default {
   namespace: 'cloud',