Browse Source

(fixed)11730 小程序待办事项-待办事项展示了未指派的数据

dev
ww664853070 2 years ago
parent
commit
966ff06798
  1. 71
      weapp/src/packages/patrol/index.jsx
  2. 3
      weapp/src/packages/patrolView/index.jsx

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

@ -57,6 +57,7 @@ const Index = () => {
const [handlePic, setHandlePic] = useState([]) const [handlePic, setHandlePic] = useState([])
const [handlePicPn, setHandlePicPn] = useState([]) const [handlePicPn, setHandlePicPn] = useState([])
const [handleId, setHandleId] = useState([]) const [handleId, setHandleId] = useState([])
const [video, setVideo] = useState('')
const prjType = const prjType =
isAnomaly ? isAnomaly ?
@ -241,7 +242,7 @@ const Index = () => {
]) ])
}, [reportType]) }, [reportType])
function report () { function report() {
if (!canReport) { return } if (!canReport) { return }
if ( if (
(isPatrol && (!projectType || !road)) (isPatrol && (!projectType || !road))
@ -317,7 +318,7 @@ const Index = () => {
}) })
} }
function deleteReport () { function deleteReport() {
Taro.showModal({ Taro.showModal({
title: '提示', title: '提示',
content: '确定删除吗?', content: '确定删除吗?',
@ -344,7 +345,7 @@ const Index = () => {
}) })
} }
function handleInput ({ detail: { value } }, type) { function handleInput({ detail: { value } }, type) {
switch (type) { switch (type) {
case 'roadSectionStart': case 'roadSectionStart':
setRoadSectionStart(value) setRoadSectionStart(value)
@ -379,15 +380,15 @@ const Index = () => {
} }
} }
function handleTypeChange (e) { function handleTypeChange(e) {
setReportType(e.detail.value) setReportType(e.detail.value)
} }
function handleImgChange (files, operationType, index, type) { function handleImgChange(files, operationType, index, type) {
if (operationType === 'remove') { if (operationType === 'remove') {
setImg(false) setImg(false)
} }
function setImg (isAdd, url) { function setImg(isAdd, url) {
switch (type) { switch (type) {
case 'scenePic': case 'scenePic':
let nextImg = sceneImg let nextImg = sceneImg
@ -462,6 +463,7 @@ const Index = () => {
default: default:
break; break;
} }
console.log(files, '==============');
for (i; i < files.length; i++) { for (i; i < files.length; i++) {
const tempFilePaths = files[i].url const tempFilePaths = files[i].url
let token = getState('token') || Taro.getStorageSync('token') let token = getState('token') || Taro.getStorageSync('token')
@ -484,19 +486,19 @@ const Index = () => {
} }
} }
function handleImgClick (index, file) { function handleImgClick(index, file) {
Taro.previewImage({ Taro.previewImage({
urls: [file.url] // http urls: [file.url] // http
}) })
} }
function handleImgClicks (index, file) { function handleImgClicks(index, file) {
Taro.previewImage({ Taro.previewImage({
urls: [file] // http urls: [file] // http
}) })
} }
useEffect(() => { useEffect(() => {
if (!isView) { if (!isView) {
let newRoadList = roadList.filter(e => e?.routeName?.match(road)) let newRoadList = roadList.filter(e => e.routeName.match(road))
let codeRoadSel = [] let codeRoadSel = []
if (newRoadList.length && road != '') { if (newRoadList.length && road != '') {
newRoadList.forEach((e, index) => { newRoadList.forEach((e, index) => {
@ -511,7 +513,7 @@ const Index = () => {
} }
} }
}, [road]) }, [road])
function handleOk () { function handleOk() {
if (!canReport) { return } if (!canReport) { return }
let str = handleCenter.trim() let str = handleCenter.trim()
if (!str) { if (!str) {
@ -562,6 +564,36 @@ const Index = () => {
} }
}) })
} }
function addVideo() {
wx.chooseMedia({
count: 1,
mediaType: ['video'],
sourceType: ['album', 'camera'],
maxDuration: 15,
camera: 'back',
success(res) {
console.log(res, 'res');
const tempFilePaths = res.tempFiles[0].tempFilePath
let token = getState('token') || Taro.getStorageSync('token')
Taro.uploadFile({
url: `${baseUrl}${postImage()}?token=${token}`,
filePath: tempFilePaths,
name: 'file',
success: (ress) => {
console.log(ress, '上传成功');
Taro.hideLoading();
if (ress.statusCode == 200) {
setVideo(res.tempFiles[0].tempFilePath)
} else {
Taro.showToast({ title: '上传失败,请重试', icon: 'error' })
}
}
});
}
})
}
console.log(video, 'video');
console.log(scenePic, 'tupia');
return ( return (
<View className='patrol'> <View className='patrol'>
{/* { {/* {
@ -600,7 +632,6 @@ const Index = () => {
onInput={setProjectType} onInput={setProjectType}
selector={prjTypeSelector} selector={prjTypeSelector}
isView={isView} isView={isView}
onlySelect={true}
/> : '' /> : ''
} }
@ -610,9 +641,7 @@ const Index = () => {
title='反馈类型:' title='反馈类型:'
placeholder='请选择反馈类型' placeholder='请选择反馈类型'
value={projectType} value={projectType}
onInput={(v) => { onInput={setProjectType}
setProjectType(v)
}}
selector={prjTypeSelector} selector={prjTypeSelector}
isView={isView} isView={isView}
onlySelect={true} onlySelect={true}
@ -861,6 +890,20 @@ const Index = () => {
} }
</View> </View>
} }
{
video.length ? <Video
style={{ width: '90%', marginLeft: '-45%', left: '50%', marginBottom: 20 }}
src={video}
poster='../../static/img/date.png'
initialTime={0}
controls={true}
autoplay={false}
loop={false}
muted={false}
/> : ''
}
<AtButton type='secondary' size='small' onClick={addVideo}>添加视频</AtButton>
{ {
isView ? isView ?
isSuperAdmin && isSuperAdmin &&

3
weapp/src/packages/patrolView/index.jsx

@ -40,6 +40,8 @@ function Index() {
Taro.setNavigationBarTitle({ title: '在建项目' }) Taro.setNavigationBarTitle({ title: '在建项目' })
} else if (isAnomaly) { } else if (isAnomaly) {
Taro.setNavigationBarTitle({ title: '异常反馈' }) Taro.setNavigationBarTitle({ title: '异常反馈' })
}else if(ishandle){
Taro.setNavigationBarTitle({ title: '已办事项' })
} else if (kind == 'conserve') { } else if (kind == 'conserve') {
Taro.setNavigationBarTitle({ title: '养护上报' }) Taro.setNavigationBarTitle({ title: '养护上报' })
} else if (isWait) { } else if (isWait) {
@ -77,6 +79,7 @@ function Index() {
reportType: isWait || ishandle ? 'anomaly' : reportType, reportType: isWait || ishandle ? 'anomaly' : reportType,
userId: filter === 'my' ? userInfo.id : '', userId: filter === 'my' ? userInfo.id : '',
handleState: isWait ? '待处理' : ishandle ? '已处理' : '', handleState: isWait ? '待处理' : ishandle ? '已处理' : '',
performerId: isWait || ishandle ? userInfo.id : ''
} }
request.get(getReportList(), data).then(res => { request.get(getReportList(), data).then(res => {
Taro.hideLoading() Taro.hideLoading()

Loading…
Cancel
Save