| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 检查所有检验项目是否已完成 |
| | | checkAllItemsCompleted() { |
| | | this.$post({ |
| | | url: "/SJ/getQSItems", |
| | | data: { |
| | | pid: this.gid, |
| | | } |
| | | }).then(res => { |
| | | if (res.data && res.data.tbBillList) { |
| | | const allItems = res.data.tbBillList; |
| | | // 检查是否所有项目都不是"未完成"状态 |
| | | const allCompleted = allItems.every(item => item.result !== '未完成'); |
| | | |
| | | if (allCompleted) { |
| | | // 所有项目已完成,不自动跳转,用户手动返回 |
| | | // const pages = getCurrentPages(); |
| | | // if (pages.length >= 2) { |
| | | // const prevPage = pages[pages.length - 2]; |
| | | // const route = '/' + prevPage.route; |
| | | // const options = prevPage.options; |
| | | // let query = ''; |
| | | // for (let key in options) { |
| | | // query += `${key}=${options[key]}&`; |
| | | // } |
| | | // query = query.slice(0, -1); |
| | | // setTimeout(() => { |
| | | // uni.redirectTo({ |
| | | // url: query ? `${route}?${query}` : route |
| | | // }); |
| | | // }, 1000); |
| | | // } |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 切换标签页 |
| | | switchTab(index, id) { |
| | | this.currentTab = index; |
| | |
| | | return 0; |
| | | } |
| | | }); |
| | | |
| | | // 根据当前id查找对应的标签索引(参考LLJ实现) |
| | | const foundIndex = this.tabs.findIndex(tab => tab.id == this.id); // 使用==而非===,避免类型不匹配 |
| | | if (foundIndex !== -1) { |
| | | this.currentTab = foundIndex; |
| | | } else { |
| | | // 如果没找到,默认跳转到第一个标签 |
| | | this.currentTab = 0; |
| | | } |
| | | } else { |
| | | // 没有项目时至少添加当前项目到标签 |
| | | this.tabs = [{id: this.id, projName: this.formData.projName || '当前项目'}]; |
| | |
| | | let checkValue = Number(this.formData.fcheckResu); |
| | | let minValue = Number(this.formData.minValue); |
| | | let maxValue = Number(this.formData.maxValue); |
| | | let standardValue = Number(this.formData.standardValue); |
| | | |
| | | // 添加新的验证:检查上限值和下限值与标准值的关系 |
| | | if (this.formData.standardValue != null) { |
| | | if (maxValue < standardValue) { |
| | | this.$showMessage("上限值过小,应大于等于标准值"); |
| | | return; |
| | | } |
| | | if (minValue > standardValue) { |
| | | this.$showMessage("下限值过大,应小于等于标准值"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) { |
| | | this.$showMessage("检验值或范围值格式不正确,请检查输入"); |
| | |
| | | }).then(res => { |
| | | this.formData.fcheckResu = null; |
| | | this.$showMessage("保存成功"); |
| | | this.refreshResult(); |
| | | |
| | | // 重新加载标签项以更新状态 |
| | | this.loadTabItems(); |
| | | |
| | | // 等待tabs更新后,查找下一个未完成的项目 |
| | | this.$nextTick(() => { |
| | | // 查找下一个未完成的项目 |
| | | const nextUnfinishedIndex = this.tabs.findIndex((tab, index) => |
| | | index > this.currentTab && tab.result === '未完成' |
| | | ); |
| | | |
| | | if (nextUnfinishedIndex !== -1) { |
| | | // 找到了下一个未完成的项目,跳转过去 |
| | | this.currentTab = nextUnfinishedIndex; |
| | | this.id = this.tabs[nextUnfinishedIndex].id; |
| | | this.refreshResult(); |
| | | } else { |
| | | // 没有下一个未完成的,从头查找第一个未完成的 |
| | | const firstUnfinishedIndex = this.tabs.findIndex(tab => tab.result === '未完成'); |
| | | if (firstUnfinishedIndex !== -1) { |
| | | this.currentTab = firstUnfinishedIndex; |
| | | this.id = this.tabs[firstUnfinishedIndex].id; |
| | | this.refreshResult(); |
| | | } else { |
| | | // 所有项目都已完成,刷新当前项目 |
| | | this.refreshResult(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 检查是否所有检验项目都已完成 |
| | | this.checkAllItemsCompleted(); |
| | | }) |
| | | |
| | | }, |
| | |
| | | let checkValue = Number(this.editData.fcheckResu); |
| | | let minValue = Number(this.formData.minValue); |
| | | let maxValue = Number(this.formData.maxValue); |
| | | let standardValue = Number(this.formData.standardValue); |
| | | |
| | | // 添加新的验证:检查上限值和下限值与标准值的关系 |
| | | if (this.formData.standardValue != null) { |
| | | if (maxValue < standardValue) { |
| | | this.$showMessage("上限值过小,应大于等于标准值"); |
| | | return; |
| | | } |
| | | if (minValue > standardValue) { |
| | | this.$showMessage("下限值过大,应小于等于标准值"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) { |
| | | this.$showMessage("检验值或范围值格式不正确,请检查输入"); |
| | |
| | | this.refreshResult();//刷新页面 |
| | | // 重新加载标签项以更新状态 |
| | | this.loadTabItems(); |
| | | |
| | | // 检查是否所有检验项目都已完成 |
| | | this.checkAllItemsCompleted(); |
| | | }) |
| | | }, |
| | | numberEdit(item) { |
| | |
| | | this.refreshResult(); //刷新页面 |
| | | // 重新加载标签项以更新状态 |
| | | this.loadTabItems(); |
| | | |
| | | // 检查是否所有检验项目都已完成 |
| | | this.checkAllItemsCompleted(); |
| | | }) |
| | | }, |
| | | // 上传图片 |
| | |
| | | this.remarks = this.formData.remarks; |
| | | }, |
| | | editRemarks() { |
| | | if (this.remarks) { |
| | | // 允许保存空字符串或空格,只检查是否为null或undefined |
| | | if (this.remarks !== null && this.remarks !== undefined) { |
| | | //saveRemarksGid |
| | | this.$post({ |
| | | url: "/SJ/saveRemarksPid", |