diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx
index fbff8176..ed1f1350 100644
--- a/weapp/src/packages/patrol/index.jsx
+++ b/weapp/src/packages/patrol/index.jsx
@@ -544,7 +544,57 @@ const Index = () => {
}
})
}
-
+ function queryConserveInfo(roadCodeHead, value) {
+ let routeCode = ''
+ let roadStart = []
+ let roadEnd = []
+ let routeName = ''
+ for (const r of roadList) {
+ if (r.routeCode === roadCodeHead + value) {
+ roadStart.push(r.startingPlaceName)
+ roadEnd.push(r.stopPlaceName)
+ routeCode = r.routeCode
+ 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) {
+ 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 {
+ if (!patrolContentEdit) {
+ setPatrolContentEdit(true)
+ let nextInfo = { ...conserveInfo }
+ Object.keys(conserveInfo).forEach(key => {
+ nextInfo[key].value = ''
+ })
+ setConserveInfo(nextInfo)
+ }
+ }
+ })
+ } else {
+ if (!patrolContentEdit) {
+ setPatrolContentEdit(true)
+ let nextInfo = { ...conserveInfo }
+ Object.keys(conserveInfo).forEach(key => {
+ nextInfo[key].value = ''
+ })
+ setConserveInfo(nextInfo)
+ }
+ }
+ })
+ }
+ }
function handleInput({ detail: { value } }, type, key) {
switch (type) {
case 'roadSectionStart':
@@ -578,55 +628,7 @@ const Index = () => {
case "roadCodeEnd":
setRoadCodeEnd(value)
if (value.length >= 9) {
- let routeCode = ''
- let roadStart = []
- let roadEnd = []
- let routeName = ''
- for (const r of roadList) {
- if (r.routeCode === roadCodeHead + value) {
- roadStart.push(r.startingPlaceName)
- roadEnd.push(r.stopPlaceName)
- routeCode = r.routeCode
- 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) {
- 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 {
- if (!patrolContentEdit) {
- setPatrolContentEdit(true)
- let nextInfo = { ...conserveInfo }
- Object.keys(conserveInfo).forEach(key => {
- nextInfo[key].value = ''
- })
- setConserveInfo(nextInfo)
- }
- }
- })
- } else {
- if (!patrolContentEdit) {
- setPatrolContentEdit(true)
- let nextInfo = { ...conserveInfo }
- Object.keys(conserveInfo).forEach(key => {
- nextInfo[key].value = ''
- })
- setConserveInfo(nextInfo)
- }
- }
- })
- }
+ queryConserveInfo(roadCodeHead, value)
} else {
if (!patrolContentEdit) {
setPatrolContentEdit(true)
@@ -936,6 +938,18 @@ const Index = () => {
* 线路编码:
{
setRoadCodeHead(e.detail.value[0]);
+ if (roadCodeEnd.length >= 9) {
+ queryConserveInfo(e.detail.value[0], roadCodeEnd)
+ } else {
+ if (!patrolContentEdit) {
+ setPatrolContentEdit(true)
+ let nextInfo = { ...conserveInfo }
+ Object.keys(conserveInfo).forEach(key => {
+ nextInfo[key].value = ''
+ })
+ setConserveInfo(nextInfo)
+ }
+ }
}}>
X
Y