| | |
| | | <view class="action-buttons"> |
| | | <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="save">创建检验单并生成部分默认值</button> |
| | | <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button> |
| | | <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="refreshItems">刷新检验项目</button> |
| | | <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="submit">提交检验</button> |
| | | <!-- <button class="action-btn danger" v-if="!isUpdate && !formData.statusUser && !isShowTable" @click="removeXJ">删除单据</button> --> |
| | | <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不合格描述</button> |
| | | <!-- <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="submit">审核单据</button> --> |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | refreshItems() { |
| | | if (!this.formData.id) { |
| | | this.$showMessage("请先保存检验单"); |
| | | return; |
| | | } |
| | | this.$post({ |
| | | url: "/SJ/GenUpdateSJ", |
| | | data: { |
| | | id: this.formData.id, |
| | | no: this.formData.billNo, |
| | | userNo: this.$loginInfo.account |
| | | } |
| | | }).then(res => { |
| | | if (res.status === 0) { |
| | | this.$showMessage(res.message || "已刷新检验项目"); |
| | | this.init(); |
| | | } else { |
| | | this.$showMessage(res.message || "刷新失败"); |
| | | } |
| | | }).catch(err => { |
| | | console.error("刷新检验项目失败:", err); |
| | | this.$showMessage("刷新失败,请稍后重试"); |
| | | }); |
| | | }, |
| | | removeXJ() { |
| | | if (this.formData.id) { |
| | | this.$post({ |
| | |
| | | }, |
| | | |
| | | submit() { |
| | | // 校验:所有检验项目必须完成 |
| | | const hasIncomplete = this.tableData && this.tableData.some(item => { |
| | | // 允许的完成条件:result 不为 '未完成' 且 已检次数达到要求 |
| | | const resultIncomplete = item.result === '未完成'; |
| | | const countIncomplete = (item.isCheck ?? 0) < (item.levelNum ?? 0); |
| | | return resultIncomplete || countIncomplete; |
| | | }); |
| | | if (hasIncomplete) { |
| | | this.$showMessage("还有未完成的检验项目,无法提交"); |
| | | return; |
| | | } |
| | | this.$post({ |
| | | url: "/SJ/SJQaSubmit", |
| | | data: { |
| | |
| | | id: this.formData.id |
| | | } |
| | | }).then(res => { |
| | | //2024-11-28 kyy 校验合格提交增加提示 |
| | | console.log("Status Code的值:", res.statusCode); |
| | | if (res.statusCode === 200) { |
| | | // 按后端统一返回结构判断 |
| | | if (res.status === 0) { |
| | | this.$showMessage("成功提交检验"); |
| | | // 使用setTimeout在7秒后隐藏消息 |
| | | setTimeout(() => { |
| | | this.hideCustomMessage(); |
| | | }, 7000); // 7000毫秒等于7秒 |
| | | } else { |
| | | this.$showMessage(res.data.message || "审核失败"); |
| | | this.$showMessage(res.message || "审核失败"); |
| | | } |
| | | }).catch(error => { |
| | | console.error("审核提交失败:", error); |
| | |
| | | |
| | | /* 按钮样式 */ |
| | | .record-btn { |
| | | padding: 6px 12px; |
| | | background-color: #f8f9fa; |
| | | border: 1px solid #ddd; |
| | | padding: 8px 16px; |
| | | background: linear-gradient(135deg, #3498db, #2980b9); |
| | | color: #fff; |
| | | border: none; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | transition: all 0.2s; |
| | | font-size: 12px; |
| | | transition: all 0.3s ease; |
| | | font-weight: 500; |
| | | font-size: 13px; |
| | | box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3); |
| | | } |
| | | |
| | | .record-btn:hover { |
| | | background-color: #e9ecef; |
| | | background: linear-gradient(135deg, #2980b9, #1f618d); |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4); |
| | | } |
| | | |
| | | .record-btn:active { |
| | | transform: translateY(0); |
| | | } |
| | | |
| | | /* 填写状态按钮 */ |
| | | .record-btn-fill { |
| | | background-color: #2ecc71; |
| | | color: white; |
| | | border-color: #27ae60; |
| | | background: linear-gradient(135deg, #2ecc71, #27ae60); |
| | | box-shadow: 0 2px 4px rgba(46, 204, 113, 0.3); |
| | | } |
| | | |
| | | .record-btn-fill:hover { |
| | | background-color: #27ae60; |
| | | background: linear-gradient(135deg, #27ae60, #229954); |
| | | box-shadow: 0 4px 8px rgba(46, 204, 113, 0.4); |
| | | } |
| | | |
| | | /* 查看状态按钮 */ |
| | | .record-btn-view { |
| | | background-color: #95a5a6; |
| | | color: white; |
| | | border-color: #7f8c8d; |
| | | background: linear-gradient(135deg, #95a5a6, #7f8c8d); |
| | | box-shadow: 0 2px 4px rgba(149, 165, 166, 0.3); |
| | | } |
| | | |
| | | .record-btn-view:hover { |
| | | background-color: #7f8c8d; |
| | | background: linear-gradient(135deg, #7f8c8d, #6c7b7d); |
| | | box-shadow: 0 4px 8px rgba(149, 165, 166, 0.4); |
| | | } |
| | | |
| | | /* 操作按钮区 */ |
| | | .action-buttons { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: flex-end; |
| | | gap: 10px; |
| | | margin-bottom: 20px; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .action-btn { |
| | | padding: 12px 20px; |
| | | padding: 10px 20px; |
| | | border: none; |
| | | border-radius: 6px; |
| | | border-radius: 4px; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | transition: all 0.2s; |
| | | cursor: pointer; |
| | | transition: all 0.3s; |
| | | } |
| | | |
| | | .action-btn.primary { |
| | |
| | | } |
| | | |
| | | .action-btn.secondary { |
| | | background-color: #95a5a6; |
| | | color: white; |
| | | background-color: #ecf0f1; |
| | | color: #7f8c8d; |
| | | } |
| | | |
| | | .action-btn.secondary:hover { |
| | | background-color: #7f8c8d; |
| | | background-color: #d5dbdb; |
| | | } |
| | | |
| | | .action-btn.danger { |
| | |
| | | } |
| | | |
| | | .action-btn.success { |
| | | background-color: #2ecc71; |
| | | background: linear-gradient(135deg, #2ecc71, #27ae60); |
| | | color: white; |
| | | } |
| | | |
| | | .action-btn.success:hover { |
| | | background-color: #27ae60; |
| | | background: linear-gradient(135deg, #27ae60, #229954); |
| | | } |
| | | |
| | | /* 弹出框样式 */ |