From 35c857b1471760fd1723d1fe04458ba97c49cb0f Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 14 十一月 2025 13:21:34 +0800
Subject: [PATCH] 调试

---
 components/EquipmentInspection.vue |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/components/EquipmentInspection.vue b/components/EquipmentInspection.vue
index 61c9c18..2dda798 100644
--- a/components/EquipmentInspection.vue
+++ b/components/EquipmentInspection.vue
@@ -160,14 +160,34 @@
 					date: this.currentDate
 				}, { mock: true, showLoading: true })
 
-				if (record && record.dailyChecks) {
-					this.dailyChecks = record.dailyChecks
+				// 楠岃瘉骞惰缃棩甯哥偣妫�鏁版嵁
+				if (record && Array.isArray(record.dailyChecks) && record.dailyChecks.length === 6) {
+					// 纭繚姣忎釜瀛愭暟缁勯兘鏄湁鏁堢殑鏁扮粍
+					const isValid = record.dailyChecks.every(arr => Array.isArray(arr) && arr.length === 31)
+					if (isValid) {
+						// 浣跨敤 $set 纭繚 Vue 鑳藉妫�娴嬪埌宓屽鏁扮粍鐨勫彉鍖�
+						this.$set(this, 'dailyChecks', record.dailyChecks.map(arr => [...arr]))
+					} else {
+						console.warn('鏃ュ父鐐规鏁版嵁鏍煎紡涓嶆纭紝浣跨敤榛樿鍊�')
+						this.$set(this, 'dailyChecks', this.dailyItems.map(() => Array(31).fill(false)))
+					}
 				} else {
-					this.initChecks()
+					this.$set(this, 'dailyChecks', this.dailyItems.map(() => Array(31).fill(false)))
 				}
 
-				if (record && record.monthlyChecks) {
-					this.monthlyChecks = record.monthlyChecks
+				// 楠岃瘉骞惰缃湀搴︾偣妫�鏁版嵁
+				if (record && Array.isArray(record.monthlyChecks) && record.monthlyChecks.length === 2) {
+					// 纭繚姣忎釜瀛愭暟缁勯兘鏄湁鏁堢殑鏁扮粍
+					const isValid = record.monthlyChecks.every(arr => Array.isArray(arr) && arr.length === 31)
+					if (isValid) {
+						// 浣跨敤 $set 纭繚 Vue 鑳藉妫�娴嬪埌宓屽鏁扮粍鐨勫彉鍖�
+						this.$set(this, 'monthlyChecks', record.monthlyChecks.map(arr => [...arr]))
+					} else {
+						console.warn('鏈堝害鐐规鏁版嵁鏍煎紡涓嶆纭紝浣跨敤榛樿鍊�')
+						this.$set(this, 'monthlyChecks', this.monthlyItems.map(() => Array(31).fill(false)))
+					}
+				} else {
+					this.$set(this, 'monthlyChecks', this.monthlyItems.map(() => Array(31).fill(false)))
 				}
 
 				this.dirty = false
@@ -186,8 +206,20 @@
 			}
 
 			if (type === 'daily') {
+				// 瀹夊叏妫�鏌ワ細纭繚鏁扮粍鍜岀储寮曟湁鏁�
+				if (!Array.isArray(this.dailyChecks) || !Array.isArray(this.dailyChecks[itemIdx])) {
+					console.error('鏃ュ父鐐规鏁版嵁缁撴瀯寮傚父锛岄噸鏂板垵濮嬪寲')
+					this.initChecks()
+					return
+				}
 				this.$set(this.dailyChecks[itemIdx], dayIdx, !this.dailyChecks[itemIdx][dayIdx])
 			} else {
+				// 瀹夊叏妫�鏌ワ細纭繚鏁扮粍鍜岀储寮曟湁鏁�
+				if (!Array.isArray(this.monthlyChecks) || !Array.isArray(this.monthlyChecks[itemIdx])) {
+					console.error('鏈堝害鐐规鏁版嵁缁撴瀯寮傚父锛岄噸鏂板垵濮嬪寲')
+					this.initChecks()
+					return
+				}
 				this.$set(this.monthlyChecks[itemIdx], dayIdx, !this.monthlyChecks[itemIdx][dayIdx])
 			}
 			this.dirty = true

--
Gitblit v1.9.3