From 7bd85d5a6d9b2586387cbcff1cdcadfc6c1c95a6 Mon Sep 17 00:00:00 2001
From: Lou <luzhiping@qqyjz.com>
Date: Mon, 19 Feb 2024 17:32:08 +0800
Subject: [PATCH] 更新

---
 subPackage/label/check.vue |   94 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 77 insertions(+), 17 deletions(-)

diff --git a/subPackage/label/check.vue b/subPackage/label/check.vue
index 332cdf8..227b08c 100644
--- a/subPackage/label/check.vue
+++ b/subPackage/label/check.vue
@@ -97,7 +97,9 @@
 	} from "@/api/place/place.js"
 
 	import {
-		savePlaceCheck
+		savePlaceCheck,
+		getPlaceCheckDetail,
+		updatePlaceCheck
 	} from "@/api/reporting/reporting.js"
 
 	export default {
@@ -148,17 +150,59 @@
 				],
 				time: Number(new Date()),
 				showSelectDate: false,
-				dangerCount: 0 //隐患项数量
+				dangerCount: 0, //隐患项数量
+				isEdit: false
 
 			}
 		},
-		onLoad(option) {
-			this.info.houseCode = uni.getStorageSync("siteInfo").houseCode;
-			this.info.placeName = uni.getStorageSync("siteInfo").name;
-			this.getItem();
+		async onLoad(option) {
+			await this.getItem();
+			if (option.taskId) {
+				this.isEdit = true;
+				this.getDetail(option.taskId)
+			} else {
+				this.info.houseCode = uni.getStorageSync("siteInfo").houseCode;
+				this.info.placeName = uni.getStorageSync("siteInfo").name;
+			}
+
+
+
 		},
 
 		methods: {
+
+			getDetail(id) {
+				getPlaceCheckDetail({
+					taskId: id
+				}).then(res => {
+					let data = res.data;
+					for (let i = 0, ii = this.questionList.length; i < ii; i++) {
+						for (let k = 0, kk = this.questionList[i].children.length; k < kk; k++) {
+							for (let j = 0, jj = data.taskPlaceRecordVOList.length; j < jj; j++) {
+								if (this.questionList[i].children[k].id == data.taskPlaceRecordVOList[j].itemId) {
+									let children = this.questionList[i]
+									children.children[k].state = data.taskPlaceRecordVOList[j].state;
+									if (data.taskPlaceRecordVOList[j].imageUrls) {
+										children.children[k].urls = this.$setImageUrl(data.taskPlaceRecordVOList[j]
+											.imageUrls, 2);
+									}
+									children.children[k].remark = data.taskPlaceRecordVOList[j].remark || "";
+									this.$set(this.questionList, i, children)
+								}
+							}
+						}
+					}
+					this.info.remark = data.remark;
+					if (data.signaturePath) {
+						this.signatureUrl = this.$setFullUrl(data.signaturePath);
+						this.info.signaturePath = data.signaturePath;
+					}
+					this.form.images = this.$setImageUrl(data.imageUrls, 2)
+
+				})
+			},
+
+
 			getItem() {
 				getPlaceCheckItem().then(res => {
 					let data = res.data;
@@ -328,18 +372,34 @@
 
 				this.info.taskPlaceRecordVOList = this.getSelected()
 				this.info.status = 1;
-				savePlaceCheck(this.info).then(res => {
-					uni.hideLoading();
-					uni.showToast({
-						icon: 'success',
-						title: '提交成功',
-						success() {
-							setTimeout(() => {
-								uni.navigateBack();
-							}, 300)
-						}
+
+				if (this.isEdit) {
+					updatePlaceCheck(this.info).then(res => {
+						uni.hideLoading();
+						uni.showToast({
+							icon: 'success',
+							title: '提交成功',
+							success() {
+								setTimeout(() => {
+									uni.navigateBack();
+								}, 300)
+							}
+						})
 					})
-				})
+				} else {
+					savePlaceCheck(this.info).then(res => {
+						uni.hideLoading();
+						uni.showToast({
+							icon: 'success',
+							title: '提交成功',
+							success() {
+								setTimeout(() => {
+									uni.navigateBack();
+								}, 300)
+							}
+						})
+					})
+				}
 			},
 
 			previewImg() {

--
Gitblit v1.9.3