Browse Source

道路关键字筛选

dev
liujiangyong 1 year ago
parent
commit
fb6442b4d0
  1. 46
      weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx
  2. 47
      weapp/src/packages/patrol/index.jsx

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

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import Taro, { useRouter } from '@tarojs/taro' import Taro, { useRouter } from '@tarojs/taro'
import { View, Text, Picker, } from '@tarojs/components' import { View, Text, Picker, Input } from '@tarojs/components'
import { AtButton, AtIcon, } from 'taro-ui' import { AtButton, AtIcon, } from 'taro-ui'
import request from '@/services/request' import request from '@/services/request'
import { roadSpotChange, roadUrl } from '@/services/api' import { roadSpotChange, roadUrl } from '@/services/api'
@ -77,18 +77,23 @@ function Index() {
[key]: value [key]: value
} }
let routeName = []
let routeCode = [] let routeCode = []
let sectionNo = [] let sectionNo = []
let data = [...road] let data = [...road]
data.forEach(v => { if (key == 'routeName') {
if (v.routeName && !routeName.includes(v.routeName)) { // routeName
routeName.push(v.routeName) let routeName = []
road.forEach(item => {
if (item.routeName && !routeName.includes(item.routeName)) {
routeName.push(item.routeName)
}
})
if (value) {
routeName = routeName.filter(item => item.indexOf(value) > -1)
} }
}); setNameList(routeName)
if (key == 'routeName') {
nextValue.routeCode = '' nextValue.routeCode = ''
nextValue.sectionNo = '' nextValue.sectionNo = ''
data?.forEach(v => { data?.forEach(v => {
@ -115,8 +120,6 @@ function Index() {
setNoList(sectionNo) setNoList(sectionNo)
} }
setNameList(routeName)
if (nextValue?.routeName) { if (nextValue?.routeName) {
setRouteCodeDisabled(false) setRouteCodeDisabled(false)
} else { } else {
@ -181,16 +184,23 @@ function Index() {
<View className='cell'> <View className='cell'>
<View className='title'><Text className='star'>*</Text>路线名称</View> <View className='title'><Text className='star'>*</Text>路线名称</View>
<View className='content'> <View className='content'>
<Picker <View className='picker'>
mode='selector'
range={nameList} <Input
onChange={e => handleCheckChange(nameList[e.detail.value], 'routeName')} type='text'
> placeholder='输入关键字筛选'
<View className='picker'> border={false}
<View>{checked.routeName || '请选择'}</View> value={checked.routeName}
onInput={e => handleCheckChange(e.detail.value, 'routeName')}
/>
<Picker
mode='selector'
range={nameList}
onChange={e => handleCheckChange(nameList[e.detail.value], 'routeName')}
>
<AtIcon className='arrow' value='chevron-down' size='20' color='#999' /> <AtIcon className='arrow' value='chevron-down' size='20' color='#999' />
</View> </Picker>
</Picker> </View>
<AtIcon <AtIcon
value='close-circle' value='close-circle'
size='20' size='20'

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

@ -731,17 +731,23 @@ const Index = () => {
...roadChecked, ...roadChecked,
[key]: value [key]: value
} }
let routeName = []
let routeCode = [] let routeCode = []
let sectionNo = [] let sectionNo = []
let data = [...roadList] let data = [...roadList]
data.forEach(v => {
if (v.routeName && !routeName.includes(v.routeName)) {
routeName.push(v.routeName)
}
});
if (key == 'routeName') { if (key == 'routeName') {
// routeName
let routeName = []
roadList.forEach(item => {
if (item.routeName && !routeName.includes(item.routeName)) {
routeName.push(item.routeName)
}
})
if (value) {
routeName = routeName.filter(item => item.indexOf(value) > -1)
}
setRouteNameList(routeName)
nextValue.routeCode = '' nextValue.routeCode = ''
nextValue.sectionNo = '' nextValue.sectionNo = ''
data?.forEach(v => { data?.forEach(v => {
@ -768,8 +774,6 @@ const Index = () => {
setSectionNoList(sectionNo) setSectionNoList(sectionNo)
} }
setRouteNameList(routeName)
if (nextValue?.routeName) { if (nextValue?.routeName) {
setRouteCodeDisabled(false) setRouteCodeDisabled(false)
} else { } else {
@ -1046,17 +1050,24 @@ const Index = () => {
<View className='code-choice'> <View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>路线名称 <Text style={{ color: 'red' }}>*&nbsp;</Text>路线名称
<View className='select-box'> <View className='select-box'>
<Picker <View className='picker'>
mode='selector' <Input
range={routeNameList} type='text'
onChange={e => handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')} placeholder='输入关键字筛选'
disabled={isView} border={false}
> value={roadChecked.routeName}
<View className='picker'> onInput={e => handleRoadCheckChange(e.detail.value, 'routeName')}
<View>{roadChecked.routeName || '请选择路线名称'}</View> disabled={isView}
/>
<Picker
mode='selector'
range={routeNameList}
onChange={e => handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')}
disabled={isView}
>
<AtIcon className='arrow' value='chevron-down' size='20' color='#999' /> <AtIcon className='arrow' value='chevron-down' size='20' color='#999' />
</View> </Picker>
</Picker> </View>
{!isView && <AtIcon {!isView && <AtIcon
value='close-circle' value='close-circle'
size='20' size='20'

Loading…
Cancel
Save