| | |
| | | return; |
| | | } |
| | | |
| | | // 验证不合格检验项目必须上传图片并填写不良描述 |
| | | this.validateUnqualifiedItems().then(() => { |
| | | // 检查钉钉推送条件:PSZT为待判,且不良原因、不良描述、所属车间不为空 |
| | | const shouldPushToDingTalk = this.PSTYPE === '待判' && |
| | | this.badreason && |
| | |
| | | } |
| | | } |
| | | }); |
| | | }).catch(error => { |
| | | this.$showMessage(error); |
| | | }); |
| | | }, |
| | | |
| | | // 验证不合格检验项目 |
| | | async validateUnqualifiedItems() { |
| | | const unqualifiedItems = this.tableData.filter(item => item.result === '不合格'); |
| | | |
| | | if (unqualifiedItems.length === 0) { |
| | | return Promise.resolve(); |
| | | } |
| | | |
| | | // 检查每个不合格项目是否有图片和描述 |
| | | for (const item of unqualifiedItems) { |
| | | try { |
| | | const detail = await this.getInspectionItemDetail(item.id); |
| | | if (!detail.hasImage || !detail.hasRemarks) { |
| | | const missingItems = []; |
| | | if (!detail.hasImage) missingItems.push('图片'); |
| | | if (!detail.hasRemarks) missingItems.push('不良描述'); |
| | | |
| | | throw new Error(`检验项目"${item.projName}"不合格,但缺少:${missingItems.join('、')},请完善后重新提交!`); |
| | | } |
| | | } catch (error) { |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | |
| | | // 获取检验项目详细信息 |
| | | getInspectionItemDetail(itemId) { |
| | | return new Promise((resolve, reject) => { |
| | | this.$post({ |
| | | url: "/RKJ/getXjDetail02ById", |
| | | data: { id: itemId } |
| | | }).then(res => { |
| | | const itemData = res.data.tbBillList.itemXj01; |
| | | resolve({ |
| | | hasImage: itemData.imageData && itemData.imageData.length > 0, |
| | | hasRemarks: itemData.remarks && itemData.remarks.trim() !== '' |
| | | }); |
| | | }).catch(error => { |
| | | reject('获取检验项目详情失败'); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | viewAttachmentInfo() { |
| | | this.showAttachmentPopup = true; // 先弹窗 |
| | | this.attachmentsLoading = true; |