Browse Source

Merge branch 'dev' of https://gitea.anxinyun.cn/gao.zhiyuan/Highways4Good into dev

release_0.0.4
LUCAS 2 years ago
parent
commit
385f017aea
  1. 7
      weapp/src/packages/patrol/index.jsx
  2. 19
      weapp/src/packages/patrolView/index.jsx
  3. 19
      weapp/src/pages/user/index.jsx
  4. 2
      web/client/src/sections/organization/components/depModal.js
  5. 4
      web/client/src/sections/organization/components/userModal.js
  6. 9
      web/client/src/sections/quanju/containers/example.js
  7. 16
      web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js

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

@ -9,6 +9,9 @@ import './index.scss';
import arrowIcon from '../../static/img/patrol/arrow-down.svg'; import arrowIcon from '../../static/img/patrol/arrow-down.svg';
const Index = () => { const Index = () => {
const userInfo = Taro.getStorageSync('userInfo') || {};
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const router = useRouter() const router = useRouter()
const { params: { type } } = router const { params: { type } } = router
const isView = type === 'view' ? true : false const isView = type === 'view' ? true : false
@ -281,6 +284,8 @@ const Index = () => {
return ( return (
<View className='patrol'> <View className='patrol'>
{
!isSuperAdmin &&
<View className='report-type'> <View className='report-type'>
<View className='text'>上报类型</View> <View className='text'>上报类型</View>
<RadioGroup onChange={handleTypeChange}> <RadioGroup onChange={handleTypeChange}>
@ -302,7 +307,7 @@ const Index = () => {
} }
</RadioGroup> </RadioGroup>
</View> </View>
}
<InputPicker <InputPicker
title='工程类型:' title='工程类型:'
placeholder='请选择工程类型' placeholder='请选择工程类型'

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

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import Taro, { useDidShow } from '@tarojs/taro' import Taro, { useDidShow, useRouter } from '@tarojs/taro'
import { View, Picker, Input, Image } from '@tarojs/components' import { View, Picker, Input, Image } from '@tarojs/components'
import moment from 'moment' import moment from 'moment'
import './index.scss' import './index.scss'
@ -15,6 +15,10 @@ import conserveIcon from '../../static/img/patrolView/conserve.svg'
import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg' import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg'
function Index() { function Index() {
const userInfo = Taro.getStorageSync('userInfo') || {};
const router = useRouter()
const { params: { limit } } = router
const [isPatrol, setIsPatrol] = useState(true) const [isPatrol, setIsPatrol] = useState(true)
const [datePicker, setDatePicker] = useState(moment().format('YYYY-MM-DD')) const [datePicker, setDatePicker] = useState(moment().format('YYYY-MM-DD'))
const [listData, setListData] = useState([]) const [listData, setListData] = useState([])
@ -42,14 +46,17 @@ function Index() {
Taro.showLoading({ title: '加载中' }) Taro.showLoading({ title: '加载中' })
request.get( request.get(
getReportList(), getReportList(),
{ startTime: datePicker + ' 00:00:00', endTime: datePicker + ' 23:59:59' }, { startTime: datePicker + ' 00:00:00', endTime: datePicker + ' 23:59:59' }
{ hideErrorToast: true, hideLoading: true }
).then(res => { ).then(res => {
Taro.hideLoading() Taro.hideLoading()
if (res.statusCode == 200) { if (res.statusCode == 200) {
setListData(res.data) let { data } = res
setShowListData(res.data.filter(item => isPatrol ? item.reportType === 'patrol' : item.reportType === 'conserve')) if (limit === 'my') {
return res.data; data = data.filter(item => item.user.name === userInfo.name)
}
setListData(data)
setShowListData(data.filter(item => isPatrol ? item.reportType === 'patrol' : item.reportType === 'conserve'))
return data;
} else { } else {
dealError(res.data.message || '请求出错'); dealError(res.data.message || '请求出错');
} }

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

@ -16,11 +16,24 @@ 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 changePassword = () => { const changePassword = () => {
Taro.navigateTo({ url: '/packages/changePassword/index' }) Taro.navigateTo({ url: '/packages/changePassword/index' })
} }
const toMyReport = () => {
Taro.navigateTo({
url: '/packages/patrolView/index?limit=my'
})
}
const toPatrolReport = () => {
Taro.navigateTo({
url: '/packages/patrol/index?type=edit'
})
}
const onLogout = () => { const onLogout = () => {
Taro.showModal({ Taro.showModal({
title: '提示', title: '提示',
@ -49,9 +62,11 @@ const Index = ({ ...props }) => {
</View> </View>
</View> </View>
<View className='box' onClick={() => goRedirect(1)}> <View className='box' onClick={isSuperAdmin ? toPatrolReport : toMyReport}>
<Image className='box-img' src={reportImg} /> <Image className='box-img' src={reportImg} />
<View className='box-txt'>我的填报</View> <View className='box-txt'>
{isSuperAdmin ? '巡查上报' : '我的上报'}
</View>
<Image className='img' src={moreImg} /> <Image className='img' src={moreImg} />
</View> </View>

2
web/client/src/sections/organization/components/depModal.js

@ -43,7 +43,7 @@ const DepModal = (props) => {
autocomplete: 'new-password' autocomplete: 'new-password'
}} }}
rules={[ rules={[
{ required: true, message: '请输入部门名称' }, { max: 20, message: '请输入10个字以内的名称' } { required: true, message: '请输入部门名称' }, { max: 10, message: '请输入10个字以内的名称' }
]} ]}
/> />
<ProFormTreeSelect <ProFormTreeSelect

4
web/client/src/sections/organization/components/userModal.js

@ -41,12 +41,11 @@ const UserModal = (props) => {
<ProForm.Group> <ProForm.Group>
<ProFormText <ProFormText
name={['contract', 'name']} name={['contract', 'name']}
maxLength={10}
width="md" width="md"
label="姓名" label="姓名"
required required
placeholder="请输入姓名" placeholder="请输入姓名"
rules={[{ required: true, message: '请输入姓名' }]} rules={[{ required: true, message: '请输入姓名' },{ max: 10, message: '请输入10个字以内的名称' }]}
/> />
< ProFormText < ProFormText
name={['contract', 'phone']} name={['contract', 'phone']}
@ -156,7 +155,6 @@ const UserModal = (props) => {
function mapStateToProps(state) { function mapStateToProps(state) {
const { depMessage } = state; const { depMessage } = state;
console.log('depMessage:', depMessage);
const pakData = (dep) => { const pakData = (dep) => {
// console.log(dep); // console.log(dep);
return dep.map((d) => { return dep.map((d) => {

9
web/client/src/sections/quanju/containers/example.js

@ -26,7 +26,6 @@ const Example = (props) => {
useEffect(() => { useEffect(() => {
const timer = setTimeout(() => {
const map = new AMap.Map(MAPID, { const map = new AMap.Map(MAPID, {
//resizeEnable: true, //resizeEnable: true,
center: [115.912663, 28.543149],//地图中心点,初始定位加载显示楼块 center: [115.912663, 28.543149],//地图中心点,初始定位加载显示楼块
@ -46,7 +45,10 @@ const Example = (props) => {
window.onload = function () { window.onload = function () {
windowOnload = true; windowOnload = true;
} }
}, 100);
//主题样式 //主题样式
@ -57,8 +59,7 @@ const Example = (props) => {
}) })
map.clearMap(); map.clearMap();
if (map) map.destroy(); if (map) map.destroy();
map = null;
clearTimeout(timer)
} }
}, []) }, [])

16
web/client/src/sections/quanju/containers/footer/conserve/right/right-bottom.js

@ -15,7 +15,7 @@ let underColorList = [
"rgba(255,194,20,0.5)" "rgba(255,194,20,0.5)"
] ]
const type = ['culvert','', 'road', 'bridge'] const type = ['culvert', '', 'road', 'bridge']
const RightBottom = (props) => { const RightBottom = (props) => {
const { roadMaintenances } = props const { roadMaintenances } = props
@ -23,7 +23,7 @@ const RightBottom = (props) => {
let typesNum = null let typesNum = null
const list = roadMaintenances?.reportCount?.map((r, index) => { const list = roadMaintenances?.reportCount?.map((r, index) => {
totalData += Number(r.count) totalData += Number(r.count)
if (r.projectType === type[index]) { if (r.projectType === 'culvert' || 'road' || 'bridge') {
typesNum += Number(r.count) typesNum += Number(r.count)
} }
switch (r.projectType) { switch (r.projectType) {
@ -41,12 +41,16 @@ const RightBottom = (props) => {
return { return {
name: '桥梁', name: '桥梁',
value: r.count value: r.count
} };
case '其他':
return {
name: '其他',
value: r.count
};
} }
}).filter(f => f !== undefined) }).filter(f => f !== undefined)
const otherNum = totalData - typesNum // const otherNum = totalData - typesNum
console.log(); // otherNum !== null && list?.push({ name: '其他', value: otherNum })
otherNum !== null && list?.push({ name: '其他', value: otherNum })
const style = { height: "31%", marginTop: "3%" } const style = { height: "31%", marginTop: "3%" }
return ( return (
<> <>

Loading…
Cancel
Save