From db8e416fec0ab844026eb7bc91d9f59a457f4e6e Mon Sep 17 00:00:00 2001
From: Lou <luzhiping@qqyjz.com>
Date: Tue, 16 Jan 2024 17:41:30 +0800
Subject: [PATCH] 标签事件审核调整,优化

---
 subPackage/label/bail.vue |   81 +++++++++++++++++++++++++++++++++-------
 1 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/subPackage/label/bail.vue b/subPackage/label/bail.vue
index e2b792c..f511829 100644
--- a/subPackage/label/bail.vue
+++ b/subPackage/label/bail.vue
@@ -67,7 +67,9 @@
 <script>
 	import uploadMixin from "@/mixin/uploadMixin";
 	import {
-		saveBailReporting
+		saveBailReporting,
+		getBailReportingDetail,
+		updateBailReporting
 	} from "@/api/reporting/reporting";
 	export default {
 		mixins: [uploadMixin],
@@ -131,10 +133,18 @@
 					}
 				},
 				showSelectDate: false,
-				applyTime: Number(new Date())
+				applyTime: Number(new Date()),
+				status: "",
+				isEdit: false
 			}
 		},
 		onLoad(option) {
+
+			if (option.id) {
+				this.isEdit = true;
+				this.getDetail(option.id)
+			}
+
 			let siteInfo = uni.getStorageSync("siteInfo");
 			let userInfo = uni.getStorageSync("userInfo");
 			this.$set(this.info, "houseCode", siteInfo.houseCode);
@@ -150,6 +160,29 @@
 		},
 
 		methods: {
+
+
+			getDetail(id) {
+				getBailReportingDetail({
+					taskId: id
+				}).then(res => {
+					if (res.code == 200) {
+						for (let i in this.info) {
+							this.info[i] = res.data[i]
+						}
+						this.info.reportType = 1;
+						this.status = data.confirmFlag;
+						if (res.data.applyTime) {
+							this.applyTime = Number(new Date(res.data.applyTime))
+						}
+						this.form.images = this.$setImageUrl(data.locationImageUrls, 2);
+						this.info.locationImageUrls = data.locationImageUrls;
+						this.info.id = data.id;
+						this.info.taskId = data.taskId;
+					}
+				})
+			},
+
 
 			getLocation() {
 				uni.chooseLocation({
@@ -195,20 +228,40 @@
 			sumitInfo() {
 				this.$refs.form.validate().then(valid => {
 					this.checkImages();
-					saveBailReporting(this.info).then(res => {
-						uni.showToast({
-							icon: 'success',
-							title: '提交成功',
-							success() {
-								setTimeout(() => {
-									// this.$u.func.globalNavigator("", "navBack")
-									uni.navigateBack()
-								}, 1000)
-							}
-						})
-					})
+					if (this.isEdit) {
+						this.info.status = 1;
+						this.updateRequest()
+					} else {
+						this.addRequest()
+					}
 				})
 			},
+
+
+			addRequest() {
+				saveBailReporting(this.info).then(res => {
+					uni.showToast({
+						icon: 'success',
+						title: '提交成功'
+					})
+					setTimeout(() => {
+						uni.navigateBack()
+					}, 300)
+				})
+			},
+
+			updateRequest() {
+				updateBailReporting(this.info).then(res => {
+					uni.showToast({
+						icon: 'success',
+						title: '保存成功'
+					})
+					setTimeout(() => {
+						uni.navigateBack()
+					}, 300)
+				})
+			},
+
 			navigatorPage() {
 				this.$u.func.globalNavigator('bailList', "navTo")
 			}

--
Gitblit v1.9.3