From a8ce30ce74fc04dddfa6fbdc913b23ce820bfbdf Mon Sep 17 00:00:00 2001 From: ww664853070 Date: Thu, 13 Jul 2023 16:31:36 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=B7=B2=E5=8A=9E=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 65 ++++++++++++++----------- weapp/src/packages/patrolView/index.jsx | 9 ++-- weapp/src/pages/home/index.jsx | 6 +-- weapp/src/pages/user/index.jsx | 4 +- 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 859da3ab..afefeb99 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/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 = () => { 上报 } { - wait == 'wait' ? + wait == 'wait' || handle == 'handle' ? *处理内容: handleInput(e, 'wait')} - // disabled={isView} + disabled={handle == 'handle' ? true : false} 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} - /> + handle == 'handle' ? + + {handlePic.map(item => ( + handleImgClicks(undefined, item)} /> + ))} + : + = 3 ? false : true} + files={handlePic} + onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'wait')} + onImageClick={handleImgClick} + /> } - 提交 + {handle != 'handle' ? 提交 : ''} : '' } diff --git a/weapp/src/packages/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx index 46efa25a..86cb0b8f 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/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 ( diff --git a/weapp/src/pages/home/index.jsx b/weapp/src/pages/home/index.jsx index 48d397d5..6d62fd8a 100644 --- a/weapp/src/pages/home/index.jsx +++ b/weapp/src/pages/home/index.jsx @@ -103,15 +103,13 @@ const Index = () => { : '' } { - isSuperAdmin || isAdmin ? + judgeRight('WXTODOLIST') ? 待 办 事 项 toPatrolView('wait') - : () => toPatrol('wait') }> - {isSuperAdmin || isAdmin ? '查看' : '填报'} + 查看 : '' } diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx index 6df2873c..f3e80b0d 100644 --- a/weapp/src/pages/user/index.jsx +++ b/weapp/src/pages/user/index.jsx @@ -112,11 +112,11 @@ const Index = ({ ...props }) => { : '' } { - judgeRight('WXFEEDBACKMANAGE') ? + judgeRight('WXDONELIST') ? toMyReport('handle')}> - {isSuperAdmin || isAdmin ? '已办事项' : '已办事项'} + 已办事项