| | |
| | | <view class="section"> |
| | | <view class="section-header">检验结果录入</view> |
| | | <view class="section-body"> |
| | | <view class="input-group" v-if="tableData.length >= formData.checkQyt"> |
| | | <view class="input-wrapper"> |
| | | <input v-model="batchInput" type="text" class="result-input" |
| | | placeholder="格式:OK-3 或 NG-3(请勿修改结果为数字的值)" placeholder-class="placeholder" |
| | | @input="validateBatchInput" @blur="validateBatchInput" /> |
| | | <button :disabled="!isBatchInputValid" :class="{ 'btn-disabled': !isBatchInputValid }" |
| | | style="margin: 0px;background-color: #3498db;color:#ffffff ;" class="btn primary-btn" |
| | | @tap="batchUpdateResults">批量修改</button> |
| | | </view> |
| | | <view v-if="batchInputError" class="error-message">{{ batchInputError }}</view> |
| | | </view> |
| | | <view class="input-group input1"> |
| | | <view class="input-wrapper"> |
| | | |
| | |
| | | @tap="saveResult">保存结果</button> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="input-group input2"> |
| | | <view class="input-wrapper"> |
| | | |
| | | |
| | | <button class="btn upload-btn" @tap="chooseImage"> |
| | | <uni-icons type="upload" size="16" color="#fff"></uni-icons> |
| | | 上传/查看图片 |
| | |
| | | </button> |
| | | </view> |
| | | <view class="input-wrapper" style="margin-top: 15px;"> |
| | | |
| | | |
| | | <input v-if="(tableData.length < formData.checkQyt)" @input="search($event)" |
| | | v-model="inputTxt" type="text" class="result-input" placeholder="请输入检验结果..." |
| | | placeholder-class="placeholder" /> |
| | |
| | | <view v-if="tableData.length>0" class="table-container"> |
| | | <view class="table-header"> |
| | | <view class="th">编号</view> |
| | | <view class="th">检验结果<i style="color: rgb(0 212 68);" v-if="!(tableData.length < formData.checkQyt)">(输入已完成)</i></view> |
| | | <view class="th">检验结果<i style="color: rgb(0 212 68);" |
| | | v-if="!(tableData.length < formData.checkQyt)">(输入已完成)</i></view> |
| | | <view class="th" v-if="current">操作</view> |
| | | </view> |
| | | |
| | |
| | | {{ item.fcheckResu }} |
| | | </view> |
| | | </view> |
| | | <view class="td" v-if="current" > |
| | | <view class="td" v-if="current"> |
| | | <button v-if="!isNumber" class="btn danger-btn" @tap="toggleResult(item)"> |
| | | {{ editResult(item.fcheckResu) }} |
| | | </button> |
| | |
| | | showPopup: false, |
| | | editData: {}, |
| | | inputTxt: '', |
| | | formID:'', |
| | | releaseNo:'', |
| | | current:false |
| | | formID: '', |
| | | releaseNo: '', |
| | | current: false, |
| | | batchInput: '', |
| | | batchInputError: '', |
| | | isBatchInputValid: false |
| | | } |
| | | }, |
| | | methods: { |
| | | switchTab(index,mainIds) { |
| | | switchTab(index, mainIds) { |
| | | this.currentTab = index |
| | | this.mainId = mainIds; |
| | | this.refreshResult(); |
| | | |
| | | }, |
| | | validateBatchInput() { |
| | | const input = this.batchInput.trim(); |
| | | if (!input) { |
| | | this.batchInputError = ''; |
| | | this.isBatchInputValid = false; |
| | | return; |
| | | } |
| | | |
| | | // 验证格式:OK-数字 或 NG-数字 |
| | | const match = input.match(/^(OK|NG)-(\d+)$/); |
| | | if (!match) { |
| | | this.batchInputError = '格式错误,请输入:OK-数字 或 NG-数字'; |
| | | this.isBatchInputValid = false; |
| | | return; |
| | | } |
| | | |
| | | const count = parseInt(match[2]); |
| | | if (count <= 0 || count > this.tableData.length) { |
| | | this.batchInputError = `数量必须在 1-${this.tableData.length} 之间`; |
| | | this.isBatchInputValid = false; |
| | | return; |
| | | } |
| | | |
| | | |
| | | this.batchInputError = ''; |
| | | this.isBatchInputValid = true; |
| | | }, |
| | | |
| | | // 批量更新检验结果 |
| | | batchUpdateResults() { |
| | | if (!this.isBatchInputValid) return; |
| | | |
| | | const [status, countStr] = this.batchInput.split('-'); |
| | | const count = parseInt(countStr); |
| | | |
| | | if (this.tableData.length > 0) { |
| | | const firstItem = this.tableData[0]; |
| | | const isNumber = /^-?\d+(\.\d+)?$/.test(firstItem.fcheckResu); |
| | | if (isNumber) { |
| | | this.$showMessage("不能批量修改数字类型的结果"); |
| | | return; |
| | | } |
| | | } |
| | | let updatedCount = 0; |
| | | const requests = []; |
| | | for (let i = 0; i < count; i++) { |
| | | const item = this.tableData[i]; |
| | | const fstand = status === 'OK' ? '√' : '×'; |
| | | const fcheckResu = status; |
| | | |
| | | requests.push(this.$post({ |
| | | url: "/LLJ/UpdateQSItemDetail", |
| | | data: { |
| | | id: item.id, |
| | | mainId: this.formData.id, |
| | | releaseNo: this.formData.releaseNo, |
| | | fstand: fstand, |
| | | fcheckResu: fcheckResu, |
| | | updateBy: this.$loginInfo.account, |
| | | } |
| | | })); |
| | | } |
| | | |
| | | Promise.all(requests) |
| | | .then(() => { |
| | | this.$showMessage(`成功将前${count}个结果修改为${status}`); |
| | | this.batchInput = ''; |
| | | this.batchInputError = ''; |
| | | this.isBatchInputValid = false; |
| | | this.refreshResult(); // 刷新结果 |
| | | }) |
| | | .catch(error => { |
| | | this.$showMessage(`批量修改失败: ${error.message}`); |
| | | }); |
| | | }, |
| | | //检测输入框的输入,并给变量赋值 |
| | | search(event) { |
| | |
| | | //fupAllow fdownAllow standardValue |
| | | if (this.formData.fupAllow && this.formData.fdownAllow && this.formData.fstand) { |
| | | this.isNumber = true; |
| | | }else{ |
| | | } else { |
| | | this.isNumber = false; |
| | | } |
| | | }) |
| | |
| | | let params = options; |
| | | this.mainId = params["mainId"]; |
| | | this.refreshResult(); |
| | | this.formID= params["formID"]; |
| | | this.releaseNo= params["releaseNo"]; |
| | | this.currentTab=parseInt(params["index"]); |
| | | this.current=params["current"] === 'true' ? true : false; |
| | | this.formID = params["formID"]; |
| | | this.releaseNo = params["releaseNo"]; |
| | | this.currentTab = parseInt(params["index"]); |
| | | this.current = params["current"] === 'true' ? true : false; |
| | | this.$post({ |
| | | url: "/LLJ/getJYItem", |
| | | data: { |
| | |
| | | return 0; |
| | | } |
| | | }); |
| | | this.tabs = tableData; |
| | | this.tabs = tableData; |
| | | // if (this.tableData.length === 0) { |
| | | // this.isShowTable = true; |
| | | // } |
| | |
| | | this.set(item, 'current', this.current); |
| | | }); |
| | | console.log(this.tableData); |
| | | |
| | | |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.validateBatchInput(); |
| | | }); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | background-color: #3498db; |
| | | color: white; |
| | | } |
| | | .input1{ |
| | | display: block; |
| | | } |
| | | .input2{ |
| | | display: none; |
| | | } |
| | | |
| | | .input1 { |
| | | display: block; |
| | | } |
| | | |
| | | .input2 { |
| | | display: none; |
| | | } |
| | | |
| | | /* 响应式设计 */ |
| | | @media (max-width: 500px) { |
| | | .input1{ |
| | | display: none; |
| | | } |
| | | .input2{ |
| | | display: block; |
| | | } |
| | | .input1 { |
| | | display: none; |
| | | } |
| | | |
| | | .input2 { |
| | | display: block; |
| | | } |
| | | } |
| | | |
| | | |
| | | .error-message { |
| | | color: $danger-color; |
| | | font-size: 12px; |
| | | margin-top: 4px; |
| | | } |
| | | |
| | | .input-group:first-child { |
| | | .result-input { |
| | | border-color: $primary-color; |
| | | box-shadow: 0 0 0 2px rgba($primary-color, 0.2); |
| | | } |
| | | } |
| | | |
| | | .btn-disabled { |
| | | opacity: 0.6; |
| | | cursor: not-allowed; |
| | | } |
| | | </style> |