Browse Source

(*)在建项目

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

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

@ -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, '所在道路的值');
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('')
if (!isView) {
let newRoadList = roadList.filter(e => e.routeName.match(road))
let codeRoadSel = []
if (newRoadList.length && road != '') {
newRoadList.forEach((e, index) => {
codeRoadSel.push(e.routeCode)
})
}
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} // keyselector
title='项目名称:'
value={projectName}
placeholder='请选择或输入项目名称'
onInput={setProjectName}
selector={projectList}
isView={isView}
/> : ''
}
{
isPatrol || isAnomaly ?
<InputPicker
key={Math.random() || sourceRoadSel} // keyselector
key={123} // keyselector
title='所在道路:'
placeholder='请选择或输入您所在的道路'
value={road}
@ -555,9 +576,8 @@ const Index = () => {
{
isPatrol || isAnomaly ?
<InputPickers
key={Math.random() || codeRoadSel} // keyselector
key={456} // keyselector
title='线路编码:'
placeholder='请选择或输入您所在的道路'
value={codeRoad}
onInput={setCodeRoad}
selector={codeRoadSel}

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

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

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

@ -8,7 +8,7 @@ const Index = () => {
const userInfo = Taro.getStorageSync('userInfo') || {};
const token = Taro.getStorageSync('token') || null;
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const isAdmin = userInfo && userInfo.isAdmin == true ? true : false
useEffect(() => {
if (!userInfo || !token) {
Taro.showModal({
@ -26,24 +26,24 @@ const Index = () => {
}
}, [])
function toPatrol (kind) {
function toPatrol(kind) {
Taro.navigateTo({
url: `/packages/patrol/index?type=edit&kind=${kind}`
})
}
function toPatrolView (kind) {
function toPatrolView(kind) {
Taro.navigateTo({
url: `/packages/patrolView/index?kind=${kind}`
})
}
function toVideo () {
function toVideo() {
Taro.navigateTo({
url: '/packages/video/index'
})
}
function judgeRight (code) {
function judgeRight(code) {
return userInfo && userInfo.userResources && userInfo.userResources.some(item => item.resourceId === code)
}
@ -54,11 +54,11 @@ const Index = () => {
<View className='card fill'>
<View className='title'> </View>
<View className='btn' onClick={
isSuperAdmin ?
isSuperAdmin || isAdmin ?
() => toPatrolView('patrol')
: () => toPatrol('patrol')
}>
{isSuperAdmin ? '查看' : '填报'}
{isSuperAdmin || isAdmin ? '查看' : '填报'}
</View>
</View>
: ''
@ -68,24 +68,24 @@ const Index = () => {
<View className='card fill'>
<View className='title'> </View>
<View className='btn' onClick={
isSuperAdmin ?
isSuperAdmin || isAdmin ?
() => toPatrolView('conserve')
: () => toPatrol('conserve')
}>
{isSuperAdmin ? '查看' : '填报'}
{isSuperAdmin || isAdmin ? '查看' : '填报'}
</View>
</View> : ''
}
{
judgeRight('WXBUILDINGROAD') ?
<View className='card fill_road'>
<View className='title'> </View>
<View className='title'> </View>
<View className='btn' onClick={
isSuperAdmin ?
isSuperAdmin || isAdmin ?
() => toPatrolView('road')
: () => toPatrol('road')
}>
{isSuperAdmin ? '查看' : '填报'}
{isSuperAdmin || isAdmin ? '查看' : '填报'}
</View>
</View> : ''
}
@ -94,11 +94,24 @@ const Index = () => {
<View className='card fill_anomaly'>
<View className='title'> </View>
<View className='btn' onClick={
isSuperAdmin ?
isSuperAdmin || isAdmin ?
() => toPatrolView('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> : ''
}

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

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

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

@ -18,6 +18,7 @@ const { webUrl } = cfg;
const Index = ({ ...props }) => {
const userInfo = Taro.getStorageSync('userInfo') || {};
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const isAdmin = userInfo && userInfo.isAdmin == true ? true : false
const changePassword = () => {
Taro.navigateTo({ url: '/packages/changePassword/index' })
@ -52,7 +53,7 @@ const Index = ({ ...props }) => {
})
}
function judgeRight (code) {
function judgeRight(code) {
return userInfo && userInfo.userResources && userInfo.userResources.some(item => item.resourceId === code)
}
@ -70,20 +71,20 @@ const Index = ({ ...props }) => {
{
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} />
<View className='box-txt'>
{isSuperAdmin ? '巡查上报' : '巡查上报'}
{isSuperAdmin || isAdmin ? '巡查上报' : '巡查上报'}
</View>
<Image className='img' src={moreImg} />
</View> : ''
}
{
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} />
<View className='box-txt'>
{isSuperAdmin ? '养护上报' : '养护上报'}
{isSuperAdmin || isAdmin ? '养护上报' : '养护上报'}
</View>
<Image className='img' src={moreImg} />
</View>
@ -91,20 +92,20 @@ const Index = ({ ...props }) => {
}
{
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} />
<View className='box-txt'>
{isSuperAdmin ? '在建道路上报' : '在建道路'}
{isSuperAdmin || isAdmin ? '在建项目上报' : '在建项目'}
</View>
<Image className='img' src={moreImg} />
</View> : ''
}
{
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} />
<View className='box-txt'>
{isSuperAdmin ? '异常反馈上报' : '异常反馈'}
{isSuperAdmin || isAdmin ? '异常反馈上报' : '异常反馈'}
</View>
<Image className='img' src={moreImg} />
</View>

5
weapp/src/services/api.js

@ -47,6 +47,11 @@ export const getIndustryUrl = () => {
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