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] 更新

---
 common/common.js                               |    9 ++
 subPackage/workbench/views/patrol.vue          |    9 +-
 api/reporting/reporting.js                     |   12 ++
 main.js                                        |    5 
 subPackage/label/check.vue                     |   94 +++++++++++++++++++----
 subPackage/workbench/views/selfCheckDetail.vue |    2 
 subPackage/workbench/views/workLog.vue         |   54 +++++++++---
 subPackage/article/detail.vue                  |    2 
 8 files changed, 146 insertions(+), 41 deletions(-)

diff --git a/api/reporting/reporting.js b/api/reporting/reporting.js
index a650d55..f5ab196 100644
--- a/api/reporting/reporting.js
+++ b/api/reporting/reporting.js
@@ -189,7 +189,7 @@
 	})
 }
 
-//消防自查
+//消防自查提交
 export const savePlaceCheck = (data) => {
 	return http.request({
 		url: '/blade-taskPlaceSelfCheck/taskPlaceSelfCheck/saveTwo',
@@ -198,6 +198,16 @@
 	})
 }
 
+//消防自查保存
+export const updatePlaceCheck = (data) => {
+	return http.request({
+		url: '/blade-taskPlaceSelfCheck/taskPlaceSelfCheck/saveTwo',
+		method: 'POST',
+		data: data
+	})
+}
+
+
 //消防自查详情
 export const getPlaceCheckDetail = (params) => {
 	return http.request({
diff --git a/common/common.js b/common/common.js
index a3b6d85..0ad6457 100644
--- a/common/common.js
+++ b/common/common.js
@@ -29,6 +29,15 @@
 	}
 }
 
+/**
+ * 
+ *  显示完整路径
+ */
+export const setFullUrl = (str) => {
+	return `${minioBaseUrl}${str}`
+}
+
+
 
 export const showTips = (text, icon) => {
 	uni.showToast({
diff --git a/main.js b/main.js
index 6ce6062..5dc2771 100644
--- a/main.js
+++ b/main.js
@@ -10,7 +10,8 @@
 	showTips,
 	getIndex,
 	formattingUrls,
-	setLabelColor
+	setLabelColor,
+	setFullUrl
 } from '@/common/common.js'
 Vue.config.productionTip = false;
 
@@ -42,7 +43,7 @@
 Vue.prototype.$getIndex = getIndex;
 Vue.prototype.$formattingUrls = formattingUrls;
 Vue.prototype.$setLabelColor = setLabelColor;
-
+Vue.prototype.$setFullUrl = setFullUrl
 // 公共函数
 import globalFunc from '@/utils/func.js'
 Vue.use(globalFunc, app);
diff --git a/subPackage/article/detail.vue b/subPackage/article/detail.vue
index 7a63a3f..fdfbef8 100644
--- a/subPackage/article/detail.vue
+++ b/subPackage/article/detail.vue
@@ -139,7 +139,7 @@
 		</view>
 
 
-		<view class="footer">
+		<view class="footer" v-if="detailInfo.iscomment == 1">
 			<u-search searchIcon='edit-pen' :animation="true" placeholder="写评论" disabled
 				@click="navToComment"></u-search>
 		</view>
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() {
diff --git a/subPackage/workbench/views/patrol.vue b/subPackage/workbench/views/patrol.vue
index 41e6c85..079e842 100644
--- a/subPackage/workbench/views/patrol.vue
+++ b/subPackage/workbench/views/patrol.vue
@@ -3,18 +3,18 @@
 		<view class="content bgc-ff">
 			<u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
 				:labelStyle="{fontSize:'28rpx'}">
-				<u-form-item label="巡查标题" prop="info.name" borderBottom required>
+				<u-form-item label="巡查标题" prop="name" borderBottom required>
 					<u-input v-model="info.name" border="none" placeholder="请输入标题" placeholderClass="f-28 c-99"
 						inputAlign="right"></u-input>
 				</u-form-item>
-			
+
 
 				<!-- <u-form-item label="巡查时间" prop="patrolTime" borderBottom required @click="showSelectDate = true">
 					<u-input v-model="info.patrolTime" disabled disabledColor="#ffffff" border="none"
 						placeholder="请选择时间" placeholderClass="f-28 c-99" inputAlign="right"></u-input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item> -->
-				<u-form-item label="巡查位置" prop="address" :borderBottom="false" required>
+				<u-form-item label="巡查位置" prop="location" :borderBottom="false" required>
 					<view class="address-row flex">
 						<view class="address-content f-28" v-if="info.location">
 							{{info.location}}
@@ -78,7 +78,8 @@
 				info: {
 					name: "",
 					context: "",
-					patrolTime: ""
+					patrolTime: "",
+					location: ""
 				},
 				rules: {
 					'name': {
diff --git a/subPackage/workbench/views/selfCheckDetail.vue b/subPackage/workbench/views/selfCheckDetail.vue
index 858a72a..dba7f3f 100644
--- a/subPackage/workbench/views/selfCheckDetail.vue
+++ b/subPackage/workbench/views/selfCheckDetail.vue
@@ -346,7 +346,7 @@
 
 			navTo() {
 				uni.navigateTo({
-					url: "/subPackage/label/check"
+					url: `/subPackage/label/check?taskId=${this.info.taskId}`
 				})
 			},
 
diff --git a/subPackage/workbench/views/workLog.vue b/subPackage/workbench/views/workLog.vue
index bf9a7a2..7b4a359 100644
--- a/subPackage/workbench/views/workLog.vue
+++ b/subPackage/workbench/views/workLog.vue
@@ -15,7 +15,8 @@
 					<u-icon slot="right" name="arrow-right"></u-icon>
 				</u-form-item>
 
-				<u-form-item label="被访人姓名" prop="name" :borderBottom="false" required @click="isShowPopup = true">
+				<u-form-item label="被访人姓名" prop="householdId" :borderBottom="false" required
+					@click="isShowPopup = true">
 					<u-input v-model="selectedHousehold.name" disabled disabledColor="#fff" border="none"
 						placeholder="请选择" placeholderClass="f-28 c-99" inputAlign="right"></u-input>
 					<u-icon slot="right" name="arrow-right"></u-icon>
@@ -39,7 +40,7 @@
 					<u-input v-model="info.phone" border="none" placeholder="请输入手机号" placeholderClass="f-28 c-99"
 						inputAlign="right"></u-input>
 				</u-form-item> -->
-				<u-form-item label="内容" borderBottom required>
+				<u-form-item label="内容" borderBottom required prop="context">
 					<u-input type="textarea" v-model="info.context" border="none" placeholderClass="f-28 c-99"
 						inputAlign="right" placeholder="请输入内容">
 					</u-input>
@@ -141,7 +142,11 @@
 				info: {
 					// name: "",
 					// phone: "",
-					context: ""
+					type: "",
+					householdId: "",
+					context: "",
+					workTime: "",
+					personType: ""
 				},
 				rules: {
 					// 'name': {
@@ -157,24 +162,30 @@
 					// 	trigger: ['blur', 'change']
 					// },
 
-					'info.type': {
-						type: 'string',
+					type: [{
+						type: 'number',
 						required: true,
 						message: '请选择走访类型',
 						trigger: ['blur', 'change']
-					},
-					'info.householdId': {
+					}],
+					// peopleType: [{
+					// 	type: 'number',
+					// 	required: true,
+					// 	message: '请选择重点人群类型',
+					// 	trigger: ['blur', 'change']
+					// }],
+					householdId: [{
 						type: 'string',
 						required: true,
 						message: '请选择被访问人',
 						trigger: ['blur', 'change']
-					},
-					'info.context': {
+					}],
+					context: [{
 						type: 'string',
 						required: true,
 						message: '请输入工作内容',
 						trigger: ['blur', 'change']
-					},
+					}],
 				},
 				showSelectDate: false,
 				workTime: Number(new Date()),
@@ -216,6 +227,11 @@
 			}
 		},
 
+		onReady() {
+			//onReady 为uni-app支持的生命周期之一
+			this.$refs.form.setRules(this.rules)
+		},
+
 		methods: {
 
 			getDetail(id) {
@@ -230,17 +246,21 @@
 						if (data.workTime) {
 							this.workTime = Number(new Date(data.workTime))
 						}
-						this.info.type = data.type;
-						this.info.workTime = data.workTime;
-						this.info.context = data.context;
-						this.info.householdId = data.householdId;
-						this.info.personType = data.personType;
+						// this.info.type = data.type;
+						// this.info.workTime = data.workTime;
+						// this.info.context = data.context;
+						// this.info.householdId = data.householdId;
+						// this.info.personType = data.personType;
+						console.log(typeof data.personType)
 						this.labelIndex = this.$getIndex(this.labelList[0], data.personType, "id", "name").index;
 						this.labelName = this.$getIndex(this.labelList[0], data.personType, "id", "name").name;
 						this.getHouseholdList();
 						this.getHousehold(data.householdId);
 						this.form.images = this.$setImageUrl(data.url, 2);
 						this.info.id = data.id;
+						for (let i in this.info) {
+							this.$set(this.info, i, data[i])
+						}
 					}
 				})
 			},
@@ -354,6 +374,10 @@
 				this.$refs.form.validate().then(valid => {
 					this.checkImages();
 					this.info.status = 2;
+					if (this.info.type == 2 && !this.info.personType) {
+						this.$showTips("请选择重点人群类型")
+						return
+					}
 					if (this.isEdit) {
 						this.updateWorkLogRequest()
 					} else {

--
Gitblit v1.9.3