|
@ -6,7 +6,7 @@ import { NoData } from '@/components/index' |
|
|
import Skeleton from '../components/skeleton' |
|
|
import Skeleton from '../components/skeleton' |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
import request from '@/services/request' |
|
|
import request from '@/services/request' |
|
|
import { getRoadSpotDetail } from '@/services/api' |
|
|
import { getRoadSpotDetail, roadSpotNextUrl, getRoadSpotList } from '@/services/api' |
|
|
import './index.scss' |
|
|
import './index.scss' |
|
|
|
|
|
|
|
|
function Index() { |
|
|
function Index() { |
|
@ -16,16 +16,17 @@ function Index() { |
|
|
const [keyword, setKeyword] = useState('') |
|
|
const [keyword, setKeyword] = useState('') |
|
|
const [roadDetailList, setRoadDetailList] = useState([]) |
|
|
const [roadDetailList, setRoadDetailList] = useState([]) |
|
|
const [isNoData, setIsNoData] = useState(false) |
|
|
const [isNoData, setIsNoData] = useState(false) |
|
|
|
|
|
const [nextAbstract, setNextAbstract] = useState(spotItem.nextAbstract) |
|
|
|
|
|
|
|
|
useDidShow(() => { |
|
|
useDidShow(() => { |
|
|
getDetail() |
|
|
getDetail() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const getDetail = () => { |
|
|
const getDetail = (showLoading = true) => { |
|
|
if (spotItem) { |
|
|
if (spotItem) { |
|
|
Taro.showLoading({ title: '加载中' }) |
|
|
showLoading && Taro.showLoading({ title: '加载中' }) |
|
|
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => { |
|
|
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => { |
|
|
Taro.hideLoading() |
|
|
showLoading && Taro.hideLoading() |
|
|
if (res.statusCode === 200) { |
|
|
if (res.statusCode === 200) { |
|
|
setRoadDetailList(res.data) |
|
|
setRoadDetailList(res.data) |
|
|
} else { |
|
|
} else { |
|
@ -40,6 +41,15 @@ function Index() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getSpotList = () => { |
|
|
|
|
|
request.get(`${getRoadSpotList()}`) |
|
|
|
|
|
.then(res => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
setNextAbstract(res.data[0].nextAbstract) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const renderList = () => { |
|
|
const renderList = () => { |
|
|
return roadDetailList.length ? roadDetailList.map(item => <View key={item.id} className='card'> |
|
|
return roadDetailList.length ? roadDetailList.map(item => <View key={item.id} className='card'> |
|
|
<View className='item'>道路类型:{item.road?.level ? (item.road?.level + '道') : '--'}</View> |
|
|
<View className='item'>道路类型:{item.road?.level ? (item.road?.level + '道') : '--'}</View> |
|
@ -52,9 +62,11 @@ function Index() { |
|
|
<View className='at-col-6'>起点地名:{item.road?.startingPlaceName || '--'}</View> |
|
|
<View className='at-col-6'>起点地名:{item.road?.startingPlaceName || '--'}</View> |
|
|
<View className='at-col-6'>止点地名:{item.road?.stopPlaceName || '--'}</View> |
|
|
<View className='at-col-6'>止点地名:{item.road?.stopPlaceName || '--'}</View> |
|
|
</View> |
|
|
</View> |
|
|
<View className='item'>里程:{item.road?.chainageMileage || '--'}</View> |
|
|
|
|
|
<View className='item at-row'> |
|
|
<View className='item at-row'> |
|
|
|
|
|
<View className='at-col-6'>里程:{item.road?.chainageMileage || '--'}</View> |
|
|
<View className='at-col-6'>养护次数(次):{item.maintenanceCount}</View> |
|
|
<View className='at-col-6'>养护次数(次):{item.maintenanceCount}</View> |
|
|
|
|
|
</View> |
|
|
|
|
|
<View className='item at-row'> |
|
|
<View className='at-col-3'> |
|
|
<View className='at-col-3'> |
|
|
<AtButton |
|
|
<AtButton |
|
|
className='edit-btn' |
|
|
className='edit-btn' |
|
@ -75,6 +87,47 @@ function Index() { |
|
|
} |
|
|
} |
|
|
>调整</AtButton> |
|
|
>调整</AtButton> |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
<View className='at-col-6'> |
|
|
|
|
|
<AtButton |
|
|
|
|
|
className='next-btn' |
|
|
|
|
|
type='primary' |
|
|
|
|
|
size='small' |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
Taro.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: '确认纳入下次抽查?', |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
request.post(roadSpotNextUrl(), { |
|
|
|
|
|
previewId: spotItem?.id, |
|
|
|
|
|
level: item.road?.level, |
|
|
|
|
|
roadId: item.roadId |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
Taro.showLoading() |
|
|
|
|
|
if (res.statusCode === 200 || res.statusCode === 204) { |
|
|
|
|
|
Taro.hideLoading() |
|
|
|
|
|
Taro.showToast({ title: '纳入下次抽查成功', icon: 'success' }) |
|
|
|
|
|
getSpotList() |
|
|
|
|
|
getDetail(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
Taro.showToast({ title: '纳入下次抽查失败', icon: 'error' }) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (res.cancel) { |
|
|
|
|
|
console.log('用户点击取消') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}} |
|
|
|
|
|
disabled={ |
|
|
|
|
|
isOld === 'true' || ( |
|
|
|
|
|
nextAbstract?.town?.includes(item.roadId) |
|
|
|
|
|
|| nextAbstract?.village?.includes(item.roadId) |
|
|
|
|
|
|| nextAbstract?.county?.includes(item.roadId) |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
>纳入下次抽查</AtButton> |
|
|
|
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</View>) : <Skeleton length={3} /> |
|
|
</View>) : <Skeleton length={3} /> |
|
|
} |
|
|
} |
|
|