From 8d24d963f8b82163685c34b816998a904f08234d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 17 九月 2026 13:39:35 +0800
Subject: [PATCH] feat: 新聚-下单到检验
---
src/views/business/inspectionView/index.vue | 228 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 180 insertions(+), 48 deletions(-)
diff --git a/src/views/business/inspectionView/index.vue b/src/views/business/inspectionView/index.vue
index 7346997..eec9fe9 100644
--- a/src/views/business/inspectionView/index.vue
+++ b/src/views/business/inspectionView/index.vue
@@ -1,22 +1,7 @@
<template>
<div v-loading="loading" class="inspection" style="background-color: rgb(245, 247, 251);">
<el-row class="title">
- <el-col :span="8" style="text-align: left">
- <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px"
- style="text-align: right; padding-top: 0; display: inline">
- <el-form-item label="娓╁害:" style="margin-bottom: 0">
- <el-input v-model="otherForm.temperature" :disabled="state > 1" placeholder="" size="small"
- style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'temperature')"></el-input>
- <span style="margin-left: 4px">鈩�</span>
- </el-form-item>
- <el-form-item label="婀垮害:" style="margin-bottom: 0">
- <el-input v-model="otherForm.humidity" :disabled="state > 1" placeholder="" size="small"
- style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
- <span style="margin-left: 4px">%</span>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="16" style="text-align: right">
+ <el-col :span="24" style="text-align: right">
<el-button size="small" type="primary" @click="refreshView">鍒锋柊</el-button>
<el-button v-if="typeSource == 1" size="small" type="primary" @click="openPurchase">杩涜揣楠岃瘉</el-button>
<el-button v-if="state == 1 && typeSource == 1" size="small" type="primary"
@@ -73,12 +58,6 @@
<el-input v-model="insOrder.remark" :disabled="state != 1" clearable placeholder="璇疯緭鍏�" size="small"
@blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
<!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> -->
- </el-form-item>
- <el-form-item label="妫�楠岀粨璁�:">
- <el-radio-group v-model="reviewInsResult" :disabled="state != 2">
- <el-radio :label="1">鍚堟牸</el-radio>
- <el-radio :label="0">涓嶅悎鏍�</el-radio>
- </el-radio-group>
</el-form-item>
</el-form>
</div>
@@ -150,6 +129,51 @@
@click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰"
}}</el-button>
</div>
+ </div>
+ <!-- 褰撳墠妫�楠屾ā鏉跨殑妫�娴嬫潯浠朵笌妫�楠岀粨璁� -->
+ <div class="template-panel">
+ <el-form v-if="showTemplateConditions" :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" size="small"
+ style="width: 90px" @change="m => subOtherForm(m, 'temperature')" />
+ <span class="template-panel__unit">鈩�</span>
+ </el-form-item>
+ <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="婀垮害:">
+ <el-input v-model="currentOtherForm.humidity" :disabled="state > 1" size="small"
+ style="width: 90px" @change="m => subOtherForm(m, 'humidity')" />
+ <span class="template-panel__unit">%RH</span>
+ </el-form-item>
+ <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" 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-form-item>
+ <el-form-item v-if="insOrder.ifsOrderType !== '02wg'" label="妫�娴嬪湴鐐�:">
+ <el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable
+ placeholder="璇疯緭鍏ユ娴嬪湴鐐�" size="small" style="width: 200px"
+ @change="m => subOtherForm(m, 'detectionPlace')" />
+ </el-form-item>
+ <el-form-item v-if="isDirectTemplateOrder()" label="璁惧:">
+ <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
+ placeholder="璇烽�夋嫨璁惧" size="small" style="width: 360px"
+ @change="m => subOtherForm(m, 'deviceIds')">
+ <el-option v-for="device in orderDeviceOptions" :key="device.id" :label="device.label"
+ :value="device.id" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <el-form :inline="true" :model="currentOtherForm"
+ :class="['form-inline', { 'template-panel__conclusion--divided': showTemplateConditions }]"
+ size="small" label-width="84px">
+ <el-form-item label="妫�楠岀粨璁�:">
+ <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
+ @change="m => subOtherForm(m, 'insResult')">
+ <el-radio :label="1">鍚堟牸</el-radio>
+ <el-radio :label="0">涓嶅悎鏍�</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-form>
</div>
<!-- 甯歌妫�楠屽師濮嬭褰� -->
<div id="nav" v-loading="tableLoading" class="center-box">
@@ -551,6 +575,7 @@
comparisonList: [],
excelMethodList: [],
equipOptions: [],
+ orderDeviceOptions: [],
reviewLoading: false,
reviewDia: false,
noReason: "",
@@ -571,10 +596,8 @@
inspectionItem: 1,
inspectionItemSubclass: "20(甯告俯)",
},
- otherForm: {
- humidity: null,
- temperature: null,
- },
+ // 妫�娴嬫潯浠朵笌妫�楠岀粨璁烘寜妯℃澘 ID 鍒嗙粍
+ otherForm: {},
equipForm: {
value0: null,
code0: null,
@@ -724,8 +747,22 @@
action() {
return this.javaApi + "/insOrderPlan/uploadFile";
},
+ currentOtherForm() {
+ return this.otherForm[this.currentTable] || {
+ temperature: null,
+ humidity: null,
+ detectionTime: null,
+ detectionPlace: null,
+ deviceIds: [],
+ insResult: null,
+ };
+ },
+ showTemplateConditions() {
+ return this.insOrder.ifsOrderType !== "02wg" || this.isDirectTemplateOrder();
+ },
},
created() {
+ this.saveQueue = Promise.resolve();
let { sonLaboratory, orderId, state, inspectorList, typeSource } =
this.$route.query;
this.sonLaboratory = sonLaboratory;
@@ -898,18 +935,26 @@
this.sampleProduct = res.data.sampleProduct;
this.currentSample = this.HaveJson(this.sampleProduct[0]);
let insProduct = this.HaveJson(this.currentSample.insProduct);
- // 娓╁害銆佹箍搴﹁祴鍊�
- this.otherForm = {
- temperature: this.insOrder.temperature
- ? this.insOrder.temperature
- : null,
- humidity: this.insOrder.humidity ? this.insOrder.humidity : null,
- };
+ // 鎸夋ā鏉垮洖鏄炬娴嬫潯浠朵笌妫�楠岀粨璁�
+ this.otherForm = {};
+ (this.insOrder.templateConditions || []).forEach((item) => {
+ this.$set(this.otherForm, item.templateId, {
+ temperature: item.temperature != null ? item.temperature : null,
+ humidity: item.humidity != null ? item.humidity : null,
+ detectionTime: item.detectionTime != null ? item.detectionTime : null,
+ detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
+ deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
+ insResult: item.insResult != null ? item.insResult : null,
+ });
+ });
if (this.typeSource == "1") {
this.getRawMaterialTag(this.currentSample.id); // 鍘熸潗鏂欑殑妫�楠屼换鍔℃煡璇㈡壒鏁�
this.rawMaterialTag = "1";
}
this.getEquipOptions(1);
+ if (this.sonLaboratory === "鏂拌仛") {
+ this.loadDeviceOptions();
+ }
// 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
let list = await this.getCurrentProduct(this.currentSample.id, 0);
this.currentSample.insProduct = this.HaveJson(list);
@@ -920,6 +965,7 @@
this.currentSample["index"] = 1;
let bushing = this.currentSample.bushing;
this.getTableLists(); //澶勭悊妯℃澘鍒楄〃淇℃伅
+ this.tableLists.forEach((item) => this.ensureOtherForm(item.templateId));
this.currentKey = 1;
this.getCableTag(this.currentSample.id); // 鏌ヨ鏄惁鏈夎澶氭妫�楠岀殑鐢电紗閰嶇疆
@@ -1406,12 +1452,33 @@
this.worker0 = null;
}
},
- // 淇濆瓨婀垮害銆佹俯搴︽暟鎹�
+ ensureOtherForm(templateId) {
+ if (templateId == null || this.otherForm[templateId]) return;
+ this.$set(this.otherForm, templateId, {
+ temperature: null,
+ humidity: null,
+ detectionTime: null,
+ detectionPlace: null,
+ deviceIds: [],
+ insResult: null,
+ });
+ },
+ // 淇濆瓨褰撳墠妯℃澘鐨勬娴嬫潯浠讹紱澶囨敞浠嶇劧鏄鍗曠骇瀛楁
subOtherForm(m, type) {
- write({
- [type]: type === "remark" ? m : Number(m),
- id: this.insOrder.id,
- }).then((res) => {
+ const payload = { id: this.insOrder.id };
+ if (type === "remark") {
+ payload.remark = m;
+ } else {
+ payload.templateId = this.currentTable;
+ if (type === "deviceIds") {
+ payload.deviceIds = Array.isArray(m) ? [...m] : [];
+ } else if (type === "detectionTime" || type === "detectionPlace") {
+ payload[type] = m === "" || m == null ? null : m;
+ } else {
+ payload[type] = Number(m);
+ }
+ }
+ write(payload).then((res) => {
this.$message.success("淇濆瓨鎴愬姛");
});
},
@@ -1922,6 +1989,11 @@
},
// 瀵硅緭鍏ュ�艰繘琛屾牸寮忔牎楠�
handleInput(n) {
+ // 鐩寸粦妯℃澘鏈厤缃楠屽�肩被鍨嬫椂鎸夎嚜鐢辨枃鏈鐞嗭紝鍏佽褰曞叆澶栬绛変腑鏂囩粨鏋溿��
+ const inspectionValueType = this.getInspectionValueType(n.i);
+ if (inspectionValueType === undefined || inspectionValueType === null) {
+ return;
+ }
try {
n.v.v = n.v.v.replace(/[^\d.^e>锛炩墺鈮�<锛滄柇瑁傝剢鍖朶-/+]/g, "");
n.v.v = n.v.v.replace(/\.{2,}/g, "."); //鍙繚鐣欑涓�涓�. 娓呴櫎澶氫綑鐨�
@@ -1970,7 +2042,18 @@
upInsReview(e) {
if (e == 1) {
// 閫氳繃
- if (this.reviewInsResult !== 0 && this.reviewInsResult !== 1) {
+ let finalInsResult = this.reviewInsResult;
+ if (this.isDirectTemplateOrder()) {
+ const insResults = this.tableLists.map(
+ item => (this.otherForm[item.templateId] || {}).insResult
+ );
+ const missingIndex = insResults.findIndex(result => result !== 0 && result !== 1);
+ if (missingIndex > -1) {
+ this.$message.error(`璇烽�夋嫨銆�${this.tableLists[missingIndex].templateName}銆嶇殑妫�楠岀粨璁篳);
+ return;
+ }
+ finalInsResult = insResults.every(result => result === 1) ? 1 : 0;
+ } else if (finalInsResult !== 0 && finalInsResult !== 1) {
this.$message.error("璇烽�夋嫨妫�楠岀粨璁�");
return;
}
@@ -1981,7 +2064,7 @@
laboratory: this.sonLaboratory,
tell: null,
userId: this.checkUser,
- insResult: this.reviewInsResult,
+ insResult: finalInsResult,
}).then((res) => {
if (res.code === 200) {
this.$message.success("鎿嶄綔鎴愬姛");
@@ -2034,12 +2117,21 @@
this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
return;
}
- if (!this.otherForm.humidity) {
- this.$message.error("璇疯緭鍏ユ箍搴�");
- return;
- }
- if (!this.otherForm.temperature) {
- this.$message.error("璇疯緭鍏ユ俯搴�");
+ const missing = [];
+ this.tableLists.forEach((item) => {
+ const form = this.otherForm[item.templateId] || {};
+ if (this.insOrder.ifsOrderType !== "02wg") {
+ if (!form.temperature) missing.push(`璇峰~鍐欍��${item.templateName}銆嶇殑娓╁害`);
+ if (!form.humidity) missing.push(`璇峰~鍐欍��${item.templateName}銆嶇殑婀垮害`);
+ if (!form.detectionTime) missing.push(`璇烽�夋嫨銆�${item.templateName}銆嶇殑妫�娴嬫椂闂碻);
+ if (!form.detectionPlace) missing.push(`璇峰~鍐欍��${item.templateName}銆嶇殑妫�娴嬪湴鐐筦);
+ }
+ if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) {
+ missing.push(`璇烽�夋嫨銆�${item.templateName}銆嶇殑璁惧`);
+ }
+ });
+ if (missing.length > 0) {
+ this.$message.error(missing[0]);
return;
}
await this.waitForPendingSaves();
@@ -2257,8 +2349,19 @@
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((res) => {
+ this.orderDeviceOptions = (res.data || []).map((device) => ({
+ id: device.id,
+ label: `${device.deviceName}--${device.managementNumber}`,
+ }));
+ }).catch((error) => {
+ console.error(error);
+ });
},
async waitForPendingSaves() {
const targetRevision = this.calculationRevision;
@@ -2448,6 +2551,35 @@
text-align: left;
}
+.template-panel {
+ background-color: #f8f9fb;
+ border: 1px solid #ebeef5;
+ border-radius: 3px;
+ padding: 16px 16px 4px;
+ margin-bottom: 12px;
+ text-align: left;
+}
+
+.template-panel>>>.el-form-item {
+ display: inline-flex;
+ align-items: center;
+ margin-bottom: 12px;
+}
+
+.template-panel>>>.el-form-item__label {
+ flex: none;
+}
+
+.template-panel__unit {
+ margin-left: 4px;
+ color: #606266;
+}
+
+.template-panel__conclusion--divided {
+ border-top: 1px dashed #e4e7ed;
+ padding-top: 12px;
+}
+
.center {
width: 100%;
/* max-height: 580px; */
--
Gitblit v1.9.3