| | |
| | | // 确保每个子数组都是有效的数组 |
| | | const isValid = record.dailyChecks.every(arr => Array.isArray(arr) && arr.length === 31) |
| | | if (isValid) { |
| | | this.dailyChecks = record.dailyChecks |
| | | // 使用 $set 确保 Vue 能够检测到嵌套数组的变化 |
| | | this.$set(this, 'dailyChecks', record.dailyChecks.map(arr => [...arr])) |
| | | } else { |
| | | console.warn('日常点检数据格式不正确,使用默认值') |
| | | this.dailyChecks = this.dailyItems.map(() => Array(31).fill(false)) |
| | | this.$set(this, 'dailyChecks', this.dailyItems.map(() => Array(31).fill(false))) |
| | | } |
| | | } else { |
| | | this.dailyChecks = this.dailyItems.map(() => Array(31).fill(false)) |
| | | this.$set(this, 'dailyChecks', this.dailyItems.map(() => Array(31).fill(false))) |
| | | } |
| | | |
| | | // 验证并设置月度点检数据 |
| | |
| | | // 确保每个子数组都是有效的数组 |
| | | const isValid = record.monthlyChecks.every(arr => Array.isArray(arr) && arr.length === 31) |
| | | if (isValid) { |
| | | this.monthlyChecks = record.monthlyChecks |
| | | // 使用 $set 确保 Vue 能够检测到嵌套数组的变化 |
| | | this.$set(this, 'monthlyChecks', record.monthlyChecks.map(arr => [...arr])) |
| | | } else { |
| | | console.warn('月度点检数据格式不正确,使用默认值') |
| | | this.monthlyChecks = this.monthlyItems.map(() => Array(31).fill(false)) |
| | | this.$set(this, 'monthlyChecks', this.monthlyItems.map(() => Array(31).fill(false))) |
| | | } |
| | | } else { |
| | | this.monthlyChecks = this.monthlyItems.map(() => Array(31).fill(false)) |
| | | this.$set(this, 'monthlyChecks', this.monthlyItems.map(() => Array(31).fill(false))) |
| | | } |
| | | |
| | | this.dirty = false |