diff --git a/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx b/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx index 14207dd4..9861c3ae 100644 --- a/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx +++ b/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() { *路线名称 - handleCheckChange(nameList[e.detail.value], 'routeName')} - > - - {checked.routeName || '请选择'} + + + handleCheckChange(e.detail.value, 'routeName')} + /> + handleCheckChange(nameList[e.detail.value], 'routeName')} + > - - + + { ...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 = () => { 路线名称: - handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')} - disabled={isView} - > - - {roadChecked.routeName || '请选择路线名称'} + + handleRoadCheckChange(e.detail.value, 'routeName')} + disabled={isView} + /> + handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')} + disabled={isView} + > - - + + {!isView &&