Browse Source

我的上报&业主巡查上报

release_0.0.4
liujiangyong 2 years ago
parent
commit
f66bb27e57
  1. 49
      weapp/src/packages/patrol/index.jsx
  2. 19
      weapp/src/packages/patrolView/index.jsx
  3. 19
      weapp/src/pages/user/index.jsx

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

@ -9,6 +9,9 @@ import './index.scss';
import arrowIcon from '../../static/img/patrol/arrow-down.svg';
const Index = () => {
const userInfo = Taro.getStorageSync('userInfo') || {};
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const router = useRouter()
const { params: { type } } = router
const isView = type === 'view' ? true : false
@ -281,28 +284,30 @@ const Index = () => {
return (
<View className='patrol'>
<View className='report-type'>
<View className='text'>上报类型</View>
<RadioGroup onChange={handleTypeChange}>
{
typeList.map((item, i) => {
return (
<Radio
key={i}
value={item.value}
checked={item.checked}
className='radio'
color='#346FC2'
disabled={isView}
>
{item.text}
</Radio>
)
})
}
</RadioGroup>
</View>
{
!isSuperAdmin &&
<View className='report-type'>
<View className='text'>上报类型</View>
<RadioGroup onChange={handleTypeChange}>
{
typeList.map((item, i) => {
return (
<Radio
key={i}
value={item.value}
checked={item.checked}
className='radio'
color='#346FC2'
disabled={isView}
>
{item.text}
</Radio>
)
})
}
</RadioGroup>
</View>
}
<InputPicker
title='工程类型:'
placeholder='请选择工程类型'

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

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

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

@ -16,11 +16,24 @@ const { webUrl } = cfg;
const Index = ({ ...props }) => {
const userInfo = Taro.getStorageSync('userInfo') || {};
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const changePassword = () => {
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 = () => {
Taro.showModal({
title: '提示',
@ -49,9 +62,11 @@ const Index = ({ ...props }) => {
</View>
</View>
<View className='box' onClick={() => goRedirect(1)}>
<View className='box' onClick={isSuperAdmin ? toPatrolReport : toMyReport}>
<Image className='box-img' src={reportImg} />
<View className='box-txt'>我的填报</View>
<View className='box-txt'>
{isSuperAdmin ? '巡查上报' : '我的上报'}
</View>
<Image className='img' src={moreImg} />
</View>

Loading…
Cancel
Save