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/ToDoBaoZhou/ToDoBaoZhou.vue |  422 ++++++++++++++++++++++++++++------------------------
 1 files changed, 230 insertions(+), 192 deletions(-)

diff --git a/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue b/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue
index 03fc669..1e9bc64 100644
--- a/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue
+++ b/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue
@@ -2,14 +2,15 @@
 	<view class="container">
 		<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
 			<block slot="backText">杩斿洖</block>
-			<block slot="content">鎵ц</block>
+			<block slot="content">鍛ㄤ繚鎵ц</block>
 		</cu-custom>
 		<view class="container">
 
 
 			<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,19 +29,9 @@
 						<uni-easyinput v-model="formData.remark" placeholder="璇疯緭鍏ュ娉�" :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="纭绫诲瀷:">
@@ -60,15 +51,15 @@
 
 
 
-
-			<view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view>
+			<view class="divider"><text>淇濆吇椤逛俊鎭�</text></view>
+			<!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> -->
 			<view class="padding flex flex-direction">
 				<button :disabled="isClick" class="mini-btn" type="primary" @click.stop="batchnsIpection()"
 					size="mini">鎵归噺淇濆吇姝e父</button>
 			</view>
 			<uni-collapse @change="change">
-				<uni-collapse-item :show-animation="true" :show-arrow="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false"
-					title-border="none" >
+				<uni-collapse-item :show-animation="true" :show-arrow="true" :accordion="true" title="鏌ョ湅淇濆吇椤�"
+					:border="false" title-border="none">
 					<uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index">
 						<view class="flex">
 							<view class="flex-sub text-light bg-white padding-xs margin-xs radius">琛屽彿:</view>
@@ -83,38 +74,39 @@
 						</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.subItemName!=null && item.subItemName.length>10">
 								{{(item.subItemName).toString().substr(0,10)+'...'}}
 							</view>
 
 							<view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
 								{{item.subItemName}}
+							</view> -->
+							<view class="flex-sub bg-white padding-xs margin-xs radius text-right">
+								{{item.subItemName}}
 							</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.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>
+							<view class="flex-sub bg-white padding-xs margin-xs radius text-right">
 								{{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" @change="handleType($event, index)"   v-model="item.reportFlag"
-									:disabled="item.istrue" />
-							</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.restle" v-model="item.maintenanceResult"
 									@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>
 
@@ -147,6 +139,15 @@
 		mixins: [MescrollMixin], // 浣跨敤mixin
 		data() {
 			return {
+				// 鍥剧墖鍥炴樉
+				fileLists: [],
+				// 涓婁紶鍥剧墖鐨勬牱寮�
+				imageStyles: {
+					width: 90,
+					height: 90,
+				},
+				// uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽�
+				sourceType: ['album', 'camera'],
 				scrollLeft: 0,
 				searchValue: '',
 				imgList: [],
@@ -154,7 +155,8 @@
 				uploadUrl: "/sys/common/upload",
 				formData: {
 					avatar: [],
-					id:''
+					id: '',
+					num: ''
 
 				},
 				istrue: true,
@@ -163,7 +165,7 @@
 				url: {
 					upload: "/eam/sysFiles/batch_upload",
 					stallList: "/eam/weekMaintenanceOrder/queryById",
-					getEquipmentList:'eam/equipment/list',
+					getEquipmentList: 'eam/equipment/list',
 					// getEquipmentList: "eam/equipment/asyncLoadEquipment",
 					BaoList: '/eam/weekMaintenanceOrderDetail/queryList',
 					approval: 'eam/weekMaintenanceOrder/approval'
@@ -193,7 +195,8 @@
 				msg1Title: "",
 				procInstId: '',
 				values: '',
-				isClick:false
+				isClick: false,
+				announcement1: {}
 
 			}
 		},
@@ -224,8 +227,8 @@
 
 		methods: {
 			change(e) {
-							console.log(e);
-						},
+				console.log(e);
+			},
 			batchnsIpection() {
 				uni.showModal({
 					title: '鎻愮ず',
@@ -245,76 +248,112 @@
 
 			},
 			ProductionTask() {
-				if(this.hasInspectionDateArrived()){
-				for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) {
-					if (this.partTakeAdviceDetailList[i].maintenanceResult == undefined || this.partTakeAdviceDetailList[i]
-						.maintenanceResult == null || this
-						.partTakeAdviceDetailList[i].maintenanceResult == '') {
-						/* this.$tip.error("璇疯緭鍏ラ鏂欐暟閲忥紒"); */
-						uni.showToast({
-							icon: 'none',
-							title: '鐐规缁撴灉涓嶈兘涓虹┖'
-						});
-						return false;
+				if (this.hasInspectionDateArrived()) {
+					for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) {
+						if (this.partTakeAdviceDetailList[i].maintenanceResult == undefined || this
+							.partTakeAdviceDetailList[i]
+							.maintenanceResult == null || this
+							.partTakeAdviceDetailList[i].maintenanceResult == '') {
+							uni.showToast({
+								icon: 'none',
+								title: '鐐规缁撴灉涓嶈兘涓虹┖'
+							});
+							return false;
+						}
 					}
-				}
-				
-				this.$http.put(this.url.approval, {
-					
-					confirmComment: '',
-					id:this.formData.id,
-					confirmDealType: '',
-					dataId: this.id,
-					imageFiles: null,
-					instanceId: this.procInstId,
-					tableDetailList: this.partTakeAdviceDetailList,
-					taskId: this.taskId,
-					userId: this.assignee,
-					values: this.values,
-					maintenanceDate: this.formData.maintenanceDate,
-					creationMethod: this.formData.creationMethod,
-					equipmentCode: this.formData.equipmentCode,
-					equipmentId: this.formData.num,
-					imageFilesResult: this.formData.avatar,
-					orderNum: this.formData.orderNum,
-					remark: this.formData.remark,
-					standardId: this.formData.standardId,
-					standardName: this.formData.standardName
-				}).then(res => {
-					console.log(res)
-					this.$tip.loaded();
-					if (res.data.success) {
+					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,
+						title: "鍔犺浇涓�....",
+					})
+					this.$http.put(this.url.approval, {
+
+						confirmComment: null,
+						id: this.formData.id,
+						confirmDealType: null,
+						dataId: this.id,
+						imageFiles: null,
+						instanceId: this.procInstId,
+						tableDetailList: this.partTakeAdviceDetailList,
+						taskId: this.taskId,
+						userId: this.assignee,
+						values: this.values,
+						maintenanceDate: this.formData.maintenanceDate,
+						creationMethod: this.formData.creationMethod,
+						equipmentCode: this.formData.equipmentCode,
+						equipmentId: this.formData.num,
+						imageFilesResult: this.formData.avatar,
+						orderNum: this.formData.orderNum,
+						remark: this.formData.remark,
+						standardId: this.formData.standardId,
+						standardName: this.formData.standardName
+					}).then(res => {
+						uni.hideLoading()
+						if (res.data.success) {
+							uni.showToast({
+								icon: "success",
+								title: '鎻愪氦鎴愬姛',
+								duration: 2000
+							});
+							this.$Router.replaceAll({
+								name: 'ToDoList'
+							})
+
+						}
+					}).catch(() => {
+						this.$tip.loaded();
 						uni.showToast({
-							icon: "success",
-							title: '鎻愪氦鎴愬姛',
+							icon: "error",
+							title: res.data.message,
 							duration: 2000
 						});
-						this.$Router.replaceAll({name: 'ToDoList'})
-				
-					}
-				}).catch(() => {
-					this.$tip.loaded();
-					uni.showToast({
-						icon: "error",
-						title: res.data.message,
-						duration: 2000
 					});
-				});	
-				}else{
+				} else {
 					uni.showToast({
 						icon: "error",
 						title: '鏈埌淇濆吇鏃堕棿',
 						duration: 2000
 					});
 				}
-				
+
 			},
 
 			changeEquipmentList(e) {
 				this.formData.num = e;
 			},
-			
-			handleType(e,index){
+
+			handleType(e, index) {
 				console.log(e);
 			},
 			handleCode(e, index) {
@@ -327,48 +366,31 @@
 					this.partTakeAdviceDetailList[index].istrue = true;
 				}
 			},
-				getEquipment() {
-							this.$http.get(this.url.getEquipmentList, {
-								params: {
-									pageNo: 1,
-									pageSize: 9999,
-									order: 'desc',
-									column: 'createTime'
-								},
-							
-							}).then(res => {
-								//璁剧疆鍒楄〃鏁版嵁
-								if (res.data.success) {
-									this.equipmentList = res.data.result.records
-								} else {
-									uni.showToast({
-										icon: "error",
-										title: res.data.message,
-										duration: 2000
-									});
-			
-								}
-							}).catch(() => {
-								this.$tip.error("鑱旂綉澶辫触")
-							})
-						},
-			// 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
-			// 			});
+			getEquipment() {
+				this.$http.get(this.url.getEquipmentList, {
+					params: {
+						pageNo: 1,
+						pageSize: 9999,
+						order: 'desc',
+						column: 'createTime'
+					},
 
-			// 		}
-			// 	}).catch(() => {
-			// 		this.$tip.error("鑱旂綉澶辫触")
-			// 	})
-			// },
+				}).then(res => {
+					//璁剧疆鍒楄〃鏁版嵁
+					if (res.data.success) {
+						this.equipmentList = res.data.result.records
+					} else {
+						uni.showToast({
+							icon: "error",
+							title: res.data.message,
+							duration: 2000
+						});
+
+					}
+				}).catch(() => {
+					this.$tip.error("鑱旂綉澶辫触")
+				})
+			},
 			getList() {
 				this.$http.get(this.url.BaoList, {
 					params: {
@@ -409,69 +431,62 @@
 					//鑱旂綉澶辫触, 缁撴潫鍔犺浇
 				})
 			},
-			ChooseImage() {
-				var that = this;
-				uni.chooseImage({
-					count: 4,
-					sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈�
-					sourceType: ['album'], // 浠庣浉鍐岄�夋嫨
-					success: (res) => {
-						// 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰�
-						that.imgList = res.tempFilePaths;
+			select(e) {
+				const tempFilePaths = e.tempFilePaths;
 
-						// 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓�
-						that.formData.avatar = [];
+				// if (!Array.isArray(tempFilePaths) || tempFilePaths.length === 0) {
+				// 	uni.showToast({
+				// 		title: '璇烽�夋嫨鏂囦欢',
+				// 		icon: 'none'
+				// 	});
+				// 	return;
+				// }
 
-						// 鍒涘缓涓婁紶浠诲姟鐨� 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);
-										resolve(filePath);
-									})
-									.catch(err => {
-										console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err);
-										reject(err);
-									});
-							});
-						});
+				uni.showLoading({
+					title: '涓婁紶涓�...'
+				});
 
-						// 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔�
-						Promise.all(uploadPromises)
-							.then((uploadedFilePaths) => {
-								console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar);
+				const uploadPromises = tempFilePaths.map((filePath, index) => {
+					return new Promise((resolve, reject) => {
+						this.$http.upload(this.url.upload, {
+								filePath: filePath,
+								name: 'file'
 							})
-							.catch((err) => {
-								console.error('鍥剧墖涓婁紶澶辫触:', err);
-								that.$tip.error('鍥剧墖涓婁紶澶辫触');
+							.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);
+					});
 			},
-			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)
-						}
-					}
-				})
+
+
+
+			// 鍒犻櫎
+			deletea(e) {
+				console.log('鍒犻櫎鍥剧墖', e);
 			},
 
 			upCallback() {
@@ -479,20 +494,18 @@
 					params: {
 						id: this.id
 					},
-
 				}).then(res => {
 					this.announcement1 = res.data.result
 					console.log("url", res)
 					//璁剧疆鍒楄〃鏁版嵁
 					if (res.data.success) {
-						console.log("res", res.data.result.equipmentCode)
 						this.formData.num = this.announcement1.equipmentId,
 							this.formData.orderNum = this.announcement1.orderNum,
 							this.formData.operator = this.announcement1.operator_dictText,
 							this.formData.maintenanceDate = this.announcement1.maintenanceDate,
-							this.formData.id=this.announcement1.id,
+							this.formData.id = this.announcement1.id,
 							this.formData.remark = this.announcement1.remark
-							this.hasInspectionDateArrived();
+						this.hasInspectionDateArrived();
 					}
 				}).catch(() => {
 					//鑱旂綉澶辫触, 缁撴潫鍔犺浇
@@ -579,4 +592,29 @@
 		margin-top: 85px;
 		height: auto;
 	}
+
+	.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;
+		/* 闃叉鏂囧瓧鎹㈣ */
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3