From 049fda473cc178917a02f3a174dfd08a84b0cb8d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 17 九月 2026 10:52:28 +0800
Subject: [PATCH] 新疆——新聚lims 1.每个检验项都要有一个选择检测时间的地方,跟温湿度放在一起,还有检测地点,设备也要单独绑定检验项,最后导出模版再总结到一起 2.产品名称改为检测依据、加一个样品名称手输 3.下单时原始记录模板可以从标准库绑定的模板进行删减
---
src/views/business/inspectionView/index.vue | 107 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 78 insertions(+), 29 deletions(-)
diff --git a/src/views/business/inspectionView/index.vue b/src/views/business/inspectionView/index.vue
index f086612..7346997 100644
--- a/src/views/business/inspectionView/index.vue
+++ b/src/views/business/inspectionView/index.vue
@@ -45,7 +45,7 @@
<el-input v-model="currentSample.sample" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input>
</el-form-item>
<el-form-item label="鏍峰搧鏁伴噺:">
- <el-input v-model="sampleProduct.length" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input>
+ <el-input v-model="insOrder.testQuantity" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input>
</el-form-item>
<el-form-item label="鏍峰搧鍨嬪彿:">
<el-input v-model="currentSample.model" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input>
@@ -73,6 +73,12 @@
<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>
@@ -205,8 +211,8 @@
" />
<span v-else-if="getInspectionValueType(n.i) == 4"
:style="`font-family:${n.v.ff} !important;`">/</span>
- </template>
- <template v-else-if="
+ </template>
+ <template v-else-if="
n.v.ps != undefined && n.v.ps.value === '璁惧鍚嶇О'
">
<el-select v-model="n.v.v" :disabled="state > 1" class="table_input" filterable multiple
@@ -334,17 +340,6 @@
<el-select v-model="verifyUser" clearable filterable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
<el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
</el-option>
- </el-select>
- </div>
- </div>
- <div class="body" style="display: flex; padding: 10px; align-items: center">
- <div class="search_label" style="width: 150px">
- <span class="required-span">*</span>鎶ュ憡绫诲瀷
- </div>
- <div class="search_input" style="width: 100%">
- <el-select v-model="reportType" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
- <el-option label="妫�娴嬫姤鍛�" :value="0"></el-option>
- <el-option label="妫�楠屾姤鍛�" :value="1"></el-option>
</el-select>
</div>
</div>
@@ -486,6 +481,7 @@
checkSubmitPlan,
submitPlan,
saveInsContext,
+ saveTemplateContext,
selectUserCondition,
downFile,
getFileList,
@@ -546,6 +542,8 @@
ps: {},
param: {},
saveQueue: null,
+ calculationRevision: 0,
+ completedCalculationRevision: 0,
currentKey: 1,
currentKey0: 1,
currentKey1: 1,
@@ -556,13 +554,13 @@
reviewLoading: false,
reviewDia: false,
noReason: "",
+ reviewInsResult: null,
tableWidth: 1000,
currentTable: null,
tableLists: [],
widthList: [],
addVerifyDia: false,
verifyUser: null,
- reportType: null,
personList: [],
enumList: [],
tableLoading: false,
@@ -875,13 +873,15 @@
this.checkUser = "";
},
// 鍒锋柊椤甸潰
- refreshView() {
+ async refreshView() {
+ await this.waitForPendingSaves();
this.loading = true;
doInsOrder({
id: this.id,
laboratory: this.sonLaboratory,
}).then(async (res) => {
this.insOrder = res.data.insOrder;
+ this.reviewInsResult = this.insOrder.insResult;
this.supplierDensity = res.data.supplierDensity;
this.getList()
this.urgentList.forEach((m) => {
@@ -1802,6 +1802,7 @@
}
}
try {
+ const revision = ++this.calculationRevision;
// 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
this.worker.postMessage(
JSON.stringify({
@@ -1816,6 +1817,7 @@
getDataTypeId: this.getDataTypeId,
modelType: this.sampleProduct[0].model,
currentInsItem: n,
+ revision: revision,
})
);
// 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
@@ -1830,6 +1832,9 @@
// 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
this.worker.onmessage = (event) => {
const workerResult = JSON.parse(event.data);
+ if (workerResult.revision != null && workerResult.revision < this.calculationRevision) {
+ return;
+ }
this.result = workerResult;
switch (workerResult.method) {
case "saveInsContext":
@@ -1842,6 +1847,10 @@
);
this.param = resultValue.param;
this.saveInsContext();
+ this.completedCalculationRevision = Math.max(
+ this.completedCalculationRevision,
+ workerResult.revision || 0
+ );
});
break;
case "tableList":
@@ -1961,6 +1970,10 @@
upInsReview(e) {
if (e == 1) {
// 閫氳繃
+ if (this.reviewInsResult !== 0 && this.reviewInsResult !== 1) {
+ this.$message.error("璇烽�夋嫨妫�楠岀粨璁�");
+ return;
+ }
this.reviewLoading = true;
verifyPlan({
orderId: this.orderId,
@@ -1968,6 +1981,7 @@
laboratory: this.sonLaboratory,
tell: null,
userId: this.checkUser,
+ insResult: this.reviewInsResult,
}).then((res) => {
if (res.code === 200) {
this.$message.success("鎿嶄綔鎴愬姛");
@@ -2013,16 +2027,11 @@
this.$refs.viewManHourDia.showDialog(this.id, 99);
},
openAddVerifyDia() {
- this.reportType = null;
this.addVerifyDia = true;
},
- submit() {
+ async submit() {
if (this.verifyUser === null || this.verifyUser === "") {
this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
- return;
- }
- if (this.reportType === null || this.reportType === "") {
- this.$message.error("璇烽�夋嫨鎶ュ憡绫诲瀷");
return;
}
if (!this.otherForm.humidity) {
@@ -2033,11 +2042,11 @@
this.$message.error("璇疯緭鍏ユ俯搴�");
return;
}
+ await this.waitForPendingSaves();
this.submitLoading = true;
checkSubmitPlan({
orderId: this.orderId,
laboratory: this.sonLaboratory,
- reportType: this.reportType,
}).then((res) => {
if (res.code === 200) {
if (!res.data || res.data.errorMsg.length == 0) {
@@ -2047,8 +2056,7 @@
laboratory: this.sonLaboratory,
verifyUser: this.verifyUser,
entrustCode: this.insOrder.entrustCode,
- registerInsResults: this.reportType === 1,
- reportType: this.reportType,
+ registerInsResults: false,
}).then((res) => {
if (res.code === 200) {
this.$message.success("鎿嶄綔鎴愬姛");
@@ -2101,7 +2109,6 @@
laboratory: this.sonLaboratory,
verifyUser: this.verifyUser,
registerInsResults: false,
- reportType: this.reportType,
}).then((res) => {
if (res.code === 200) {
this.$message.success("鎿嶄綔鎴愬姛");
@@ -2130,7 +2137,17 @@
const param = {};
this.tableList.forEach((a) => {
param[a.templateId] = {};
- a.template.forEach((cell) => {
+ // Worker 鍥炰紶鍚� arr 鏄〉闈笂鐨勬渶鏂板璞★紝template 浠嶅彲鑳戒繚鐣欒绠楀墠鐨勬棫鍊笺��
+ const cells = a.arr && a.arr.length
+ ? a.arr.reduce((all, row) => all.concat(row), [])
+ : a.template;
+ const resultHeader = cells.find((cell) =>
+ cell.v && String(cell.v.v || "").trim() === "妫�楠岀粨鏋�"
+ );
+ const exportRows = new Set(cells.filter((cell) =>
+ cell.v && cell.v.ps && cell.v.ps.value === "瀵煎嚭鍊�"
+ ).map((cell) => cell.r));
+ cells.forEach((cell) => {
const isEditable =
cell.v.ps != undefined &&
typeof cell.v.ps.value === "string" &&
@@ -2138,10 +2155,12 @@
cell.v.ps.value === "璁$畻鍊�" ||
cell.v.ps.value === "鏈�缁堝��" ||
cell.v.ps.value === "璁惧鍚嶇О");
- if (!isEditable) {
+ const isExportResult = resultHeader && exportRows.has(cell.r) && cell.c === resultHeader.c;
+ if (!isEditable && !isExportResult) {
return;
}
if (
+ isEditable &&
cell.v.ps.value.includes("妫�楠屽��") &&
(cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
) {
@@ -2187,7 +2206,14 @@
const previousSave = this.saveQueue || Promise.resolve();
this.saveQueue = previousSave
.catch(() => undefined)
- .then(() => saveInsContext(payload))
+ .then(() => this.isDirectTemplateOrder()
+ ? saveTemplateContext({
+ orderId: this.orderId,
+ sampleId: this.currentSample.id,
+ templateId: this.currentTable,
+ values: param[this.currentTable] || {},
+ })
+ : saveInsContext(payload))
.then(() => {
this.$message.success("宸蹭繚瀛�");
})
@@ -2230,6 +2256,29 @@
// 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
this.saveInsContext();
},
+ isDirectTemplateOrder() {
+ return this.sonLaboratory === "鏂拌仛" && this.currentSample &&
+ (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
+ },
+ async waitForPendingSaves() {
+ const targetRevision = this.calculationRevision;
+ if (this.completedCalculationRevision < targetRevision) {
+ await new Promise((resolve) => {
+ const startedAt = Date.now();
+ const waitWorker = () => {
+ if (this.completedCalculationRevision >= targetRevision || Date.now() - startedAt > 5000) {
+ resolve();
+ return;
+ }
+ setTimeout(waitWorker, 20);
+ };
+ waitWorker();
+ });
+ }
+ if (this.saveQueue) {
+ await this.saveQueue;
+ }
+ },
getAuthorizedPerson() {
selectUserCondition({ type: 1 }).then((res) => {
let data = [];
--
Gitblit v1.9.3