|
|
@ -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, getProject } from '@/services/api'; |
|
|
|
import { postReport, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle } from '@/services/api'; |
|
|
|
import './index.scss'; |
|
|
|
import arrowIcon from '../../static/img/patrol/arrow-down.svg'; |
|
|
|
|
|
|
@ -19,7 +19,7 @@ const Index = () => { |
|
|
|
const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false |
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
const { params: { type, kind } } = router |
|
|
|
const { params: { type, kind, wait } } = router |
|
|
|
const isView = type === 'view' ? true : false |
|
|
|
|
|
|
|
const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false |
|
|
@ -54,6 +54,9 @@ const Index = () => { |
|
|
|
const [roadList, setRoadList] = useState([]) |
|
|
|
const [codeRoad, setCodeRoad] = useState('') |
|
|
|
const [projectList, setProjdetList] = useState([]) |
|
|
|
const [handleCenter, setHandleCenter] = useState('') |
|
|
|
const [handlePic, setHandlePic] = useState([]) |
|
|
|
const [handlePicPn, setHandlePicPn] = useState([]) |
|
|
|
|
|
|
|
const prjType = |
|
|
|
isAnomaly ? |
|
|
@ -102,6 +105,8 @@ const Index = () => { |
|
|
|
useEffect(() => { |
|
|
|
if (isRoad) { |
|
|
|
Taro.setNavigationBarTitle({ title: '在建项目' }) |
|
|
|
} else if (wait == 'wait') { |
|
|
|
Taro.setNavigationBarTitle({ title: '待办事项' }) |
|
|
|
} else if (isAnomaly) { |
|
|
|
Taro.setNavigationBarTitle({ title: '异常反馈' }) |
|
|
|
} else if (kind == 'conserve') { |
|
|
@ -360,6 +365,9 @@ const Index = () => { |
|
|
|
case "projectName": |
|
|
|
setProjectName(value) |
|
|
|
break; |
|
|
|
case "wait": |
|
|
|
setHandleCenter(value) |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
@ -385,6 +393,16 @@ const Index = () => { |
|
|
|
setSceneImg(nextImg) |
|
|
|
setScenePic(files) |
|
|
|
break; |
|
|
|
case 'wait': |
|
|
|
let handlPicImg = handlePicPn |
|
|
|
if (isAdd) { |
|
|
|
handlPicImg.push(url) |
|
|
|
} else { |
|
|
|
handlPicImg.splice(index, 1) |
|
|
|
} |
|
|
|
setHandlePicPn(handlPicImg) |
|
|
|
setHandlePic(files) |
|
|
|
break; |
|
|
|
case 'conserveBeforePic': |
|
|
|
let nextConserveBeforeImg = conserveBeforeImg |
|
|
|
if (isAdd) { |
|
|
@ -482,6 +500,58 @@ const Index = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
}, [road]) |
|
|
|
function handleOk() { |
|
|
|
if (!canReport) { return } |
|
|
|
let str = handleCenter.trim() |
|
|
|
if (!str) { |
|
|
|
Taro.showToast({ title: '请完善处理内容', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
if (str.length > 50) { |
|
|
|
Taro.showToast({ title: '内容字数不能超过50', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
let handlePicList = [] |
|
|
|
if(handlePic.length){ |
|
|
|
handlePic.forEach(e=>{ |
|
|
|
handlePicList.push(e.url) |
|
|
|
}) |
|
|
|
} |
|
|
|
let data = { |
|
|
|
handleContent: str, |
|
|
|
handlePic: handlePicList, |
|
|
|
handleState:'已处理' |
|
|
|
} |
|
|
|
Taro.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '您要进行处理提交吗?', |
|
|
|
success: function (res) { |
|
|
|
if (res.confirm) { |
|
|
|
setCanReport(false) |
|
|
|
setTimeout(() => { |
|
|
|
setCanReport(true) |
|
|
|
}, 3000) // 3秒内不可以重复点击 |
|
|
|
Taro.showLoading({ |
|
|
|
title: '提交中' |
|
|
|
}) |
|
|
|
request.post(postHandle(userInfo.id), data).then(res => { |
|
|
|
Taro.hideLoading() |
|
|
|
if (res.statusCode == 200 || res.statusCode == 204) { |
|
|
|
Taro.showToast({ title: '提交成功', icon: 'none', duration: 1500 }) |
|
|
|
setTimeout(() => { |
|
|
|
Taro.navigateBack() |
|
|
|
}, 1500) |
|
|
|
} else { |
|
|
|
Taro.showToast({ title: res.data.message || '请求出错', icon: 'none' }) |
|
|
|
} |
|
|
|
}, err => { |
|
|
|
console.log(err); |
|
|
|
Taro.showToast({ title: err.message || '请求出错123', icon: 'none' }) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
return ( |
|
|
|
<View className='patrol'> |
|
|
|
{/* { |
|
|
@ -785,6 +855,40 @@ const Index = () => { |
|
|
|
: |
|
|
|
<AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton> |
|
|
|
} |
|
|
|
{ |
|
|
|
wait == 'wait' ? <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} |
|
|
|
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} |
|
|
|
/> |
|
|
|
} |
|
|
|
<AtButton type='primary' className='sub-btn' onClick={handleOk}>提交</AtButton> |
|
|
|
</View> |
|
|
|
</view> : '' |
|
|
|
} |
|
|
|
</View> |
|
|
|
) |
|
|
|
} |
|
|
|