Browse Source

(*) 小程序抽查功能修改

dev
liujiangyong 10 months ago
parent
commit
5f01a42c57
  1. 3
      weapp/project.config.json
  2. 1
      weapp/src/app.config.js
  3. 8
      weapp/src/packages/maintenanceSpotCheck/index.jsx
  4. 20
      weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx
  5. 3
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.config.js
  6. 99
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.jsx
  7. 29
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.scss
  8. 2
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.config.js
  9. 136
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx
  10. 28
      weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.scss
  11. 25
      weapp/src/packages/maintenanceSpotCheck/startSpotCheck/index.jsx

3
weapp/project.config.json

@ -30,7 +30,8 @@
"disableUseStrict": false,
"useCompilerPlugins": false,
"minifyWXML": true,
"condition": false
"condition": false,
"ignoreDevUnusedFiles": false
},
"compileType": "miniprogram",
"libVersion": "2.25.1",

1
weapp/src/app.config.js

@ -14,6 +14,7 @@ export default {
'video/index',
'maintenanceSpotCheck/index',
'maintenanceSpotCheck/startSpotCheck/index',
'maintenanceSpotCheck/spotCheckRoad/index',
'maintenanceSpotCheck/spotCheckRoadDetail/index',
'maintenanceSpotCheck/spotChange/index',
]

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

@ -90,13 +90,13 @@ function Index() {
{roadSpotList.length ? roadSpotList.map((item, index) => <View
key={item.id}
className='card'
onClick={() => navigateTo(`/packages/maintenanceSpotCheck/spotCheckRoadDetail/index?item=${encodeURIComponent(JSON.stringify(item))}&isOld=${index !== 0}`
onClick={() => navigateTo(`/packages/maintenanceSpotCheck/spotCheckRoad/index?item=${encodeURIComponent(JSON.stringify(item))}&isOld=${index !== 0}`
)}
>
<View className='item'>抽查县道比例%{item.countyPercentage}</View>
<View className='item'>抽查县道{item.spotCountyRoadCount}</View>
<View className='item'>抽查乡道{item.spotTownRoadCount}</View>
<View className='item'>抽查村道{item.spotVillageRoadCount}</View>
<View className='item'>抽查县道公里{item.countryMil}</View>
<View className='item'>抽查乡道公里{item.townMil}</View>
<View className='item'>抽查村道公里{item.villageMil}</View>
<View className='item'>抽查日期{moment(item.date).format('YYYY-MM-DD')}</View>
</View>) : <View style={{ paddingTop: 100 }}><NoData /></View>}
</ScrollView>

20
weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx

@ -21,8 +21,8 @@ function Index() {
routeName: '',
routeCode: '',
sectionNo: '',
startingPlaceName: '',
stopPlaceName: '',
startStation: '',
stopStation: '',
})
const [routeCodeDisabled, setRouteCodeDisabled] = useState(true);
const [sectionNoDisabled, setSectionNoDisabled] = useState(true);
@ -138,11 +138,11 @@ function Index() {
&& nextValue.routeCode == s.routeCode
&& nextValue.sectionNo == s.sectionNo
)
nextValue.startingPlaceName = find?.startingPlaceName
nextValue.stopPlaceName = find?.stopPlaceName
nextValue.startStation = find?.startStation
nextValue.stopStation = find?.stopStation
} else {
nextValue.startingPlaceName = ''
nextValue.stopPlaceName = ''
nextValue.startStation = ''
nextValue.stopStation = ''
}
setChecked(nextValue)
@ -254,12 +254,12 @@ function Index() {
</View>
</View>
<View className='cell'>
<View className='title'>起点地名</View>
<View className='content'>{checked.startingPlaceName}</View>
<View className='title'>起点桩号</View>
<View className='content'>{checked.startStation}</View>
</View>
<View className='cell'>
<View className='title'>止点地名</View>
<View className='content'>{checked.stopPlaceName}</View>
<View className='title'>止点桩号</View>
<View className='content'>{checked.stopStation}</View>
</View>
<AtButton

3
weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.config.js

@ -0,0 +1,3 @@
export default {
navigationBarTitleText: '抽查详情'
}

99
weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.jsx

@ -0,0 +1,99 @@
import React, { useEffect, useState } from 'react'
import Taro, { useRouter, useDidShow } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtButton, AtSearchBar } from 'taro-ui'
import { NoData } from '@/components/index'
import Skeleton from '../components/skeleton'
import moment from 'moment'
import request from '@/services/request'
import { getRoadSpotDetail } from '@/services/api'
import './index.scss'
function Index() {
const { item, isOld } = useRouter().params
const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null
const [keyword, setKeyword] = useState('')
const [roadDetailList, setRoadDetailList] = useState([])
const [isNoData, setIsNoData] = useState(false)
useDidShow(() => {
getDetail()
})
const getDetail = () => {
if (spotItem) {
Taro.showLoading({ title: '加载中' })
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => {
Taro.hideLoading()
if (res.statusCode === 200) {
setRoadDetailList(res.data)
} else {
Taro.showToast({ title: '获取详情失败', icon: 'error' })
}
if (res.data?.length) {
setIsNoData(false)
} else {
setIsNoData(true)
}
})
}
}
const renderList = () => {
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?.routeName || '--'}</View>
<View className='item at-row'>
<View className='at-col-6'>路线代码{item.road?.routeCode || '--'}</View>
<View className='at-col-6'>路段序号{item.road?.sectionNo || '--'}</View>
</View>
<View className='item at-row'>
<View className='at-col-6'>起点地名{item.road?.startingPlaceName || '--'}</View>
<View className='at-col-6'>止点地名{item.road?.stopPlaceName || '--'}</View>
</View>
<View className='item'>里程{item.road?.chainageMileage || '--'}</View>
<View className='item at-row'>
<View className='at-col-6'>养护次数{item.maintenanceCount}</View>
<View className='at-col-3'>
<AtButton
className='edit-btn'
type='primary'
size='small'
onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotCheckRoadDetail/index?detail=${encodeURIComponent(JSON.stringify(item))}` })}
>详情</AtButton>
</View>
<View className='at-col-3'>
<AtButton
className='edit-btn'
type='primary'
size='small'
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>
</View>
</View>
</View>) : <Skeleton length={3} />
}
const renderNoData = () => {
return <View style={{ marginTop: 100 }}><NoData /></View>
}
return (<View className='page'>
<AtSearchBar
placeholder='道路名称关键字'
showActionButton
value={keyword}
onChange={v => setKeyword(v)}
onActionClick={getDetail}
/>
<View className='top flex'>抽查日期{moment(spotItem.date).format('YYYY-MM-DD')}</View>
{isNoData ? renderNoData() : renderList()}
</View>)
}
export default Index

29
weapp/src/packages/maintenanceSpotCheck/spotCheckRoad/index.scss

@ -0,0 +1,29 @@
.page {
background-color: #fff;
height: 100vh;
font-size: 28px;
padding-bottom: 40px;
.top {
height: 90px;
}
.card {
padding: 20px;
border: gainsboro 1px solid;
border-radius: 10px;
background-color: #fff;
box-shadow: 10px 10px 5px rgb(219, 218, 218);
margin: 0 0 20px 20px;
width: calc(100% - 40px);
box-sizing: border-box;
.item {
padding: 10px 0;
.edit-btn {
width: 100px;
}
}
}
}

2
weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.config.js

@ -1,3 +1,3 @@
export default {
navigationBarTitleText: '抽查详情'
navigationBarTitleText: '抽查道路详情'
}

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

@ -1,91 +1,61 @@
import React, { useEffect, useState } from 'react'
import Taro, { useRouter, useDidShow } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtButton, AtSearchBar } from 'taro-ui'
import { NoData } from '@/components/index'
import Skeleton from '../components/skeleton'
import moment from 'moment'
import request from '@/services/request'
import { getRoadSpotDetail } from '@/services/api'
import React from 'react'
import Taro, { useRouter } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { AtList, AtListItem } from "taro-ui"
import './index.scss'
function Index() {
const { item, isOld } = useRouter().params
const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null
const [keyword, setKeyword] = useState('')
const [roadDetailList, setRoadDetailList] = useState([])
const [isNoData, setIsNoData] = useState(false)
useDidShow(() => {
getDetail()
})
const getDetail = () => {
if (spotItem) {
Taro.showLoading({ title: '加载中' })
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => {
Taro.hideLoading()
if (res.statusCode === 200) {
setRoadDetailList(res.data)
} else {
Taro.showToast({ title: '获取详情失败', icon: 'error' })
}
if (res.data?.length) {
setIsNoData(false)
} else {
setIsNoData(true)
}
})
}
}
const renderList = () => {
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?.routeName || '--'}</View>
<View className='item at-row'>
<View className='at-col-6'>路线代码{item.road?.routeCode || '--'}</View>
<View className='at-col-6'>路段序号{item.road?.sectionNo || '--'}</View>
</View>
<View className='item at-row'>
<View className='at-col-6'>起点地名{item.road?.startingPlaceName || '--'}</View>
<View className='at-col-6'>止点地名{item.road?.stopPlaceName || '--'}</View>
</View>
<View className='item'>里程{item.road?.chainageMileage || '--'}</View>
<View className='item at-row'>
<View className='at-col-6'>养护次数{item.maintenanceCount}</View>
<View className='at-col-6'>
<AtButton
className='edit-btn'
type='primary'
size='small'
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>
</View>
</View>
</View>) : <Skeleton length={3} />
}
const roadCode = [
{ title: "八一乡", value: "360121206000" },
{ title: "东新乡", value: "360121205000" },
{ title: "富山乡", value: "360121204000" },
{ title: "冈上镇", value: "360121107000" },
{ title: "广福镇", value: "360121108000" },
{ title: "黄马乡", value: "360121203000" },
{ title: "蒋巷镇", value: "360121105000" },
{ title: "金湖管理处", value: "330052" },
{ title: "泾口乡", value: "360121200000" },
{ title: "莲塘镇", value: "360121100000" },
{ title: "南新乡", value: "360121201000" },
{ title: "三江镇", value: "360121102000" },
{ title: "塔城乡", value: "360121202000" },
{ title: "塘南镇", value: "360121103000" },
{ title: "武阳镇", value: "360121106000" },
{ title: "向塘镇", value: "360121101000" },
{ title: "银三角管委会", value: "360121471000" },
{ title: "幽兰镇", value: "360121104000" },
]
const renderNoData = () => {
return <View style={{ marginTop: 100 }}><NoData /></View>
function Index() {
const { detail } = useRouter().params
const detailItem = detail ? JSON.parse(decodeURIComponent(detail)) : null
let townshipCode = ''
const targetValue = detailItem?.road?.townshipCode ?? ''
const foundItem = roadCode.find(item => item.value === targetValue)
if (foundItem) {
townshipCode = foundItem.title
} else {
townshipCode = "--"
}
return (<View className='page'>
<AtSearchBar
placeholder='道路名称关键字'
showActionButton
value={keyword}
onChange={v => setKeyword(v)}
onActionClick={getDetail}
/>
<View className='top flex'>抽查日期{moment(spotItem.date).format('YYYY-MM-DD')}</View>
{isNoData ? renderNoData() : renderList()}
</View>)
return (
<View className='page'>
<AtList>
<AtListItem title='所属乡镇' extraText={townshipCode} />
<AtListItem title='所属行政村' extraText={detailItem.road?.village?.name || '--'} />
<AtListItem title='道路名称' extraText={detailItem.road?.routeName || '--'} />
<AtListItem title='道路代码' extraText={detailItem.road?.routeCode || '--'} />
<AtListItem title='起点桩号' extraText={detailItem.road?.startStation || '--'} />
<AtListItem title='止点桩号' extraText={detailItem.road?.stopStation || '--'} />
<AtListItem title='技术等级' extraText={detailItem.road?.technicalLevel || '--'} />
<AtListItem title='路面类型' extraText={detailItem.road?.pavementType || '--'} />
<AtListItem title='路面宽度' extraText={detailItem.road?.pavementWidth || '--'} />
<AtListItem title='路基宽度' extraText={detailItem.road?.subgradeWidth || '--'} />
<AtListItem title='桩号里程' extraText={detailItem.road?.chainageMileage || '--'} />
<AtListItem title='养护次数(次)' extraText={detailItem.maintenanceCount} />
</AtList>
</View>
)
}
export default Index

28
weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.scss

@ -1,29 +1,9 @@
.page {
background-color: #fff;
height: 100vh;
font-size: 28px;
padding-bottom: 40px;
.top {
height: 90px;
}
.card {
padding: 20px;
border: gainsboro 1px solid;
border-radius: 10px;
background-color: #fff;
box-shadow: 10px 10px 5px rgb(219, 218, 218);
margin: 0 0 20px 20px;
width: calc(100% - 40px);
box-sizing: border-box;
.item {
padding: 10px 0;
background-color: #fff;
// font-size: 28px;
.edit-btn {
width: 100px;
}
}
.at-list__item-extra {
max-width: 470px;
}
}

25
weapp/src/packages/maintenanceSpotCheck/startSpotCheck/index.jsx

@ -17,7 +17,9 @@ function Index() {
})
const startSpotCheck = () => {
Taro.showLoading({ title: '抽取中' })
request.post(roadSpotPrepare(), { countyPercentage: rate === '50%' ? 50 : 75 }).then(res => {
Taro.hideLoading()
if (res.statusCode === 200 || res.statusCode === 204) {
Taro.showToast({ title: '抽取成功', icon: 'success' })
setPrepare(res.data)
@ -33,7 +35,9 @@ function Index() {
Taro.showToast({ title: '请先抽取道路' })
return
}
Taro.showLoading({ title: '提交中' })
request.post(roadSpotConfirm(), { previewId: prepare.previewId }).then(res => {
Taro.hideLoading()
if (res.statusCode === 204) {
Taro.showToast({ title: '提交成功', icon: 'success' })
setTimeout(() => {
@ -49,7 +53,6 @@ function Index() {
return (
<View className='page'>
<View className='content'>
<View className='fs24'>默认抽查乡道比例为25%村道比例为10%</View>
<View className='item'>
<View className='title'>抽查县道比例%:</View>
<Picker mode='selector'
@ -62,20 +65,28 @@ function Index() {
</View>
</Picker>
</View>
<View className='item'>
<View className='title'>抽查乡道比例%</View>
<View className='input disabled'>{rate === '50%' ? '25%' : '50%'}</View>
</View>
<View className='item'>
<View className='title'>抽查村道比例%</View>
<View className='input disabled'>{rate === '50%' ? '10%' : '20%'}</View>
</View>
<AtButton type='primary' className='start-btn' size='small'
onClick={startSpotCheck}
>开始抽取</AtButton>
<View className='item'>
<View className='title'>抽查县道</View>
<View className='input disabled'>{prepare.spotCountyRoadCount}</View>
<View className='title'>抽查县道公里</View>
<View className='input disabled'>{prepare.countryMil}</View>
</View>
<View className='item'>
<View className='title'>抽查乡道</View>
<View className='input disabled'>{prepare.spotTownRoadCount}</View>
<View className='title'>抽查乡道公里</View>
<View className='input disabled'>{prepare.townMil}</View>
</View>
<View className='item'>
<View className='title'>抽查村道</View>
<View className='input disabled'>{prepare.spotVillageRoadCount}</View>
<View className='title'>抽查村道公里</View>
<View className='input disabled'>{prepare.villageMil}</View>
</View>
<AtButton type='primary' className='submit-btn' onClick={onSubmit}>提交</AtButton>
</View>

Loading…
Cancel
Save