| | |
| | | <view class="info-value">{{formData.result}}</view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view v-if="formData.result != null" class="result-preview"> |
| | | <view class="info-label">预览结果</view> |
| | | <view class="info-value">{{formData.result}}</view> |
| | | </view> |
| | | |
| | | |
| | | <view v-if="formData.remarks != null" class="result-ng"> |
| | | <view class="info-label">不合格描述</view> |
| | | <view class="info-value danger">{{formData.remarks}}</view> |
| | |
| | | <view class="section"> |
| | | <view class="section-header">检验结果录入</view> |
| | | <view class="section-body"> |
| | | <!-- 验证提示 --> |
| | | <view v-if="isUnqualifiedResult()" class="validation-hint"> |
| | | <view class="validation-icon">⚠️</view> |
| | | <view class="validation-text"> |
| | | <view class="validation-title">检验项目不合格,必须完成以下操作:</view> |
| | | <view class="validation-requirements"> |
| | | <view class="requirement-item" :class="{ 'completed': hasImage() }"> |
| | | <view class="requirement-icon">{{ hasImage() ? '✅' : '❌' }}</view> |
| | | <view class="requirement-text">上传图片</view> |
| | | </view> |
| | | <view class="requirement-item" :class="{ 'completed': hasRemarks() }"> |
| | | <view class="requirement-icon">{{ hasRemarks() ? '✅' : '❌' }}</view> |
| | | <view class="requirement-text">填写不良描述</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="input-group"> |
| | | <view class="input-wrapper"> |
| | | <button class="btn upload-btn" @tap="saveRemarks"> |
| | | <uni-icons type="compose" size="16" color="#fff"></uni-icons> |
| | | 不合格描述 |
| | | </button> |
| | | |
| | | <button class="btn attachment-btn" @tap="viewAttachmentInfo"> |
| | | <uni-icons type="folder" size="16" color="#fff"></uni-icons> |
| | | 查看附件信息 |
| | | </button> |
| | | |
| | | <input v-if="!isAllCompleted" |
| | | v-model="formData.fcheckResu" |
| | | type="text" |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作按钮 --> |
| | | <view class="action-buttons"> |
| | | <button class="btn upload-btn" @tap="saveRemarks"> |
| | | <view class="btn-content"> |
| | | <uni-icons type="compose" size="16" color="#fff"></uni-icons> |
| | | <view class="btn-text">不合格描述</view> |
| | | </view> |
| | | </button> |
| | | <button class="btn attachment-btn" @tap="viewAttachmentInfo"> |
| | | <view class="btn-content"> |
| | | <uni-icons type="folder" size="16" color="#fff"></uni-icons> |
| | | <view class="btn-text">查看附件信息</view> |
| | | </view> |
| | | </button> |
| | | <button class="action-btn success tablet-upload-btn" @click="uploadImage"> |
| | | <view class="btn-content"> |
| | | <view class="btn-icon">📷</view> |
| | | <view class="btn-text">拍照/上传图片</view> |
| | | </view> |
| | | </button> |
| | | </view> |
| | | |
| | | <!-- 结果表格 --> |
| | |
| | | |
| | | <!-- 图片预览 --> |
| | | <view v-if="isShowImg" class="section"> |
| | | <view class="section-header">相关图片</view> |
| | | <view class="section-header"> |
| | | <view class="section-title">相关图片</view> |
| | | <view class="section-actions"> |
| | | <button class="delete-image-btn" @click="deleteImage">删除图片</button> |
| | | </view> |
| | | </view> |
| | | <view class="section-body"> |
| | | <view class="image-preview" @click="previewImage"> |
| | | <image :src="base64Image" mode="aspectFit" class="preview-image"/> |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 判断当前检验结果是否为不合格 |
| | | isUnqualifiedResult() { |
| | | if (!this.formData.fcheckResu) return false; |
| | | |
| | | // 如果有最大值和最小值,检查是否超出范围 |
| | | if (this.formData.maxValue && this.formData.minValue) { |
| | | return this.formData.fcheckResu < this.formData.minValue || |
| | | this.formData.fcheckResu > this.formData.maxValue; |
| | | } |
| | | |
| | | // 如果没有最大值和最小值,检查是否为0(不合格) |
| | | return this.formData.fcheckResu == 0; |
| | | }, |
| | | |
| | | // 判断是否已上传图片 |
| | | hasImage() { |
| | | return this.formData.imageData && this.formData.imageData.length > 0; |
| | | }, |
| | | |
| | | // 判断是否已填写不良描述 |
| | | hasRemarks() { |
| | | return this.formData.remarks && this.formData.remarks.trim() !== ''; |
| | | }, |
| | | |
| | | getResultClass(fcheckResu, fstand, index) { |
| | | // 检查是否被堵穴 |
| | | if (this.isHoleBlocked(index)) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 验证不合格检验项目必须上传图片并填写不良描述 |
| | | if (fstand === "×" || this.formData.fcheckResu == 0) { |
| | | // 检查是否已上传图片 |
| | | if (!this.formData.imageData || this.formData.imageData.length === 0) { |
| | | this.$showMessage("检验项目不合格,必须上传图片!"); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否已填写不良描述 |
| | | if (!this.formData.remarks || this.formData.remarks.trim() === '') { |
| | | this.$showMessage("检验项目不合格,必须填写不良描述!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.formData.updater = this.$loginInfo.account; |
| | | |
| | | |
| | | // 直接执行保存,不显示确认弹窗 |
| | | this.$post({ |
| | | url: "/SJ/SetQSItemDetail", |
| | |
| | | if (this.formData.imageData) { |
| | | this.isShowImg = true; |
| | | this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData; |
| | | } else { |
| | | this.isShowImg = false; |
| | | this.base64Image = ''; |
| | | } |
| | | if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) { |
| | | this.isNumber = true; |
| | |
| | | } |
| | | } |
| | | |
| | | // 验证不合格检验项目必须上传图片并填写不良描述 |
| | | if (fstand === "×" || this.editData.fcheckResu == 0) { |
| | | // 检查是否已上传图片 |
| | | if (!this.formData.imageData || this.formData.imageData.length === 0) { |
| | | this.$showMessage("检验项目不合格,必须上传图片!"); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否已填写不良描述 |
| | | if (!this.formData.remarks || this.formData.remarks.trim() === '') { |
| | | this.$showMessage("检验项目不合格,必须填写不良描述!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.editData.updater = this.$loginInfo.account; |
| | | |
| | | |
| | | // 显示确认提示框 |
| | | uni.showModal({ |
| | | title: '确认修改', |
| | |
| | | fstand = "×"; |
| | | fcheckResu = 0; |
| | | } |
| | | |
| | | |
| | | // 验证不合格检验项目必须上传图片并填写不良描述 |
| | | if (fstand === "×" || fcheckResu == 0) { |
| | | // 检查是否已上传图片 |
| | | if (!this.formData.imageData || this.formData.imageData.length === 0) { |
| | | this.$showMessage("检验项目不合格,必须上传图片!"); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否已填写不良描述 |
| | | if (!this.formData.remarks || this.formData.remarks.trim() === '') { |
| | | this.$showMessage("检验项目不合格,必须填写不良描述!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.$post({ |
| | | url: "/SJ/UpdateQSItemDetail", |
| | | data: { |
| | |
| | | current: this.previewContent |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 图片上传方法 |
| | | uploadImage() { |
| | | uni.showActionSheet({ |
| | | itemList: ['拍照', '从相册选择'], |
| | | success: (res) => { |
| | | if (res.tapIndex === 0) { |
| | | this.chooseImageWithSource('camera'); |
| | | } else if (res.tapIndex === 1) { |
| | | this.chooseImageWithSource('album'); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 选择图片来源 |
| | | chooseImageWithSource(source) { |
| | | uni.chooseImage({ |
| | | count: 1, |
| | | sizeType: ['compressed'], |
| | | sourceType: [source], |
| | | success: (res) => { |
| | | const tempFilePath = res.tempFilePaths[0]; |
| | | if (source === 'camera') { |
| | | // 拍照后显示预览确认 |
| | | this.showImagePreview(tempFilePath); |
| | | } else { |
| | | // 相册选择直接上传 |
| | | this.uploadImageToServer(tempFilePath); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | console.error('选择图片失败:', err); |
| | | this.$showMessage('选择图片失败'); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 显示图片预览 |
| | | showImagePreview(tempFilePath) { |
| | | uni.previewImage({ |
| | | urls: [tempFilePath], |
| | | current: tempFilePath, |
| | | success: () => { |
| | | // 预览后询问是否上传 |
| | | uni.showModal({ |
| | | title: '确认上传', |
| | | content: '是否上传此图片?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | this.uploadImageToServer(tempFilePath); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 上传图片到服务器 |
| | | uploadImageToServer(tempFilePath) { |
| | | uni.showLoading({ |
| | | title: '上传中...' |
| | | }); |
| | | |
| | | uni.uploadFile({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/SJ/UploadImageToPicture', |
| | | filePath: tempFilePath, |
| | | name: 'file', |
| | | formData: { |
| | | id: this.id.toString(), |
| | | gid: this.gid.toString(), |
| | | billNo: this.billNo, |
| | | createBy: this.$loginInfo.account |
| | | }, |
| | | success: (res) => { |
| | | uni.hideLoading(); |
| | | try { |
| | | const result = JSON.parse(res.data); |
| | | if (result.status === 0) { |
| | | this.$showMessage('图片上传成功'); |
| | | this.refreshResult(); // 刷新页面数据 |
| | | } else { |
| | | this.$showMessage(result.message || '上传失败'); |
| | | } |
| | | } catch (e) { |
| | | this.$showMessage('上传失败,请重试'); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | uni.hideLoading(); |
| | | console.error('上传失败:', err); |
| | | this.$showMessage('上传失败,请重试'); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 删除图片 |
| | | deleteImage() { |
| | | uni.showModal({ |
| | | title: '确认删除', |
| | | content: '确定要删除此图片吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | this.deleteImageFromServer(); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 从服务器删除图片 |
| | | deleteImageFromServer() { |
| | | uni.showLoading({ |
| | | title: '删除中...' |
| | | }); |
| | | |
| | | this.$post({ |
| | | url: '/SJ/DeleteImageFromPicture', |
| | | data: { |
| | | id: this.id |
| | | } |
| | | }).then(res => { |
| | | uni.hideLoading(); |
| | | if (res.status === 0) { |
| | | this.$showMessage('图片删除成功'); |
| | | this.refreshResult(); // 刷新页面数据 |
| | | } else { |
| | | this.$showMessage(res.message || '删除失败'); |
| | | } |
| | | }).catch(err => { |
| | | uni.hideLoading(); |
| | | console.error('删除失败:', err); |
| | | this.$showMessage('删除失败,请重试'); |
| | | }); |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | |
| | | margin: 20px 0; |
| | | border: 1px solid $border-color; |
| | | border-radius: 4px; |
| | | |
| | | |
| | | &-header { |
| | | padding: 12px 16px; |
| | | background-color: $bg-color; |
| | | border-bottom: 1px solid $border-color; |
| | | font-weight: bold; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | |
| | | &-title { |
| | | flex: 1; |
| | | } |
| | | |
| | | &-actions { |
| | | display: flex; |
| | | gap: 10px; |
| | | } |
| | | |
| | | &-body { |
| | | padding: 16px; |
| | | } |
| | |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 12px; |
| | | |
| | | |
| | | .btn { |
| | | padding: 8px 20px; |
| | | border-radius: 4px; |
| | | |
| | | |
| | | &.primary-btn { |
| | | background-color: $primary-color; |
| | | color: #fff; |
| | | } |
| | | |
| | | |
| | | &.cancel-btn { |
| | | background-color: #909399; |
| | | color: #fff; |
| | | } |
| | | |
| | | &.upload-btn { |
| | | background-color: #909399; |
| | | color: #fff; |
| | | border: none; |
| | | border-radius: 8px; |
| | | padding: 12px 20px; |
| | | margin: 0; |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | min-height: 48px; |
| | | white-space: nowrap; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | gap: 8px; |
| | | cursor: pointer; |
| | | transition: all 0.3s ease; |
| | | box-shadow: 0 4px 12px rgba(144, 147, 153, 0.3); |
| | | } |
| | | |
| | | &.upload-btn:hover { |
| | | background-color: #7a7d82; |
| | | transform: translateY(-2px); |
| | | box-shadow: 0 6px 16px rgba(144, 147, 153, 0.4); |
| | | } |
| | | |
| | | &.attachment-btn { |
| | | background-color: #17a2b8; |
| | | color: #fff; |
| | | border: none; |
| | | border-radius: 8px; |
| | | padding: 12px 20px; |
| | | margin: 0; |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | min-height: 48px; |
| | | white-space: nowrap; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | gap: 8px; |
| | | cursor: pointer; |
| | | transition: all 0.3s ease; |
| | | box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3); |
| | | } |
| | | |
| | | &.attachment-btn:hover { |
| | | background-color: #138496; |
| | | transform: translateY(-2px); |
| | | box-shadow: 0 6px 16px rgba(23, 162, 184, 0.4); |
| | | } |
| | | } |
| | | } |
| | |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 2px 8px rgba(0,0,0,0.15); |
| | | } |
| | | |
| | | /* 验证提示样式 */ |
| | | .validation-hint { |
| | | background: linear-gradient(135deg, #ffe6e6 0%, #ffcccc 100%); |
| | | border: 2px solid #ff6b6b; |
| | | border-radius: 8px; |
| | | padding: 16px; |
| | | margin-bottom: 20px; |
| | | display: flex; |
| | | align-items: flex-start; |
| | | gap: 12px; |
| | | box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2); |
| | | } |
| | | |
| | | .validation-icon { |
| | | font-size: 24px; |
| | | flex-shrink: 0; |
| | | margin-top: 2px; |
| | | } |
| | | |
| | | .validation-text { |
| | | flex: 1; |
| | | } |
| | | |
| | | .validation-title { |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | color: #d63031; |
| | | margin-bottom: 12px; |
| | | line-height: 1.4; |
| | | } |
| | | |
| | | .validation-requirements { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .requirement-item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | padding: 8px 12px; |
| | | background: rgba(255, 255, 255, 0.7); |
| | | border-radius: 6px; |
| | | border: 1px solid rgba(255, 107, 107, 0.3); |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | .requirement-item.completed { |
| | | background: rgba(46, 204, 113, 0.1); |
| | | border-color: rgba(46, 204, 113, 0.3); |
| | | } |
| | | |
| | | .requirement-icon { |
| | | font-size: 16px; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .requirement-text { |
| | | font-size: 13px; |
| | | color: #2c3e50; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .requirement-item.completed .requirement-text { |
| | | color: #27ae60; |
| | | } |
| | | |
| | | /* 删除图片按钮样式 */ |
| | | .delete-image-btn { |
| | | padding: 6px 12px; |
| | | border: 1px solid #e74c3c; |
| | | border-radius: 4px; |
| | | background-color: #e74c3c; |
| | | color: white; |
| | | font-size: 12px; |
| | | font-weight: 500; |
| | | cursor: pointer; |
| | | transition: all 0.2s; |
| | | } |
| | | |
| | | .delete-image-btn:hover { |
| | | background-color: #c0392b; |
| | | border-color: #c0392b; |
| | | transform: translateY(-1px); |
| | | } |
| | | |
| | | /* 上传图片按钮样式 */ |
| | | .tablet-upload-btn { |
| | | background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%); |
| | | border: none; |
| | | border-radius: 8px; |
| | | padding: 12px 20px; |
| | | color: white; |
| | | font-weight: 600; |
| | | font-size: 14px; |
| | | cursor: pointer; |
| | | transition: all 0.3s ease; |
| | | box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | min-height: 48px; |
| | | margin: 0; |
| | | } |
| | | |
| | | .tablet-upload-btn:hover { |
| | | background: linear-gradient(135deg, #27ae60 0%, #229954 100%); |
| | | transform: translateY(-2px); |
| | | box-shadow: 0 6px 16px rgba(46, 204, 113, 0.4); |
| | | } |
| | | |
| | | .btn-content { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | } |
| | | |
| | | .btn-icon { |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .btn-text { |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | /* 响应式设计 */ |
| | | @media (min-width: 768px) { |
| | | .section-body { |
| | | padding: 40px; |
| | | } |
| | | |
| | | .validation-hint { |
| | | padding: 25px; |
| | | margin-bottom: 30px; |
| | | } |
| | | |
| | | .validation-title { |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .requirement-item { |
| | | padding: 12px 18px; |
| | | } |
| | | |
| | | .requirement-text { |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | </style> |