|
@ -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) { |
|
|
function handleInput({ detail: { value } }, type, key) { |
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case 'roadSectionStart': |
|
|
case 'roadSectionStart': |
|
@ -578,55 +628,7 @@ const Index = () => { |
|
|
case "roadCodeEnd": |
|
|
case "roadCodeEnd": |
|
|
setRoadCodeEnd(value) |
|
|
setRoadCodeEnd(value) |
|
|
if (value.length >= 9) { |
|
|
if (value.length >= 9) { |
|
|
let routeCode = '' |
|
|
queryConserveInfo(roadCodeHead, value) |
|
|
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) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
if (!patrolContentEdit) { |
|
|
if (!patrolContentEdit) { |
|
|
setPatrolContentEdit(true) |
|
|
setPatrolContentEdit(true) |
|
@ -936,6 +938,18 @@ const Index = () => { |
|
|
<Text style={{ color: 'red' }}>* </Text>线路编码: |
|
|
<Text style={{ color: 'red' }}>* </Text>线路编码: |
|
|
<RadioGroup onChange={(e) => { |
|
|
<RadioGroup onChange={(e) => { |
|
|
setRoadCodeHead(e.detail.value[0]); |
|
|
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) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}}> |
|
|
}}> |
|
|
<Radio value='X' checked={roadCodeHead === 'X'} color='#0080EE' className='radio' disabled={isView}>X</Radio> |
|
|
<Radio value='X' checked={roadCodeHead === 'X'} color='#0080EE' className='radio' disabled={isView}>X</Radio> |
|
|
<Radio value='Y' checked={roadCodeHead === 'Y'} color='#0080EE' className='radio' disabled={isView}>Y</Radio> |
|
|
<Radio value='Y' checked={roadCodeHead === 'Y'} color='#0080EE' className='radio' disabled={isView}>Y</Radio> |
|
|