|
|
@ -8,7 +8,7 @@ import VideoUpload from '../../components/uploads' |
|
|
|
import request from '@/services/request'; |
|
|
|
import environment from '../../config'; |
|
|
|
import { getState } from '../../store/globalState'; |
|
|
|
import { postReport, getReportDetail, delReport, getRoadSection, postImage } from '@/services/api'; |
|
|
|
import { postReport, getReportDetail, delReport, getRoadSection, postImage, getProject } from '@/services/api'; |
|
|
|
import './index.scss'; |
|
|
|
import arrowIcon from '../../static/img/patrol/arrow-down.svg'; |
|
|
|
|
|
|
@ -53,6 +53,7 @@ const Index = () => { |
|
|
|
const [codeRoadSel, setCodeRoadSel] = useState([]) |
|
|
|
const [roadList, setRoadList] = useState([]) |
|
|
|
const [codeRoad, setCodeRoad] = useState('') |
|
|
|
const [projectList, setProjdetList] = useState([]) |
|
|
|
|
|
|
|
const prjType = |
|
|
|
isAnomaly ? |
|
|
@ -100,7 +101,7 @@ const Index = () => { |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (isRoad) { |
|
|
|
Taro.setNavigationBarTitle({ title: '在建道路' }) |
|
|
|
Taro.setNavigationBarTitle({ title: '在建项目' }) |
|
|
|
} else if (isAnomaly) { |
|
|
|
Taro.setNavigationBarTitle({ title: '异常反馈' }) |
|
|
|
} else if (kind == 'conserve') { |
|
|
@ -126,6 +127,7 @@ const Index = () => { |
|
|
|
setProjectType(showPrjType || data.projectType) |
|
|
|
setProjectName(data.projectName) |
|
|
|
setRoad(data.road) |
|
|
|
setCodeRoad(data.codeRoad) |
|
|
|
setRoadSectionStart(data.roadSectionStart) |
|
|
|
setRoadSectionEnd(data.roadSectionEnd) |
|
|
|
setAddress(data.address) |
|
|
@ -192,6 +194,18 @@ const Index = () => { |
|
|
|
}, err => { |
|
|
|
Taro.showToast({ title: err.message || '请求出错', icon: 'none' }) |
|
|
|
}) |
|
|
|
request.get(getProject()).then(res => { |
|
|
|
if (res.statusCode == 200 || res.statusCode == 204) { |
|
|
|
const { data } = res |
|
|
|
let projectList = [] |
|
|
|
if (data.length) { |
|
|
|
data.forEach(e => { |
|
|
|
projectList.push(e.entryName) |
|
|
|
}) |
|
|
|
} |
|
|
|
setProjdetList(projectList) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, []) |
|
|
|
|
|
|
@ -450,27 +464,22 @@ const Index = () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
useEffect(() => { |
|
|
|
console.log(road, '所在道路的值'); |
|
|
|
if (!isView) { |
|
|
|
let newRoadList = roadList.filter(e => e.routeName.match(road)) |
|
|
|
console.log(newRoadList, '过滤后的列表'); |
|
|
|
let codeRoadSel = [] |
|
|
|
if (newRoadList.length && road != '') { |
|
|
|
newRoadList.forEach((e, index) => { |
|
|
|
codeRoadSel.push(e.routeCode) |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(codeRoadSel, '最新的线路列表'); |
|
|
|
setCodeRoadSel(codeRoadSel) |
|
|
|
if (codeRoadSel.length) { |
|
|
|
setCodeRoad(codeRoadSel[0]) |
|
|
|
} else { |
|
|
|
setCodeRoad('') |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, [road]) |
|
|
|
console.log(codeRoadSel, '线路编码'); |
|
|
|
console.log(sourceRoadSel, '所在道路'); |
|
|
|
console.log(roadList, '线路列表'); |
|
|
|
return ( |
|
|
|
<View className='patrol'> |
|
|
|
{/* { |
|
|
@ -525,7 +534,7 @@ const Index = () => { |
|
|
|
/> : '' |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
{/* { |
|
|
|
isRoad ? |
|
|
|
<View className='address'> |
|
|
|
<View className='title'>项目名称:</View> |
|
|
@ -538,12 +547,24 @@ const Index = () => { |
|
|
|
disabled={isView} |
|
|
|
/> |
|
|
|
</View> : '' |
|
|
|
} */} |
|
|
|
{ |
|
|
|
isRoad ? |
|
|
|
<InputPickers |
|
|
|
key={789} // 添加key保证selector更新重新渲染 |
|
|
|
title='项目名称:' |
|
|
|
value={projectName} |
|
|
|
placeholder='请选择或输入项目名称' |
|
|
|
onInput={setProjectName} |
|
|
|
selector={projectList} |
|
|
|
isView={isView} |
|
|
|
/> : '' |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
isPatrol || isAnomaly ? |
|
|
|
<InputPicker |
|
|
|
key={Math.random() || sourceRoadSel} // 添加key保证selector更新重新渲染 |
|
|
|
key={123} // 添加key保证selector更新重新渲染 |
|
|
|
title='所在道路:' |
|
|
|
placeholder='请选择或输入您所在的道路' |
|
|
|
value={road} |
|
|
@ -555,9 +576,8 @@ const Index = () => { |
|
|
|
{ |
|
|
|
isPatrol || isAnomaly ? |
|
|
|
<InputPickers |
|
|
|
key={Math.random() || codeRoadSel} // 添加key保证selector更新重新渲染 |
|
|
|
key={456} // 添加key保证selector更新重新渲染 |
|
|
|
title='线路编码:' |
|
|
|
placeholder='请选择或输入您所在的道路' |
|
|
|
value={codeRoad} |
|
|
|
onInput={setCodeRoad} |
|
|
|
selector={codeRoadSel} |
|
|
|