From 2b9837363657aba9957aa56e107e1ed51917a2ae Mon Sep 17 00:00:00 2001 From: ww664853070 Date: Thu, 13 Jul 2023 15:23:05 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 122 ++++++++++++++++++++++++++-- weapp/src/pages/user/index.jsx | 11 +++ weapp/src/services/api.js | 5 ++ 3 files changed, 129 insertions(+), 9 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 6177e18e..859da3ab 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, 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') { @@ -230,7 +235,7 @@ const Index = () => { ]) }, [reportType]) - function report () { + function report() { if (!canReport) { return } if ( (isPatrol && (!projectType || !road)) @@ -306,7 +311,7 @@ const Index = () => { }) } - function deleteReport () { + function deleteReport() { Taro.showModal({ title: '提示', content: '确定删除吗?', @@ -333,7 +338,7 @@ const Index = () => { }) } - function handleInput ({ detail: { value } }, type) { + function handleInput({ detail: { value } }, type) { switch (type) { case 'roadSectionStart': setRoadSectionStart(value) @@ -360,20 +365,23 @@ const Index = () => { case "projectName": setProjectName(value) break; + case "wait": + setHandleCenter(value) + break; default: break; } } - function handleTypeChange (e) { + function handleTypeChange(e) { setReportType(e.detail.value) } - function handleImgChange (files, operationType, index, type) { + function handleImgChange(files, operationType, index, type) { if (operationType === 'remove') { setImg(false) } - function setImg (isAdd, url) { + function setImg(isAdd, url) { switch (type) { case 'scenePic': let nextImg = sceneImg @@ -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) { @@ -460,7 +478,7 @@ const Index = () => { } } - function handleImgClick (index, file) { + function handleImgClick(index, file) { Taro.previewImage({ urls: [file.url] // 需要预览的图片http链接列表 }) @@ -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 ( {/* { @@ -785,6 +855,40 @@ const Index = () => { : 上报 } + { + wait == 'wait' ? + *处理内容: + handleInput(e, 'wait')} + // disabled={isView} + maxLength={50} + /> + + 处理图片: + { + // isView ? + // + // {scenePic.map(item => ( + // handleImgClick(undefined, item)} /> + // ))} + // : + = 3 ? false : true} + files={handlePic} + onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'wait')} + onImageClick={handleImgClick} + /> + } + 提交 + + : '' + } ) } diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx index 0e7a6af0..6df2873c 100644 --- a/weapp/src/pages/user/index.jsx +++ b/weapp/src/pages/user/index.jsx @@ -111,6 +111,17 @@ const Index = ({ ...props }) => { : '' } + { + judgeRight('WXFEEDBACKMANAGE') ? + toMyReport('handle')}> + + + {isSuperAdmin || isAdmin ? '已办事项' : '已办事项'} + + + + : '' + } 修改密码 diff --git a/weapp/src/services/api.js b/weapp/src/services/api.js index 1db8b2d8..27bc5049 100644 --- a/weapp/src/services/api.js +++ b/weapp/src/services/api.js @@ -52,6 +52,11 @@ export const getProject = () => { return `/project` } +//待办事项提交 +export const postHandle = reportId => { + return `/report/${reportId}/handle`; +}; +