|
|
@ -206,6 +206,23 @@ const Index = () => { |
|
|
|
const [appointUser, setAppointUser] = useState(null) // 责任人在userList的index |
|
|
|
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' }}>* </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' }}>* </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' }}>* </Text>道路类型: |
|
|
|
<Input |
|
|
|
style={{ width: '30%' }} |
|
|
|
type='text' |
|
|
|
value={isView && isBeforeReport |
|
|
|
? projectType |
|
|
|
: roadCodeHead === 'X' ? '县道' : roadCodeHead === 'Y' ? '乡道' : '村道'} |
|
|
|
onInput={() => { }} |
|
|
|
disabled={true} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
</> : '' |
|
|
|
} |
|
|
|
|
|
|
|