瀏覽代碼

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

zhaobao 1 年之前
父節點
當前提交
bcb9ccc00b

+ 123 - 16
pages/index/handle/task/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,15 +49,66 @@
 			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({
+					type: 'wgs84',
+					success: function (res) {
+						self.formData.dutyLongitude=res.longitude
+						self.formData.dutyLatitude=res.latitude
+					}
+				});		
 			},
 			async onSubmit() {
 				let point=uni.getStorageSync('point')
 				let attachList=[]
 				for(let i=0;i<this.formData.attachList.length;i++){
 					let filePath=this.formData.attachList[i].url
-					let fileresq=await upload({filePath})
+					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,
@@ -75,15 +124,73 @@
 						title:"提交失败!"
 					})				
 				})
-				uni.showToast({
-					icon:'none',
-					title:"提交成功!",
-					complete() {
-						uni.redirectTo({
-							url:`/pages/index/handle/task/task?rid=${point.recordId}&cid=${point.checklistId}`
-						})
-					}
-				})
+				// 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(){
+				let point=uni.getStorageSync('point')
+				if(this.handles.length<1){
+					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					
+				}
+				let nextPoint=this.handles[0]
+				this.formData={
+					checkResult:1,	
+					remark:"",
+					attachList:[]
+				}
+				this.handles.shift()
+				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))

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/handle/task/checkList/form/form.js.map


+ 36 - 9
unpackage/dist/dev/mp-weixin/pages/index/handle/task/checkList/form/form.js

@@ -282,15 +282,16 @@ var _default = {
                   });
                 });
               case 15:
-                uni.showToast({
-                  icon: 'none',
-                  title: "提交成功!",
-                  complete: function complete() {
-                    uni.redirectTo({
-                      url: "/pages/index/handle/task/task?rid=".concat(point.recordId, "&cid=").concat(point.checklistId)
-                    });
-                  }
-                });
+                _this.batchHandle();
+                // uni.showToast({
+                // 	icon:'none',
+                // 	title:"提交成功!",
+                // 	complete() {
+                // 		uni.redirectTo({
+                // 			url:`/pages/index/handle/task/task?rid=${point.recordId}&cid=${point.checklistId}`
+                // 		})
+                // 	}
+                // })
               case 16:
               case "end":
                 return _context.stop();
@@ -299,6 +300,32 @@ var _default = {
         }, _callee);
       }))();
     },
+    // 批量处理未处理的
+    batchHandle: function batchHandle() {
+      var point = uni.getStorageSync('point');
+      if (this.handles.length < 1) {
+        uni.showToast({
+          icon: 'none',
+          title: "处理完毕",
+          duration: 1000,
+          complete: function complete() {
+            uni.redirectTo({
+              url: "/pages/app_views/checkList/index/index?type=form&id=".concat(point.checklistId, "&recordId=").concat(point.recordId)
+            });
+          }
+        });
+        return;
+      }
+      var nextPoint = this.handles[0];
+      this.formData = {
+        checkResult: 1,
+        remark: "",
+        attachList: []
+      };
+      this.handles.shift();
+      uni.setStorageSync('point', nextPoint);
+      this.point = nextPoint;
+    },
     uploadSuccess: function uploadSuccess(e) {
       var attachList = JSON.parse(JSON.stringify(this.formData.attachList));
       attachList.push(e.tempFiles[0]);

+ 21 - 15
unpackage/dist/dev/mp-weixin/project.config.json

@@ -1,8 +1,7 @@
 {
   "description": "项目配置文件。",
   "packOptions": {
-    "ignore": [],
-    "include": []
+    "ignore": []
   },
   "setting": {
     "urlCheck": false,
@@ -10,21 +9,28 @@
     "postcss": false,
     "minified": false,
     "newFeature": true,
-    "bigPackageSizeSupport": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
-    },
-    "condition": false
+    "bigPackageSizeSupport": true
   },
   "compileType": "miniprogram",
-  "libVersion": "3.1.0",
-  "appid": "wxf98223d6e4c7c1a9",
+  "libVersion": "",
+  "appid": "touristappid",
   "projectname": "六院联创",
-  "condition": {},
-  "editorSetting": {
-    "tabIndent": "insertSpaces",
-    "tabSize": 2
+  "condition": {
+    "search": {
+      "current": -1,
+      "list": []
+    },
+    "conversation": {
+      "current": -1,
+      "list": []
+    },
+    "game": {
+      "current": -1,
+      "list": []
+    },
+    "miniprogram": {
+      "current": -1,
+      "list": []
+    }
   }
 }

部分文件因文件數量過多而無法顯示