From 025e5c58bfaeee5721b726fc2b960208d7540348 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 18 九月 2026 14:15:21 +0800
Subject: [PATCH] 新疆——新聚lims 1.按钮限制放开 2.检验单详情温湿度、检测时间、检测地方校验必填
---
src/workers/InspectionWorker.worker.js | 87 +++++++++----------------------------------
1 files changed, 19 insertions(+), 68 deletions(-)
diff --git a/src/workers/InspectionWorker.worker.js b/src/workers/InspectionWorker.worker.js
index d77d1f7..119d3ce 100644
--- a/src/workers/InspectionWorker.worker.js
+++ b/src/workers/InspectionWorker.worker.js
@@ -176,6 +176,18 @@
}
/**
+ * 鑾峰彇绾崟鍏冩牸寮曠敤鍏紡鐨勫潗鏍囧悕锛屼緥濡� =F4銆�=$F$4銆�
+ * 绾紩鐢ㄥ簲鐩存帴澶嶅埗鍘熷�硷紝閬垮厤鎶娾�滃瑙傗�濈瓑涓枃鏂囨湰閫佸叆鏁板�艰绠椼��
+ */
+function getDirectReferenceName(f) {
+ if (typeof f !== "string") {
+ return null;
+ }
+ const matched = f.trim().match(/^=\s*\$?([A-Za-z]{1,3})\$?(\d{1,7})\s*$/);
+ return matched ? `${matched[1].toUpperCase()}${matched[2]}` : null;
+}
+
+/**
* 鎸夋楠岄」id鍙栧綋鍓嶆牱鍝佷笅鐨勬楠岄」淇℃伅,鍙栦笉鍒版椂杩斿洖绌哄璞�,閬垮厤鍏紡璁$畻鍥犵己椤逛腑鏂�
*
* @param id 妫�楠岄」id
@@ -215,8 +227,6 @@
break;
}
}
- let isToExponential = ""; //鏄惁涓虹瀛﹁鏁版硶
- let list2 = []; //涓�涓暟缁勶紝閲岄潰淇濆瓨鏈夊綋鍓嶆楠岄」鐨勬墍鏈夊弬鏁板��
let isPoint = ""; //鏄惁涓哄皬鏁扮偣
let inputType = null;
let currentInsItemId = "";
@@ -250,7 +260,6 @@
break;
}
}
- list2.push(c.v.v);
// 缁勮鍙傛暟鐨勫璞¢泦鍚堝苟璧嬪�硷紝鍒楀{A3:12,B4:15}
if (
(getInspectionValueType(item.i) == 1 ||
@@ -277,7 +286,11 @@
// 濡傛灉鏄嚱鏁版柟娉曪紝鍒欐墽琛屾鏂规硶
let comResult = ""; //鍒濆鍖栬绠楃粨鏋�
try {
- if (
+ const directReferenceName = getDirectReferenceName(item.v.f);
+ if (directReferenceName && Object.prototype.hasOwnProperty.call(comValue, directReferenceName)) {
+ // =F4 杩欑被鍏紡鏃㈠彲鑳藉紩鐢ㄦ暟瀛楋紝涔熷彲鑳藉紩鐢ㄤ腑鏂囨枃鏈紝鐩存帴淇濈暀婧愬�笺��
+ comResult = comValue[directReferenceName];
+ } else if (
getInspectionValueType(item.i) == 1 ||
isNumericFormula(item.v.f)
) {
@@ -325,22 +338,7 @@
}
// 鏍规嵁杈撳叆鐨勬暟鍊硷紝杩涜璁$畻
comResult = compute(item.v.f.replace(/=/g, " "), comValue, isPoint);
- // 妫�楠岄」涓哄瘑搴︽椂锛屾牴鎹姹傚�肩殑灏忔暟浣嶆敼鍙樻渶缁堝�肩殑灏忔暟浣�
- if (inspectionItem == "瀵嗗害") {
- const str = "" + tell;
- const indexOfDecimal = str.indexOf(".");
- if (indexOfDecimal > -1) {
- const length = str.length - indexOfDecimal - 1;
- comResult = comResult.toFixed(length);
- }
- } else if (
- inspectionItemClass == "澶栨姢濂楁満姊扮墿鐞嗘�ц兘" &&
- inspectionItem == "鍦↖RM 902鐭跨墿娌逛腑娴告场鍚�" &&
- (inspectionItemSubclass == "鏂浼搁暱鐜囧彉鍖栫巼" ||
- inspectionItemSubclass == "鎶楀紶寮哄害鍙樺寲鐜�")
- ) {
- comResult = Math.round(comResult).toFixed(0);
- } else if (
+ if (
typeof comResult == "string" &&
(comResult.includes("鏂") || comResult.includes("鑴嗗寲"))
) {
@@ -368,15 +366,6 @@
}
if (isHaveSymbol) {
comResult = symbol + comResult;
- }
- let list3 = list2.map((item) => item + "");
- // 鍒ゆ柇濉殑妫�楠屽�兼槸鍚︿负绉戝璁℃暟娉曪紝濡傛灉涓虹瀛﹁鏁版硶锛屽垯杩涜杞寲
- isToExponential = list3.some(
- (val) => val.includes("e+") || val.includes("e-")
- );
- if (isToExponential) {
- let num2 = new Big(comResult);
- comResult = num2.toExponential(1);
}
} else {
// 濡傛灉妫�楠屽�肩被鍨嬫槸鏂囨湰杈撳叆妗嗐�佷笅鎷夋
@@ -416,45 +405,7 @@
// 鍒ゆ柇褰撳墠琛屾槸鍚︿负褰撳墠妫�楠岄」鎵�鍦ㄨ锛屽鏋滀负褰撳墠琛岋紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪��
for (var b in a) {
if (a[b].c == item.c) {
- try {
- if (comResult == 0) {
- // 鍒ゆ柇璁$畻缁撴灉鏄惁涓�0锛屽鏋滀负0锛屽垯缁欒〃鏍兼暟鎹祴鍊间负0
- a[b].v.v = 0;
- } else if (
- a[b].v.ct &&
- a[b].v.ct.fa &&
- typeof a[b].v.ct.fa == "string" &&
- a[b].v.ct.fa.includes(".")
- ) {
- // 鍒ゆ柇褰撳墠鍗曞厓鏍兼槸鍚︿繚鐣欏皬鏁扮偣锛屽鏋滀负淇濈暀灏忔暟鐐癸紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪�间负淇濈暀灏忔暟鐐癸紝杩欎釜鏄牴鎹ā鏉块厤缃皬鏁扮偣鏉ョ殑
- let num = 0;
- let str = a[b].v.ct.fa.split(".")[1];
- num = str.length;
- a[b].v.v = comResult
- ? Number(comResult).toFixed(num)
- : comResult;
- } else if (
- typeof comResult == "string" &&
- (comResult.includes("e+") || comResult.includes("e-"))
- ) {
- // 鍒ゆ柇璁$畻缁撴灉鏄惁涓虹瀛﹁鏁版硶锛屽鏋滀负绉戝璁℃暟娉曪紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪�间负绉戝璁℃暟娉�
- a[b].v.v = comResult;
- } else {
- const inspectionItem = findInsItem(item.i).inspectionItem;
- // 鍒ゆ柇璁$畻缁撴灉鏄惁涓烘暟瀛楋紝濡傛灉涓烘暟瀛楋紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪�间负鏁板瓧
- if (inspectionItem == "閾滅嚎鐢甸樆鐜囅�20鏈�澶у��") {
- let val = parseFloat(Number(comResult).toFixed(5));
- a[b].v.v = isNaN(val) ? comResult : val;
- } else {
- let val = parseFloat(Number(comResult).toFixed(3));
- a[b].v.v = isNaN(val) ? comResult : val;
- }
- }
- } catch (error) {
- // 濡傛灉浠ヤ笂鍒ゆ柇閮戒笉鏀寔锛屽垯鐩存帴璧嬪��
- a[b].v.v = comResult;
- console.log("error---", error);
- }
+ a[b].v.v = comResult;
hasComputedWrite = true;
break;
}
--
Gitblit v1.9.3