| | |
| | | <view class="info-label">上限</view> |
| | | <view class="info-value">{{ formData.maxValue }}</view> |
| | | </view> |
| | | <view class="info-item" v-if="formData.mnum"> |
| | | <view class="info-label">开穴总数</view> |
| | | <view class="info-value">{{ formData.mnum }}</view> |
| | | </view> |
| | | <view class="info-item" v-if="formData.dnum"> |
| | | <view class="info-label">堵穴号</view> |
| | | <view class="info-value">{{ formData.dnum }}</view> |
| | | </view> |
| | | <view class="info-item" v-if="formData.updater"> |
| | | <view class="info-label">更新人</view> |
| | | <view class="info-value">{{ formData.updater }}</view> |
| | |
| | | 不合格描述 |
| | | </button> |
| | | |
| | | <input v-if="tableData.length < formData.levelNum" |
| | | <input v-if="!isAllCompleted" |
| | | v-model="formData.fcheckResu" |
| | | type="text" |
| | | class="result-input" |
| | | placeholder="没有最大值和最小值时填写0(未通过检验)或1(通过检验)" |
| | | placeholder-class="placeholder" /> |
| | | <button v-if="(tableData.length < formData.levelNum)" |
| | | <button v-if="!isAllCompleted" |
| | | style="margin: 0px;background-color: #3498db;color:#ffffff ;" class="btn primary-btn" |
| | | @tap="submit">保存结果</button> |
| | | </view> |
| | |
| | | </view> |
| | | |
| | | <!-- 结果表格 --> |
| | | <view v-if="tableData.length > 0" class="table-container"> |
| | | <view v-if="formData.levelNum > 0" class="table-container"> |
| | | <view class="table-header"> |
| | | <view class="th">编号</view> |
| | | <view class="th">穴号</view> |
| | | <view class="th">记录值</view> |
| | | <view class="th">检验结果<i style="color: rgb(0 212 68);" |
| | | v-if="!(tableData.length < formData.levelNum)">(输入已完成)</i></view> |
| | | v-if="isAllCompleted">(输入已完成)</i></view> |
| | | <view class="th">操作</view> |
| | | </view> |
| | | |
| | | <view v-for="(item, index) in tableData" :key="index" class="table-row"> |
| | | <view v-for="(item, index) in displayTableData" :key="index" class="table-row"> |
| | | <view class="td">{{ index + 1 }}</view> |
| | | <view class="td">{{ getHoleNumber(index) }}</view> |
| | | <view class="td"> |
| | | <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand)]"> |
| | | {{ item.fcheckResu }} |
| | | <view class="record-value">{{ getRecordValue(item, index) }}</view> |
| | | </view> |
| | | <view class="td"> |
| | | <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand, index)]"> |
| | | {{ getResultText(item.fcheckResu, item.fstand, index) }} |
| | | </view> |
| | | </view> |
| | | <view class="td"> |
| | | <button v-if="!isNumber" class="btn danger-btn" @tap="numberEdit(item)"> |
| | | <!-- 修改按钮 - 已填写后显示 --> |
| | | <button v-if="!isHoleBlocked(index) && item.fcheckResu && !isNumber" class="btn danger-btn" @tap="numberEdit(item)"> |
| | | {{ editResult(item.fcheckResu) }} |
| | | </button> |
| | | <button v-if="isNumber" class="btn danger-btn" @tap="toDetail(item)"> |
| | | <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="ready-text">可填写</span> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | tabs: [] |
| | | } |
| | | }, |
| | | computed: { |
| | | // 根据穴号信息生成完整的显示数据 |
| | | displayTableData() { |
| | | const result = []; |
| | | |
| | | console.log('displayTableData - formData:', this.formData); |
| | | console.log('displayTableData - tableData:', this.tableData); |
| | | |
| | | // 如果有穴号信息,使用穴号信息生成数据 |
| | | if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) { |
| | | // 对数据库记录按创建时间排序,确保顺序稳定 |
| | | 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) { |
| | | // 如果有实际数据,使用实际数据 |
| | | result.push({ |
| | | ...actualData, |
| | | index: index, |
| | | holeInfo: holeInfo |
| | | }); |
| | | } else { |
| | | // 如果没有实际数据,创建空记录 |
| | | result.push({ |
| | | id: null, |
| | | fcheckResu: holeInfo.isBlocked ? "/" : null, |
| | | fstand: holeInfo.isBlocked ? "/" : null, |
| | | index: index, |
| | | pid: this.id, |
| | | gid: this.gid, |
| | | holeInfo: holeInfo |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | // 如果没有穴号信息,使用原来的逻辑 |
| | | const levelNum = this.formData.levelNum || 0; |
| | | |
| | | // 按照创建时间或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({ |
| | | ...actualData, |
| | | index: i |
| | | }); |
| | | } else { |
| | | result.push({ |
| | | id: null, |
| | | fcheckResu: null, |
| | | fstand: null, |
| | | index: i, |
| | | pid: this.id, |
| | | gid: this.gid |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | console.log('displayTableData - result:', result); |
| | | return result; |
| | | }, |
| | | |
| | | // 判断是否所有检验都已完成 |
| | | isAllCompleted() { |
| | | // 只检查非堵穴的行是否都已填写 |
| | | return this.displayTableData.every(item => { |
| | | // 如果是堵穴,跳过检查 |
| | | if (item.holeInfo && item.holeInfo.isBlocked) { |
| | | return true; |
| | | } |
| | | // 非堵穴的行必须有检验结果 |
| | | return item.fcheckResu !== null && item.fcheckResu !== undefined; |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | | getResultClass(fcheckResu, fstand) { |
| | | // 根据检验结果和判定标识确定样式类 |
| | | if (fstand === '√' || fcheckResu === 'OK') { |
| | | getResultClass(fcheckResu, fstand, index) { |
| | | // 检查是否被堵穴 |
| | | if (this.isHoleBlocked(index)) { |
| | | return 'BLOCKED'; |
| | | } |
| | | |
| | | // 如果没有记录值,显示未检验样式 |
| | | if (!fcheckResu) { |
| | | return 'PENDING'; |
| | | } |
| | | |
| | | // 优先根据fstand判断 |
| | | if (fstand === '√') { |
| | | return 'OK'; |
| | | } else if (fstand === '×' || fcheckResu === 'NG') { |
| | | } else if (fstand === '×') { |
| | | return 'NG'; |
| | | } else { |
| | | // 对于数字结果,根据fstand判断 |
| | | return fstand === '√' ? 'OK' : 'NG'; |
| | | // 如果没有fstand,根据fcheckResu的值判断 |
| | | if (fcheckResu === '1' || fcheckResu === 1) { |
| | | return 'OK'; |
| | | } else if (fcheckResu === '0' || fcheckResu === 0) { |
| | | return 'NG'; |
| | | } 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 'OK'; |
| | | } else { |
| | | return 'NG'; |
| | | } |
| | | } |
| | | } |
| | | // 默认返回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 || '未检测'; |
| | | } |
| | | } |
| | | }, |
| | | |
| | |
| | | // this.gid = id; |
| | | // this.refreshResult(); |
| | | }, |
| | | |
| | | // ===== 穴号相关方法 ===== |
| | | getHoleNumber(index) { |
| | | const item = this.displayTableData[index]; |
| | | if (item && item.holeInfo) { |
| | | return item.holeInfo.holeNumber; |
| | | } |
| | | return index + 1; |
| | | }, |
| | | |
| | | getRecordValue(item, index) { |
| | | if (this.isHoleBlocked(index)) { |
| | | return '/'; |
| | | } |
| | | return item.fcheckResu || '无'; |
| | | }, |
| | | |
| | | isHoleBlocked(index) { |
| | | const item = this.displayTableData[index]; |
| | | if (item && item.holeInfo) { |
| | | return item.holeInfo.isBlocked; |
| | | } |
| | | 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 = count - this.tableData.length; |
| | | |
| | | // 计算实际需要填写的数量(考虑穴号信息) |
| | | 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({ |
| | | url: "/SJ/getQSItemDetail", |
| | | data: { |
| | | pid: this.id, |
| | | gid: this.gid |
| | | } |
| | | |
| | | // 然后获取检验详情数据 |
| | | 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; |
| | | |
| | | this.$post({ |
| | | url: "/SJ/UpdateQSItemDetail", |
| | | data: { |
| | | id: this.editData.id, |
| | | pid: this.id, |
| | | gid: this.gid, |
| | | fstand: fstand, |
| | | fcheckResu: this.editData.fcheckResu, |
| | | updateBy: this.editData.updater, |
| | | // 显示确认提示框 |
| | | uni.showModal({ |
| | | title: '确认修改', |
| | | content: '确定要修改检验结果吗?', |
| | | confirmText: '确定修改', |
| | | cancelText: '取消', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 用户确认后执行修改 |
| | | this.$post({ |
| | | url: "/SJ/UpdateQSItemDetail", |
| | | data: { |
| | | id: this.editData.id, |
| | | pid: this.id, |
| | | gid: this.gid, |
| | | fstand: fstand, |
| | | fcheckResu: this.editData.fcheckResu, |
| | | updateBy: this.editData.updater, |
| | | } |
| | | }).then(res => { |
| | | this.showPopup = !this.showPopup; |
| | | this.$showMessage("修改成功"); |
| | | this.refreshResult();//刷新页面 |
| | | }) |
| | | } |
| | | } |
| | | }).then(res => { |
| | | this.showPopup = !this.showPopup; |
| | | this.$showMessage("修改成功"); |
| | | this.refreshResult();//刷新页面 |
| | | }) |
| | | }); |
| | | }, |
| | | numberEdit(item) { |
| | | |
| | |
| | | background-color: rgba($danger-color, 0.1); |
| | | color: $danger-color; |
| | | } |
| | | |
| | | &.PENDING { |
| | | background-color: rgba(#E6A23C, 0.1); |
| | | color: #E6A23C; |
| | | } |
| | | |
| | | &.BLOCKED { |
| | | background-color: rgba(#909399, 0.1); |
| | | color: #909399; |
| | | } |
| | | } |
| | | |
| | | .record-value { |
| | | font-family: 'Courier New', monospace; |
| | | font-weight: 500; |
| | | color: #333; |
| | | padding: 2px 4px; |
| | | background-color: #f8f9fa; |
| | | border-radius: 3px; |
| | | border: 1px solid #e9ecef; |
| | | } |
| | | |
| | | .no-data-text { |
| | | color: #E6A23C; |
| | | font-size: 12px; |
| | | font-style: italic; |
| | | } |
| | | |
| | | .blocked-text { |
| | | color: #909399; |
| | | font-size: 12px; |
| | | 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: #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 { |