diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 4c111472..c718fb41 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -59,6 +59,7 @@ const Index = () => { const [handleId, setHandleId] = useState([]) const [video, setVideo] = useState('') const [videoqn, setVideoqn] = useState([]) + const [handleType, setHandleType] = useState('') const prjType = isAnomaly ? @@ -140,13 +141,14 @@ const Index = () => { setRoadSectionEnd(data.roadSectionEnd) setAddress(data.address) setContent(data.content) + setHandleType(data.handleState) setScenePic(data.scenePic ? data.scenePic.map(item => ({ url: imgUrl + item })) : []) setHandlePic(data.handlePic ? data.handlePic.map(item => ({ url: imgUrl + item })) : []) 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) - setVideo(imgUrl + data.videoUrl[0]) + setVideo(data.videoUrl[0] ? imgUrl + data.videoUrl[0] : '') if (data.handleContent) { setHandleCenter(data.handleContent) } @@ -249,7 +251,7 @@ const Index = () => { ]) }, [reportType]) - function report () { + function report() { if (!canReport) { return } if ( (isPatrol && (!projectType || !road)) @@ -326,7 +328,7 @@ const Index = () => { }) } - function deleteReport () { + function deleteReport() { Taro.showModal({ title: '提示', content: '确定删除吗?', @@ -353,7 +355,7 @@ const Index = () => { }) } - function handleInput ({ detail: { value } }, type) { + function handleInput({ detail: { value } }, type) { switch (type) { case 'roadSectionStart': setRoadSectionStart(value) @@ -388,15 +390,15 @@ const Index = () => { } } - 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 @@ -496,12 +498,12 @@ const Index = () => { } } - function handleImgClick (index, file) { + function handleImgClick(index, file) { Taro.previewImage({ urls: [file.url] // 需要预览的图片http链接列表 }) } - function handleImgClicks (index, file) { + function handleImgClicks(index, file) { Taro.previewImage({ urls: [file] // 需要预览的图片http链接列表 }) @@ -523,7 +525,7 @@ const Index = () => { } } }, [road]) - function handleOk () { + function handleOk() { if (!canReport) { return } let str = handleCenter.trim() if (!str) { @@ -568,7 +570,7 @@ const Index = () => { } }) } - function addVideo () { + function addVideo() { wx.chooseMedia({ count: 1, mediaType: ['video'], @@ -611,6 +613,7 @@ const Index = () => { } }) } + console.log(handleType,'handleType'); return ( {/* { @@ -941,11 +944,10 @@ const Index = () => { 上报 } { - wait == 'wait' || handle == 'handle' ? + handleType == '已处理' || wait == 'wait' || handle == 'handle' ? *处理内容: handleInput(e, 'wait')} disabled={handle == 'handle' ? true : false} @@ -959,15 +961,15 @@ const Index = () => { {handlePic.map(item => ( handleImgClicks(undefined, item)} /> ))} - : - = 3 ? false : true} - files={handlePic} - onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'wait')} - onImageClick={handleImgClick} - /> + : handleType != '已处理' ? + = 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 f0b524f0..8e773d6a 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/weapp/src/packages/patrolView/index.jsx @@ -14,7 +14,7 @@ import patrolActiveIcon from '../../static/img/patrolView/patrol-active.svg' import conserveIcon from '../../static/img/patrolView/conserve.svg' import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg' -function Index () { +function Index() { const userInfo = Taro.getStorageSync('userInfo') || {}; const router = useRouter() const { params: { filter, kind, } } = router @@ -32,6 +32,8 @@ function Index () { const [systemInfo, setSystemInfo] = useState('') const [page, setPage] = useState(0) const [num, setNum] = useState(Math.random()) + const [typeSearchList, setTypeSearchList] = useState(['全部', '待处理', '不处理', '已处理']) + const [typeSearch, setTypeSearch] = useState('全部') const limit = 10 @@ -54,13 +56,13 @@ function Index () { useEffect(() => { setPage(0) setNum(Math.random()) - }, [reportType, datePicker]) + }, [reportType, datePicker, typeSearch]) useEffect(() => { getList(page == 0 ? true : false) }, [num]) - function dealError (error) { + function dealError(error) { Taro.showToast({ title: error, icon: 'none', @@ -70,6 +72,12 @@ function Index () { } const getList = (isInit) => { Taro.showLoading({ title: '加载中' }) + let handleState = '' + if (typeSearch != '全部') { + handleState = typeSearch + } else { + handleState = isWait ? '待处理' : ishandle ? '已处理' : '' + } const data = { limit, page, @@ -78,7 +86,7 @@ function Index () { keyword: filterText, reportType: isWait || ishandle ? 'anomaly' : reportType, userId: filter === 'my' && !ishandle ? userInfo.id : '', - handleState: isWait ? '待处理' : ishandle ? '已处理' : '', + handleState: handleState, performerId: isWait || ishandle ? userInfo.id : '' } request.get(getReportList(), data).then(res => { @@ -143,7 +151,9 @@ function Index () { const handleDetail = index => { 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' : ''}&videoShow=${kind == 'wait' || kind == 'handle' ? 'videoShow' : ''}` }) } - + const setType = (e) => { + setTypeSearch(e.detail.value == 1 ? '待处理' : e.detail.value == 2 ? '不处理' : e.detail.value == 3 ? '已处理' : '全部') + } return ( {/* { @@ -163,7 +173,7 @@ function Index () { } */} - + 日期: + { + kind == 'anomaly' ? + 状态: + + {typeSearch} + + + : '' + } { , - isAnomaly && record.handleState != '已处理' && record.performerId === null && user?.username === 'SuperAdmin' ? + isAnomaly && record.handleState != '不处理' && record.performerId === null && user?.username === 'SuperAdmin' ? : null, - isAnomaly && record.handleState != '已处理' && record.performerId === null && user?.username === 'SuperAdmin' ? + isAnomaly && record.handleState != '不处理' && record.performerId === null && user?.username === 'SuperAdmin' ? < Popover content={ [
-