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 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 request from '@/services/request'
import { roadSpotChange, roadUrl } from '@/services/api'
@ -77,18 +77,23 @@ function Index() {
[key]: value
}
let routeName = []
let routeCode = []
let sectionNo = []
let data = [...road]
data.forEach(v => {
if (v.routeName && !routeName.includes(v.routeName)) {
routeName.push(v.routeName)
if (key == 'routeName') {
// 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.sectionNo = ''
data?.forEach(v => {
@ -115,8 +120,6 @@ function Index() {
setNoList(sectionNo)
}
setNameList(routeName)
if (nextValue?.routeName) {
setRouteCodeDisabled(false)
} else {
@ -181,16 +184,23 @@ function Index() {
<View className='cell'>
<View className='title'><Text className='star'>*</Text>路线名称</View>
<View className='content'>
<Picker
mode='selector'
range={nameList}
onChange={e => handleCheckChange(nameList[e.detail.value], 'routeName')}
>
<View className='picker'>
<View>{checked.routeName || '请选择'}</View>
<View className='picker'>
<Input
type='text'
placeholder='输入关键字筛选'
border={false}
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' />
</View>
</Picker>
</Picker>
</View>
<AtIcon
value='close-circle'
size='20'

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

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

Loading…
Cancel
Save