| | |
| | | } |
| | | }, |
| | | autoGenerateDefaultResult() { |
| | | // 检查是否已经有检验结果记录 |
| | | if (this.tableData.length === 0) { |
| | | // 只有没有标准值时才自动生成默认的合格记录 |
| | | // 非数值型项目:自动补齐至检验数量(默认合格),便于逐条调整 |
| | | if (!this.hasStandardValues) { |
| | | const totalNeeded = Number(this.formData.levelNum) || 0; |
| | | const currentCount = this.tableData.length || 0; |
| | | const remaining = totalNeeded - currentCount; |
| | | if (remaining > 0) { |
| | | this.$post({ |
| | | url: "/THJ/SetQSItemDetail", |
| | | data: { |
| | | pid: this.id, |
| | | gid: this.gid, |
| | | fstand: "√", // 默认合格 |
| | | fcheckResu: "1", // 默认合格 |
| | | fstand: "√", |
| | | fcheckResu: "1", |
| | | updateBy: this.$loginInfo.account, |
| | | count: 1 |
| | | count: remaining |
| | | } |
| | | }).then(res => { |
| | | }).then(() => { |
| | | // 刷新数据以显示新生成的记录 |
| | | this.refreshResult(); |
| | | }).catch(err => { |
| | | }).catch(() => { |
| | | this.$showMessage("自动生成默认记录失败"); |
| | | }); |
| | | } |