From f63e51553b520b5dd760ba186d9b274ed246a64a Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 16 十月 2025 14:27:18 +0800
Subject: [PATCH] SJ,XJ,RKJ单独检验项目拍照+提交限制
---
pages/QC/SJ/Add.vue | 105 ++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 81 insertions(+), 24 deletions(-)
diff --git a/pages/QC/SJ/Add.vue b/pages/QC/SJ/Add.vue
index e7778e5..9d3607f 100644
--- a/pages/QC/SJ/Add.vue
+++ b/pages/QC/SJ/Add.vue
@@ -873,35 +873,92 @@
this.SJ_MJIndex = e.mp.detail.value;
this.formData.SJ_MJ = this.SJ_MJList[this.SJ_MJIndex];
},
- submitInspection() {
+ async submitInspection() {
if (this.formData.id) {
- // 鏄剧ず纭鎻愮ず妗�
- uni.showModal({
- title: '纭鎻愪氦',
- content: '纭畾瑕佹彁浜ゆ楠岀粨鏋滃悧锛熸彁浜ゅ悗灏嗘棤娉曚慨鏀广��',
- confirmText: '纭畾鎻愪氦',
- cancelText: '鍙栨秷',
- success: (res) => {
- if (res.confirm) {
- // 鐢ㄦ埛纭鍚庢墽琛屾彁浜�
- this.$post({
- url: "/SJ/SjSubmit",
- data: {
- id: this.formData.id,
- userNo: this.$loginInfo.account
- }
- }).then(res => {
- if (res.data.tbBillList) {
- this.$showMessage("鎻愪氦鎴愬姛");
- this.init();
- }
- });
+ try {
+ // 楠岃瘉涓嶅悎鏍兼楠岄」鐩�
+ await this.validateUnqualifiedItems();
+
+ // 鏄剧ず纭鎻愮ず妗�
+ uni.showModal({
+ title: '纭鎻愪氦',
+ content: '纭畾瑕佹彁浜ゆ楠岀粨鏋滃悧锛熸彁浜ゅ悗灏嗘棤娉曚慨鏀广��',
+ confirmText: '纭畾鎻愪氦',
+ cancelText: '鍙栨秷',
+ success: (res) => {
+ if (res.confirm) {
+ // 鐢ㄦ埛纭鍚庢墽琛屾彁浜�
+ this.$post({
+ url: "/SJ/SjSubmit",
+ data: {
+ id: this.formData.id,
+ userNo: this.$loginInfo.account
+ }
+ }).then(res => {
+ if (res.data.tbBillList) {
+ this.$showMessage("鎻愪氦鎴愬姛");
+ this.init();
+ }
+ });
+ }
}
- }
- });
+ });
+ } catch (error) {
+ this.$showMessage(error.message);
+ }
}
},
+ // 楠岃瘉涓嶅悎鏍兼楠岄」鐩�
+ 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;
+ }
+ }
+ },
+
+ // 鑾峰彇妫�楠岄」鐩缁嗕俊鎭�
+ async getInspectionItemDetail(itemId) {
+ return new Promise((resolve, reject) => {
+ this.$post({
+ url: "/SJ/getQSItems",
+ data: {
+ pid: this.formData.id,
+ id: itemId
+ }
+ }).then(res => {
+ const item = res.data.tbBillList[0];
+ if (item) {
+ resolve({
+ hasImage: item.imageData && item.imageData.length > 0,
+ hasRemarks: item.remarks && item.remarks.trim() !== ''
+ });
+ } else {
+ reject(new Error('鏃犳硶鑾峰彇妫�楠岄」鐩鎯�'));
+ }
+ }).catch(err => {
+ reject(err);
+ });
+ });
+ },
+
drawingConfirm() {
this.drawingShow = false
this.imageShow = false
--
Gitblit v1.9.3