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 [handlePicPn, setHandlePicPn] = useState([])
const [handleId, setHandleId] = useState([])
const [video, setVideo] = useState('')
const prjType =
isAnomaly ?
@ -241,7 +242,7 @@ const Index = () => {
])
}, [reportType])
function report () {
function report() {
if (!canReport) { return }
if (
(isPatrol && (!projectType || !road))
@ -317,7 +318,7 @@ const Index = () => {
})
}
function deleteReport () {
function deleteReport() {
Taro.showModal({
title: '提示',
content: '确定删除吗?',
@ -344,7 +345,7 @@ const Index = () => {
})
}
function handleInput ({ detail: { value } }, type) {
function handleInput({ detail: { value } }, type) {
switch (type) {
case 'roadSectionStart':
setRoadSectionStart(value)
@ -379,15 +380,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
@ -462,6 +463,7 @@ const Index = () => {
default:
break;
}
console.log(files, '==============');
for (i; i < files.length; i++) {
const tempFilePaths = files[i].url
let token = getState('token') || Taro.getStorageSync('token')
@ -484,19 +486,19 @@ 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
})
}
useEffect(() => {
if (!isView) {
let newRoadList = roadList.filter(e => e?.routeName?.match(road))
let newRoadList = roadList.filter(e => e.routeName.match(road))
let codeRoadSel = []
if (newRoadList.length && road != '') {
newRoadList.forEach((e, index) => {
@ -511,7 +513,7 @@ const Index = () => {
}
}
}, [road])
function handleOk () {
function handleOk() {
if (!canReport) { return }
let str = handleCenter.trim()
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 (
<View className='patrol'>
{/* {
@ -600,7 +632,6 @@ const Index = () => {
onInput={setProjectType}
selector={prjTypeSelector}
isView={isView}
onlySelect={true}
/> : ''
}
@ -610,9 +641,7 @@ const Index = () => {
title='反馈类型:'
placeholder='请选择反馈类型'
value={projectType}
onInput={(v) => {
setProjectType(v)
}}
onInput={setProjectType}
selector={prjTypeSelector}
isView={isView}
onlySelect={true}
@ -861,6 +890,20 @@ const Index = () => {
}
</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 ?
isSuperAdmin &&

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

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

Loading…
Cancel
Save