|
@ -399,10 +399,6 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
setRoadStartSel(sourceRoadStartSel) |
|
|
|
|
|
setRoadEndSel(sourceRoadEndSel) |
|
|
|
|
|
}, [sourceRoadStartSel, sourceRoadEndSel]) |
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
setTypeList([ |
|
|
setTypeList([ |
|
|
{ |
|
|
{ |
|
@ -576,32 +572,41 @@ 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 |
|
|
if (res.statusCode === 200 && res.data.length) { |
|
|
|
|
|
request.get(getReportDetail(res.data[0].id)).then(detailRes => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
let nextInfo = { ...conserveInfo } |
|
|
|
|
|
Object.keys(conserveInfo).forEach(key => { |
|
|
|
|
|
if (detailRes.data[key]) nextInfo[key].value = detailRes.data[key] |
|
|
|
|
|
}) |
|
|
|
|
|
setConserveInfo(nextInfo) |
|
|
|
|
|
setPatrolContentEdit(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
setPatrolContentEdit(true) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
setPatrolContentEdit(true) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
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) { |
|
|
|
|
|
request.get(getReportDetail(res.data[0].id)).then(detailRes => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
let nextInfo = { ...conserveInfo } |
|
|
|
|
|
Object.keys(conserveInfo).forEach(key => { |
|
|
|
|
|
if (detailRes.data[key]) nextInfo[key].value = detailRes.data[key] |
|
|
|
|
|
}) |
|
|
|
|
|
setConserveInfo(nextInfo) |
|
|
|
|
|
setPatrolContentEdit(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
setPatrolContentEdit(true) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
setPatrolContentEdit(true) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case "conserveInfo": |
|
|
case "conserveInfo": |
|
@ -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; |
|
|