Browse Source

上报道路增加县乡村筛选

dev
liujiangyong 11 months ago
parent
commit
0a5ca8d0e7
  1. 80
      weapp/src/packages/patrol/index.jsx

80
weapp/src/packages/patrol/index.jsx

@ -206,6 +206,23 @@ const Index = () => {
const [appointUser, setAppointUser] = useState(null) // userListindex
const [handleAdvice, setHandleAdvice] = useState('') //
const [roadTypeList, setRoadTypeList] = useState([
{
value: '县',
text: '县道',
checked: true
},
{
value: '乡',
text: '乡道',
checked: false
},
{
value: '村',
text: '村道',
checked: false
},
]);
const [routeNameList, setRouteNameList] = useState([]);
const [routeCodeList, setRouteCodeList] = useState([]);
const [sectionNoList, setSectionNoList] = useState([]);
@ -328,7 +345,19 @@ const Index = () => {
setHandleCenter(data.handleContent)
}
setIsBeforeReport(dayjs(data.time).diff('2023-08-03 00:00:00', 'h') < 0)
//
let items = roadTypeList
const head = data.codeRoad?.slice(0, 1)
const level = head
? head === 'X'
? '县' : head === 'Y'
? '乡' : '村'
: ''
for (let i = 0, len = items.length; i < len; ++i) {
items[i].checked = items[i].value === (data.road_?.level || level)
}
setRoadTypeList(items)
//
setRoadChecked({
routeName: data.road,
routeCode: data.codeRoad,
@ -378,6 +407,7 @@ const Index = () => {
})
}
})
//
request.get(getRoadSection()).then(res => {
Taro.hideLoading()
if (res.statusCode == 200 || res.statusCode == 204) {
@ -390,12 +420,13 @@ const Index = () => {
let routeCode = []
let sectionNo = []
const selLevel = roadTypeList.find(item => item.checked).value
data.forEach(item => {
nextSourceRoadStartSel.push(item.startingPlaceName)
nextSourceRoadEndSel.push(item.stopPlaceName)
nextCodeRoadSel.push(item.routeCode)
if (item.routeName && !routeName.includes(item.routeName)) {
if (item.routeName && !routeName.includes(item.routeName) && item.level === selLevel) {
routeName.push(item.routeName)
}
if (item.routeCode && !routeCode.includes(item.routeCode)) {
@ -726,19 +757,19 @@ const Index = () => {
}
}
const handleRoadCheckChange = (value, key) => {
const handleRoadCheckChange = (value, key, typeList = roadTypeList) => {
let nextValue = {
...roadChecked,
[key]: value
}
let routeCode = []
let sectionNo = []
let data = [...roadList]
let data = roadList.filter(r => r.level === typeList.find(t => t.checked).value)
if (key == 'routeName') {
// routeName
let routeName = []
roadList.forEach(item => {
data.forEach(item => {
if (item.routeName && !routeName.includes(item.routeName)) {
routeName.push(item.routeName)
}
@ -1043,15 +1074,42 @@ const Index = () => {
}
})
}
function roadTypeChange(e) {
let items = roadTypeList
for (let i = 0, len = items.length; i < len; ++i) {
items[i].checked = items[i].value === e.detail.value
}
handleRoadCheckChange('', 'routeName', items)
setRoadTypeList(items)
}
return (
<View className='patrol'>
{
isPatrol || isAnomaly ? <>
<View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>道路类型
<View className='radio-list'>
<RadioGroup onChange={roadTypeChange}>
{roadTypeList.map((item, i) => {
return <Radio
className='radio'
color='#2579C7'
value={item.value}
checked={item.checked}
disabled={isView}
>{item.text}</Radio>
})}
</RadioGroup>
</View>
</View>
<View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>路线名称
<View className='select-box'>
<View className='picker'>
<Input
style={{ textAlign: 'right' }}
type='text'
placeholder='输入关键字筛选'
border={false}
@ -1120,18 +1178,6 @@ const Index = () => {
/>}
</View>
</View>
<View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>道路类型
<Input
style={{ width: '30%' }}
type='text'
value={isView && isBeforeReport
? projectType
: roadCodeHead === 'X' ? '县道' : roadCodeHead === 'Y' ? '乡道' : '村道'}
onInput={() => { }}
disabled={true}
/>
</View>
</> : ''
}

Loading…
Cancel
Save