From 94e0abbf193f9e1fc953716ca7868d74cd14a2cd Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 21 九月 2026 11:06:25 +0800
Subject: [PATCH] fix(inspectionTask): 修复连接实验室功能并更新字段标签
---
src/views/business/inspectionTask/inspection.vue | 136 +++++++++++++++++++++++++--------------------
1 files changed, 75 insertions(+), 61 deletions(-)
diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index eac01ab..6852d28 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -91,7 +91,7 @@
</template>
<template v-else>
<el-descriptions-item label="濮旀墭缂栧彿">{{ insOrder.entrustCode }}</el-descriptions-item>
- <el-descriptions-item label="妫�娴嬩緷鎹�">{{ insOrder.sample || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="妫�娴嬩緷鎹�">{{ standardDisplayName(insOrder.sample) }}</el-descriptions-item>
<el-descriptions-item label="鏍峰搧鍚嶇О">{{ insOrder.sampleView || '-' }}</el-descriptions-item>
<el-descriptions-item label="鏍峰搧缂栧彿">{{ currentSample.sampleCode }}</el-descriptions-item>
<el-descriptions-item label="鏍峰搧鏁伴噺">{{ insOrder.testQuantity }}</el-descriptions-item>
@@ -177,7 +177,7 @@
</div>
<!-- 褰撳墠妫�楠屾ā鏉跨殑妫�娴嬫潯浠朵笌妫�楠岀粨璁� -->
<div class="template-panel">
- <el-form v-if="showTemplateConditions" :inline="true" :model="currentOtherForm" class="form-inline"
+ <el-form :inline="true" :model="currentOtherForm" class="form-inline"
size="small" label-width="84px">
<el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="娓╁害:">
<el-input v-model="currentOtherForm.temperature" :disabled="state > 1" placeholder="" size="small"
@@ -189,16 +189,16 @@
style="width: 90px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
<span class="template-panel__unit">%RH</span>
</el-form-item>
- <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="妫�娴嬫椂闂�:">
+ <el-form-item label="妫�娴嬫椂闂�:">
<el-date-picker v-model="currentOtherForm.detectionTime" :disabled="state > 1" type="date"
value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨鏃ユ湡" size="small" style="width: 160px"
@change="(m) => subOtherForm(m, 'detectionTime')"></el-date-picker>
</el-form-item>
- <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="妫�娴嬪湴鐐�:">
+ <el-form-item label="妫�娴嬪湴鐐�:">
<el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable placeholder="璇疯緭鍏ユ娴嬪湴鐐�"
size="small" style="width: 200px" @change="(m) => subOtherForm(m, 'detectionPlace')"></el-input>
</el-form-item>
- <el-form-item v-if="isDirectTemplateOrder()" label="璁惧:">
+ <el-form-item label="璁惧:">
<el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
size="small" placeholder="璇烽�夋嫨璁惧" style="width: 360px"
@change="(m) => subOtherForm(m, 'deviceIds')">
@@ -207,8 +207,7 @@
</el-form-item>
</el-form>
<!-- 澶嶆牳鏃舵墠鑳介�� -->
- <el-form :inline="true" :model="currentOtherForm"
- :class="['form-inline', { 'template-panel__conclusion--divided': showTemplateConditions }]"
+ <el-form :inline="true" :model="currentOtherForm" class="form-inline template-panel__conclusion--divided"
size="small" label-width="84px">
<el-form-item label="妫�楠岀粨璁�:">
<el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
@@ -299,7 +298,7 @@
n.v.ps.value === '璁$畻鍊�' &&
state == 1
"><span :style="`font-family:${n.v.ff} !important;`">{{
- toFixed(n.v.v, n.v.ct)
+ n.v.v
}}</span></template>
<template v-else-if="
n.v.ps != undefined &&
@@ -307,7 +306,7 @@
state == 1
">
<span :style="`font-family:${n.v.ff} !important;`">{{
- toFixed(n.v.v, n.v.ct)
+ n.v.v
}}</span>
</template>
<template v-else-if="
@@ -870,10 +869,6 @@
}
);
},
- // 02wg 鍗曟病鏈夋俯婀垮害锛涙柊鑱氱洿鎺ョ粦瀹氭ā鏉跨殑鍗曞彧鏈夎澶�
- showTemplateConditions() {
- return this.insOrder.ifsOrderType !== "02wg" || this.isDirectTemplateOrder();
- },
},
created() {
this.saveQueue = Promise.resolve();
@@ -968,6 +963,11 @@
this.stopWorker();
},
methods: {
+ standardDisplayName(value) {
+ if (!value) return '-';
+ const separatorIndex = value.indexOf(' - ');
+ return separatorIndex > -1 ? value.slice(0, separatorIndex) : value;
+ },
validateQuality(){
let inboundLength = Number(this.calcInbondLength(this.ifsMaterialPropsForm.startMeterMark,this.ifsMaterialPropsForm.endMeterMark));
let testQuantity = Number(this.insOrder.testQuantity);
@@ -1154,9 +1154,7 @@
this.rawMaterialTag = "1";
}
this.getEquipOptions(1);
- if (this.sonLaboratory === "鏂拌仛") {
- this.loadDeviceOptions();
- }
+ this.loadDeviceOptions();
// 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
let list = await this.getCurrentProduct(this.currentSample.id, 0);
this.currentSample.insProduct = this.HaveJson(list);
@@ -1683,9 +1681,17 @@
payload[type] = Number(m);
}
}
- write(payload).then((res) => {
- this.$message.success("淇濆瓨鎴愬姛");
- });
+ const previousSave = this.saveQueue || Promise.resolve();
+ this.saveQueue = previousSave
+ .catch(() => undefined)
+ .then(() => write(payload))
+ .then(() => {
+ this.$message.success("淇濆瓨鎴愬姛");
+ })
+ .catch((error) => {
+ console.error("妫�楠屾潯浠朵繚瀛樺け璐�", error);
+ this.$message.error("妫�楠屾潯浠朵繚瀛樺け璐ワ紝璇烽噸璇�");
+ });
},
exportTable(tableId) {
// 鑾峰彇table鍏冪礌
@@ -2160,13 +2166,6 @@
.replace(new RegExp("\n", "g"), "<br/>")
.replace(new RegExp("@", "g"), "<br/>")
: "";
- // 瀵规暟鎹繚鐣欏皬鏁扮偣杩涜澶勭悊
- if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) {
- let num = 0;
- let str0 = v.ct.fa.split(".")[1];
- num = str0.length;
- str = Number(str).toFixed(num);
- }
if (v.v && typeof v.v == "string" && v.v.includes("@")) {
str = v.v.replace(new RegExp("@", "g"), "<br/>");
}
@@ -2197,6 +2196,11 @@
},
// 瀵硅緭鍏ュ�艰繘琛屾牸寮忔牎楠�
handleInput(n) {
+ // 鐩寸粦妯℃澘鏈厤缃楠屽�肩被鍨嬫椂鎸夎嚜鐢辨枃鏈鐞嗭紝鍏佽褰曞叆澶栬绛変腑鏂囩粨鏋溿��
+ const inspectionValueType = this.getInspectionValueType(n.i);
+ if (inspectionValueType === undefined || inspectionValueType === null) {
+ return;
+ }
try {
const v = n.v.v;
// 鑳藉姏鑼冨洿宸插簾寮�,妫�楠屽�肩被鍨嬩笉鍐嶄綔涓哄垽鏂緷鎹�傛暣涓插彧鐢辩畻寮忓瓧绗︾粍鎴愭椂鎵嶈鑼冨寲鏍煎紡,
@@ -2245,10 +2249,33 @@
openAddCheck() {
this.addCheck = true;
},
+ // 鏀堕泦妯℃澘绾ф娴嬫潯浠剁殑缂哄け椤癸紙姣忎釜妯℃澘閮借濉叏锛�
+ getMissingConditions() {
+ const missing = [];
+ this.tableLists.forEach((m) => {
+ const form = this.otherForm[m.templateId] || {};
+ if (this.insOrder.ifsOrderType !== "02wg") {
+ if (!form.temperature) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑娓╁害`);
+ if (!form.humidity) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑婀垮害`);
+ }
+ if (!form.detectionTime) missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑妫�娴嬫椂闂碻);
+ if (!form.detectionPlace) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑妫�娴嬪湴鐐筦);
+ if (!form.deviceIds || form.deviceIds.length === 0) {
+ missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑璁惧`);
+ }
+ });
+ return missing;
+ },
// 澶嶆牳
upInsReview(e) {
if (e == 1) {
// 閫氳繃
+ // 姣忎釜妯℃澘閮借鏈夋娴嬫潯浠讹紝缂轰竴涓嶅彲
+ const missing = this.getMissingConditions();
+ if (missing.length > 0) {
+ this.$message.error(missing[0]);
+ return;
+ }
// 姣忎釜妯℃澘閮借鏈夌粨璁猴紱鍏ㄩ儴鍚堟牸鎵嶇畻鏁村崟鍚堟牸
const insResults = this.tableLists.map(
(m) => (this.otherForm[m.templateId] || {}).insResult
@@ -2340,19 +2367,7 @@
this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
return;
}
- const missing = [];
- this.tableLists.forEach((m) => {
- const form = this.otherForm[m.templateId] || {};
- if (this.insOrder.ifsOrderType !== "02wg") {
- if (!form.temperature) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑娓╁害`);
- if (!form.humidity) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑婀垮害`);
- if (!form.detectionTime) missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑妫�娴嬫椂闂碻);
- if (!form.detectionPlace) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑妫�娴嬪湴鐐筦);
- }
- if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) {
- missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑璁惧`);
- }
- });
+ const missing = this.getMissingConditions();
if (missing.length > 0) {
this.$message.error(missing[0]);
return;
@@ -2362,6 +2377,24 @@
return;
}
await this.waitForPendingSaves();
+ try {
+ await Promise.all(this.tableLists.map((template) => {
+ const form = this.otherForm[template.templateId] || {};
+ return write({
+ id: this.insOrder.id,
+ templateId: template.templateId,
+ temperature: form.temperature == null ? null : form.temperature,
+ humidity: form.humidity == null ? null : form.humidity,
+ detectionTime: form.detectionTime || null,
+ detectionPlace: form.detectionPlace || null,
+ deviceIds: Array.isArray(form.deviceIds) ? [...form.deviceIds] : [],
+ });
+ }));
+ } catch (error) {
+ console.error("妫�楠屾潯浠朵繚瀛樺け璐�", error);
+ this.$message.error("妫�楠屾潯浠朵繚瀛樺け璐ワ紝璇烽噸璇�");
+ return;
+ }
this.submitLoading = true;
checkSubmitPlan({
orderId: this.orderId,
@@ -2578,8 +2611,9 @@
this.saveInsContext();
},
isDirectTemplateOrder() {
- return this.sonLaboratory === "鏂拌仛" && this.currentSample &&
- (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
+ return this.sonLaboratory === "鏂拌仛" &&
+ Array.isArray(this.insOrder.templateConditions) &&
+ this.insOrder.templateConditions.length > 0;
},
loadDeviceOptions() {
search({ status: 0 }).then((devices) => {
@@ -2686,26 +2720,6 @@
this.$download.saveAs(res.data.fileUrl, row.fileName)
})
.catch((error) => { });
- },
- /**
- * 灏嗘暟鍊紇淇濈暀ct.fa涓�'##'鍚庣殑鎸囧畾灏忔暟浣嶆暟锛屽苟杩斿洖鏍煎紡鍖栧悗鐨勫瓧绗︿覆銆�
- *
- * @param v 瑕佹牸寮忓寲鐨勬暟鍊�
- * @param ct 鍖呭惈鏍煎紡鍖栭厤缃殑瀵硅薄
- * @param ct.fa 鏍煎紡鍖栭厤缃瓧绗︿覆锛岃嫢鍖呭惈'##'鍒欐寜鐓у叾鍚庣殑鍐呭纭畾灏忔暟浣嶆暟
- * @returns 鏍煎紡鍖栧悗鐨勫瓧绗︿覆鎴栧師濮嬫暟鍊硷紙鑻ラ厤缃笉绗﹀悎瑕佹眰锛�
- */
- toFixed(v, ct) {
- if (v && ct && ct.fa) {
- if (ct.fa.includes(".")) {
- let num = ct.fa.slice(4).length;
- return Number(v).toFixed(num);
- } else {
- return v;
- }
- } else {
- return v;
- }
},
async goback() {
await this.waitForPendingSaves();
--
Gitblit v1.9.3