Browse Source

小程序抽查调整逻辑完善

dev
liujiangyong 1 year ago
parent
commit
44f571b9e0
  1. 9
      api/app/lib/controllers/report/index.js
  2. 4
      weapp/src/packages/maintenanceSpotCheck/index.jsx
  3. 6
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx

9
api/app/lib/controllers/report/index.js

@ -866,8 +866,13 @@ async function roadSpotDetail (ctx) {
where: { where: {
...(keyword ? { routeName: { $ilike: `%${keyword}%` } } : {}) ...(keyword ? { routeName: { $ilike: `%${keyword}%` } } : {})
}, },
}, {
model: models.RoadSpotCheckPreview,
attributes: ['id'],
include: [{
model: models.RoadSpotCheckChangeLog,
attributes: ['id', 'changeRoadId'],
}]
}] }]
}) })

4
weapp/src/packages/maintenanceSpotCheck/index.jsx

@ -87,10 +87,10 @@ function Index() {
enhanced enhanced
pagingEnabled pagingEnabled
> >
{roadSpotList.length ? roadSpotList.map(item => <View {roadSpotList.length ? roadSpotList.map((item, index) => <View
key={item.id} key={item.id}
className='card' className='card'
onClick={() => navigateTo(`/packages/maintenanceSpotCheck/spotCheckRoadDetail/index?item=${encodeURIComponent(JSON.stringify(item))}` onClick={() => navigateTo(`/packages/maintenanceSpotCheck/spotCheckRoadDetail/index?item=${encodeURIComponent(JSON.stringify(item))}&isOld=${index !== 0}`
)} )}
> >
<View className='item'>抽查县道比例%{item.countyPercentage}</View> <View className='item'>抽查县道比例%{item.countyPercentage}</View>

6
weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx

@ -9,7 +9,7 @@ import { getRoadSpotDetail } from '@/services/api'
import './index.scss' import './index.scss'
function Index() { function Index() {
const { item } = useRouter().params const { item, isOld } = useRouter().params
const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null
const [keyword, setKeyword] = useState('') const [keyword, setKeyword] = useState('')
@ -63,6 +63,10 @@ function Index() {
type='primary' type='primary'
size='small' size='small'
onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotChange/index?detail=${encodeURIComponent(JSON.stringify(item))}&spot=${encodeURIComponent(JSON.stringify(spotItem))}` })} onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotChange/index?detail=${encodeURIComponent(JSON.stringify(item))}&spot=${encodeURIComponent(JSON.stringify(spotItem))}` })}
disabled={
isOld === 'true' ||
item.roadSpotCheckPreview?.roadSpotCheckChangeLogs?.some(l => l.changeRoadId == item.roadId)
}
>调整</AtButton> >调整</AtButton>
</View> </View>
</View> </View>

Loading…
Cancel
Save