Browse Source

查看巡查/养护上报逻辑

dev
liujiangyong 2 years ago
parent
commit
539050b3db
  1. 23
      weapp/src/packages/patrol/index.jsx

23
weapp/src/packages/patrol/index.jsx

@ -11,6 +11,7 @@ import { getState } from '../../store/globalState';
import { postReport, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle } from '@/services/api';
import './index.scss';
import arrowIcon from '../../static/img/patrol/arrow-down.svg';
import dayjs from 'dayjs';
const { baseUrl, imgUrl } = environment;
@ -197,6 +198,7 @@ const Index = () => {
unit: '块',
},
})
const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0
const prjType =
isAnomaly ?
@ -286,7 +288,7 @@ const Index = () => {
setConserveUnderwayPic(data.conserveUnderwayPic ? data.conserveUnderwayPic.map(item => ({ url: imgUrl + item })) : [])
setConserveAfterPic(data.conserveAfterPic ? data.conserveAfterPic.map(item => ({ url: imgUrl + item })) : [])
setHandleId(data.id)
setVideo(data.videoUrl[0] ? imgUrl + data.videoUrl[0] : '')
setVideo((data.videoUrl && data.videoUrl[0]) ? imgUrl + data.videoUrl[0] : '')
setRoadCodeHead(data.codeRoad ? data.codeRoad.slice(0, 1) : '')
setRoadCodeEnd(data.codeRoad ? data.codeRoad.slice(1) : '')
if (data.reportType === 'patrol') {
@ -314,6 +316,7 @@ const Index = () => {
if (data.handleContent) {
setHandleCenter(data.handleContent)
}
setIsBeforeReport(dayjs(data.time).diff('2023-08-02', 'd') < 0)
} else {
Taro.showToast({ title: res.data.message || '请求出错', icon: 'none' })
}
@ -900,7 +903,7 @@ const Index = () => {
{
isPatrol ? <>
<View className='code-choice'>
{!(isView && isBeforeReport) && <View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>线路编码
<RadioGroup onChange={(e) => {
setRoadCodeHead(e.detail.value[0]);
@ -917,13 +920,19 @@ const Index = () => {
onInput={e => handleInput(e, 'roadCodeEnd')}
disabled={isView}
/>
</View>
</View>}
<View className='code-choice'>
<Text style={{ color: 'red' }}>*&nbsp;</Text>道路类型
<Input
style={{ width: '30%' }}
type='text'
value={roadCodeHead === 'X' ? '县道' : roadCodeHead === 'Y' ? '乡道' : '村道'}
value={isView
? projectType
: roadCodeHead === 'X'
? '县道'
: roadCodeHead === 'Y'
? '乡道'
: '村道'}
onInput={() => { }}
disabled={true}
/>
@ -1004,7 +1013,7 @@ const Index = () => {
/> : ''
}
{
isAnomaly ?
isAnomaly || (isView && isBeforeReport) ?
<InputPickers
key={456} // keyselector
title='线路编码:'
@ -1073,7 +1082,7 @@ const Index = () => {
/>
</View>
{
kind === 'patrol' && <View className='patrol-content'>
(kind === 'patrol' && !(isView && isBeforeReport)) && <View className='patrol-content'>
<View className='title'>
<View><Text style={{ color: 'red' }}>*&nbsp;</Text>巡查内容</View>
</View>
@ -1160,7 +1169,7 @@ const Index = () => {
</View>
}
{
!isPatrol ? <AtTextarea
!isPatrol || (isView && isBeforeReport) ? <AtTextarea
title='巡查内容:'
placeholder={isView ? '' : '请输入具体内容'}
value={content}

Loading…
Cancel
Save