|
|
@@ -2,28 +2,24 @@ import React, { useState, useEffect } from 'react'
|
|
|
import { Row, Col } from 'antd'
|
|
|
import { connect } from 'umi'
|
|
|
import consts from '@/consts'
|
|
|
-import RoadpricingForm from './Form'
|
|
|
-import RoadpricingLowerList from './LowerList'
|
|
|
-import RoadpricingTabList from './TabList'
|
|
|
+import Form from './Form'
|
|
|
+import LowerList from './LowerList'
|
|
|
+import TabList from './TabList'
|
|
|
import { apiRoadpricingDetail } from '@/services/product'
|
|
|
-import roadpricingEnum from '../RoadpricingDetail'
|
|
|
|
|
|
-const RoadpricingDetail = props => {
|
|
|
- const { dispatch, updateKey = 'cloud', refresh, visible, dataId = '' } = props
|
|
|
+const Detail = props => {
|
|
|
+ const { dispatch, updateKey = 'cloud', refresh, visible, dataId = '', projectType } = props
|
|
|
const shouldUpdate = refresh[updateKey] || false
|
|
|
- const columnStateType = pathname?.match(/\/([^/]*)$/)[1]?.toUpperCase()
|
|
|
const [state, setState] = useState({
|
|
|
loading: false,
|
|
|
- cloudUser: {},
|
|
|
- projectPype: roadpricingEnum[columnStateType]
|
|
|
+ cloudUser: {}
|
|
|
})
|
|
|
- console.log(state.projectPype)
|
|
|
- const initData = async (id = dataId) => {
|
|
|
- setState({ ...state, loading: true, projectPype })
|
|
|
+ const initData = async id => {
|
|
|
+ setState({ ...state, loading: true })
|
|
|
const {
|
|
|
data: { cloudUser = {} },
|
|
|
code = -1
|
|
|
- } = await apiRoadpricingDetail(id)
|
|
|
+ } = await apiRoadpricingDetail({ id, projectType })
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
if (shouldUpdate) {
|
|
|
dispatch({
|
|
|
@@ -31,7 +27,7 @@ const RoadpricingDetail = props => {
|
|
|
payload: updateKey
|
|
|
})
|
|
|
}
|
|
|
- setState({ ...state, cloudUser, loading: false, projectPype })
|
|
|
+ setState({ ...state, cloudUser, loading: false })
|
|
|
}
|
|
|
}
|
|
|
useEffect(() => {
|
|
|
@@ -48,9 +44,10 @@ const RoadpricingDetail = 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">
|
|
|
- <RoadpricingForm updateKey={updateKey} />
|
|
|
+ <Form updateKey={updateKey} />
|
|
|
</div>
|
|
|
</Col>
|
|
|
<Col
|
|
|
@@ -59,9 +56,10 @@ const RoadpricingDetail = props => {
|
|
|
lg={{ span: 15 }}
|
|
|
xl={{ span: 15 }}
|
|
|
flex={{ flexDirection: 'column' }}
|
|
|
- className="sheet-box-right">
|
|
|
- <RoadpricingTabList />
|
|
|
- <RoadpricingLowerList />
|
|
|
+ className="sheet-box-right"
|
|
|
+ >
|
|
|
+ <TabList />
|
|
|
+ <LowerList />
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</div>
|
|
|
@@ -71,4 +69,4 @@ const RoadpricingDetail = props => {
|
|
|
export default connect(({ refresh, single }) => ({
|
|
|
refresh,
|
|
|
visible: single.drawer.visible
|
|
|
-}))(RoadpricingDetail)
|
|
|
+}))(Detail)
|