Browse Source

(*)在建项目

dev
ww664853070 2 years ago
parent
commit
ffc66cb945
  1. 46
      weapp/src/packages/patrol/index.jsx
  2. 5
      weapp/src/packages/patrolView/index.jsx
  3. 33
      weapp/src/pages/home/index.jsx
  4. 4
      weapp/src/pages/home/index.scss
  5. 17
      weapp/src/pages/user/index.jsx
  6. 5
      weapp/src/services/api.js
  7. BIN
      weapp/src/static/img/home/fill-wait.png

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

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

5
weapp/src/packages/patrolView/index.jsx

@ -22,6 +22,7 @@ function Index () {
const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false
const isRoad = kind === 'road' ? true : false const isRoad = kind === 'road' ? true : false
const isAnomaly = kind === 'anomaly' ? true : false const isAnomaly = kind === 'anomaly' ? true : false
const isWait = kind === 'wait' ? true : false
const [reportType, setReportType] = useState(kind || 'patrol') const [reportType, setReportType] = useState(kind || 'patrol')
const [datePicker, setDatePicker] = useState('') const [datePicker, setDatePicker] = useState('')
@ -35,11 +36,13 @@ function Index () {
useEffect(() => { useEffect(() => {
if (isRoad) { if (isRoad) {
Taro.setNavigationBarTitle({ title: '在建道路' }) Taro.setNavigationBarTitle({ title: '在建项目' })
} else if (isAnomaly) { } else if (isAnomaly) {
Taro.setNavigationBarTitle({ title: '异常反馈' }) Taro.setNavigationBarTitle({ title: '异常反馈' })
} else if (kind == 'conserve') { } else if (kind == 'conserve') {
Taro.setNavigationBarTitle({ title: '养护上报' }) Taro.setNavigationBarTitle({ title: '养护上报' })
}else if(isWait){
Taro.setNavigationBarTitle({ title: '待办事项' })
} else { } else {
Taro.setNavigationBarTitle({ title: '巡查上报' }) Taro.setNavigationBarTitle({ title: '巡查上报' })
} }

33
weapp/src/pages/home/index.jsx

@ -8,7 +8,7 @@ const Index = () => {
const userInfo = Taro.getStorageSync('userInfo') || {}; const userInfo = Taro.getStorageSync('userInfo') || {};
const token = Taro.getStorageSync('token') || null; const token = Taro.getStorageSync('token') || null;
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const isAdmin = userInfo && userInfo.isAdmin == true ? true : false
useEffect(() => { useEffect(() => {
if (!userInfo || !token) { if (!userInfo || !token) {
Taro.showModal({ Taro.showModal({
@ -54,11 +54,11 @@ const Index = () => {
<View className='card fill'> <View className='card fill'>
<View className='title'> </View> <View className='title'> </View>
<View className='btn' onClick={ <View className='btn' onClick={
isSuperAdmin ? isSuperAdmin || isAdmin ?
() => toPatrolView('patrol') () => toPatrolView('patrol')
: () => toPatrol('patrol') : () => toPatrol('patrol')
}> }>
{isSuperAdmin ? '查看' : '填报'} {isSuperAdmin || isAdmin ? '查看' : '填报'}
</View> </View>
</View> </View>
: '' : ''
@ -68,24 +68,24 @@ const Index = () => {
<View className='card fill'> <View className='card fill'>
<View className='title'> </View> <View className='title'> </View>
<View className='btn' onClick={ <View className='btn' onClick={
isSuperAdmin ? isSuperAdmin || isAdmin ?
() => toPatrolView('conserve') () => toPatrolView('conserve')
: () => toPatrol('conserve') : () => toPatrol('conserve')
}> }>
{isSuperAdmin ? '查看' : '填报'} {isSuperAdmin || isAdmin ? '查看' : '填报'}
</View> </View>
</View> : '' </View> : ''
} }
{ {
judgeRight('WXBUILDINGROAD') ? judgeRight('WXBUILDINGROAD') ?
<View className='card fill_road'> <View className='card fill_road'>
<View className='title'> </View> <View className='title'> </View>
<View className='btn' onClick={ <View className='btn' onClick={
isSuperAdmin ? isSuperAdmin || isAdmin ?
() => toPatrolView('road') () => toPatrolView('road')
: () => toPatrol('road') : () => toPatrol('road')
}> }>
{isSuperAdmin ? '查看' : '填报'} {isSuperAdmin || isAdmin ? '查看' : '填报'}
</View> </View>
</View> : '' </View> : ''
} }
@ -94,11 +94,24 @@ const Index = () => {
<View className='card fill_anomaly'> <View className='card fill_anomaly'>
<View className='title'> </View> <View className='title'> </View>
<View className='btn' onClick={ <View className='btn' onClick={
isSuperAdmin ? isSuperAdmin || isAdmin ?
() => toPatrolView('anomaly') () => toPatrolView('anomaly')
: () => toPatrol('anomaly') : () => toPatrol('anomaly')
}> }>
{isSuperAdmin ? '查看' : '填报'} {isSuperAdmin || isAdmin ? '查看' : '填报'}
</View>
</View> : ''
}
{
isSuperAdmin || isAdmin ?
<View className='card fill_wait'>
<View className='title'> </View>
<View className='btn' onClick={
isSuperAdmin || isAdmin ?
() => toPatrolView('wait')
: () => toPatrol('wait')
}>
{isSuperAdmin || isAdmin ? '查看' : '填报'}
</View> </View>
</View> : '' </View> : ''
} }

4
weapp/src/pages/home/index.scss

@ -22,6 +22,10 @@
background: url('../../static/img/home/fill-anomaly.svg') no-repeat; background: url('../../static/img/home/fill-anomaly.svg') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.fill_wait {
background: url('../../static/img/home/fill-wait.png') no-repeat;
background-size: 100% 100%;
}
.video { .video {
background: url('../../static/img/home/video-bg.svg') no-repeat; background: url('../../static/img/home/video-bg.svg') no-repeat;

17
weapp/src/pages/user/index.jsx

@ -18,6 +18,7 @@ const { webUrl } = cfg;
const Index = ({ ...props }) => { const Index = ({ ...props }) => {
const userInfo = Taro.getStorageSync('userInfo') || {}; const userInfo = Taro.getStorageSync('userInfo') || {};
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const isAdmin = userInfo && userInfo.isAdmin == true ? true : false
const changePassword = () => { const changePassword = () => {
Taro.navigateTo({ url: '/packages/changePassword/index' }) Taro.navigateTo({ url: '/packages/changePassword/index' })
@ -70,20 +71,20 @@ const Index = ({ ...props }) => {
{ {
judgeRight('WXPATROLREPORT') ? judgeRight('WXPATROLREPORT') ?
<View className='box' onClick={isSuperAdmin ? () => toPatrolReport('patrol') : () => toMyReport('patrol')}> <View className='box' onClick={isSuperAdmin || isAdmin ? () => toPatrolReport('patrol') : () => toMyReport('patrol')}>
<Image className='box-img' src={reportImg} /> <Image className='box-img' src={reportImg} />
<View className='box-txt'> <View className='box-txt'>
{isSuperAdmin ? '巡查上报' : '巡查上报'} {isSuperAdmin || isAdmin ? '巡查上报' : '巡查上报'}
</View> </View>
<Image className='img' src={moreImg} /> <Image className='img' src={moreImg} />
</View> : '' </View> : ''
} }
{ {
judgeRight('WXMAINTENANCEREPORT') ? judgeRight('WXMAINTENANCEREPORT') ?
<View className='box' onClick={isSuperAdmin ? () => toPatrolReport('conserve') : () => toMyReport('conserve')}> <View className='box' onClick={isSuperAdmin || isAdmin ? () => toPatrolReport('conserve') : () => toMyReport('conserve')}>
<Image className='box-img' src={reportImg} /> <Image className='box-img' src={reportImg} />
<View className='box-txt'> <View className='box-txt'>
{isSuperAdmin ? '养护上报' : '养护上报'} {isSuperAdmin || isAdmin ? '养护上报' : '养护上报'}
</View> </View>
<Image className='img' src={moreImg} /> <Image className='img' src={moreImg} />
</View> </View>
@ -91,20 +92,20 @@ const Index = ({ ...props }) => {
} }
{ {
judgeRight('WXBUILDINGROAD') ? judgeRight('WXBUILDINGROAD') ?
<View className='box' onClick={isSuperAdmin ? () => toPatrolReport('road') : () => toMyReport('road')}> <View className='box' onClick={isSuperAdmin || isAdmin ? () => toPatrolReport('road') : () => toMyReport('road')}>
<Image className='box-img' src={reportImg} /> <Image className='box-img' src={reportImg} />
<View className='box-txt'> <View className='box-txt'>
{isSuperAdmin ? '在建道路上报' : '在建道路'} {isSuperAdmin || isAdmin ? '在建项目上报' : '在建项目'}
</View> </View>
<Image className='img' src={moreImg} /> <Image className='img' src={moreImg} />
</View> : '' </View> : ''
} }
{ {
judgeRight('WXFEEDBACKMANAGE') ? judgeRight('WXFEEDBACKMANAGE') ?
<View className='box' onClick={isSuperAdmin ? () => toPatrolReport('anomaly') : () => toMyReport('anomaly')}> <View className='box' onClick={isSuperAdmin || isAdmin ? () => toPatrolReport('anomaly') : () => toMyReport('anomaly')}>
<Image className='box-img' src={reportImg} /> <Image className='box-img' src={reportImg} />
<View className='box-txt'> <View className='box-txt'>
{isSuperAdmin ? '异常反馈上报' : '异常反馈'} {isSuperAdmin || isAdmin ? '异常反馈上报' : '异常反馈'}
</View> </View>
<Image className='img' src={moreImg} /> <Image className='img' src={moreImg} />
</View> </View>

5
weapp/src/services/api.js

@ -47,6 +47,11 @@ export const getIndustryUrl = () => {
return `/elec/business/industry` return `/elec/business/industry`
} }
//项目名称查询
export const getProject = () => {
return `/project`
}

BIN
weapp/src/static/img/home/fill-wait.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Loading…
Cancel
Save