From 964faa1077a89713910063c39ebe08fac4e4c56e Mon Sep 17 00:00:00 2001
From: Houjie <714924425@qq.com>
Date: 星期四, 24 七月 2025 17:44:18 +0800
Subject: [PATCH] 企业维修适配修改

---
 pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue |  427 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 273 insertions(+), 154 deletions(-)

diff --git a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue
index b758296..a2a1fa3 100644
--- a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue
+++ b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue
@@ -1,21 +1,41 @@
 <template>
 	<view class="container">
-		<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
+		<cu-custom :bgColor="NavBarColor" :isBack="true">
 			<block slot="backText">杩斿洖</block>
 			<block slot="content">{{title}}</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" @error="handleImageError"
+							:show-menu-by-longpress="false" />
+					</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="num" label="宸ュ崟鍙�:">
 						<uni-easyinput v-model="formData.orderNum" :disabled="true" />
 					</uni-forms-item>
-					<uni-forms-item :label-width="80" required name="num" label="璁惧缂栧彿:">
+					<uni-forms-item :label-width="80" name="inspectionStatus_dictText" label="宸ュ崟鐘舵��:">
+						<uni-easyinput v-model="formData.inspectionStatus_dictText" :disabled="true" />
+					</uni-forms-item>
+
+					<uni-forms-item :label-width="80" name="num" label="璁惧缂栧彿:">
 						<uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList"
 							placeholder="璇烽�夋嫨" :disabled="true" />
+					</uni-forms-item>
+					<uni-forms-item :label-width="80" name="installationPosition_dictText" label="瀹夎浣嶇疆:">
+						<uni-easyinput v-model="formData.installationPosition_dictText" :disabled="true" />
 					</uni-forms-item>
 
 					<uni-forms-item :label-width="80" name="remark" label="鐐规鏃ユ湡:">
@@ -24,25 +44,25 @@
 					<uni-forms-item :label-width="80" name="outNum" label="鐐规浜�:">
 						<uni-easyinput v-model="formData.operator" :disabled="true" />
 					</uni-forms-item>
+					<uni-forms-item :label-width="80" name="operatorPhone_dictText" label="鐐规浜虹數璇�:">
+						<uni-easyinput v-model="formData.operatorPhone_dictText" :disabled="true" />
+					</uni-forms-item>
+					<uni-forms-item :label-width="80" name="formData.remark" label="澶囨敞:">
+						<uni-easyinput 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" 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" :readonly="readonly" />
+					</uni-forms-item>
+					<uni-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:">
+						<button class="cu-btn  bg-blue" @tap="showPreview = true">鏌ョ湅</button>
 					</uni-forms-item>
 				</uni-group>
 			</uni-forms>
-			<view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view>
-
+			<!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> -->
+			<view class="divider"><text>淇濆吇椤逛俊鎭�</text></view>
 			<uni-collapse>
 				<uni-collapse-item :show-animation="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false"
 					title-border="none">
@@ -63,20 +83,8 @@
 
 						<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" v-model="item.reportFlag"
-									:disabled="item.istrue" />
 							</view>
 						</view>
 						<view class="flex">
@@ -86,6 +94,14 @@
 									@change="handleCode($event, index)" :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.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>
@@ -98,9 +114,11 @@
 			</uni-collapse>
 
 
-			<uni-forms  v-show="isShowTeam" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext">
+			<uni-forms v-show="isShowTeam" ref="form" :modelValue="ScanData" 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" required name="typeName" label="澶勭悊绫诲瀷:">
 						<uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType"
 							@change="changehandlingType" placeholder="璇烽�夋嫨" :disabled="isTouch" />
@@ -128,9 +146,19 @@
 		mixins: [MescrollMixin], // 浣跨敤mixin
 		data() {
 			return {
-				isShowTeam:false,
+				showPreview: false,
+				readonly: false,
+				// 鍥剧墖鍥炴樉
+				fileLists: [],
+				// 涓婁紶鍥剧墖鐨勬牱寮�
+				imageStyles: {
+					width: 90,
+					height: 90,
+				},
+				sourceType: ['album', 'camera'],
+				isShowTeam: false,
 				isShowBtn: true,
-				title: '鐝粍闀跨‘璁�',
+				title: '',
 				isTouch: false,
 				scrollLeft: 0,
 				searchValue: '',
@@ -165,7 +193,7 @@
 				url: {
 					upload: "/eam/sysFiles/batch_upload",
 					stallList: "/eam/eamInspectionOrder/queryById",
-					// getEquipmentList: "eam/equipment/asyncLoadEquipment",
+					getStandardFile: "eam/maintenanceStandard/queryById",
 					getEquipmentList: 'eam/equipment/list',
 					BaoList: 'eam/eamInspectionOrderDetail/queryList',
 					approval: 'eam/eamInspectionOrder/approval'
@@ -174,6 +202,7 @@
 				taskId: '',
 				imageFilesList: [],
 				inspectionResult: '',
+				reportFlag:'',
 				upOption: {
 					page: {
 						num: 0, // 褰撳墠椤电爜,榛樿0,鍥炶皟涔嬪墠浼氬姞1,鍗砪allback(page)浼氫粠1寮�濮�
@@ -196,7 +225,12 @@
 				msg2Count: 0,
 				msg1Title: "",
 				procInstId: '',
-				values: ''
+				values: '',
+				flag: '',
+				from: '',
+				standardId: '',
+				previewImageSrc: '',
+				todoName: ''
 
 
 			}
@@ -214,11 +248,23 @@
 		},
 		onLoad(options) {
 			const annItem = JSON.parse(decodeURIComponent(options.item));
-			this.id = annItem.dataId,
-				this.taskId = annItem.id,
-				this.procInstId = annItem.procInstId,
-				this.values = annItem.values,
-				this.assignee = annItem.assignee
+			this.flag = options.flag
+			if (this.flag == 'task') {
+				this.todoName = annItem.taskName
+			} else {
+				this.todoName = annItem.name
+			}
+			this.from = options.from
+			if (this.from === 'detils') {
+				this.id = annItem.id;
+				console.log(annItem.id);
+			} else {
+				this.id = annItem.dataId;
+			}
+			this.taskId = annItem.id
+			this.procInstId = annItem.procInstId
+			this.values = annItem.values
+			this.assignee = annItem.assignee
 
 		},
 		created() {
@@ -228,30 +274,47 @@
 		},
 
 		methods: {
+			handleImageError(e) {
+				const icon_prefix = "/static/";
+				this.previewImageSrc = icon_prefix + "icn_erro.png"
+			},
 			changehandlingType(e) {
 				this.ScanData.typeName = e;
 			},
+			closePreview() {
+				this.showPreview = false;
+			},
 			ProductionTask() {
 				if (this.hasInspectionDateArrived()) {
-					if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName ==
-						'') {
+					if (this.formData.inspectionStatus == 'WAIT_CONFIRM' && this.flag != 'task') {
+						if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData
+							.typeName ==
+							'') {
 
-						uni.showToast({
-							icon: 'none',
-							title: '澶勭悊绫诲瀷涓嶈兘涓虹┖'
-						});
-						return false;
-					}
-					if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this
-						.ScanData.handlingSuggestion ==
-						'') {
+							uni.showToast({
+								icon: 'none',
+								title: '澶勭悊绫诲瀷涓嶈兘涓虹┖'
+							});
+							return false;
+						}
+						if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion ==
+							null ||
+							this
+							.ScanData.handlingSuggestion ==
+							'') {
 
-						uni.showToast({
-							icon: 'none',
-							title: '澶勭悊鎰忚涓嶈兘涓虹┖'
-						});
-						return false;
+							uni.showToast({
+								icon: 'none',
+								title: '澶勭悊鎰忚涓嶈兘涓虹┖'
+							});
+							return false;
+						}
 					}
+
+					uni.showLoading({
+						mask: true,
+						title: "鍔犺浇涓�....",
+					})
 					this.$http.post(this.url.approval, {
 						/**
 						 * 纭鎰忚
@@ -269,8 +332,7 @@
 						userId: this.assignee,
 						values: this.values
 					}).then(res => {
-						console.log(res)
-						this.$tip.loaded();
+						uni.hideLoading();
 						if (res.data.success) {
 							uni.showToast({
 								icon: "success",
@@ -282,6 +344,13 @@
 							// })
 							this.$Router.replaceAll({
 								name: 'ToDoList'
+							})
+						} else {
+							uni.showModal({
+								title: "鎻愮ず",
+								content: res.data.message,
+								confirmText: '纭畾',
+								showCancel: false,
 							})
 						}
 					}).catch(() => {
@@ -305,6 +374,9 @@
 
 			changeEquipmentList(e) {
 				this.formData.num = e;
+			},
+			handleType(e, index) {
+				console.log(e);
 			},
 			handleCode(e, index) {
 				console.log(index);
@@ -342,23 +414,6 @@
 					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
-			// 			});
-
-			// 		}
-			// 	}).catch(() => {
-			// 		this.$tip.error("鑱旂綉澶辫触")
-			// 	})
-			// },
 			getList() {
 				this.$http.get(this.url.BaoList, {
 					params: {
@@ -380,11 +435,11 @@
 						]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍
 						item.type = [{
 								text: "鍚�",
-								value: 0
+								value: "0"
 							},
 							{
 								text: "鏄�",
-								value: 1
+								value: "1"
 							}
 						]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍
 						item.istrue = true;
@@ -399,76 +454,37 @@
 					//鑱旂綉澶辫触, 缁撴潫鍔犺浇
 				})
 			},
-			ChooseImage() {
-				var that = this;
-				uni.chooseImage({
-					count: 4,
-					sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈�
-					sourceType: ['album'], // 浠庣浉鍐岄�夋嫨
-					success: (res) => {
-						// 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰�
-						that.imgList = res.tempFilePaths;
-
-						// 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓�
-
-
-						// 鍒濆鍖� 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: {
@@ -483,23 +499,58 @@
 						console.log(this.announcement1.operator_dictText)
 						this.formData.operator = this.announcement1.operator_dictText
 						this.formData.num = this.announcement1.equipmentId
+						this.formData.remark = this.announcement1.remark
+						this.formData.installationPosition_dictText = this.announcement1
+							.installationPosition_dictText
+						this.formData.inspectionStatus_dictText = this.announcement1.inspectionStatus_dictText
+						this.formData.operatorPhone_dictText = this.announcement1.operatorPhone_dictText
 						this.formData.orderNum = this.announcement1.orderNum
 						this.formData.inspectionDate = this.announcement1.inspectionDate
 						this.formData.inspectionStatus = this.announcement1.inspectionStatus
 						this.ScanData.typeName = this.announcement1.confirmDealType
 						this.formData.confirmComment = this.announcement1.confirmDealType_dictText
 						this.ScanData.handlingSuggestion = this.announcement1.confirmComment
-
+						this.title = this.todoName ?? '璇︽儏';
+						if (this.announcement1.standardId !== null) {
+							this.standardId = this.announcement1.standardId
+							this.getStandardFile()
+						}
+						if (this.formData.inspectionStatus == 'WAIT_INSPECTION') {
+							if (this.flag == 'task') {
+								// this.title = '鐝粍闀跨‘璁�'
+								this.readonly = true
+								this.isShowBtn = false
+							}
+						}
 						if (this.formData.inspectionStatus == 'COMPLETE') {
-							this.title = '璇︽儏'
-							this.isTouch = true
-							this.isShowTeam=true
-							this.isShowBtn = false
+							if (this.flag == 'task') {
+								// this.title = '鐝粍闀跨‘璁�'
+								this.isTouch = true
+								this.readonly = true
+								this.isShowTeam = true
+								this.isShowBtn = false
+							}
 						} else if (this.formData.inspectionStatus == 'WAIT_CONFIRM') {
-							this.title = '鐐规寮�濮�';
-							this.isShowTeam=true
-							this.isTouch=true
-							this.isShowBtn=false
+							if (this.flag == 'task') {
+								// this.title = '鐝粍闀跨‘璁�';
+								this.readonly = true
+								this.isShowTeam = true
+								this.isTouch = true
+								this.isShowBtn = false
+							} else {
+								// this.title = '鐐规寮�濮�';
+								this.isShowTeam = true
+								this.isTouch = false
+								this.readonly = true
+								this.isShowBtn = true
+							}
+
+						} else if (this.formData.inspectionStatus == 'UNDER_INSPECTION') {
+							if (this.flag == 'task') {
+								// this.title = '鐐规寮�濮�';
+								this.isShowBtn = false;
+
+							}
 						}
 						this.formData.avatar = this.announcement1.imageFiles
 						this.imageFilesList = JSON.parse(this.formData.avatar)
@@ -508,6 +559,12 @@
 							return `${this.ipAndPort}${imageObj.filePath}`;
 						});
 
+						// 鏍规嵁 imgList 鏋勯�� fileLists
+						this.fileLists = this.imgList.map(url => ({
+							url: url,
+							extname: 'png',
+							name: 'eam'
+						}));
 						this.hasInspectionDateArrived();
 					}
 				}).catch(() => {
@@ -592,7 +649,69 @@
 	}
 
 	.popupView {
-		margin-top: 85px;
+		margin-top: 45px;
 		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;
+		/* 闃叉鏂囧瓧鎹㈣ */
+	}
+
+	.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