|
|
@ -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, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle } from '@/services/api'; |
|
|
|
import { postReport, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle, getAllDepUsers, getUsers } from '@/services/api'; |
|
|
|
import './index.scss'; |
|
|
|
import arrowIcon from '../../static/img/patrol/arrow-down.svg'; |
|
|
|
import dayjs from 'dayjs'; |
|
|
@ -25,6 +25,7 @@ const Index = () => { |
|
|
|
const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false |
|
|
|
const isRoad = kind === 'road' ? true : false |
|
|
|
const isAnomaly = kind === 'anomaly' ? true : false |
|
|
|
const noDel = wait === 'wait' || handle === 'handle' |
|
|
|
|
|
|
|
const [reportType, setReportType] = useState(kind || 'patrol') // 上报类型 |
|
|
|
const [projectType, setProjectType] = useState('') // 工程类型 |
|
|
@ -60,7 +61,7 @@ const Index = () => { |
|
|
|
const [handleId, setHandleId] = useState([]) |
|
|
|
const [video, setVideo] = useState('') |
|
|
|
const [videoqn, setVideoqn] = useState([]) |
|
|
|
const [handleType, setHandleType] = useState('') |
|
|
|
const [handleState, setHandleState] = useState('') |
|
|
|
|
|
|
|
const [roadCodeHead, setRoadCodeHead] = useState('X') |
|
|
|
const [roadCodeEnd, setRoadCodeEnd] = useState('') |
|
|
@ -201,6 +202,12 @@ const Index = () => { |
|
|
|
const [otherDescription, setOtherDescription] = useState('') // 其他养护内容 |
|
|
|
const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0上报内容修改,查看时根据时间判断展示逻辑) |
|
|
|
|
|
|
|
const [isAppoint, setIsAppoint] = useState(true) // 指派 / 不处理 |
|
|
|
const [allDepUsers, setAllDepUsers] = useState([]) // 所有部门用户列表 |
|
|
|
const [userList, setUserList] = useState([]) // 所有用户列表 |
|
|
|
const [appointUser, setAppointUser] = useState(null) // 责任人在userList的index |
|
|
|
const [handleAdvice, setHandleAdvice] = useState('') // 处理意见 |
|
|
|
|
|
|
|
const prjType = |
|
|
|
isAnomaly ? |
|
|
|
[ |
|
|
@ -282,7 +289,7 @@ const Index = () => { |
|
|
|
setRoadSectionEnd(data.roadSectionEnd) |
|
|
|
setAddress(data.address) |
|
|
|
setContent(data.content) |
|
|
|
setHandleType(data.handleState) |
|
|
|
setHandleState(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 })) : []) |
|
|
@ -314,6 +321,9 @@ const Index = () => { |
|
|
|
}) |
|
|
|
setConserveContent(nextContent) |
|
|
|
setOtherDescription(data.otherDescription) |
|
|
|
} else if (data.reportType === 'anomaly') { |
|
|
|
setAppointUser(data.performerId) |
|
|
|
setHandleAdvice(data.handleAdvice) |
|
|
|
} |
|
|
|
if (data.handleContent) { |
|
|
|
setHandleCenter(data.handleContent) |
|
|
@ -401,6 +411,19 @@ const Index = () => { |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (isSuperAdmin && kind === 'anomaly') { |
|
|
|
request.get(getAllDepUsers()).then(res => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setAllDepUsers(res.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
request.get(getUsers()).then(res => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
const users = res.data.filter(u => u.phone !== 'SuperAdmin' && u.isAdmin) |
|
|
|
setUserList(users) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, []) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
@ -829,19 +852,36 @@ const Index = () => { |
|
|
|
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 |
|
|
|
if (!isSuperAdmin) { |
|
|
|
if (!str) { |
|
|
|
Taro.showToast({ title: '请完善处理内容', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
if (str.length > 50) { |
|
|
|
Taro.showToast({ title: '内容字数不能超过50', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (isAppoint && appointUser === null) { |
|
|
|
Taro.showToast({ title: '请选择责任人', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
let data = { |
|
|
|
handleContent: str, |
|
|
|
handlePic: handlePicPn, |
|
|
|
handleState: '已处理' |
|
|
|
let data = {} |
|
|
|
if (isSuperAdmin) { |
|
|
|
data = { |
|
|
|
handleState: isAppoint ? '已指派' : '不处理', |
|
|
|
performerId: userList[appointUser].id, |
|
|
|
handleAdvice, |
|
|
|
} |
|
|
|
} else { |
|
|
|
data = { |
|
|
|
handleContent: str, |
|
|
|
handlePic: handlePicPn, |
|
|
|
handleState: '已处理' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Taro.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '您要进行处理提交吗?', |
|
|
@ -1399,43 +1439,122 @@ const Index = () => { |
|
|
|
</view> |
|
|
|
} |
|
|
|
{ |
|
|
|
isView ? |
|
|
|
isSuperAdmin && |
|
|
|
<AtButton type='primary' className='del-btn' onClick={deleteReport}>删除</AtButton> |
|
|
|
: |
|
|
|
<AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton> |
|
|
|
!isPatrol && (handleState == '已处理' || wait == 'wait' || handle == 'handle') ? <> |
|
|
|
{ |
|
|
|
isSuperAdmin && (wait === 'wait' || kind === 'handle') && <View className='appoint'> |
|
|
|
{ |
|
|
|
handleState === '待处理' ? // 管理员指派 |
|
|
|
<> |
|
|
|
<RadioGroup onChange={(e) => { |
|
|
|
setIsAppoint(e.detail.value === '指派' ? true : false) |
|
|
|
}}> |
|
|
|
<Radio value='指派' checked={isAppoint} color='#0080EE' className='radio'>指派</Radio> |
|
|
|
<Radio value='不处理' checked={!isAppoint} color='#0080EE' className='radio' style={{ marginLeft: 10 }}>不处理</Radio> |
|
|
|
</RadioGroup> |
|
|
|
{ |
|
|
|
isAppoint && <> |
|
|
|
<View className='picker'> |
|
|
|
<Text>责任人:{appointUser !== null ? userList[appointUser]?.name : ''}</Text> |
|
|
|
<Picker |
|
|
|
mode='selector' |
|
|
|
range={userList} |
|
|
|
rangeKey='name' |
|
|
|
onChange={e => setAppointUser(Number(e.detail.value))} |
|
|
|
> |
|
|
|
<Image src={arrowIcon} className='arrow' /> |
|
|
|
</Picker> |
|
|
|
</View> |
|
|
|
<Textarea |
|
|
|
placeholder='请输入处理意见' |
|
|
|
value={handleAdvice} |
|
|
|
onInput={e => setHandleAdvice(e.target.value)} |
|
|
|
disabled={isView && handleState !== '待处理'} |
|
|
|
maxlength={1024} |
|
|
|
/> |
|
|
|
</> |
|
|
|
} |
|
|
|
</> |
|
|
|
: // 管理员查看 |
|
|
|
<> |
|
|
|
{/* { |
|
|
|
handleState === '不处理' && <Text> |
|
|
|
处理结果:暂不进行处理 |
|
|
|
</Text> |
|
|
|
} */} |
|
|
|
{/* { |
|
|
|
(handleState === '已指派' || handleState === '已处理') && <> |
|
|
|
<View>处理意见:</View> |
|
|
|
<View>{handleAdvice}</View> |
|
|
|
<View style={{ marginTop: 10 }}>责任人:</View> |
|
|
|
<View>{appointUser !== null ? allDepUsers.find(d => d.depId === userList[appointUser]?.departmentId)?.depName : ''}-{appointUser !== null ? userList[appointUser]?.name : ''}</View> |
|
|
|
</> |
|
|
|
} */} |
|
|
|
</> |
|
|
|
} |
|
|
|
</View> |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
handleState !== '待处理' && <View style={{ backgroundColor: '#fff', padding: 10 }}> |
|
|
|
{ |
|
|
|
isSuperAdmin && handleState === '不处理' && <Text> |
|
|
|
处理结果:暂不进行处理 |
|
|
|
</Text> |
|
|
|
} |
|
|
|
{ |
|
|
|
(!isSuperAdmin || (isSuperAdmin && (handleState === '已指派' || handleState === '已处理'))) && <> |
|
|
|
<View>处理意见:</View> |
|
|
|
<View>{handleAdvice}</View> |
|
|
|
</> |
|
|
|
} |
|
|
|
{ |
|
|
|
(isSuperAdmin && (handleState === '已指派' || handleState === '已处理')) && <> |
|
|
|
<View style={{ marginTop: 10 }}>责任人:</View> |
|
|
|
<View>{appointUser !== null ? allDepUsers.find(d => d.depId === userList[appointUser]?.departmentId)?.depName : ''}-{appointUser !== null ? userList[appointUser]?.name : ''}</View> |
|
|
|
</> |
|
|
|
} |
|
|
|
</View> |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
((isSuperAdmin && handleState == '已处理') || !isSuperAdmin) && <> |
|
|
|
<View className='patrol-img'><Text style={{ color: 'red' }}>*</Text>处理内容:</View> |
|
|
|
<AtTextarea |
|
|
|
placeholder='请输入处理内容' |
|
|
|
value={handleCenter} |
|
|
|
onChange={(v, e) => handleInput(e, 'wait')} |
|
|
|
disabled={handle == 'handle' ? true : false} |
|
|
|
maxLength={50} |
|
|
|
/> |
|
|
|
<View className='patrol-img'> |
|
|
|
处理图片: |
|
|
|
{ |
|
|
|
handle == 'handle' || handleState == '已处理' ? |
|
|
|
<View className='img-box'> |
|
|
|
{handlePic.map(item => ( |
|
|
|
<Image className='img' src={item.url} onClick={() => handleImgClicks(undefined, item)} /> |
|
|
|
))} |
|
|
|
</View> : handleState != '已处理' ? |
|
|
|
<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} |
|
|
|
/> : '' |
|
|
|
} |
|
|
|
</View> |
|
|
|
</> |
|
|
|
} |
|
|
|
|
|
|
|
{handle != 'handle' && handleState != '已处理' ? <AtButton type='primary' className='sub-btn' onClick={handleOk}>提交</AtButton> : ''} |
|
|
|
</> : '' |
|
|
|
} |
|
|
|
{ |
|
|
|
!isPatrol && (handleType == '已处理' || wait == 'wait' || handle == 'handle') ? <view> |
|
|
|
<view className='patrol-img'><text style={{ color: 'red' }}>*</text>处理内容:</view> |
|
|
|
<AtTextarea |
|
|
|
title='处理内容:' |
|
|
|
value={handleCenter} |
|
|
|
onChange={(v, e) => handleInput(e, 'wait')} |
|
|
|
disabled={handle == 'handle' ? true : false} |
|
|
|
maxLength={50} |
|
|
|
/> |
|
|
|
<View className='patrol-img'> |
|
|
|
处理图片: |
|
|
|
{ |
|
|
|
handle == 'handle' || handleType == '已处理' ? |
|
|
|
<View className='img-box'> |
|
|
|
{handlePic.map(item => ( |
|
|
|
<Image className='img' src={item.url} onClick={() => handleImgClicks(undefined, item)} /> |
|
|
|
))} |
|
|
|
</View> : handleType != '已处理' ? |
|
|
|
<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' && handleType != '已处理' ? <AtButton type='primary' className='sub-btn' onClick={handleOk}>提交</AtButton> : ''} |
|
|
|
</View> |
|
|
|
</view> : '' |
|
|
|
isView |
|
|
|
? isSuperAdmin && !noDel && <AtButton type='primary' className='del-btn' onClick={deleteReport}>删除</AtButton> |
|
|
|
: <AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton> |
|
|
|
} |
|
|
|
<AtMessage /> |
|
|
|
</View > |
|
|
|