From 1833dd6d7cac01c35840af52fadc1199821e5805 Mon Sep 17 00:00:00 2001
From: Houjie <714924425@qq.com>
Date: 星期四, 15 五月 2025 09:28:16 +0800
Subject: [PATCH] 提交优化项

---
 pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue |  361 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 226 insertions(+), 135 deletions(-)

diff --git a/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue b/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue
index b166a9d..b675259 100644
--- a/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue
+++ b/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue
@@ -5,11 +5,22 @@
 			<block slot="content">鎵ц</block>
 		</cu-custom>
 		<view class="container">
+			<template>
+				<!-- 娴獥閬僵灞� -->
+				<view v-if="showPreview" class="overlay" @tap.stop="closePreview">
+					<view class="modal">
+						<!-- 鍏抽棴鎸夐挳 -->
+						<text class="close-btn" @tap.stop="showPreview = false">&times;</text>
+						<!-- 鍥剧墖灞曠ず -->
+						<image :src="previewImageSrc" mode="aspectFit" class="preview-image" />
+					</view>
+				</view>
 
-
+			</template>
 			<uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
 				<uni-group top="1">
-					<view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view>
+					<view class="divider"><text>鍩烘湰淇℃伅</text></view>
+					<!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> -->
 					<uni-forms-item :label-width="80" name="orderNum" label="宸ュ崟鍙�:">
 						<uni-easyinput v-model="formData.orderNum" :disabled="true" />
 					</uni-forms-item>
@@ -28,41 +39,17 @@
 						<uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" />
 					</uni-forms-item>
 					<uni-forms-item :label-width="80" name="outNum" label="鐐规鍥剧墖:">
-						<view class="grid col-4 grid-square flex-sub">
-							<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
-								:data-url="imgList[index]">
-								<image :src="imgList[index]" mode="aspectFill"></image>
-								<view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index">
-									<text class='cuIcon-close'></text>
-								</view>
-							</view>
-							<view class="solids" @tap="ChooseImage" v-if="imgList.length<1">
-								<text class='cuIcon-cameraadd'></text>
-							</view>
-						</view>
-
+						<uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles"
+							:sourceType="sourceType" @select="select" @progress="progress" @success="success"
+							@fail="fail" @delete="deletea" />
 					</uni-forms-item>
-					<!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view>
-					<uni-forms-item name="outNum" required label="纭绫诲瀷:">
-						<uni-data-select :localdata="formData.msListCategory" popup-title="璇烽�夋嫨" @change="changeType"
-							:clear="false">
-						</uni-data-select>
+					<uni-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:">
+						<button class="cu-btn  bg-blue" @tap="showPreview = true">鏌ョ湅</button>
 					</uni-forms-item>
-					<uni-forms-item name="outNum" required label="纭鎰忚:">
-						<uni-easyinput type="textarea" v-model="formData.ttitle" placeholder="璇疯緭鍏ュ唴瀹�"></uni-easyinput>
-					</uni-forms-item> -->
 				</uni-group>
 			</uni-forms>
 
-
-
-
-
-
-
-			<view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view>
-
-
+			<view class="divider"><text>淇濆吇椤逛俊鎭�</text></view>
 			<view class="padding flex flex-direction">
 				<button :disabled="isClick" class="mini-btn" type="primary" @click.stop="batchnsIpection()"
 					size="mini">鎵归噺鐐规姝e父</button>
@@ -84,33 +71,19 @@
 								{{item.itemName}}
 							</view>
 						</view>
-						<!-- <view class="flex">
-							<view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view>
-							<view class="flex-sub bg-white padding-xs margin-xs radius text-right"
-								v-if="item.small!=null && item.small.length>10">
-								{{(item.small).toString().substr(0,10)+'...'}}
-							</view>
-					
-							<view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
-								{{item.small}}
-							</view>
-						</view> -->
+
 						<view class="flex">
 							<view class="flex-sub text-light bg-white  padding-xs margin-xs radius">淇濆吇瑕佹眰:</view>
-							<view class="flex-sub bg-white padding-xs margin-xs radius text-right"
+							<!-- 	<view class="flex-sub bg-white padding-xs margin-xs radius text-right"
 								v-if="item.itemDemand!=null && item.itemDemand.length>10">
 								{{(item.itemDemand).toString().substr(0,10)+'...'}}
 							</view>
 
 							<view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
 								{{item.itemDemand}}
-							</view>
-						</view>
-						<view class="flex">
-							<view class="flex-sub text-light bg-white  padding-xs margin-xs radius">寮傚父鏄惁鎶ヤ慨:</view>
-							<view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
-								<uni-data-select :localdata="item.type" v-model="item.reportFlag"
-									:disabled="item.istrue" />
+							</view> -->
+							<view class="flex-sub bg-white padding-xs margin-xs radius text-right">
+								{{item.itemDemand}}
 							</view>
 						</view>
 						<view class="flex">
@@ -118,6 +91,14 @@
 							<view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
 								<uni-data-select :localdata="item.restle" v-model="item.inspectionResult"
 									@change="handleCode($event, index)" />
+							</view>
+						</view>
+
+						<view class="flex">
+							<view class="flex-sub text-light bg-white  padding-xs margin-xs radius">寮傚父鏄惁鎶ヤ慨:</view>
+							<view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
+								<uni-data-select :localdata="item.type" @change="handleType($event, index)"
+									v-model="item.reportFlag" :disabled="item.istrue" />
 							</view>
 						</view>
 
@@ -145,11 +126,21 @@
 </template>
 
 <script>
+	import index from "../../../../store";
 	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
 	export default {
 		mixins: [MescrollMixin], // 浣跨敤mixin
 		data() {
 			return {
+				showPreview: false,
+				// 鍥剧墖鍥炴樉
+				fileLists: [],
+				// 涓婁紶鍥剧墖鐨勬牱寮�
+				imageStyles: {
+					width: 90,
+					height: 90,
+				},
+				sourceType: ['album', 'camera'],
 				isClick: false,
 				scrollLeft: 0,
 				searchValue: '',
@@ -167,10 +158,12 @@
 					upload: "/eam/sysFiles/batch_upload",
 					stallList: "/eam/eamInspectionOrder/queryById",
 					getEquipmentList: 'eam/equipment/list',
-					// getEquipmentList: "eam/equipment/asyncLoadEquipment",
+					getStandardFile: "eam/maintenanceStandard/queryById",
 					BaoList: 'eam/eamInspectionOrderDetail/queryList',
 					approval: 'eam/eamInspectionOrder/approval'
 				},
+				previewImageSrc: '',
+				standardId: '',
 				id: '',
 				taskId: '',
 				inspectionResult: '',
@@ -226,7 +219,52 @@
 		},
 
 		methods: {
+			select(e) {
+				const tempFilePaths = e.tempFilePaths;
+				uni.showLoading({
+					title: '涓婁紶涓�...'
+				});
 
+				const uploadPromises = tempFilePaths.map((filePath, index) => {
+					return new Promise((resolve, reject) => {
+						this.$http.upload(this.url.upload, {
+								filePath: filePath,
+								name: 'file'
+							})
+							.then(uploadRes => {
+								// 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰�
+								const serverFilePath = uploadRes.data.result[0];
+								this.formData.avatar.push(serverFilePath);
+								resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all
+							})
+							.catch(err => {
+								console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err);
+								reject(err);
+							});
+					});
+				});
+
+				Promise.all(uploadPromises)
+					.then(() => {
+						uni.hideLoading();
+						uni.showToast({
+							title: '鍏ㄩ儴涓婁紶鎴愬姛'
+						});
+					})
+					.catch(err => {
+						uni.hideLoading();
+						uni.showToast({
+							title: '閮ㄥ垎涓婁紶澶辫触',
+							icon: 'none'
+						});
+						console.error('涓婁紶寮傚父:', err);
+					});
+			},
+
+			// 鍒犻櫎
+			deletea(e) {
+				console.log('鍒犻櫎鍥剧墖', e);
+			},
 			batchnsIpection() {
 				uni.showModal({
 					title: '鎻愮ず',
@@ -252,7 +290,6 @@
 							.partTakeAdviceDetailList[i]
 							.inspectionResult == null || this
 							.partTakeAdviceDetailList[i].inspectionResult == '') {
-							/* this.$tip.error("璇疯緭鍏ラ鏂欐暟閲忥紒"); */
 							uni.showToast({
 								icon: 'none',
 								title: '鐐规缁撴灉涓嶈兘涓虹┖'
@@ -260,6 +297,41 @@
 							return false;
 						}
 					}
+
+					for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) {
+						if (this.partTakeAdviceDetailList[i].inspectionResult === "2") {
+							if (this.partTakeAdviceDetailList[i].reportFlag === undefined || this
+								.partTakeAdviceDetailList[i].reportFlag === null || this.partTakeAdviceDetailList[i]
+								.reportFlag === '') {
+								const index = i + 1
+								uni.showModal({
+									title: "鎻愮ず",
+									content: '绗�' + index + '琛屽彿寮傚父鎶ヤ慨蹇呴��',
+									confirmText: '纭畾',
+									showCancel: false,
+								})
+
+								return false;
+
+							}
+							if (this.partTakeAdviceDetailList[i].exceptionDescription == undefined || this
+								.partTakeAdviceDetailList[i].exceptionDescription == null || this
+								.partTakeAdviceDetailList[i].exceptionDescription == '') {
+								const index = i + 1
+								uni.showModal({
+									title: "鎻愮ず",
+									content: '绗�' + index + '琛屽彿寮傚父鎻忚堪闇�濉啓',
+									confirmText: '纭畾',
+									showCancel: false,
+								})
+								return false;
+
+							}
+
+
+						}
+					}
+
 
 					uni.showLoading({
 						mask: true,
@@ -289,9 +361,6 @@
 								title: '鎻愪氦鎴愬姛',
 								duration: 2000
 							});
-							// this.$Router.replace({
-							// 	name: 'ToDoList'
-							// })
 							this.$Router.replaceAll({
 								name: 'ToDoList'
 							})
@@ -314,7 +383,9 @@
 				}
 
 			},
-
+			closePreview() {
+				this.showPreview = false;
+			},
 			changeEquipmentList(e) {
 				this.formData.num = e;
 			},
@@ -328,23 +399,11 @@
 					this.partTakeAdviceDetailList[index].istrue = true;
 				}
 			},
-			// getEquipment() {
-			// 	this.$http.get(this.url.getEquipmentList).then(res => {
-			// 		//璁剧疆鍒楄〃鏁版嵁
-			// 		if (res.data.success) {
-			// 			this.equipmentList = res.data.result
-			// 		} else {
-			// 			uni.showToast({
-			// 				icon: "error",
-			// 				title: res.data.message,
-			// 				duration: 2000
-			// 			});
 
-			// 		}
-			// 	}).catch(() => {
-			// 		this.$tip.error("鑱旂綉澶辫触")
-			// 	})
-			// },
+
+			handleType(e, index) {
+				console.log(e)
+			},
 			getEquipment() {
 				this.$http.get(this.url.getEquipmentList, {
 					params: {
@@ -410,71 +469,38 @@
 					//鑱旂綉澶辫触, 缁撴潫鍔犺浇
 				})
 			},
-			ChooseImage() {
-				var that = this;
-				uni.chooseImage({
-					count: 4,
-					sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈�
-					sourceType: ['album'], // 浠庣浉鍐岄�夋嫨
-					success: (res) => {
-						// 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰�
-						that.imgList = res.tempFilePaths;
 
-						// 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓�
-						that.formData.avatar = [];
-
-						// 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍
-						const uploadPromises = res.tempFilePaths.map((filePath, index) => {
-							return new Promise((resolve, reject) => {
-								that.$http.upload(that.url.upload, {
-										filePath: filePath,
-										name: 'file'
-									})
-									.then(uploadRes => {
-										const filePath = uploadRes.data.result[0];
-										this.formData.avatar.push(filePath);
-										console.log(this.formData.avatar)
-										resolve(filePath);
-									})
-									.catch(err => {
-										console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err);
-										reject(err);
-									});
-							});
-						});
-
-						// 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔�
-						Promise.all(uploadPromises)
-							.then((uploadedFilePaths) => {
-								console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar);
-							})
-							.catch((err) => {
-								console.error('鍥剧墖涓婁紶澶辫触:', err);
-								that.$tip.error('鍥剧墖涓婁紶澶辫触');
-							});
+			getStandardFile() {
+				this.$http.get(this.url.getStandardFile, {
+					params: {
+						id: this.standardId
 					}
-				});
-			},
-			ViewImage(e) {
-				uni.previewImage({
-					urls: this.imgList,
-					current: e.currentTarget.dataset.url
-				});
-			},
-			DelImg(e) {
-				uni.showModal({
-					title: '鎻愮ず',
-					content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�',
-					cancelText: '鍐嶇湅鐪�',
-					confirmText: '鍐嶈',
-					success: res => {
-						if (res.confirm) {
-							this.imgList.splice(e.currentTarget.dataset.index, 1)
+				}).then(res => {
+					if (res.data.success) {
+						console.log("res", res.data.result);
+						const referenceFileStr = res.data.result.referenceFile;
+
+						// 鍒ゆ柇鏄惁瀛樺湪 referenceFile 骞惰繘琛岃В鏋�
+						if (referenceFileStr) {
+							try {
+								const referenceFileObj = JSON.parse(referenceFileStr);
+								const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`;
+								this.previewImageSrc = filePath;
+								console.log('previewImageSrc:', this.previewImageSrc);
+							} catch (e) {
+								console.error("referenceFile 瑙f瀽澶辫触", e);
+								this.previewImageSrc = '';
+							}
+						} else {
+							console.warn("referenceFile 涓嶅瓨鍦�");
+							this.previewImageSrc = '';
 						}
 					}
-				})
+				}).catch(err => {
+					console.error("缃戠粶璇锋眰澶辫触", err);
+					// 鑱旂綉澶辫触, 缁撴潫鍔犺浇
+				});
 			},
-
 			upCallback() {
 				this.$http.get(this.url.stallList, {
 					params: {
@@ -487,11 +513,15 @@
 					//璁剧疆鍒楄〃鏁版嵁
 					if (res.data.success) {
 						console.log("res", res.data.result.equipmentCode)
+						if (this.announcement1.standardId !== null) {
+							this.standardId = this.announcement1.standardId
+							this.getStandardFile()
+						}
 						this.formData.num = this.announcement1.equipmentId,
 							this.formData.orderNum = this.announcement1.orderNum,
 							this.formData.operator = this.announcement1.operator,
-							this.formData.inspectionDate = this.announcement1.inspectionDate
-						this.hasInspectionDateArrived();
+							this.formData.inspectionDate = this.announcement1.inspectionDate,
+							this.hasInspectionDateArrived();
 
 
 					}
@@ -567,6 +597,30 @@
 		border-color: #179b16;
 	}
 
+	.divider {
+		display: flex;
+		align-items: center;
+		text-align: center;
+		color: gray;
+		/* 鏂囧瓧棰滆壊 */
+		margin: 20px 0;
+		/* 涓婁笅闂磋窛 */
+	}
+
+	.divider::before,
+	.divider::after {
+		content: '';
+		flex: 1;
+		border-bottom: 1px solid gray;
+		/* 妯嚎棰滆壊 */
+		margin: 0 16px;
+		/* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */
+	}
+
+	.divider text {
+		white-space: nowrap;
+		/* 闃叉鏂囧瓧鎹㈣ */
+	}
 
 	.content {
 		margin-top: 5px;
@@ -580,4 +634,41 @@
 		margin-top: 85px;
 		height: auto;
 	}
+
+	.overlay {
+		position: fixed;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 100%;
+		background-color: rgba(0, 0, 0, 0.7);
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		z-index: 999;
+	}
+
+	.modal {
+		position: relative;
+		width: 90%;
+		max-width: 600px;
+		background: #fff;
+		border-radius: 12rpx;
+		padding: 20rpx;
+		box-sizing: border-box;
+	}
+
+	.preview-image {
+		width: 100%;
+		max-height: 80vh;
+		object-fit: contain;
+	}
+
+	.close-btn {
+		position: absolute;
+		top: 10rpx;
+		right: 20rpx;
+		font-size: 40rpx;
+		color: #333;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3