Browse Source

细节优化

dev
liujiangyong 1 year ago
parent
commit
2911823934
  1. 30
      weapp/src/packages/patrol/index.jsx

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

@ -399,10 +399,6 @@ const Index = () => {
} }
}, []) }, [])
useEffect(() => {
setRoadStartSel(sourceRoadStartSel)
setRoadEndSel(sourceRoadEndSel)
}, [sourceRoadStartSel, sourceRoadEndSel])
useEffect(() => { useEffect(() => {
setTypeList([ setTypeList([
{ {
@ -576,12 +572,23 @@ const Index = () => {
case "roadCodeEnd": case "roadCodeEnd":
setRoadCodeEnd(value) setRoadCodeEnd(value)
if (value.length >= 9) { if (value.length >= 9) {
let routeCode = ''
let roadStart = []
let roadEnd = []
let routeName = ''
for (const r of roadList) { for (const r of roadList) {
if (r.routeCode === roadCodeHead + value) { if (r.routeCode === roadCodeHead + value) {
setRoad(r.routeName) roadStart.push(r.startingPlaceName)
setRoadSectionStart(r.startingPlaceName) roadEnd.push(r.stopPlaceName)
setRoadSectionEnd(r.stopPlaceName) routeCode = r.routeCode
request.get(getReportList(), { limit: 1, page: 0, codeRoad: r.routeCode }).then(res => { routeName = r.routeName
}
}
setRoadStartSel(roadStart)
setRoadEndSel(roadEnd)
if (routeName) setRoad(routeName)
if (kind === 'conserve' && routeCode) {
request.get(getReportList(), { limit: 1, page: 0, codeRoad: routeCode }).then(res => {
if (res.statusCode === 200 && res.data.length) { if (res.statusCode === 200 && res.data.length) {
request.get(getReportDetail(res.data[0].id)).then(detailRes => { request.get(getReportDetail(res.data[0].id)).then(detailRes => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
@ -599,8 +606,6 @@ const Index = () => {
setPatrolContentEdit(true) setPatrolContentEdit(true)
} }
}) })
break;
}
} }
} }
break; break;
@ -611,6 +616,11 @@ const Index = () => {
break; break;
case "conserveContent": case "conserveContent":
let nextContent = { ...conserveContent } let nextContent = { ...conserveContent }
if (value.split('.')[1] && value.split('.')[1].length > 3) {
setConserveContent(nextContent)
Taro.showToast({ title: '最多输入三位小数', icon: 'none', duration: 1500 })
return;
}
nextContent[key].value = value nextContent[key].value = value
setConserveContent(nextContent) setConserveContent(nextContent)
break; break;

Loading…
Cancel
Save