Browse Source

(*)已办事项

dev
ww664853070 2 years ago
parent
commit
a8ce30ce74
  1. 65
      weapp/src/packages/patrol/index.jsx
  2. 9
      weapp/src/packages/patrolView/index.jsx
  3. 6
      weapp/src/pages/home/index.jsx
  4. 4
      weapp/src/pages/user/index.jsx

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

@ -19,9 +19,8 @@ const Index = () => {
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false
const router = useRouter()
const { params: { type, kind, wait } } = router
const { params: { type, kind, wait, handle } } = router
const isView = type === 'view' ? true : false
const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false
const isRoad = kind === 'road' ? true : false
const isAnomaly = kind === 'anomaly' ? true : false
@ -57,6 +56,7 @@ const Index = () => {
const [handleCenter, setHandleCenter] = useState('')
const [handlePic, setHandlePic] = useState([])
const [handlePicPn, setHandlePicPn] = useState([])
const [handleId, setHandleId] = useState([])
const prjType =
isAnomaly ?
@ -101,11 +101,10 @@ const Index = () => {
checked: false
}
])
useEffect(() => {
if (isRoad) {
Taro.setNavigationBarTitle({ title: '在建项目' })
} else if (wait == 'wait') {
} else if (wait == 'wait' || handle == 'handle') {
Taro.setNavigationBarTitle({ title: '待办事项' })
} else if (isAnomaly) {
Taro.setNavigationBarTitle({ title: '异常反馈' })
@ -141,6 +140,13 @@ const Index = () => {
setConserveBeforePic(data.conserveBeforePic ? data.conserveBeforePic.map(item => ({ url: imgUrl + item })) : [])
setConserveUnderwayPic(data.conserveUnderwayPic ? data.conserveUnderwayPic.map(item => ({ url: imgUrl + item })) : [])
setConserveAfterPic(data.conserveAfterPic ? data.conserveAfterPic.map(item => ({ url: imgUrl + item })) : [])
setHandleId(data.id)
if (data.handleContent) {
setHandleCenter(data.handleContent)
}
if (data.handlePic.length) {
setHandlePic(data.handlePic)
}
} else {
Taro.showToast({ title: res.data.message || '请求出错', icon: 'none' })
}
@ -483,6 +489,11 @@ const Index = () => {
urls: [file.url] // http
})
}
function handleImgClicks(index, file) {
Taro.previewImage({
urls: [file] // http
})
}
useEffect(() => {
if (!isView) {
let newRoadList = roadList.filter(e => e.routeName.match(road))
@ -512,15 +523,15 @@ const Index = () => {
return
}
let handlePicList = []
if(handlePic.length){
handlePic.forEach(e=>{
if (handlePic.length) {
handlePic.forEach(e => {
handlePicList.push(e.url)
})
}
let data = {
handleContent: str,
handlePic: handlePicList,
handleState:'已处理'
handleState: '已处理'
}
Taro.showModal({
title: '提示',
@ -534,7 +545,7 @@ const Index = () => {
Taro.showLoading({
title: '提交中'
})
request.post(postHandle(userInfo.id), data).then(res => {
request.post(postHandle(handleId), data).then(res => {
Taro.hideLoading()
if (res.statusCode == 200 || res.statusCode == 204) {
Taro.showToast({ title: '提交成功', icon: 'none', duration: 1500 })
@ -545,8 +556,7 @@ const Index = () => {
Taro.showToast({ title: res.data.message || '请求出错', icon: 'none' })
}
}, err => {
console.log(err);
Taro.showToast({ title: err.message || '请求出错123', icon: 'none' })
Taro.showToast({ title: err.message || '请求出错', icon: 'none' })
})
}
}
@ -856,36 +866,35 @@ const Index = () => {
<AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton>
}
{
wait == 'wait' ? <view>
wait == 'wait' || handle == 'handle' ? <view>
<view className='patrol-img'><text style={{ color: 'red' }}>*</text>处理内容</view>
<AtTextarea
title='处理内容:'
// placeholder={isView ? '' : ''}
placeholder='请输入处理内容'
value={handleCenter}
onChange={(v, e) => handleInput(e, 'wait')}
// disabled={isView}
disabled={handle == 'handle' ? true : false}
maxLength={50}
/>
<View className='patrol-img'>
处理图片
{
// isView ?
// <View className='img-box'>
// {scenePic.map(item => (
// <Image className='img' src={item.url} onClick={() => handleImgClick(undefined, item)} />
// ))}
// </View> :
<AtImagePicker
className='img-picker'
count={3 - handlePic.length}
showAddBtn={handlePic.length >= 3 ? false : true}
files={handlePic}
onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'wait')}
onImageClick={handleImgClick}
/>
handle == 'handle' ?
<View className='img-box'>
{handlePic.map(item => (
<Image className='img' src={item} onClick={() => handleImgClicks(undefined, item)} />
))}
</View> :
<AtImagePicker
className='img-picker'
count={3 - handlePic.length}
showAddBtn={handlePic.length >= 3 ? false : true}
files={handlePic}
onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'wait')}
onImageClick={handleImgClick}
/>
}
<AtButton type='primary' className='sub-btn' onClick={handleOk}>提交</AtButton>
{handle != 'handle' ? <AtButton type='primary' className='sub-btn' onClick={handleOk}>提交</AtButton> : ''}
</View>
</view> : ''
}

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

@ -17,12 +17,13 @@ import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg'
function Index() {
const userInfo = Taro.getStorageSync('userInfo') || {};
const router = useRouter()
const { params: { filter, kind } } = router
const { params: { filter, kind, } } = router
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 ishandle = kind == 'handle' ? true : false
const [reportType, setReportType] = useState(kind || 'patrol')
const [datePicker, setDatePicker] = useState('')
@ -73,9 +74,9 @@ function Index() {
startTime: datePicker ? datePicker + ' 00:00:00' : '',
endTime: datePicker ? datePicker + ' 23:59:59' : '',
keyword: filterText,
reportType: isWait ? 'anomaly' : reportType,
reportType: isWait || ishandle ? 'anomaly' : reportType,
userId: filter === 'my' ? userInfo.id : '',
handleState: isWait ? '待处理' : '',
handleState: isWait ? '待处理' : ishandle ? '已处理' : '',
}
request.get(getReportList(), data).then(res => {
Taro.hideLoading()
@ -137,7 +138,7 @@ function Index() {
}
const handleDetail = index => {
Taro.navigateTo({ url: `/packages/patrol/index?type=view&id=${listData[index].id}&kind=${kind == 'wait' ? 'anomaly' : kind}&wait=${kind == 'wait' ? 'wait' : ''}` })
Taro.navigateTo({ url: `/packages/patrol/index?type=view&id=${listData[index].id}&kind=${kind == 'wait' || kind == 'handle' ? 'anomaly' : kind}&wait=${kind == 'wait' ? 'wait' : ''}&handle=${kind == 'handle' ? 'handle' : ''}` })
}
return (

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

@ -103,15 +103,13 @@ const Index = () => {
</View> : ''
}
{
isSuperAdmin || isAdmin ?
judgeRight('WXTODOLIST') ?
<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/user/index.jsx

@ -112,11 +112,11 @@ const Index = ({ ...props }) => {
: ''
}
{
judgeRight('WXFEEDBACKMANAGE') ?
judgeRight('WXDONELIST') ?
<View className='box' onClick={() => toMyReport('handle')}>
<Image className='box-img' src={reportImg} />
<View className='box-txt'>
{isSuperAdmin || isAdmin ? '已办事项' : '已办事项'}
已办事项
</View>
<Image className='img' src={moreImg} />
</View>

Loading…
Cancel
Save