Преглед на файлове

Signed-off-by: zhaobao <528046418@qq.com>

zhaobao преди 1 година
родител
ревизия
e8036118ba
променени са 3 файла, в които са добавени 79 реда и са изтрити 11 реда
  1. 2 2
      config/index.js
  2. 76 8
      pages/app_views/checkList/form/form.vue
  3. 1 1
      utils/request.js

+ 2 - 2
config/index.js

@@ -1,9 +1,9 @@
 export default {
     base: {
       // dev: 'https://api.xazhyc.com',
-	  // dev: 'http://1.15.92.205:6001',
+	  dev: 'http://1.15.92.205:7001',
 	  // dev: 'http://192.168.3.253:7001',
-	  dev:"http://36.137.171.123:7001",
+	  // dev:"http://36.137.171.123:7001",
       // pro: 'https://api.xazhyc.com',
 	   pro: 'http://36.137.171.123:7001'
     },

+ 76 - 8
pages/app_views/checkList/form/form.vue

@@ -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])

+ 1 - 1
utils/request.js

@@ -64,7 +64,7 @@ function formatRequestBody(parmas) {
     header['AppKey'] = config.appKey
     header['AppSecret'] = config.appSecret	
 	header['ocId'] = qrcode.ocId
-	// header['AppType'] = 'mini'
+	header['AppType'] = 'h5-scan-mini'
 	if(unionid){header['wxCode'] = unionid}
 	if(isAccount){header['isAccount'] = isAccount}
 	let method = parmas.method || "get";