| | |
| | | </view> |
| | | </view> |
| | | <view class="td"> |
| | | <!-- 修改按钮 - 已填写后显示 --> |
| | | <button v-if="!isHoleBlocked(index) && item.fcheckResu && !isNumber" class="btn danger-btn" @tap="numberEdit(item)"> |
| | | {{ editResult(item.fcheckResu) }} |
| | | </button> |
| | | <button v-if="!isHoleBlocked(index) && item.fcheckResu && isNumber" class="btn danger-btn" @tap="toDetail(item)"> |
| | | 修改 |
| | | </button> |
| | | <!-- 状态显示 --> |
| | | <span v-if="isHoleBlocked(index)" class="blocked-text">已堵穴</span> |
| | | <span v-else-if="!item.fcheckResu" class="no-data-text">待填写</span> |
| | | <span v-else-if="!item.fcheckResu" class="ready-text">可填写</span> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | displayTableData() { |
| | | const result = []; |
| | | |
| | | console.log('displayTableData - formData:', this.formData); |
| | | console.log('displayTableData - tableData:', this.tableData); |
| | | |
| | | // 如果有穴号信息,使用穴号信息生成数据 |
| | | if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) { |
| | | this.formData.holeNumbers.forEach((holeInfo, index) => { |
| | | // 查找是否有对应的实际数据 |
| | | const actualData = this.tableData.find(item => { |
| | | return this.tableData.indexOf(item) === index; |
| | | // 对数据库记录按创建时间排序,确保顺序稳定 |
| | | const sortedTableData = [...this.tableData].sort((a, b) => { |
| | | if (a.id && b.id) return a.id - b.id; |
| | | if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate); |
| | | return 0; |
| | | }); |
| | | |
| | | console.log('displayTableData - sortedTableData:', sortedTableData); |
| | | |
| | | this.formData.holeNumbers.forEach((holeInfo, index) => { |
| | | // 直接通过索引获取对应的数据库记录 |
| | | const actualData = sortedTableData[index]; |
| | | |
| | | if (actualData) { |
| | | // 如果有实际数据,使用实际数据 |
| | |
| | | // 如果没有穴号信息,使用原来的逻辑 |
| | | const levelNum = this.formData.levelNum || 0; |
| | | |
| | | for (let i = 0; i < levelNum; i++) { |
| | | const actualData = this.tableData.find(item => { |
| | | return this.tableData.indexOf(item) === i; |
| | | // 按照创建时间或ID排序,确保顺序稳定 |
| | | const sortedTableData = [...this.tableData].sort((a, b) => { |
| | | if (a.id && b.id) return a.id - b.id; |
| | | if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate); |
| | | return 0; |
| | | }); |
| | | |
| | | console.log('displayTableData - sortedTableData (no holes):', sortedTableData); |
| | | |
| | | for (let i = 0; i < levelNum; i++) { |
| | | const actualData = sortedTableData[i]; |
| | | |
| | | if (actualData) { |
| | | result.push({ |
| | |
| | | } |
| | | } |
| | | |
| | | console.log('displayTableData - result:', result); |
| | | return result; |
| | | }, |
| | | |
| | | // 判断是否所有检验都已完成 |
| | | isAllCompleted() { |
| | | return this.displayTableData.every(item => item.fcheckResu !== null && item.fcheckResu !== undefined); |
| | | // 只检查非堵穴的行是否都已填写 |
| | | return this.displayTableData.every(item => { |
| | | // 如果是堵穴,跳过检查 |
| | | if (item.holeInfo && item.holeInfo.isBlocked) { |
| | | return true; |
| | | } |
| | | // 非堵穴的行必须有检验结果 |
| | | return item.fcheckResu !== null && item.fcheckResu !== undefined; |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | return 'PENDING'; |
| | | } |
| | | |
| | | // 根据检验结果和判定标识确定样式类 |
| | | if (fstand === '√' || fcheckResu === 'OK') { |
| | | return 'OK'; |
| | | } else if (fstand === '×' || fcheckResu === 'NG') { |
| | | return 'NG'; |
| | | } else { |
| | | // 对于数字结果,根据fstand判断 |
| | | return fstand === '√' ? 'OK' : 'NG'; |
| | | } |
| | | }, |
| | | |
| | | getResultText(fcheckResu, fstand, index) { |
| | | // 检查是否被堵穴 |
| | | if (this.isHoleBlocked(index)) { |
| | | return '/'; |
| | | } |
| | | |
| | | // 如果没有记录值,显示未检验 |
| | | if (!fcheckResu) { |
| | | return '未检验'; |
| | | } |
| | | |
| | | // 根据记录值判断检验结果是否OK |
| | | // 优先根据fstand判断 |
| | | if (fstand === '√') { |
| | | return 'OK'; |
| | | } else if (fstand === '×') { |
| | |
| | | } |
| | | } |
| | | } |
| | | // 默认返回OK样式 |
| | | return 'OK'; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getResultText(fcheckResu, fstand, index) { |
| | | // 检查是否被堵穴 |
| | | if (this.isHoleBlocked(index)) { |
| | | return '/'; |
| | | } |
| | | |
| | | // 如果没有记录值,显示未检验 |
| | | if (!fcheckResu) { |
| | | return '未检验'; |
| | | } |
| | | |
| | | // 优先根据fstand判断 |
| | | if (fstand === '√') { |
| | | return '合格'; |
| | | } else if (fstand === '×') { |
| | | return '不合格'; |
| | | } else { |
| | | // 如果没有fstand,根据fcheckResu的值判断 |
| | | if (fcheckResu === '1' || fcheckResu === 1) { |
| | | return '合格'; |
| | | } else if (fcheckResu === '0' || fcheckResu === 0) { |
| | | return '不合格'; |
| | | } else { |
| | | // 对于有上下限的数值检验,根据fcheckResu是否在范围内判断 |
| | | if (this.formData.maxValue && this.formData.minValue) { |
| | | const value = parseFloat(fcheckResu); |
| | | if (!isNaN(value)) { |
| | | if (value >= this.formData.minValue && value <= this.formData.maxValue) { |
| | | return '合格'; |
| | | } else { |
| | | return '不合格'; |
| | | } |
| | | } |
| | | } |
| | | // 如果是有数值的检验结果,直接显示数值 |
| | | return fcheckResu || '未检测'; |
| | | } |
| | | } |
| | |
| | | } |
| | | return false; |
| | | }, |
| | | |
| | | |
| | | previewImage() { |
| | | uni.previewImage({ |
| | |
| | | |
| | | if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) { |
| | | this.formData.isPass = this.formData.fcheckResu |
| | | // 根据fcheckResu设置fstand |
| | | if (this.formData.fcheckResu == 1) { |
| | | fstand = "√"; // 合格 |
| | | } else { |
| | | fstand = "×"; // 不合格 |
| | | } |
| | | } else { |
| | | this.$showMessage("无标准值时,检验结果只能为0或1!"); |
| | | return; |
| | | } |
| | | count = 1; // 每次只填写一个记录 |
| | | |
| | | // 计算实际需要填写的数量(考虑穴号信息) |
| | | if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) { |
| | | // 如果有穴号信息,计算非堵穴的数量 |
| | | const nonBlockedCount = this.formData.holeNumbers.filter(hole => !hole.isBlocked).length; |
| | | count = nonBlockedCount; |
| | | } else { |
| | | // 否则使用levelNum |
| | | count = this.formData.levelNum || 1; |
| | | } |
| | | } |
| | | |
| | | this.formData.updater = this.$loginInfo.account; |
| | | |
| | | // 直接执行保存,不显示确认弹窗 |
| | | this.$post({ |
| | | url: "/SJ/SetQSItemDetail", |
| | | data: { |
| | | pid: this.id, |
| | | gid: this.gid, |
| | | fstand: fstand, |
| | | fcheckResu: this.formData.fcheckResu, |
| | | updateBy: this.formData.updater, |
| | | Fstand: fstand, |
| | | FcheckResu: this.formData.fcheckResu, |
| | | UpdateBy: this.formData.updater, |
| | | count: count |
| | | } |
| | | }).then(res => { |
| | |
| | | |
| | | }, |
| | | refreshResult() { |
| | | // 先获取检验项目基本信息 |
| | | this.$post({ |
| | | url: "/SJ/getQSItems", |
| | | data: { |
| | | pid: this.gid, |
| | | id: this.id |
| | | } |
| | | }).then(res => { |
| | |
| | | if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) { |
| | | this.isNumber = true; |
| | | } |
| | | }) |
| | | |
| | | this.$post({ |
| | | // 然后获取检验详情数据 |
| | | return this.$post({ |
| | | url: "/SJ/getQSItemDetail", |
| | | data: { |
| | | pid: this.id, |
| | | gid: this.gid |
| | | } |
| | | }); |
| | | }).then(res => { |
| | | this.tableData = res.data.tbBillList; |
| | | }) |
| | | console.log('刷新后的tableData:', this.tableData); |
| | | }).catch(error => { |
| | | console.error('刷新数据失败:', error); |
| | | }); |
| | | }, |
| | | toDetail(item) { |
| | | this.showPopup = !this.showPopup; |
| | |
| | | |
| | | this.editData.updater = this.$loginInfo.account; |
| | | |
| | | // 显示确认提示框 |
| | | uni.showModal({ |
| | | title: '确认修改', |
| | | content: '确定要修改检验结果吗?', |
| | | confirmText: '确定修改', |
| | | cancelText: '取消', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 用户确认后执行修改 |
| | | this.$post({ |
| | | url: "/SJ/UpdateQSItemDetail", |
| | | data: { |
| | |
| | | this.$showMessage("修改成功"); |
| | | this.refreshResult();//刷新页面 |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | numberEdit(item) { |
| | | |
| | |
| | | font-style: italic; |
| | | } |
| | | |
| | | .waiting-text { |
| | | color: #E6A23C; |
| | | font-size: 12px; |
| | | font-style: italic; |
| | | } |
| | | |
| | | .ready-text { |
| | | color: #67C23A; |
| | | font-size: 12px; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | |
| | | .spec-text { |
| | | font-size: 14px; |
| | | color: #333; |
| | |
| | | color: #2c3e50; |
| | | margin: 0; |
| | | } |
| | | |
| | | .popup-subtitle { |
| | | font-size: 14px; |
| | | color: #7f8c8d; |
| | | margin: 5px 0 0 0; |
| | | } |
| | | } |
| | | |
| | | .popup-content { |
| | |
| | | background-color: white; |
| | | } |
| | | } |
| | | |
| | | .input-hint { |
| | | margin-top: 8px; |
| | | padding: 8px 12px; |
| | | background-color: #f8f9fa; |
| | | border-radius: 4px; |
| | | border-left: 3px solid #409EFF; |
| | | |
| | | text { |
| | | font-size: 12px; |
| | | color: #666; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .popup-actions { |