diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 116bf2a1..91c409ea 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/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 ( {/* { @@ -525,7 +534,7 @@ const Index = () => { /> : '' } - { + {/* { isRoad ? 项目名称: @@ -538,12 +547,24 @@ const Index = () => { disabled={isView} /> : '' + } */} + { + isRoad ? + : '' } { isPatrol || isAnomaly ? { { isPatrol || isAnomaly ? { 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: '巡查上报' }) } diff --git a/weapp/src/pages/home/index.jsx b/weapp/src/pages/home/index.jsx index 3245aa0b..48d397d5 100644 --- a/weapp/src/pages/home/index.jsx +++ b/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 = () => { 巡 查 上 报 toPatrolView('patrol') : () => toPatrol('patrol') }> - {isSuperAdmin ? '查看' : '填报'} + {isSuperAdmin || isAdmin ? '查看' : '填报'} : '' @@ -68,24 +68,24 @@ const Index = () => { 养 护 上 报 toPatrolView('conserve') : () => toPatrol('conserve') }> - {isSuperAdmin ? '查看' : '填报'} + {isSuperAdmin || isAdmin ? '查看' : '填报'} : '' } { judgeRight('WXBUILDINGROAD') ? - 在 建 道 路 + 在 建 项 目 toPatrolView('road') : () => toPatrol('road') }> - {isSuperAdmin ? '查看' : '填报'} + {isSuperAdmin || isAdmin ? '查看' : '填报'} : '' } @@ -94,11 +94,24 @@ const Index = () => { 异 常 反 馈 toPatrolView('anomaly') : () => toPatrol('anomaly') }> - {isSuperAdmin ? '查看' : '填报'} + {isSuperAdmin || isAdmin ? '查看' : '填报'} + + : '' + } + { + isSuperAdmin || isAdmin ? + + 待 办 事 项 + toPatrolView('wait') + : () => toPatrol('wait') + }> + {isSuperAdmin || isAdmin ? '查看' : '填报'} : '' } diff --git a/weapp/src/pages/home/index.scss b/weapp/src/pages/home/index.scss index 3fdebb5c..278591cb 100644 --- a/weapp/src/pages/home/index.scss +++ b/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; diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx index fc6de304..0e7a6af0 100644 --- a/weapp/src/pages/user/index.jsx +++ b/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') ? - toPatrolReport('patrol') : () => toMyReport('patrol')}> + toPatrolReport('patrol') : () => toMyReport('patrol')}> - {isSuperAdmin ? '巡查上报' : '巡查上报'} + {isSuperAdmin || isAdmin ? '巡查上报' : '巡查上报'} : '' } { judgeRight('WXMAINTENANCEREPORT') ? - toPatrolReport('conserve') : () => toMyReport('conserve')}> + toPatrolReport('conserve') : () => toMyReport('conserve')}> - {isSuperAdmin ? '养护上报' : '养护上报'} + {isSuperAdmin || isAdmin ? '养护上报' : '养护上报'} @@ -91,20 +92,20 @@ const Index = ({ ...props }) => { } { judgeRight('WXBUILDINGROAD') ? - toPatrolReport('road') : () => toMyReport('road')}> + toPatrolReport('road') : () => toMyReport('road')}> - {isSuperAdmin ? '在建道路上报' : '在建道路'} + {isSuperAdmin || isAdmin ? '在建项目上报' : '在建项目'} : '' } { judgeRight('WXFEEDBACKMANAGE') ? - toPatrolReport('anomaly') : () => toMyReport('anomaly')}> + toPatrolReport('anomaly') : () => toMyReport('anomaly')}> - {isSuperAdmin ? '异常反馈上报' : '异常反馈'} + {isSuperAdmin || isAdmin ? '异常反馈上报' : '异常反馈'} diff --git a/weapp/src/services/api.js b/weapp/src/services/api.js index 2bd2ba09..1db8b2d8 100644 --- a/weapp/src/services/api.js +++ b/weapp/src/services/api.js @@ -47,6 +47,11 @@ export const getIndustryUrl = () => { return `/elec/business/industry` } +//项目名称查询 +export const getProject = () => { + return `/project` +} + diff --git a/weapp/src/static/img/home/fill-wait.png b/weapp/src/static/img/home/fill-wait.png new file mode 100644 index 00000000..15188222 Binary files /dev/null and b/weapp/src/static/img/home/fill-wait.png differ