|
@@ -24,7 +24,7 @@
|
|
|
|
|
|
<script>
|
|
|
import {upload} from '@/api/system/upload.js'
|
|
|
- import {updateChecklistPoint} from '@/api/aqpt/checklistPoint.js'
|
|
|
+ import {updateChecklistPoint,getchecklistRecord} from '@/api/aqpt/checklistPoint.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -38,12 +38,10 @@
|
|
|
attachList:[]
|
|
|
},
|
|
|
rules:{},
|
|
|
- point:{}
|
|
|
+ point:{},
|
|
|
+ itemList:[]
|
|
|
}
|
|
|
},
|
|
|
- onBackPress() {
|
|
|
-
|
|
|
- },
|
|
|
onLoad() {
|
|
|
this.init()
|
|
|
},
|
|
@@ -51,7 +49,34 @@
|
|
|
init(){
|
|
|
let point=uni.getStorageSync('point');
|
|
|
this.point=point;
|
|
|
+ this.getchecklistRecord()
|
|
|
+ this.getLocation()
|
|
|
},
|
|
|
+ getchecklistRecord(){
|
|
|
+ let {checklistId,recordId}=uni.getStorageSync('point');
|
|
|
+ if(!checklistId)return
|
|
|
+ getchecklistRecord(checklistId,recordId).then((res)=>{
|
|
|
+ let itemList=res.data.itemList
|
|
|
+ let point=null
|
|
|
+ let points=[]
|
|
|
+ for(let i=0;i<itemList.length;i++){
|
|
|
+ if(itemList[i].children){
|
|
|
+ itemList[i].children.map(child=>{
|
|
|
+ child.recordList.map(pointitem=>{
|
|
|
+ points.push(point)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ itemList[i].recordList.map(pointitem=>{
|
|
|
+ points.push(pointitem)
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.itemList=points
|
|
|
+ this.handles=points.filter(item=>(!item.checkResult&&item.pointId!==this.point.pointId))
|
|
|
+ })
|
|
|
+ },
|
|
|
getLocation(){
|
|
|
const self=this;
|
|
|
uni.getLocation({
|
|
@@ -69,9 +94,21 @@
|
|
|
let filePath=this.formData.attachList[i].url
|
|
|
let fileresq=await upload({filePath,formData:{
|
|
|
additions: `经度:${this.formData.dutyLongitude};纬度:${this.formData.dutyLatitude}`
|
|
|
- }})
|
|
|
+ }}).catch(()=>{
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:"提交失败!"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ if(fileresq.includes('html')){
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:"图片上传异常"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
fileresq=JSON.parse(fileresq)
|
|
|
- attachList.push(fileresq.data)
|
|
|
+ attachList.push(fileresq.data)
|
|
|
}
|
|
|
await updateChecklistPoint({
|
|
|
recordId:point.recordId,
|
|
@@ -87,16 +124,18 @@
|
|
|
title:"提交失败!"
|
|
|
})
|
|
|
})
|
|
|
- this.batchHandle()
|
|
|
// uni.showToast({
|
|
|
// icon:'none',
|
|
|
// title:"提交成功!",
|
|
|
+ // duration:1000,
|
|
|
// complete() {
|
|
|
// uni.redirectTo({
|
|
|
// url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
|
|
|
// })
|
|
|
// }
|
|
|
// })
|
|
|
+ // this.goOnNext();
|
|
|
+ this.batchHandle()
|
|
|
},
|
|
|
// 批量处理未处理的
|
|
|
batchHandle(){
|
|
@@ -124,6 +163,35 @@
|
|
|
uni.setStorageSync('point',nextPoint);
|
|
|
this.point=nextPoint;
|
|
|
},
|
|
|
+ // 批量处理未处理的【按顺序走到最后一个】
|
|
|
+ goOnNext(){
|
|
|
+ let point=uni.getStorageSync('point')
|
|
|
+ let pointIdex=this.itemList.findIndex(item=>point.pointId===item.pointId)
|
|
|
+ let handles=this.itemList.slice(pointIdex+1);
|
|
|
+ let nextPointIdx=handles.findIndex(item=>(!item.checkResult))
|
|
|
+ nextPointIdx=nextPointIdx+pointIdex
|
|
|
+ if(handles.length<1||nextPointIdx<0){
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:"处理完毕",
|
|
|
+ duration:1000,
|
|
|
+ complete() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.formData={
|
|
|
+ checkResult:1,
|
|
|
+ remark:"",
|
|
|
+ attachList:[]
|
|
|
+ }
|
|
|
+ let nextPoint=this.itemList[nextPointIdx+1]
|
|
|
+ uni.setStorageSync('point',nextPoint);//防止测试刷新数据丢失
|
|
|
+ this.point=nextPoint;
|
|
|
+ },
|
|
|
uploadSuccess(e){
|
|
|
let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
|
|
|
attachList.push(e.tempFiles[0])
|