From 7e7a8e3b15df991b9c3fbd22b94534b1d1984e29 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 14 九月 2026 19:54:28 +0800
Subject: [PATCH] 新疆——新聚lims 1.检验任务详情逻辑重构,不需要判断结论逻辑,添加复杂运算逻辑

---
 src/views/business/inspectionTask/components/InspectionWord.vue |  773 +++-----------
 vue.config.js                                                   |    7 
 src/utils/excelFountion.js                                      |   98 +
 src/views/business/inspectionView/index.vue                     |  879 ++-------------
 src/workers/InspectionWorker.worker.js                          |  634 +++-------
 src/views/business/inspectionTask/inspection.vue                |  906 ++-------------
 6 files changed, 727 insertions(+), 2,570 deletions(-)

diff --git a/src/utils/excelFountion.js b/src/utils/excelFountion.js
index 3cd11a9..a61500b 100644
--- a/src/utils/excelFountion.js
+++ b/src/utils/excelFountion.js
@@ -169,6 +169,7 @@
  */
 function getIdFromColumnName(id, arr) {
   try {
+    id = String(id).replace(/\$/g, "");
     // Get the letters
     var t = /^[a-zA-Z]+/.exec(id);
     if (t) {
@@ -245,9 +246,16 @@
  */
 function getABCList(f) {
   try {
+    if (typeof f !== "string") {
+      return [];
+    }
     let regex = /[=\+\-\*\%\(\)\/\^\s]/g;
-    let fouList = ["SUM", "MAX", "MIN", "AVERAGE", "ABS"];
+    let fouList = ["SUM", "MAX", "MIN", "AVERAGE", "ABS", "MEDIAN"];
     f = f
+      .replace(/\$/g, "") // 鍘绘帀 Excel 缁濆寮曠敤绗﹀彿,$D$14 瑙嗕负 D14
+      // 鍖洪棿鍐欐硶閲岀殑绌烘牸(AVERAGE( D14 : D15 ))浼氳涓嬮潰鐨勭┖鐧芥浛鎹㈠悆鎺夊啋鍙�,
+      // 瀵艰嚧鍖洪棿琚媶鎴愪袱涓嫭绔嬪崟鍏冩牸,鍏堟妸鍖洪棿瑙勬暣鎴� D14:D15
+      .replace(/\s*:\s*/g, ":")
       .replace(regex, ",")
       .replace(new RegExp('"&', "g"), "")
       .replace(new RegExp('&"', "g"), "");
@@ -280,6 +288,22 @@
 }
 
 /**
+ * 鎶婂崟鍏冩牸鍊艰浆鎴愬彲鍙備笌 eval 鐨勫瓧闈㈤噺,绌虹櫧鍗曞厓鏍兼寜 0 澶勭悊(涓� Excel 涓�鑷�)
+ *
+ * @param value 鍗曞厓鏍肩殑鍊�
+ * @returns 鏁板��/鍘熷鍊�,绌哄�艰繑鍥� 0
+ */
+function toNumberLiteral(value) {
+  if (value === null || value === undefined) {
+    return 0;
+  }
+  if (typeof value === "string" && value.trim() === "") {
+    return 0;
+  }
+  return value;
+}
+
+/**
  * 璁$畻鍑芥暟
  *
  * @param f 瀛楃涓茬被鍨嬶紝琛ㄧず寰呰绠楃殑鍏紡
@@ -288,9 +312,14 @@
  */
 function compute(f, comValue) {
   try {
-    let str = f;
+    if (typeof f !== "string") {
+      return undefined;
+    }
+    // 鍘绘帀 Excel 缁濆寮曠敤绗﹀彿,$D$14 涓� D14 绛変环;
+    // 鍖洪棿閲岀殑绌烘牸涔熻涓�骞跺幓鎺�,鍚﹀垯鍖洪棿 token 浼氬洜绌烘牸鍖归厤涓嶄笂鑰屽睍寮�澶辫触
+    let str = f.replace(/\$/g, "").replace(/\s*:\s*/g, ":");
     // 鑾峰彇鍗曞厓鏍煎搴斿��
-    let arr = getAllCell(f);
+    let arr = getAllCell(str);
     for (var a in comValue) {
       if (
         comValue[a] !== "undefined" &&
@@ -310,43 +339,40 @@
         }
       }
     }
-    // 瑙f瀽鍏紡鍙傛暟锛岀壒鍒槸甯︼細鐨�
-    let arr0 = getABCList(f);
-    let obj = {};
-    arr0.forEach((item) => {
-      if (item.includes(":")) {
-        let arr1 = [];
-        let r0 = getIdFromColumnName(item.split(":")[0]).r;
-        let c0 = getIdFromColumnName(item.split(":")[0]).c;
-        let r1 = getIdFromColumnName(item.split(":")[1]).r;
-        let c1 = getIdFromColumnName(item.split(":")[1]).c;
-        for (let i = Number(r0); i <= Number(r1); i++) {
-          for (let u = Number(c0); u <= Number(c1); u++) {
-            arr1.push({
-              r: i,
-              c: u,
-            });
-          }
-        }
-        let arr2 = [];
-        arr1.forEach((m) => {
-          arr2.push(getColumnNameFromId(`${m.c}` + "-" + `${m.r}`));
-        });
-        obj[item.split(":").join("-")] = arr2.join(",");
-      } else {
-        obj[item] = item;
+    // 鎶婂尯闂村弬鏁�(濡� SUM(D14:D15) 涓殑 D14:D15)灞曞紑鎴愬崟鍏冩牸鍒楄〃 D14,D15
+    getABCList(str).forEach((token) => {
+      if (!token.includes(":")) {
+        return;
       }
+      const parts = token.split(":");
+      const start = getIdFromColumnName(parts[0]);
+      const end = getIdFromColumnName(parts[1]);
+      const cells = [];
+      for (let i = Number(start.r); i <= Number(end.r); i++) {
+        for (let u = Number(start.c); u <= Number(end.c); u++) {
+          cells.push(getColumnNameFromId(`${u}` + "-" + `${i}`));
+        }
+      }
+      str = str.replace(token, cells.join(","));
     });
-    str = str.replace(new RegExp(":", "g"), "");
-    // 鏇挎崲鍙傛暟
-    for (var a in obj) {
-      str = str.replace(new RegExp(a, "g"), obj[a]);
+    // 璁$畻:涓�娆℃�ф浛鎹㈡墍鏈夊弬鏁�,閬垮厤 D1 涓� D14 杩欑被鍓嶇紑浜掔浉姹℃煋
+    const keys = Object.keys(arr);
+    if (keys.length > 0) {
+      const pattern = new RegExp(
+        keys
+          .sort((x, y) => y.length - x.length)
+          .map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
+          .join("|"),
+        "g"
+      );
+      str = str.replace(pattern, (m) => String(toNumberLiteral(arr[m])));
     }
-    // 璁$畻
-    for (var a in arr) {
-      str = str.replace(new RegExp(a, "g"), arr[a]);
+    const result = eval(str);
+    // 闄ら浂绛夐潪鏈夐檺缁撴灉涓嶅啓鍥炲崟鍏冩牸
+    if (typeof result === "number" && !isFinite(result)) {
+      return undefined;
     }
-    return eval(str);
+    return result;
   } catch (error) {}
 }
 
diff --git a/src/views/business/inspectionTask/components/InspectionWord.vue b/src/views/business/inspectionTask/components/InspectionWord.vue
index bd71a78..4c61c6b 100644
--- a/src/views/business/inspectionTask/components/InspectionWord.vue
+++ b/src/views/business/inspectionTask/components/InspectionWord.vue
@@ -41,7 +41,8 @@
                     class="content">
                     <template
                       v-if="n.v.ps != undefined && typeof n.v.ps.value === 'string' && n.v.ps.value.includes('妫�楠屽��') && state == 1">
-                      <el-input v-if="getInspectionValueType(n.i) == 1"
+                      <el-input
+                        v-if="getInspectionValueType(n.i) == 1 || (getInspectionValueType(n.i) != 2 && getInspectionValueType(n.i) != 4)"
                         :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v"
                         :disabled="(getInspectionItemType(n.i) == 1 && !dataAcquisitionEidtAble) || (n.u != userId && n.u != undefined && n.u != '')"
                         class="table_input"
@@ -61,34 +62,6 @@
                       <span v-else-if="getInspectionValueType(n.i) == 4"
                         :style="`font-family:${n.v.ff} !important;`">/</span>
                     </template>
-                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '缁撹'">
-                      <el-select
-                        v-if="(getInspectionValueType(n.i) == 2 || getInspectionValueType(n.i) == 5) && state == 1"
-                        v-model="n.v.v" class="table_input"
-                        @change="m => changeInput(m, `${item.templateId}-${n.r}-${n.c}-${n.i}`, n, 'getDataType')">
-                        <el-option :value="1" label="鍚堟牸"></el-option>
-                        <el-option :value="0" label="涓嶅悎鏍�"></el-option>
-                        <el-option :value="3" label="涓嶅垽瀹�"></el-option>
-                        <el-option :value="2" label="寰呭畾"></el-option>
-                      </el-select>
-                      <template v-if="state > 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                      <template v-if="getInspectionValueType(n.i) != 2 && state == 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                    </template>
-                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '璁惧缂栫爜' && state == 1">
-                      <span>{{ n.v.v }}</span>
-                    </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
                         placeholder="璁惧" remote @change="(val) => changeEquip(val, n)"
@@ -98,9 +71,6 @@
                           {{ item.label + '--' + item.value }}
                         </el-option>
                       </el-select>
-                    </template>
-                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '瑕佹眰鍊�' && state == 1">
-                      <span :style="`font-family:${n.v.ff} !important;`">{{ getTell(n.i) }}</span>
                     </template>
                     <template v-else-if="n.v.ps != undefined && n.v.ps.value === '璁$畻鍊�' && state == 1"><span
                         :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) }}</span></template>
@@ -510,22 +480,9 @@
           return
         }
         this.currentSample.insProduct = this.HaveJson(list)
-        // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�
+        // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�,鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆瓨
         this.param = {}
         this.changeType = 0;
-        this.currentSample.insProduct.forEach(a => {
-          // 鏄惁涓烘垚鍝佺數缂嗕笅鐨勬澗濂楃椤圭洰锛屼笉鏄垯鎵ц鍒濆鍖�
-          if (this.handleCasing(a.inspectionItem)) {
-            this.param[a.id] = {
-              insValue: [],
-              comValue: [],
-              resValue: null,
-              equipValue: [],
-              equipName: [],
-              insResult: null
-            }
-          }
-        })
         // await this.determineWhetherToCollectData()//鏄惁闇�瑕佹暟閲�
         if (this.currentSample.index == undefined) this.currentSample['index'] = 1
         let bushing = this.currentSample.bushing
@@ -545,19 +502,7 @@
           if (m.templateId == val1) {
             let list = await this.getCurrentProduct(this.currentSample.id, 0)
             this.currentSample.insProduct = this.HaveJson(list)//璧嬪�煎綋鍓嶆牱鍝佺殑妫�楠岄」
-            this.param = {}//鍒濆鍖栦紶鍒板悗绔殑鍙傛暟
-            this.currentSample.insProduct.forEach((a, j) => {
-              if (this.handleCasing(a.inspectionItem)) {
-                this.param[a.id] = {
-                  insValue: [],
-                  comValue: [],
-                  resValue: null,
-                  equipValue: [],
-                  equipName: [],
-                  insResult: null
-                }
-              }
-            })
+            this.param = {}//鍒濆鍖栦紶鍒板悗绔殑鍙傛暟,鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆瓨
             // 鍘婚噸妯℃澘锛岃繑鍥炴湁鍑犱釜妯℃澘
             const mySet1 = new Set();
             this.tableLists = this.currentSample.insProduct.filter(m => {
@@ -590,47 +535,7 @@
     // 鐗规畩妫�楠岄」--鐩戝惉璁惧淇℃伅鏀瑰彉
     equipForm: {
       deep: true,
-      handler(val) {
-        if (this.tableLists.find(m => m.templateId == this.currentTable) && (this.tableLists.find(m => m.templateId == this.currentTable).templateName == '娓╁害寰幆妫�楠屽師濮嬭褰�' || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('鐑惊鐜�') || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('娓╁崌璇曢獙')) && this.equipOptions && this.equipOptions.length > 0) {
-          // 鍒濆鍖栬澶囦俊鎭�
-          this.param[this.currentSample.insProduct[0].id].equipValue = []
-          this.param[this.currentSample.insProduct[0].id].equipName = []
-          if (this.equipForm.code0) {
-            // 璧嬪�肩涓�涓澶囩殑淇℃伅
-            this.equipForm.value0 = this.equipOptions.find(m => m.value == this.equipForm.code0).label
-            this.param[this.currentSample.insProduct[0].id].equipValue.push({
-              i: this.currentSample.insProduct[0].id,
-              v: {
-                v: this.equipForm.code0
-              }
-            })
-            this.param[this.currentSample.insProduct[0].id].equipName.push({
-              i: this.currentSample.insProduct[0].id,
-              v: {
-                v: this.equipForm.value0
-              }
-            })
-          }
-          if (this.equipForm.code1) {
-            // 璧嬪�肩浜屼釜璁惧鐨勪俊鎭�
-            this.equipForm.value1 = this.equipOptions.find(m => m.value == this.equipForm.code1).label
-            this.param[this.currentSample.insProduct[0].id].equipValue.push({
-              i: this.currentSample.insProduct[0].id,
-              v: {
-                v: this.equipForm.code1
-              }
-            })
-            this.param[this.currentSample.insProduct[0].id].equipName.push({
-              i: this.currentSample.insProduct[0].id,
-              v: {
-                v: this.equipForm.value1
-              }
-            })
-          }
-          // 淇濆瓨鏁版嵁
-          this.saveInsContext()
-        }
-      }
+      handler(val) { },
     },
   },
   beforeDestroy() {
@@ -894,16 +799,6 @@
         let list = await this.getCurrentProduct(m, type, cableTag)
         if (list.length > 0) {
           this.param = {}
-          list.forEach(a => {
-            this.param[a.id] = {
-              insValue: [],
-              comValue: [],
-              resValue: null,
-              equipValue: [],
-              equipName: [],
-              insResult: null
-            }
-          })
           this.getTableLists0(list)
           this.worker.postMessage(JSON.stringify({
             type: 'saveData',
@@ -1084,129 +979,19 @@
           count++
         })
       })
-      // 鏈寰幆涓昏鏄帶鍒跺悎骞�,浠ュ強鎺у埗妫�楠岄」淇℃伅鏄惁灞曠ず鍑烘潵,浠ヤ究鍚庣画妫�楠�
+      // 鎸夊悗绔笅鍙戠殑鈥滄ā鏉縄D + 妯℃澘琛屽彿鈥濈洿鎺ョ粦瀹氭楠岄」锛屼笉鍋氬悕绉版瘮瀵癸紝涓嶉殣钘忎换浣曡
       this.tableList.forEach(a => {
-        let dels = new Set()//闇�瑕佸垹闄ょ殑琛�
-        let ids = []//鎵�鏈夋楠岄」鐨刬d
-        let set3 = new Set()
-        a.template.forEach(b => {
-          let size1 = set3.size
-          let size2 = set3.add(b.r).size
-          if (size1 < size2) {
-            let str = ''
-            let str2 = ''
-            let unit2 = ''
-            let count4 = 0
-            let isThree = 0
-            a.template.forEach(c => {
-              // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉�
-              if (b.r === c.r) {
-                if (c.v.ps != undefined && c.v.ps.value === '妫�楠岄」鍒嗙被' && count4 === 0) {
-                  // 涓夌骇鍒嗙被
-                  isThree = 1
-                } else if (c.v.ps != undefined && c.v.ps.value === '妫�楠岄」' && count4 === 0) {
-                  // 浜岀骇鍒嗙被
-                  isThree = 0
-                }
-                if (isThree == 0) {
-                  if (c.v.ps != undefined && c.v.ps.value === '妫�楠岄」') {
-                    if (count4 === 0) {
-                      str += c.v.v
-                      count4 += 1
-                    }
-                  } else if (c.v.ps != undefined && c.v.ps.value === '妫�楠屽瓙椤�') {
-                    if (count4 === 1) {
-                      str += c.v.v
-                      count4 += 1
-                    }
-                  }
-                } else if (isThree == 1) {
-                  if (c.v.ps != undefined && c.v.ps.value === '妫�楠岄」鍒嗙被') {
-                    if (count4 === 0) {
-                      str += c.v.v
-                      count4 += 1
-                    }
-                  } else if (c.v.ps != undefined && c.v.ps.value === '妫�楠岄」') {
-                    if (count4 === 1) {
-                      str += c.v.v
-                      count4 += 1
-                    }
-                  } else if (c.v.ps != undefined && c.v.ps.value === '妫�楠屽瓙椤�') {
-                    if (count4 === 2) {
-                      str += c.v.v
-                      count4 += 1
-                    }
-                  }
-                }
-                if (str === '鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)') {
-                  if (c.v.ps != undefined && c.v.ps.value === '鍗曚綅') {
-                    str2 = str + c.v.v
-                    unit2 = c.v.v
-
-                  }
-                }
-              }
-            })
-            if (str != '') {
-              let count2 = 0
-              for (let i in this.currentSample.insProduct) {
-                let inspectionItemClass = this.currentSample.insProduct[i].inspectionItemClass == null || this.currentSample.insProduct[i].inspectionItemClass == undefined ? '' : this.currentSample.insProduct[i].inspectionItemClass
-                let inspectionItem = this.currentSample.insProduct[i].inspectionItem == null || this.currentSample.insProduct[i].inspectionItem == undefined ? '' : this.currentSample.insProduct[i].inspectionItem
-                let inspectionItemSubclass = this.currentSample.insProduct[i].inspectionItemSubclass == null || this.currentSample.insProduct[i].inspectionItemSubclass == undefined ? '' : this.currentSample.insProduct[i].inspectionItemSubclass
-                if (inspectionItemSubclass === '骞叉�佹媺浼稿己搴�(绾靛悜)') {
-                  // 妫�楠屽瓙椤逛负'骞叉�佹媺浼稿己搴�(绾靛悜)'鏃讹紝妯$増閲屾槸涓や釜璁$畻鍊煎搴旂浉鍚岀殑妫�楠屽�煎苟涓旇绠楁柟寮忎笉鍚岋紝瑕佹牴鎹浉鍚岀殑'鍗曚綅'鍋氱壒娈婄殑娓叉煋
-                  const unit = this.currentSample.insProduct[i].unit
-                  if ((this.currentSample.insProduct[i].templateId === a.templateId && inspectionItemClass + inspectionItem + inspectionItemSubclass + unit === str2) || (this.currentSample.insProduct[i].templateId === a.templateId && !unit2.includes('/') && inspectionItemClass + inspectionItem + inspectionItemSubclass === str)) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i]
-                    })
-                    break
-                  }
-                } else {
-                  // 濡傛灉鐩哥瓑,閭d箞璇存槑鎵惧埌浜�,骞朵笖鎶奿d瀛樿捣鏉�,鍚庣画妫�楠岄」涔熶細鍦ㄩ〉闈腑鏄剧ず鍑烘潵
-                  if (this.currentSample.insProduct[i].templateId === a.templateId && inspectionItemClass + inspectionItem + inspectionItemSubclass === str) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i]
-                    })
-                    break
-                  }
-                }
-                count2++
-              }
-              if (count2 == this.currentSample.insProduct.length) {
-                dels.add(b.r)
-              }
+        const directProducts = this.currentSample.insProduct.filter(
+          (product) => product.templateId === a.templateId &&
+            product.templateRowIndex !== null && product.templateRowIndex !== undefined
+        );
+        directProducts.forEach((product) => {
+          a.template.forEach((cell) => {
+            if (cell.r === product.templateRowIndex) {
+              cell.i = product.id;
             }
-          }
-        })
-        // 鎿嶄綔鍒犻櫎
-        dels.forEach(del => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === del) {
-              a.template.splice(b, 1)
-              b -= 1
-            }
-          }
-        })
-        // 鎿嶄綔璧嬪��--涓昏璧嬪�煎崟浣�,璇曢獙鏂规硶绛変俊鎭�
-        ids.forEach(id => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === id.r) {
-              a.template[b].i = id.id
-              if (a.template[b].v.ps != undefined && a.template[b].v.ps.value === '鍗曚綅') {
-                a.template[b].v.v = id.product.unit
-              }
-              if (a.template[b].v.ps != undefined && (a.template[b].v.ps.value === '璇曢獙鏂规硶' || a.template[b].v
-                .ps.value === '妫�娴嬫柟娉�')) {
-                a.template[b].v.v = id.product.methodS
-              }
-            }
-          }
-        })
+          });
+        });
         let set2 = new Set()
         // 鍚堝苟鐨勬暟鎹鐞�,cs  rs  浠h〃鍚堝苟鐨勬暟閲�
         a.template.forEach(b => {
@@ -1233,60 +1018,24 @@
         let arrs = []
         let set = new Set()
         let count1 = 0
-        let conclusionList = []; //缁撹鍒楄〃
-        let finalList = []; //鏈�缁堝�煎垪琛�
-        // 缁撹涓庢渶缁堝�煎湪杩欓噷涓�涓�瀵瑰簲,浠ヤ笅涓や釜鍒楄〃闀垮害鑲畾鏄竴鏍风殑,濡傛灉鏈変笉涓�鏍�,閭d箞澶氬崐鏄ā鏉块厤缃緱闂
-        conclusionList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '缁撹')//缁撹鍒楄〃
-        finalList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '鏈�缁堝��')//鏈�缁堝�煎垪琛�
         a.template.forEach(b => {
           if (b.v.ps != undefined && b.v.ps.value === '搴忓彿' && (b.v.mc == undefined || Object.keys(b.v.mc).length === 4)) {
             // 瀵瑰簭鍙疯繘琛岃祴鍊�
             count1++
             b.v.v = count1
           }
-          if (b.v.ps != undefined && b.v.ps.value === '瑕佹眰鍊�') {
-            // 瀵硅姹傚�艰繘琛岃祴鍊�
-            b.v.v = this.getAsk(b.i)
-          }
-          // 瀵归〉闈㈢殑鍜岀粰鍚庣浼犲弬鐨勬楠屽��,璁$畻鍊�,璁惧缂栫爜,璁惧鍚嶇О,鏈�缁堝��,缁撹杩涜鍒濆鍖�
-          if (b.v.ps != undefined && typeof b.v.ps.value === 'string' && b.v.ps.value.includes('妫�楠屽��')) {
+          // 鍒濆鍖栧彲濉啓/鍙绠楀崟鍏冩牸,鍚庣画鎸夊潗鏍囧洖鏄�
+          if (
+            b.v.ps != undefined &&
+            typeof b.v.ps.value === 'string' &&
+            (b.v.ps.value.includes('妫�楠屽��') ||
+              b.v.ps.value === '璁$畻鍊�' ||
+              b.v.ps.value === '鏈�缁堝��' ||
+              b.v.ps.value === '璁惧鍚嶇О')
+          ) {
             this.$set(b.v, 'v', '')
-            // b.v.v = ''
-            b.u = ''
-            b.i && this.param[b.i] && this.param[b.i].insValue.push(b)
-          }
-          if (b.v.ps != undefined && b.v.ps.value === '璁$畻鍊�') {
-            this.$set(b.v, 'v', '')
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].comValue.push(b)
-          }
-          if (b.v.ps != undefined && b.v.ps.value === '璁惧缂栫爜') {
-            // b.v.v = ''
-            this.$set(b.v, 'v', '')
-            b.i && this.param[b.i] && this.param[b.i].equipValue.push(b)
-          }
-          if (b.v.ps != undefined && b.v.ps.value === '璁惧鍚嶇О') {
-            this.$set(b.v, 'v', '')
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].equipName.push(b)
-          }
-          if (b.v.ps != undefined && b.v.ps.value === '鏈�缁堝��') {
-            // b.v.v = ''
-            this.$set(b.v, 'v', '')
-            if (b.i !== undefined && this.param[b.i] && !this.param[b.i].resValue) {
-              this.param[b.i].resValue = b
-            }
-          }
-          if (b.v.ps != undefined && b.v.ps.value === '缁撹') {
-            if (b.i !== undefined && this.param[b.i] && !this.param[b.i].insResult) {
-              this.param[b.i].insResult = b
-              conclusionList.forEach((n, i) => {
-                if (n.r == b.r && n.c == b.c) {
-                  b.v.f =
-                    `(${this.comparisonList.find(j => j.value == (finalList[i].c)).label}${finalList[i].r + 1})`
-
-                }
-              })
+            if (b.v.ps.value.includes('妫�楠屽��')) {
+              b.u = ''
             }
           }
           set.add(b.r)
@@ -1313,97 +1062,45 @@
           this.tableWidth += (a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i])
         }
       })
-      // 鏈寰幆涓昏鏄椤甸潰鍙婂悗绔紶鍙傝繘琛屽垵濮嬪寲璧嬪��
-      this.currentSample.insProduct.forEach(async a => {
-        try {
-          // 璁$畻鍊艰祴鍊�
-          let comValue = JSON.parse(a.insProductResult.comValue)
-          for (var i = 0; i < comValue.length; i++) {
-            this.param[a.id].comValue[i].v.v = this.toFixed(comValue[i].v, this.param[a.id].comValue[i].v.ct)
-          }
-        } catch (e) { }
-        try {
-          // 妫�楠屽�艰祴鍊�
-          let insValue = JSON.parse(a.insProductResult.insValue)
-          for (let i = 0; i < insValue.length; i++) {
-            if (this.param[a.id].insValue.find(m => m.c == insValue[i].c && m.r == insValue[i].r)) {
-              this.param[a.id].insValue.find(m => m.c == insValue[i].c && m.r == insValue[i].r).v.v = this.toFixed(insValue[i].v, this.param[a.id].insValue.find(m => m.c == insValue[i].c && m.r == insValue[i].r).v.ct)
-              this.param[a.id].insValue.find(m => m.c == insValue[i].c && m.r == insValue[i].r).u = insValue[i].u
-              // this.param[a.id].insValue[i].v.v = insValue[i].v
-              // this.param[a.id].insValue[i].u = insValue[i].u
-            }
-          }
-        } catch (e) { }
-        try {
-          // 璁惧缂栧彿璧嬪��
-          let equipValue = JSON.parse(a.insProductResult.equipValue)
-          if (this.tableLists.find(m => m.templateId == this.currentTable) && (this.tableLists.find(m => m.templateId == this.currentTable).templateName == '娓╁害寰幆妫�楠屽師濮嬭褰�' || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('鐑惊鐜�') || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('娓╁崌璇曢獙'))) {
-            // 鐗规畩椤圭洰鍒濆鍖�
-            this.param[a.id].equipValue = []
-            for (let i = 0; i < equipValue.length; i++) {
-              this.param[a.id].equipValue.push({
-                v: {
-                  v: ''
-                }
-              })
-            }
-          }
-          for (let i = 0; i < equipValue.length; i++) {
-            if (this.tableLists.find(m => m.templateId == this.currentTable) && (this.tableLists.find(m => m.templateId == this.currentTable).templateName == '娓╁害寰幆妫�楠屽師濮嬭褰�' || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('鐑惊鐜�') || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('娓╁崌璇曢獙'))) {
-              // 娓╁害寰幆璁惧璧嬪��
-              this.$set(this.equipForm, `code` + i, equipValue[i].v)
-              this.param[a.id].equipValue[i].v.v = equipValue[i].v
-            } else {
-              // 鏅�氳澶囪祴鍊�
-              this.param[a.id].equipValue[i].v.v = equipValue[i].v
-            }
-          }
-        } catch (e) { }
-        try {
-          // 璁惧鍚嶇О璧嬪��
-          let equipName = JSON.parse(a.insProductResult.equipName)
-          for (let i = 0; i < equipName.length; i++) {
-            equipName[i].v !== '' && equipName[i].v.map(val => {
-              const index = this.equipOptions.findIndex(item => item.value === val)
-              if (index > -1) {
-                // 鏍规嵁璁惧缂栫爜杞崲涓虹浉搴旂殑璁惧鍚嶇О
-                val = this.equipOptions[index].deviceName
-              }
-            })
-          }
-          if (this.tableLists.find(m => m.templateId == this.currentTable) && (this.tableLists.find(m => m.templateId == this.currentTable).templateName == '娓╁害寰幆妫�楠屽師濮嬭褰�' || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('鐑惊鐜�') || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('娓╁崌璇曢獙'))) {
-            // 璁惧鍚嶇О鍒濆鍖�
-            this.param[a.id].equipName = []
-            for (let i = 0; i < equipName.length; i++) {
-              this.param[a.id].equipName.push({
-                v: {
-                  v: ''
-                }
-              })
-            }
-          }
-          for (let i = 0; i < equipName.length; i++) {
-            if (this.tableLists.find(m => m.templateId == this.currentTable) && (this.tableLists.find(m => m.templateId == this.currentTable).templateName == '娓╁害寰幆妫�楠屽師濮嬭褰�' || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('鐑惊鐜�') || this.tableLists.find(m => m.templateId == this.currentTable).templateName.includes('娓╁崌璇曢獙'))) {
-              // 娓╁害寰幆璧嬪��
-              this.$set(this.equipForm, `value` + i, equipName[i].v)
-              this.param[a.id].equipName[i].v.v = equipName[i].v
-            } else {
-              // 鏅�氳澶囧悕绉拌祴鍊�
-              this.param[a.id].equipName[i].v.v = equipName[i].v
-            }
-          }
-        } catch (e) {
-          console.log('璁惧鍚嶇О璧嬪��----', e)
-        }
-        try {
-          // 鏈�缁堝�艰祴鍊�
-          this.param[a.id].resValue.v.v = this.toFixed(a.lastValue, this.param[a.id].resValue.v.ct)
-          // 缁撹璧嬪��
-          this.param[a.id].insResult.v.v = a.insResult
-        } catch (e) { }
-      })
+      // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+      this.initParamByCoordinate()
       // 瀵筫xcel鍑芥暟杩涜澶勭悊
       this.handleExcelMethod()
+    },
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+    initParamByCoordinate() {
+      this.param = {}
+      this.tableList.forEach(a => {
+        this.param[a.templateId] = {}
+        const product = this.currentSample.insProduct.find(m => m.templateId === a.templateId)
+        let saved = (product && (product.recordValues || product.insProductResult)) || {}
+        if (typeof saved === 'string') {
+          try {
+            saved = JSON.parse(saved)
+          } catch (e) {
+            saved = {}
+          }
+        }
+        a.template.forEach(cell => {
+          const key = `${cell.r}-${cell.c}`
+          const item = saved[key]
+          if (item === undefined || item === null) {
+            return
+          }
+          const value = typeof item === 'object' ? item.v : item
+          if (value === undefined || value === null) {
+            return
+          }
+          cell.v.v = value
+          if (typeof item === 'object' && item.u) {
+            cell.u = item.u
+          }
+          this.param[a.templateId][key] = {
+            v: value,
+            u: typeof item === 'object' ? item.u : cell.u
+          }
+        })
+      })
     },
     // 妫�楠屽�艰緭鍏ュ悗瑙﹀彂鐨勫嚱鏁�
     changeInput(m, code, n, getDataType) {
@@ -1411,9 +1108,7 @@
       if (getDataType == 'getDataType') {
         this.getDataType = 2;
       }
-      let currentInsItemId = null//褰撳墠妫�楠岄」id
       if (n) {
-        currentInsItemId = JSON.parse(JSON.stringify(n.i))
         // 瀹氫箟涓�涓嚱鏁版潵楠岃瘉鍒嗘暟鏄惁鏈夋晥
         if (typeof n.v.v == 'string') {
           function isValidFraction(fraction) {
@@ -1441,6 +1136,10 @@
           modelType: this.sampleProduct[0].model,
           currentInsItem: n
         }));
+        // 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
+        if (n) {
+          this.saveInsContext()
+        }
       } catch (error) {
         console.log(444, error);
       }
@@ -1450,24 +1149,11 @@
         this.result = JSON.parse(event.data);
         switch (this.result.method) {
           case 'saveInsContext':
-            console.log(`output->`, 11111111111111)
             this.$nextTick(() => {
-              // this.$delete(this.tableList[0],'arr')
-              this.$set(this.tableList[0], 'arr', this.result.value.tableList[0].arr)
-              this.param = this.result.value.param
-              if (this.result.value.currentInsItem) {
-                currentInsItemId = this.result.value.currentInsItem.i
-              }
-              // 鐗规畩澶勭悊涓�涓嬬粨璁�,浼氭湁杩欑鐗规畩鎯呭喌
-              for (var i in this.param) {
-                if (this.param[i].insResult && this.param[i].insResult.v && this.param[i].insResult.v.v) {
-                  if (this.param[i].insResult.v.v == '鍚堟牸') {
-                    this.$set(this.param[i].insResult.v, 'v', 1)
-                  } else if (this.param[i].insResult.v.v == '涓嶅悎鏍�') {
-                    this.$set(this.param[i].insResult.v, 'v', 0)
-                  }
-                }
-              }
+              const resultValue = this.result.value
+              this.$set(this.tableList[0], 'arr', resultValue.tableList[0].arr)
+              this.param = resultValue.param
+              this.saveInsContext()
             })
             break;
           case 'tableList':
@@ -1475,116 +1161,16 @@
               // 鏇存柊鏁版嵁
               this.$delete(this.tableList[0], 'arr')
               this.$set(this.tableList[0], 'arr', this.result.value[0].arr)
-              // this.param = this.result.value.param
-              if (this.result.value.currentInsItem) {
-                currentInsItemId = this.result.value.currentInsItem.i
-              }
             })
-            break;
-          case 'getCurrentInsProduct':
-            // 鏇存柊椤甸潰鏁版嵁
-            this.getCurrentInsProduct(this.result.value)
             break;
         }
       };
-      // 淇濆瓨鏁版嵁
-      setTimeout(() => {
-        this.saveInsContext(currentInsItemId)
-      }, 200)
     },
     // 鏄惁闇�瑕佹暟閲�
     // async determineWhetherToCollectData() {
     //   let res = determineWhetherToCollectData({ managementNumber: '' })
     //   this.isGet = res.data
     // },
-    // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁   param => this.tableList[0].insProductResult
-    getCurrentInsProduct(pId) {
-      if (!this.tableList[0].insProductResult) {
-        this.tableList[0].insProductResult = {}
-      }
-      for (let m in this.param[pId]) {
-        let value = this.param[pId][m]
-        switch (m) {
-          case 'comValue':
-            // 璧嬪�艰绠楀��
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                }
-                this.tableList[0].insProductResult[m].push(obj);
-              })
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
-              } catch (error) {
-                console.log(555, error);
-              }
-            }
-            break;
-          // 璧嬪�兼楠屽��
-          case 'insValue':
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                  u: a.u,
-                }
-                this.tableList[0].insProductResult[m].push(obj);
-              })
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
-              } catch (error) {
-                console.log(666, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囩紪鍙�
-          case 'equipValue':
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                }
-                this.tableList[0].insProductResult[m].push(obj);
-              })
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
-              } catch (error) {
-                console.log(777, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囧悕绉�
-          case 'equipName':
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                }
-                this.tableList[0].insProductResult[m].push(obj);
-              })
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
-              } catch (error) {
-                console.log(888, error);
-              }
-            }
-            break;
-          // 璧嬪�兼渶缁堝��
-          case 'resValue':
-            this.tableList[0].lastValue = value ? value.v.v : ''
-            break;
-          // 璧嬪�肩粨璁�
-          case 'insResult':
-            this.tableList[0].insResult = value ? value.v.v : ''
-            break;
-        }
-      }
-    },
     // 瀵笶XCEL鍑芥暟杩涜澶勭悊
     handleExcelMethod() {
       if (this.excelMethodList.length > 0) {
@@ -1615,14 +1201,6 @@
       for (var a in this.currentSample.insProduct) {
         if (this.currentSample.insProduct[a].id == id) {
           return this.currentSample.insProduct[a].inspectionValueType
-        }
-      }
-    },
-    // 鑾峰彇瑕佹眰鎻忚堪
-    getTell(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].tell
         }
       }
     },
@@ -1659,26 +1237,22 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鍊�
-    getAsk(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].ask
-        }
-      }
-    },
     getSystemValue(n) {
       let code = null
       try {
-        this.param[n.i].equipValue.forEach(a => {
-          if (a.r === n.r) {
-            if (a.v.v == null || a.v.v == '') {
-              this.$message.error('璇峰厛閫夋嫨閲囬泦鐨勮澶�')
-              return
-            } else {
-              code = a.v.v
-            }
-          }
+        this.tableList.forEach(table => {
+          (table.arr || []).forEach(row => {
+            row.forEach(cell => {
+              if (cell.i == n.i && cell.r === n.r && cell.v.ps && cell.v.ps.value === '璁惧缂栫爜') {
+                if (cell.v.v == null || cell.v.v == '') {
+                  this.$message.error('璇峰厛閫夋嫨閲囬泦鐨勮澶�')
+                  return
+                } else {
+                  code = cell.v.v
+                }
+              }
+            })
+          })
         })
       } catch (e) {
         // console.log(e);
@@ -1857,91 +1431,97 @@
       })
       return
     },
-    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
-    saveInsContext(currentInsItemId) {
-      try {
-        if (this.param) {
-          let param = null
-          if (currentInsItemId) {
-            param = { [currentInsItemId]: this.param[currentInsItemId] }
-          } else {
-            param = this.param
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濅粠褰撳墠妯℃澘蹇収鍑哄緟淇濆瓨鍙傛暟
+    buildParam() {
+      const param = {}
+      this.tableList.forEach(a => {
+        param[a.templateId] = {}
+        a.template.forEach(cell => {
+          const isEditable =
+            cell.v.ps != undefined &&
+            typeof cell.v.ps.value === 'string' &&
+            (cell.v.ps.value.includes('妫�楠屽��') ||
+              cell.v.ps.value === '璁$畻鍊�' ||
+              cell.v.ps.value === '鏈�缁堝��' ||
+              cell.v.ps.value === '璁惧鍚嶇О')
+          if (!isEditable) {
+            return
           }
-          saveUnqualifiedContext({
-            param: JSON.stringify(param),
-            currentTable: this.currentTable,
-            sampleId: this.currentSample.id
-          }).then(res => {
-            this.$message.success('宸蹭繚瀛�')
-          })
-          // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
-          this.worker.postMessage(JSON.stringify({
-            modelType: this.sampleProduct[0].model,
-            type: 'saveData',
-            tableList: this.tableList,
-            param: this.param,
-            currentTable: this.currentTable
-          }));
+          if (
+            cell.v.ps.value.includes('妫�楠屽��') &&
+            (cell.v.v === '' || cell.v.v === null || cell.v.v === undefined)
+          ) {
+            return
+          }
+          param[a.templateId][`${cell.r}-${cell.c}`] = {
+            v: cell.v.v,
+            u: cell.u
+          }
+        })
+      })
+      return param
+    },
+    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
+    saveInsContext() {
+      try {
+        if (!this.param) {
+          return
         }
+        const param = this.buildParam()
+        this.param = param
+        let isNoTestValue = ''
+        this.tableList.forEach(a => {
+          a.template.forEach(cell => {
+            if (
+              cell.v.ps != undefined &&
+              typeof cell.v.ps.value === 'string' &&
+              cell.v.ps.value.includes('妫�楠屽��') &&
+              (cell.v.v === '' || cell.v.v === null || cell.v.v === undefined)
+            ) {
+              isNoTestValue = 1
+            }
+          })
+        })
+        saveUnqualifiedContext({
+          param: JSON.stringify(param),
+          currentTable: this.currentTable,
+          sampleId: this.currentSample.id,
+          isNoTestValue: isNoTestValue
+        }).then(res => {
+          this.$message.success('宸蹭繚瀛�')
+        })
+        // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+        this.worker.postMessage(JSON.stringify({
+          modelType: this.sampleProduct[0].model,
+          type: 'saveData',
+          tableList: this.tableList,
+          param: this.param,
+          currentTable: this.currentTable
+        }));
       } catch (error) {
         console.log(999, error);
       }
     },
     // 璁惧鏀瑰彉
-    changeEquip(val, n, v) {
-      try {
-        // this.$set(n.v,'v',val)
-        this.tableList[0].arr.forEach((item, index) => {
-          item.forEach((m, i) => {
-            if (this.param[m.i]) {
-              this.param[m.i].state = 1
+    changeEquip(val, n) {
+      const selectedDevices = Array.isArray(val) ? [...val] : []
+      const deviceCodes = selectedDevices.join('锛�')
+      this.$set(n.v, 'v', selectedDevices)
+      this.tableList.forEach(table => {
+        (table.arr || []).forEach(row => {
+          row.forEach(cell => {
+            if (cell.i == n.i && cell.v.ps) {
+              if (cell.v.ps.value === '璁惧鍚嶇О') {
+                this.$set(cell.v, 'v', [...selectedDevices])
+              } else if (cell.v.ps.value === '璁惧缂栫爜') {
+                this.$set(cell.v, 'v', deviceCodes)
+              }
             }
-            // if(m.i==n.i&&m.v.ps&&m.v.ps.value=='璁惧鍚嶇О'&&v){
-            //   this.$set(m.v,'v',v)
-            // }
           })
         })
-        for (let i in this.param) {
-          if (this.param[i].state != 1) {
-            delete this.param[i]
-          }
-        }
-        // if(val&&v){
-        //   for (let i1 in this.param[n.i].equipName) {
-        //     if (this.param[n.i].equipName[i1].i === n.i && this.param[n.i].equipName[i1].r === n.r) {
-        //       this.$delete(this.param[n.i].equipValue[i1].v,'v')
-        //       this.$set(this.param[n.i].equipValue[i1].v,'v',val)
-        //       this.$delete(this.param[n.i].equipName[i1].v,'v')
-        //       this.$set(this.param[n.i].equipName[i1].v,'v',v)
-        //     }
-        //   }
-        // }
-        // this.equipOptions涓鸿澶囧悕绉颁笅鎷夋閫夐」鏁版嵁
-        for (let i1 in this.param[n.i].equipName) {
-          if (this.param[n.i].equipName[i1].i === n.i && this.param[n.i].equipName[i1].r === n.r) {
-            this.$delete(this.param[n.i].equipValue[i1].v, 'v')
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipValue[i1].v, 'v', val.join('锛�'))
-            this.$delete(this.param[n.i].equipName[i1].v, 'v')
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipName[i1].v, 'v', val)
-            this.tableList[0].arr.forEach((item, index) => {
-              item.forEach((m) => {
-                if (m.i == n.i && m.v.ps && m.v.ps.value == '璁惧缂栫爜') {
-                  this.$set(m.v, 'v', val.join('锛�'))
-                }
-                if (m.i == n.i && m.v.ps && m.v.ps.value == '璁惧鍚嶇О') {
-                  this.$set(m.v, 'v', val)
-                }
-              })
-            })
-          }
-        }
-        // 淇濆瓨鏁版嵁
-        this.saveInsContext(n.i)
-      } catch (e) {
-        console.log('changeEquip----', e)
-      }
+      })
+      // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
+      this.saveInsContext()
     },
     getAuthorizedPerson() {
       selectUserCondition({ type: 1 }).then((res) => {
@@ -1996,16 +1576,6 @@
       this.param = {}
       this.fiberOptic = []
       this.currentFiberOptic = null;
-      this.currentFiberOpticTape.productList.forEach(a => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null
-        }
-      })
       this.fiberOpticTapeVisible = false;
       let list = await this.getCurrentProduct(this.currentFiberOpticTape.id, 1)
       this.getTableLists0(list)
@@ -2025,16 +1595,7 @@
       }
       this.currentKey2 = index
       this.currentFiberOptic = this.HaveJson(this.fiberOptic[index - 1])
-      this.currentFiberOptic.productList.forEach(a => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null
-        }
-      })
+      this.param = {}
       let list = await this.getCurrentProduct(this.currentFiberOptic.id, 2)
       this.getTableLists0(list)
     },
diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index e446166..94318dc 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -219,7 +219,9 @@
                       n.v.ps.value.includes('妫�楠屽��') &&
                       state == 1
                     ">
-                      <el-input v-if="getInspectionValueType(n.i) == 1"
+                      <el-input v-if="getInspectionValueType(n.i) == 1 ||
+                        (getInspectionValueType(n.i) != 2 && getInspectionValueType(n.i) != 4)
+                        "
                         :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v" :disabled="(getInspectionItemType(n.i) == 1 &&
                           !dataAcquisitionEidtAble) ||
                           (n.u != userId && n.u != undefined && n.u != '')
@@ -249,63 +251,8 @@
                             'getDataType'
                           )
                           " />
-                      <!-- <el-select v-else-if="getInspectionValueType(n.i) == 5" v-model="n.v.v" :disabled="state > 1 ||
-                      getInspectionItemType(n.i) == 1 ||
-                      (n.u != userId && n.u != undefined && n.u != '')
-                      " class="table_input" @change="(m) =>
-                        changeInput(
-                          m,
-                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                          n,
-                          'getDataType'
-                        )
-                        " @visible-change="(e) => getDic(e, n.i)">
-                      <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option>
-                    </el-select> -->
                       <span v-else-if="getInspectionValueType(n.i) == 4"
                         :style="`font-family:${n.v.ff} !important;`">/</span>
-                    </template>
-                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '缁撹'">
-                      <el-select v-if="
-                        (getInspectionValueType(n.i) == 2 ||
-                          getInspectionValueType(n.i) == 5) &&
-                        state == 1
-                      " v-model="n.v.v" class="table_input" @change="(m) =>
-                        changeInput(
-                          m,
-                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                          n,
-                          'getDataType',
-                          'changeSelect'
-                        )
-                        ">
-                        <el-option :value="1" label="鍚堟牸"></el-option>
-                        <el-option :value="0" label="涓嶅悎鏍�"></el-option>
-                        <el-option :value="3" label="涓嶅垽瀹�"></el-option>
-                        <el-option :value="2" label="寰呭畾"></el-option>
-                      </el-select>
-                      <template v-if="state > 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                      <template v-if="getInspectionValueType(n.i) != 2 &&
-                        state == 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                    </template>
-                    <template v-else-if="
-                      n.v.ps != undefined &&
-                      n.v.ps.value === '璁惧缂栫爜' &&
-                      state == 1
-                    ">
-                      <span>{{ n.v.v }}</span>
                     </template>
                     <template v-else-if="
                       n.v.ps != undefined && n.v.ps.value === '璁惧鍚嶇О'
@@ -318,15 +265,6 @@
                           {{ item.label + "--" + item.value }}
                         </el-option>
                       </el-select>
-                    </template>
-                    <template v-else-if="
-                      n.v.ps != undefined &&
-                      n.v.ps.value === '瑕佹眰鍊�' &&
-                      state == 1
-                    ">
-                      <span :style="`font-family:${n.v.ff} !important;`">{{
-                        getTell(n.i)
-                      }}</span>
                     </template>
                     <template v-else-if="
                       n.v.ps != undefined &&
@@ -946,17 +884,7 @@
           if (m.templateId == val1) {
             let list = await this.getCurrentProduct(this.currentSample.id, 0);
             this.currentSample.insProduct = this.HaveJson(list); //璧嬪�煎綋鍓嶆牱鍝佺殑妫�楠岄」
-            this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟
-            this.currentSample.insProduct.forEach((a, j) => {
-              this.param[a.id] = {
-                insValue: [],
-                comValue: [],
-                resValue: null,
-                equipValue: [],
-                equipName: [],
-                insResult: null,
-              };
-            });
+            this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟,鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍団�濆瓨
             // 鍘婚噸妯℃澘锛岃繑鍥炴湁鍑犱釜妯℃澘
             const mySet1 = new Set();
             this.tableLists = this.currentSample.insProduct.filter((m) => {
@@ -1187,16 +1115,6 @@
         // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�
         this.param = {};
         this.changeType = 0;
-        this.currentSample.insProduct.forEach((a) => {
-          this.param[a.id] = {
-            insValue: [],
-            comValue: [],
-            resValue: null,
-            equipValue: [],
-            equipName: [],
-            insResult: null,
-          };
-        });
         if (this.currentSample.index == undefined)
           this.currentSample["index"] = 1;
         let bushing = this.currentSample.bushing;
@@ -1756,16 +1674,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 澶勭悊椤甸潰鍒楄〃鏁版嵁
       this.getTableLists();
       this.currentKey = row.index;
@@ -1801,16 +1709,6 @@
         let list = await this.getCurrentProduct(m, type, cableTag);
         if (list && list.length > 0) {
           this.param = {};
-          list.forEach((a) => {
-            this.param[a.id] = {
-              insValue: [],
-              comValue: [],
-              resValue: null,
-              equipValue: [],
-              equipName: [],
-              insResult: null,
-            };
-          });
           this.getTableLists0(list);
           this.worker.postMessage(
             JSON.stringify({
@@ -1919,24 +1817,6 @@
     handleTableData() {
       this.excelMethodList = []; //excel鍑芥暟鍒楄〃
       this.widthList = this.tableList[0].style.columnlen; //椤甸潰瀹藉害--鏍规嵁妯℃澘鏉ョ殑
-      // 瀵圭収鎺ュ彛杩斿洖鐨勬楠岄」妯℃澘 ID 涓庨〉闈㈠疄闄呭弬涓庡尮閰嶇殑妯℃澘 ID銆�
-      this.tableList.forEach((template) => {
-        console.log("[templateId鏍稿]", {
-          sampleId: this.currentSample.id,
-          currentTable: this.currentTable,
-          templateName: template.templateName,
-        });
-        console.table(this.currentSample.insProduct.map((product) => ({
-          妫�楠岄」ID: product.id,
-          妫�楠岄」: product.inspectionItem,
-          妫�楠屽瓙椤�: product.inspectionItemSubclass,
-          "妫�楠岄」templateId锛堟帴鍙h繑鍥烇級": product.templateId,
-          妫�楠岄」ID绫诲瀷: typeof product.templateId,
-          "褰撳墠妯℃澘templateId": template.templateId,
-          妯℃澘ID绫诲瀷: typeof template.templateId,
-          "鏄惁涓�鑷达紙涓ユ牸姣旇緝锛�": product.templateId === template.templateId,
-        })));
-      });
       // 鏈寰幆涓昏鍋氶〉闈㈡覆鏌撳眰闈㈢殑澶勭悊--鍗曞厓鏍煎悎骞堕澶勭悊
       this.tableList.forEach((a) => {
         let mcList = a.template.filter(
@@ -1972,255 +1852,18 @@
           count++;
         });
       });
-      // 鏈寰幆涓昏鏄帶鍒跺悎骞�,浠ュ強鎺у埗妫�楠岄」淇℃伅鏄惁灞曠ず鍑烘潵,浠ヤ究鍚庣画妫�楠�
+      // 鎸夊悗绔笅鍙戠殑鈥滄ā鏉縄D + 妯℃澘琛屽彿鈥濈洿鎺ョ粦瀹氭楠岄」锛屼笉鍋氬悕绉版瘮瀵癸紝涓嶉殣钘忎换浣曡
       this.tableList.forEach((a) => {
-        // 鏂拌仛璁㈠崟鐩存帴鎸夆�滄ā鏉縄D + 妯℃澘琛屽彿鈥濈粦瀹氭楠岃褰曪紝涓嶅啀鍖归厤鍒嗙被鍜屾楠屽瓙椤广��
         const directProducts = this.currentSample.insProduct.filter(
           (product) => product.templateId === a.templateId &&
             product.templateRowIndex !== null && product.templateRowIndex !== undefined
         );
-        if (directProducts.length > 0) {
-          directProducts.forEach((product) => {
-            a.template.forEach((cell) => {
-              if (cell.r === product.templateRowIndex) {
-                cell.i = product.id;
-              }
-            });
+        directProducts.forEach((product) => {
+          a.template.forEach((cell) => {
+            if (cell.r === product.templateRowIndex) {
+              cell.i = product.id;
+            }
           });
-          return;
-        }
-        let dels = new Set(); //闇�瑕佸垹闄ょ殑琛�
-        let ids = []; //鎵�鏈夋楠岄」鐨刬d
-        let set3 = new Set();
-        a.template.forEach((b) => {
-          let size1 = set3.size;
-          let size2 = set3.add(b.r).size;
-          if (size1 < size2) {
-            let str = "";
-            let str2 = "";
-            let unit2 = "";
-            let count4 = 0;
-            let isThree = 0;
-            a.template.forEach((c) => {
-              // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉�
-              if (b.r === c.r) {
-                if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」鍒嗙被" &&
-                  count4 === 0
-                ) {
-                  // 涓夌骇鍒嗙被
-                  isThree = 1;
-                } else if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」" &&
-                  count4 === 0
-                ) {
-                  // 浜岀骇鍒嗙被
-                  isThree = 0;
-                }
-                if (isThree == 0) {
-                  if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") {
-                    if (count4 === 0) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (
-                    c.v.ps != undefined &&
-                    c.v.ps.value === "妫�楠屽瓙椤�"
-                  ) {
-                    if (count4 === 1) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                } else if (isThree == 1) {
-                  if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」鍒嗙被") {
-                    if (count4 === 0) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") {
-                    if (count4 === 1) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (
-                    c.v.ps != undefined &&
-                    c.v.ps.value === "妫�楠屽瓙椤�"
-                  ) {
-                    if (count4 === 2) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                }
-                if (str === "鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  if (c.v.ps != undefined && c.v.ps.value === "鍗曚綅") {
-                    if (c.v.v) {
-                      c.v.v = c.v.v.replace(/\s*/g, "");
-                    }
-                    str2 = str + c.v.v;
-                    unit2 = c.v.v;
-                  }
-                }
-              }
-            });
-            if (str != "") {
-              let count2 = 0;
-              for (let i in this.currentSample.insProduct) {
-                let inspectionItemClass =
-                  this.currentSample.insProduct[i].inspectionItemClass ==
-                    null ||
-                    this.currentSample.insProduct[i].inspectionItemClass ==
-                    undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemClass;
-                inspectionItemClass = inspectionItemClass.replace(/\s*/g, "");
-                let inspectionItem =
-                  this.currentSample.insProduct[i].inspectionItem == null ||
-                    this.currentSample.insProduct[i].inspectionItem == undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItem;
-                inspectionItem = inspectionItem.replace(/\s*/g, "");
-                let inspectionItemSubclass =
-                  this.currentSample.insProduct[i].inspectionItemSubclass ==
-                    null ||
-                    this.currentSample.insProduct[i].inspectionItemSubclass ==
-                    undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemSubclass;
-                inspectionItemSubclass = inspectionItemSubclass.replace(
-                  /\s*/g,
-                  ""
-                );
-                if (inspectionItemSubclass === "骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  // 妫�楠屽瓙椤逛负'骞叉�佹媺浼稿己搴�(绾靛悜)'鏃讹紝妯$増閲屾槸涓や釜璁$畻鍊煎搴旂浉鍚岀殑妫�楠屽�煎苟涓旇绠楁柟寮忎笉鍚岋紝瑕佹牴鎹浉鍚岀殑'鍗曚綅'鍋氱壒娈婄殑娓叉煋
-                  const unit = this.currentSample.insProduct[i].unit;
-                  if (
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass +
-                      unit ===
-                      str2) ||
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      !unit2.includes("/") &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass ===
-                      str)
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                } else {
-                  // 濡傛灉鐩哥瓑,閭d箞璇存槑鎵惧埌浜�,骞朵笖鎶奿d瀛樿捣鏉�,鍚庣画妫�楠岄」涔熶細鍦ㄩ〉闈腑鏄剧ず鍑烘潵
-                  if (
-                    this.currentSample.insProduct[i].templateId ===
-                    a.templateId &&
-                    inspectionItemClass +
-                    inspectionItem +
-                    inspectionItemSubclass ===
-                    str
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                }
-                count2++;
-              }
-              if (count2 == this.currentSample.insProduct.length) {
-                console.warn("[妯℃澘琛屾湭鍖归厤] 鍗冲皢闅愯棌璇ヨ", {
-                  sampleId: this.currentSample.id,
-                  templateId: a.templateId,
-                  templateName: a.templateName,
-                  妯℃澘琛屽彿: b.r + 1,
-                  妯℃澘鎷兼帴鍚嶇О: str,
-                  妯℃澘鏍囪鍗曞厓鏍�: a.template
-                    .filter((cell) => cell.r === b.r && cell.v.ps != undefined)
-                    .map((cell) => ({
-                      鍒楀彿: cell.c + 1,
-                      鏍囪: cell.v.ps.value,
-                      鏂囧瓧: cell.v.v,
-                    })),
-                });
-                console.table(this.currentSample.insProduct
-                  .filter((product) => product.templateId === a.templateId)
-                  .map((product) => {
-                    const name = [product.inspectionItemClass, product.inspectionItem,
-                      product.inspectionItemSubclass]
-                      .map((value) => value == null ? "" : value.replace(/\s*/g, ""))
-                      .join("");
-                    return {
-                      妫�楠岄」ID: product.id,
-                      妫�楠岄」鍒嗙被: product.inspectionItemClass,
-                      妫�楠岄」: product.inspectionItem,
-                      妫�楠屽瓙椤�: product.inspectionItemSubclass,
-                      鎺ュ彛鎷兼帴鍚嶇О: name,
-                      妯℃澘鎷兼帴鍚嶇О: str,
-                      鍚嶇О鏄惁涓�鑷�: name === str,
-                    };
-                  }));
-                dels.add(b.r);
-              }
-            }
-          }
-        });
-        // 鎿嶄綔鍒犻櫎
-        dels.forEach((del) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === del) {
-              a.template.splice(b, 1);
-              b -= 1;
-            }
-          }
-        });
-        // 鎿嶄綔璧嬪��--涓昏璧嬪�煎崟浣�,璇曢獙鏂规硶绛変俊鎭�
-        ids.forEach((id) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === id.r) {
-              a.template[b].i = id.id;
-              if (
-                a.template[b].v.ps != undefined &&
-                a.template[b].v.ps.value === "鍗曚綅"
-              ) {
-                a.template[b].v.v = id.product.unit;
-              }
-              if (
-                a.template[b].v.ps != undefined &&
-                (a.template[b].v.ps.value === "璇曢獙鏂规硶" ||
-                  a.template[b].v.ps.value === "妫�娴嬫柟娉�")
-              ) {
-                a.template[b].v.v = id.product.methodS;
-              }
-            }
-          }
         });
         let set2 = new Set();
         // 鍚堝苟鐨勬暟鎹鐞�,cs  rs  浠h〃鍚堝苟鐨勬暟閲�
@@ -2243,20 +1886,11 @@
           }
         });
       });
-      // 鏈寰幆涓昏鏄鍚庣浼犲弬杩涜鍒濆鍖�,鏍峰紡閫昏緫淇敼
+      // 鏈寰幆涓昏鍋氭牱寮忛�昏緫澶勭悊,鍙紪杈戝崟鍏冩牸鍒濆鍖�
       this.tableList.forEach((a) => {
         let arrs = [];
         let set = new Set();
         let count1 = 0;
-        let conclusionList = []; //缁撹鍒楄〃
-        let finalList = []; //鏈�缁堝�煎垪琛�
-        // 缁撹涓庢渶缁堝�煎湪杩欓噷涓�涓�瀵瑰簲,浠ヤ笅涓や釜鍒楄〃闀垮害鑲畾鏄竴鏍风殑,濡傛灉鏈変笉涓�鏍�,閭d箞澶氬崐鏄ā鏉块厤缃緱闂
-        conclusionList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "缁撹"
-        ); //缁撹鍒楄〃
-        finalList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "鏈�缁堝��"
-        ); //鏈�缁堝�煎垪琛�
         a.template.forEach((b) => {
           if (
             b.v.ps != undefined &&
@@ -2267,61 +1901,18 @@
             count1++;
             b.v.v = count1;
           }
-          if (b.v.ps != undefined && b.v.ps.value === "瑕佹眰鍊�") {
-            // 瀵硅姹傚�艰繘琛岃祴鍊�
-            b.v.v = this.getAsk(b.i);
-          }
-          // 瀵归〉闈㈢殑鍜岀粰鍚庣浼犲弬鐨勬楠屽��,璁$畻鍊�,璁惧缂栫爜,璁惧鍚嶇О,鏈�缁堝��,缁撹杩涜鍒濆鍖�
+          // 鍒濆鍖栧彲濉啓/鍙绠楀崟鍏冩牸,鍚庣画鎸夊潗鏍囧洖鏄�
           if (
             b.v.ps != undefined &&
             typeof b.v.ps.value === "string" &&
-            b.v.ps.value.includes("妫�楠屽��")
+            (b.v.ps.value.includes("妫�楠屽��") ||
+              b.v.ps.value === "璁$畻鍊�" ||
+              b.v.ps.value === "鏈�缁堝��" ||
+              b.v.ps.value === "璁惧鍚嶇О")
           ) {
             this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.u = "";
-            b.i && this.param[b.i] && this.param[b.i].insValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁$畻鍊�") {
-            this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].comValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧缂栫爜") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            b.i && this.param[b.i] && this.param[b.i].equipValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧鍚嶇О") {
-            this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].equipName.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "鏈�缁堝��") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].resValue
-            ) {
-              this.param[b.i].resValue = b;
-            }
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "缁撹") {
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].insResult
-            ) {
-              this.param[b.i].insResult = b;
-              conclusionList.forEach((n, i) => {
-                if (n.r == b.r && n.c == b.c) {
-                  b.v.f = `(${this.comparisonList.find((j) => j.value == finalList[i].c)
-                    .label
-                    }${finalList[i].r + 1})`;
-                }
-              });
+            if (b.v.ps.value.includes("妫�楠屽��")) {
+              b.u = "";
             }
           }
           set.add(b.r);
@@ -2349,112 +1940,56 @@
             a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i];
         }
       });
-      // 鏈寰幆涓昏鏄椤甸潰鍙婂悗绔紶鍙傝繘琛屽垵濮嬪寲璧嬪��
-      this.currentSample.insProduct.forEach(async (a) => {
-        // 灏氭棤妫�楠岀粨鏋滄椂锛屼繚鐣欏墠闈㈠垵濮嬪寲鐨勭┖鍊笺��
-        const savedResult = a.insProductResult || {};
-        try {
-          // 璁$畻鍊艰祴鍊�
-          let comValue = JSON.parse(savedResult.comValue || "[]");
-          for (var i = 0; i < comValue.length; i++) {
-            if (
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              )
-            ) {
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              ).v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue.find(
-                  (m) => m.c == comValue[i].c && m.r == comValue[i].r
-                ).v.ct
-              );
-            } else if (!comValue[i].c || !comValue[i].r) {
-              this.param[a.id].comValue[i].v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue[i].v.ct
-              );
-            }
-          }
-        } catch (e) { }
-        try {
-          // 妫�楠屽�艰祴鍊�
-          let insValue = JSON.parse(savedResult.insValue || "[]");
-          for (let i = 0; i < insValue.length; i++) {
-            if (
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              )
-            ) {
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).v.v = this.toFixed(
-                insValue[i].v,
-                this.param[a.id].insValue.find(
-                  (m) => m.c == insValue[i].c && m.r == insValue[i].r
-                ).v.ct
-              );
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).u = insValue[i].u;
-              // this.param[a.id].insValue[i].v.v = insValue[i].v
-              // this.param[a.id].insValue[i].u = insValue[i].u
-            }
-          }
-        } catch (e) { }
-        try {
-          // 璁惧缂栧彿璧嬪��
-          let equipValue = JSON.parse(savedResult.equipValue || "[]");
-          for (let i = 0; i < equipValue.length; i++) {
-            // 鏅�氳澶囪祴鍊�
-            this.param[a.id].equipValue[i].v.v = equipValue[i].v;
-          }
-        } catch (e) { }
-        try {
-          // 璁惧鍚嶇О璧嬪��
-          let equipName = JSON.parse(savedResult.equipName || "[]");
-          for (let i = 0; i < equipName.length; i++) {
-            equipName[i].v !== "" &&
-              equipName[i].v.map((val) => {
-                const index = this.equipOptions.findIndex(
-                  (item) => item.value === val
-                );
-                if (index > -1) {
-                  // 鏍规嵁璁惧缂栫爜杞崲涓虹浉搴旂殑璁惧鍚嶇О
-                  val = this.equipOptions[index].deviceName;
-                }
-              });
-          }
-          for (let i = 0; i < equipName.length; i++) {
-            // 鏅�氳澶囧悕绉拌祴鍊�
-            this.param[a.id].equipName[i].v.v = equipName[i].v;
-          }
-        } catch (e) {
-          console.log("璁惧鍚嶇О璧嬪��----", e);
-        }
-        try {
-          // 鏈�缁堝�艰祴鍊�
-          this.param[a.id].resValue.v.v = this.toFixed(
-            a.lastValue,
-            this.param[a.id].resValue.v.ct
-          );
-          // 缁撹璧嬪��
-          this.param[a.id].insResult.v.v = a.insResult;
-        } catch (e) { }
-      });
+      // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+      this.initParamByCoordinate();
       // 瀵筫xcel鍑芥暟杩涜澶勭悊
       this.handleExcelMethod();
     },
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+    initParamByCoordinate() {
+      this.param = {};
+      this.tableList.forEach((a) => {
+        this.param[a.templateId] = {};
+        const product = this.currentSample.insProduct.find(
+          (m) => m.templateId === a.templateId
+        );
+        let saved =
+          (product && (product.recordValues || product.insProductResult)) || {};
+        if (typeof saved === "string") {
+          try {
+            saved = JSON.parse(saved);
+          } catch (e) {
+            saved = {};
+          }
+        }
+        a.template.forEach((cell) => {
+          const key = `${cell.r}-${cell.c}`;
+          const item = saved[key];
+          if (item === undefined || item === null) {
+            return;
+          }
+          const value = typeof item === "object" ? item.v : item;
+          if (value === undefined || value === null) {
+            return;
+          }
+          cell.v.v = value;
+          if (typeof item === "object" && item.u) {
+            cell.u = item.u;
+          }
+          this.param[a.templateId][key] = {
+            v: value,
+            u: typeof item === "object" ? item.u : cell.u,
+          };
+        });
+      });
+    },
     // 妫�楠屽�艰緭鍏ュ悗瑙﹀彂鐨勫嚱鏁�
-    changeInput(m, code, n, getDataType, changeSelect) {
+    changeInput(m, code, n, getDataType) {
       // 涓烘暟閲囧畾涔変竴涓�昏緫鍙傛暟
       if (getDataType == "getDataType") {
         this.getDataType = 2;
       }
-      let currentInsItemId = null; //褰撳墠妫�楠岄」id
       if (n) {
-        currentInsItemId = JSON.parse(JSON.stringify(n.i));
         // 瀹氫箟涓�涓嚱鏁版潵楠岃瘉鍒嗘暟鏄惁鏈夋晥
         if (typeof n.v.v == "string") {
           function isValidFraction(fraction) {
@@ -2486,8 +2021,8 @@
         );
         // 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
         // 杩欐牱鍗充娇鐢ㄦ埛杈撳叆鍚庣珛鍗冲埛鏂般�佸垏鎹㈡垨杩斿洖锛屾渶鍚庣紪杈戠殑鍗曞厓鏍间篃涓嶄細涓㈠け銆�
-        if (currentInsItemId) {
-          this.saveInsContext(currentInsItemId);
+        if (n) {
+          this.saveInsContext();
         }
       } catch (error) {
         console.log(444, error);
@@ -2501,36 +2036,13 @@
           case "saveInsContext":
             this.$nextTick(() => {
               const resultValue = workerResult.value;
-              // this.$delete(this.tableList[0],'arr')
               this.$set(
                 this.tableList[0],
                 "arr",
                 resultValue.tableList[0].arr
               );
               this.param = resultValue.param;
-              // 鐗规畩澶勭悊涓�涓嬬粨璁�,浼氭湁杩欑鐗规畩鎯呭喌
-              for (var i in this.param) {
-                if (
-                  this.param[i].insResult &&
-                  this.param[i].insResult.v &&
-                  this.param[i].insResult.v.v
-                ) {
-                  if (this.param[i].insResult.v.v == "鍚堟牸") {
-                    this.$set(this.param[i].insResult.v, "v", 1);
-                  } else if (this.param[i].insResult.v.v == "涓嶅悎鏍�") {
-                    this.$set(this.param[i].insResult.v, "v", 0);
-                  }
-                }
-              }
-              const sourceInsItemId =
-                resultValue.sourceInsItemId != null &&
-                  resultValue.sourceInsItemId !== ""
-                  ? resultValue.sourceInsItemId
-                  : currentInsItemId;
-              this.saveInsContext([
-                sourceInsItemId,
-                resultValue.currentInsItemId,
-              ]);
+              this.saveInsContext();
             });
             break;
           case "tableList":
@@ -2538,117 +2050,10 @@
               // 鏇存柊鏁版嵁
               this.$delete(this.tableList[0], "arr");
               this.$set(this.tableList[0], "arr", workerResult.value[0].arr);
-              // this.param = this.result.value.param
             });
-            break;
-          case "getCurrentInsProduct":
-            // 鏇存柊椤甸潰鏁版嵁
-            this.getCurrentInsProduct(workerResult.value);
             break;
         }
       };
-      // 淇濆瓨鏁版嵁
-      setTimeout(() => {
-        if (changeSelect) {
-          this.saveInsContext(currentInsItemId);
-        }
-      }, 200);
-    },
-    // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁   param => this.tableList[0].insProductResult
-    getCurrentInsProduct(pId) {
-      if (!this.tableList[0].insProductResult) {
-        this.tableList[0].insProductResult = {};
-      }
-      for (let m in this.param[pId]) {
-        let value = this.param[pId][m];
-        switch (m) {
-          case "comValue":
-            // 璧嬪�艰绠楀��
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(555, error);
-              }
-            }
-            break;
-          // 璧嬪�兼楠屽��
-          case "insValue":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                  u: a.u,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(666, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囩紪鍙�
-          case "equipValue":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(777, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囧悕绉�
-          case "equipName":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(888, error);
-              }
-            }
-            break;
-          // 璧嬪�兼渶缁堝��
-          case "resValue":
-            this.tableList[0].lastValue = value ? value.v.v : "";
-            break;
-          // 璧嬪�肩粨璁�
-          case "insResult":
-            this.tableList[0].insResult = value ? value.v.v : "";
-            break;
-        }
-      }
     },
     // 瀵笶XCEL鍑芥暟杩涜澶勭悊
     handleExcelMethod() {
@@ -2692,14 +2097,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鎻忚堪
-    getTell(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].tell;
-        }
-      }
-    },
     // 鍔ㄦ�佽幏鍙栧崟鍏冩牸瀹藉害
     handleWidth(n) {
       let sum = 0;
@@ -2740,14 +2137,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鍊�
-    getAsk(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].ask;
-        }
-      }
-    },
     // 鑾峰彇鎵�鏈夎澶�
     getEquipOptions(e, id) {
       if (e) {
@@ -2766,17 +2155,6 @@
           });
       }
     },
-    // getDic(e, id) {
-    //   if (e) {
-    //     for (var a in this.currentSample.insProduct) {
-    //       if (this.currentSample.insProduct[a].id == id) {
-    //         let str = this.currentSample.insProduct[a].dic;
-    //         this.selectEnumByCategoryOfSelect(str);
-    //         return str;
-    //       }
-    //     }
-    //   }
-    // },
     openAddCheck() {
       this.addCheck = true;
     },
@@ -2970,68 +2348,86 @@
         });
       return;
     },
-    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
-    saveInsContext(currentInsItemIds) {
-      try {
-        if (this.param) {
-          const ids = (Array.isArray(currentInsItemIds)
-            ? currentInsItemIds
-            : [currentInsItemIds]
-          )
-            .filter((id) => id != null && id !== "")
-            .map((id) => String(id));
-          let param = this.param;
-          if (ids.length > 0) {
-            param = {};
-            [...new Set(ids)].forEach((id) => {
-              if (this.param[id]) {
-                param[id] = this.param[id];
-              }
-            });
-            if (Object.keys(param).length === 0) {
-              return;
-            }
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濅粠褰撳墠妯℃澘蹇収鍑哄緟淇濆瓨鍙傛暟
+    buildParam() {
+      const param = {};
+      this.tableList.forEach((a) => {
+        param[a.templateId] = {};
+        a.template.forEach((cell) => {
+          const isEditable =
+            cell.v.ps != undefined &&
+            typeof cell.v.ps.value === "string" &&
+            (cell.v.ps.value.includes("妫�楠屽��") ||
+              cell.v.ps.value === "璁$畻鍊�" ||
+              cell.v.ps.value === "鏈�缁堝��" ||
+              cell.v.ps.value === "璁惧鍚嶇О");
+          if (!isEditable) {
+            return;
           }
-          let isNoTestValue = ''
-          for (let key in param) {
-            if (param[key]) {
-              if (param[key].insValue?.length === 0) {
-                isNoTestValue = 1
-              } else {
-                isNoTestValue = ''
-              }
-            }
+          if (
+            cell.v.ps.value.includes("妫�楠屽��") &&
+            (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+          ) {
+            return;
           }
-          const payload = {
-            param: JSON.stringify(param),
-            currentTable: this.currentTable,
-            sampleId: this.currentSample.id,
-            orderId: this.orderId,
-            sonLaboratory: this.sonLaboratory,
-            isNoTestValue: isNoTestValue
+          param[a.templateId][`${cell.r}-${cell.c}`] = {
+            v: cell.v.v,
+            u: cell.u,
           };
-          const previousSave = this.saveQueue || Promise.resolve();
-          this.saveQueue = previousSave
-            .catch(() => undefined)
-            .then(() => saveInsContext(payload))
-            .then(() => {
-              this.$message.success("宸蹭繚瀛�");
-            })
-            .catch((error) => {
-              console.error("妫�楠屾暟鎹繚瀛樺け璐�", error);
-              this.$message.error("妫�楠屾暟鎹繚瀛樺け璐ワ紝璇烽噸璇�");
-            });
-          // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
-          this.worker.postMessage(
-            JSON.stringify({
-              modelType: this.sampleProduct[0].model,
-              type: "saveData",
-              tableList: this.tableList,
-              param: this.param,
-              currentTable: this.currentTable,
-            })
-          );
+        });
+      });
+      return param;
+    },
+    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
+    saveInsContext() {
+      try {
+        if (!this.param) {
+          return;
         }
+        const param = this.buildParam();
+        this.param = param;
+        let isNoTestValue = "";
+        this.tableList.forEach((a) => {
+          a.template.forEach((cell) => {
+            if (
+              cell.v.ps != undefined &&
+              typeof cell.v.ps.value === "string" &&
+              cell.v.ps.value.includes("妫�楠屽��") &&
+              (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+            ) {
+              isNoTestValue = 1;
+            }
+          });
+        });
+        const payload = {
+          param: JSON.stringify(param),
+          currentTable: this.currentTable,
+          sampleId: this.currentSample.id,
+          orderId: this.orderId,
+          sonLaboratory: this.sonLaboratory,
+          isNoTestValue: isNoTestValue
+        };
+        const previousSave = this.saveQueue || Promise.resolve();
+        this.saveQueue = previousSave
+          .catch(() => undefined)
+          .then(() => saveInsContext(payload))
+          .then(() => {
+            this.$message.success("宸蹭繚瀛�");
+          })
+          .catch((error) => {
+            console.error("妫�楠屾暟鎹繚瀛樺け璐�", error);
+            this.$message.error("妫�楠屾暟鎹繚瀛樺け璐ワ紝璇烽噸璇�");
+          });
+        // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+        this.worker.postMessage(
+          JSON.stringify({
+            modelType: this.sampleProduct[0].model,
+            type: "saveData",
+            tableList: this.tableList,
+            param: this.param,
+            currentTable: this.currentTable,
+          })
+        );
       } catch (error) {
         console.log(999, error);
       }
@@ -3043,21 +2439,9 @@
     },
     // 璁惧鏀瑰彉
     changeEquip(val, n) {
-      const itemParam = this.param[n.i];
-      if (!itemParam) {
-        this.$message.error("璁惧鏈叧鑱旀楠岄」锛岃鍒锋柊椤甸潰鍚庨噸璇�");
-        return;
-      }
       const selectedDevices = Array.isArray(val) ? [...val] : [];
       const deviceCodes = selectedDevices.join("锛�");
       this.$set(n.v, "v", selectedDevices);
-      // 鍚嶇О涓庣紪鐮佸崟鍏冩牸鍙兘鏁伴噺涓嶅悓锛屽垎鍒洿鏂帮紝閬垮厤涓嬫爣瓒婄晫涓柇淇濆瓨銆�
-      (itemParam.equipName || []).forEach((cell) => {
-        this.$set(cell.v, "v", [...selectedDevices]);
-      });
-      (itemParam.equipValue || []).forEach((cell) => {
-        this.$set(cell.v, "v", deviceCodes);
-      });
       this.tableList.forEach((table) => {
         (table.arr || []).forEach((row) => {
           row.forEach((cell) => {
@@ -3071,8 +2455,8 @@
           });
         });
       });
-      // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樺綋鍓嶆楠岄」銆�
-      this.saveInsContext(n.i);
+      // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
+      this.saveInsContext();
     },
     getAuthorizedPerson() {
       selectUserCondition({ type: 1 }).then((res) => {
@@ -3132,16 +2516,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 椤甸潰鏁版嵁澶勭悊
       this.getTableLists();
       // 鏇存柊鍒板绾跨▼
diff --git a/src/views/business/inspectionView/index.vue b/src/views/business/inspectionView/index.vue
index 70374e3..f086612 100644
--- a/src/views/business/inspectionView/index.vue
+++ b/src/views/business/inspectionView/index.vue
@@ -173,7 +173,7 @@
                       n.v.ps.value.includes('妫�楠屽��') &&
                       state == 1
                     ">
-                    <el-input v-if="getInspectionValueType(n.i) == 1"
+                    <el-input v-if="getInspectionValueType(n.i) == 1 || (getInspectionValueType(n.i) != 2 && getInspectionValueType(n.i) != 4)"
                               :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v" :disabled="(getInspectionItemType(n.i) == 1 &&
                           !dataAcquisitionEidtAble) ||
                           (n.u != userId && n.u != undefined && n.u != '')
@@ -203,63 +203,8 @@
                             'getDataType'
                           )
                           " />
-                    <!-- <el-select v-else-if="getInspectionValueType(n.i) == 5" v-model="n.v.v" :disabled="state > 1 ||
-                    getInspectionItemType(n.i) == 1 ||
-                    (n.u != userId && n.u != undefined && n.u != '')
-                    " class="table_input" @change="(m) =>
-                      changeInput(
-                        m,
-                        `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                        n,
-                        'getDataType'
-                      )
-                      " @visible-change="(e) => getDic(e, n.i)">
-                    <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option>
-                  </el-select> -->
                     <span v-else-if="getInspectionValueType(n.i) == 4"
                           :style="`font-family:${n.v.ff} !important;`">/</span>
-                  </template>
-                  <template v-else-if="n.v.ps != undefined && n.v.ps.value === '缁撹'">
-                    <el-select v-if="
-                        (getInspectionValueType(n.i) == 2 ||
-                          getInspectionValueType(n.i) == 5) &&
-                        state == 1
-                      " v-model="n.v.v" class="table_input" @change="(m) =>
-                        changeInput(
-                          m,
-                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                          n,
-                          'getDataType',
-                          'changeSelect'
-                        )
-                        ">
-                      <el-option :value="1" label="鍚堟牸"></el-option>
-                      <el-option :value="0" label="涓嶅悎鏍�"></el-option>
-                      <el-option :value="3" label="涓嶅垽瀹�"></el-option>
-                      <el-option :value="2" label="寰呭畾"></el-option>
-                    </el-select>
-                    <template v-if="state > 1">
-                      <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                      <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                      <span v-else-if="n.v.v === 3"
-                            :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                      <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                    </template>
-                    <template v-if="getInspectionValueType(n.i) != 2 &&
-                        state == 1">
-                      <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                      <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                      <span v-else-if="n.v.v === 3"
-                            :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                      <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                    </template>
-                  </template>
-                  <template v-else-if="
-                      n.v.ps != undefined &&
-                      n.v.ps.value === '璁惧缂栫爜' &&
-                      state == 1
-                    ">
-                    <span>{{ n.v.v }}</span>
                   </template>
                   <template v-else-if="
                       n.v.ps != undefined && n.v.ps.value === '璁惧鍚嶇О'
@@ -272,15 +217,6 @@
                         {{ item.label + "--" + item.value }}
                       </el-option>
                     </el-select>
-                  </template>
-                  <template v-else-if="
-                      n.v.ps != undefined &&
-                      n.v.ps.value === '瑕佹眰鍊�' &&
-                      state == 1
-                    ">
-                      <span :style="`font-family:${n.v.ff} !important;`">{{
-                          getTell(n.i)
-                        }}</span>
                   </template>
                   <template v-else-if="
                       n.v.ps != undefined &&
@@ -609,6 +545,7 @@
       loading: false,
       ps: {},
       param: {},
+      saveQueue: null,
       currentKey: 1,
       currentKey0: 1,
       currentKey1: 1,
@@ -835,16 +772,6 @@
             let list = await this.getCurrentProduct(this.currentSample.id, 0);
             this.currentSample.insProduct = this.HaveJson(list); //璧嬪�煎綋鍓嶆牱鍝佺殑妫�楠岄」
             this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟
-            this.currentSample.insProduct.forEach((a, j) => {
-              this.param[a.id] = {
-                insValue: [],
-                comValue: [],
-                resValue: null,
-                equipValue: [],
-                equipName: [],
-                insResult: null,
-              };
-            });
             // 鍘婚噸妯℃澘锛岃繑鍥炴湁鍑犱釜妯℃澘
             const mySet1 = new Set();
             this.tableLists = this.currentSample.insProduct.filter((m) => {
@@ -989,16 +916,6 @@
         // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�
         this.param = {};
         this.changeType = 0;
-        this.currentSample.insProduct.forEach((a) => {
-          this.param[a.id] = {
-            insValue: [],
-            comValue: [],
-            resValue: null,
-            equipValue: [],
-            equipName: [],
-            insResult: null,
-          };
-        });
         if (this.currentSample.index == undefined)
           this.currentSample["index"] = 1;
         let bushing = this.currentSample.bushing;
@@ -1556,16 +1473,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 澶勭悊椤甸潰鍒楄〃鏁版嵁
       this.getTableLists();
       this.currentKey = row.index;
@@ -1601,16 +1508,6 @@
         let list = await this.getCurrentProduct(m, type, cableTag);
         if (list && list.length > 0) {
           this.param = {};
-          list.forEach((a) => {
-            this.param[a.id] = {
-              insValue: [],
-              comValue: [],
-              resValue: null,
-              equipValue: [],
-              equipName: [],
-              insResult: null,
-            };
-          });
           this.getTableLists0(list);
           this.worker.postMessage(
             JSON.stringify({
@@ -1754,224 +1651,18 @@
           count++;
         });
       });
-      // 鏈寰幆涓昏鏄帶鍒跺悎骞�,浠ュ強鎺у埗妫�楠岄」淇℃伅鏄惁灞曠ず鍑烘潵,浠ヤ究鍚庣画妫�楠�
+      // 鎸夊悗绔笅鍙戠殑鈥滄ā鏉縄D + 妯℃澘琛屽彿鈥濈洿鎺ョ粦瀹氭楠岄」锛屼笉鍋氬悕绉版瘮瀵癸紝涓嶉殣钘忎换浣曡
       this.tableList.forEach((a) => {
-        // 鏂拌仛璁㈠崟鐩存帴鎸夆�滄ā鏉縄D + 妯℃澘琛屽彿鈥濈粦瀹氭楠岃褰曪紝涓嶅啀鍖归厤鍒嗙被鍜屾楠屽瓙椤广��
         const directProducts = this.currentSample.insProduct.filter(
           (product) => product.templateId === a.templateId &&
             product.templateRowIndex !== null && product.templateRowIndex !== undefined
         );
-        if (directProducts.length > 0) {
-          directProducts.forEach((product) => {
-            a.template.forEach((cell) => {
-              if (cell.r === product.templateRowIndex) {
-                cell.i = product.id;
-              }
-            });
+        directProducts.forEach((product) => {
+          a.template.forEach((cell) => {
+            if (cell.r === product.templateRowIndex) {
+              cell.i = product.id;
+            }
           });
-          return;
-        }
-        let dels = new Set(); //闇�瑕佸垹闄ょ殑琛�
-        let ids = []; //鎵�鏈夋楠岄」鐨刬d
-        let set3 = new Set();
-        a.template.forEach((b) => {
-          let size1 = set3.size;
-          let size2 = set3.add(b.r).size;
-          if (size1 < size2) {
-            let str = "";
-            let str2 = "";
-            let unit2 = "";
-            let count4 = 0;
-            let isThree = 0;
-            a.template.forEach((c) => {
-              // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉�
-              if (b.r === c.r) {
-                if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」鍒嗙被" &&
-                  count4 === 0
-                ) {
-                  // 涓夌骇鍒嗙被
-                  isThree = 1;
-                } else if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」" &&
-                  count4 === 0
-                ) {
-                  // 浜岀骇鍒嗙被
-                  isThree = 0;
-                }
-                if (isThree == 0) {
-                  if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") {
-                    if (count4 === 0) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (
-                    c.v.ps != undefined &&
-                    c.v.ps.value === "妫�楠屽瓙椤�"
-                  ) {
-                    if (count4 === 1) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                } else if (isThree == 1) {
-                  if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」鍒嗙被") {
-                    if (count4 === 0) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") {
-                    if (count4 === 1) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (
-                    c.v.ps != undefined &&
-                    c.v.ps.value === "妫�楠屽瓙椤�"
-                  ) {
-                    if (count4 === 2) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                }
-                if (str === "鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  if (c.v.ps != undefined && c.v.ps.value === "鍗曚綅") {
-                    if (c.v.v) {
-                      c.v.v = c.v.v.replace(/\s*/g, "");
-                    }
-                    str2 = str + c.v.v;
-                    unit2 = c.v.v;
-                  }
-                }
-              }
-            });
-            if (str != "") {
-              let count2 = 0;
-              for (let i in this.currentSample.insProduct) {
-                let inspectionItemClass =
-                  this.currentSample.insProduct[i].inspectionItemClass ==
-                  null ||
-                  this.currentSample.insProduct[i].inspectionItemClass ==
-                  undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemClass;
-                inspectionItemClass = inspectionItemClass.replace(/\s*/g, "");
-                let inspectionItem =
-                  this.currentSample.insProduct[i].inspectionItem == null ||
-                  this.currentSample.insProduct[i].inspectionItem == undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItem;
-                inspectionItem = inspectionItem.replace(/\s*/g, "");
-                let inspectionItemSubclass =
-                  this.currentSample.insProduct[i].inspectionItemSubclass ==
-                  null ||
-                  this.currentSample.insProduct[i].inspectionItemSubclass ==
-                  undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemSubclass;
-                inspectionItemSubclass = inspectionItemSubclass.replace(
-                  /\s*/g,
-                  ""
-                );
-                if (inspectionItemSubclass === "骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  // 妫�楠屽瓙椤逛负'骞叉�佹媺浼稿己搴�(绾靛悜)'鏃讹紝妯$増閲屾槸涓や釜璁$畻鍊煎搴旂浉鍚岀殑妫�楠屽�煎苟涓旇绠楁柟寮忎笉鍚岋紝瑕佹牴鎹浉鍚岀殑'鍗曚綅'鍋氱壒娈婄殑娓叉煋
-                  const unit = this.currentSample.insProduct[i].unit;
-                  if (
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass +
-                      unit ===
-                      str2) ||
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      !unit2.includes("/") &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass ===
-                      str)
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                } else {
-                  // 濡傛灉鐩哥瓑,閭d箞璇存槑鎵惧埌浜�,骞朵笖鎶奿d瀛樿捣鏉�,鍚庣画妫�楠岄」涔熶細鍦ㄩ〉闈腑鏄剧ず鍑烘潵
-                  if (
-                    this.currentSample.insProduct[i].templateId ===
-                    a.templateId &&
-                    inspectionItemClass +
-                    inspectionItem +
-                    inspectionItemSubclass ===
-                    str
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                }
-                count2++;
-              }
-              if (count2 == this.currentSample.insProduct.length) {
-                dels.add(b.r);
-              }
-            }
-          }
-        });
-        // 鎿嶄綔鍒犻櫎
-        dels.forEach((del) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === del) {
-              a.template.splice(b, 1);
-              b -= 1;
-            }
-          }
-        });
-        // 鎿嶄綔璧嬪��--涓昏璧嬪�煎崟浣�,璇曢獙鏂规硶绛変俊鎭�
-        ids.forEach((id) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === id.r) {
-              a.template[b].i = id.id;
-              if (
-                a.template[b].v.ps != undefined &&
-                a.template[b].v.ps.value === "鍗曚綅"
-              ) {
-                a.template[b].v.v = id.product.unit;
-              }
-              if (
-                a.template[b].v.ps != undefined &&
-                (a.template[b].v.ps.value === "璇曢獙鏂规硶" ||
-                  a.template[b].v.ps.value === "妫�娴嬫柟娉�")
-              ) {
-                a.template[b].v.v = id.product.methodS;
-              }
-            }
-          }
         });
         let set2 = new Set();
         // 鍚堝苟鐨勬暟鎹鐞�,cs  rs  浠h〃鍚堝苟鐨勬暟閲�
@@ -1999,15 +1690,6 @@
         let arrs = [];
         let set = new Set();
         let count1 = 0;
-        let conclusionList = []; //缁撹鍒楄〃
-        let finalList = []; //鏈�缁堝�煎垪琛�
-        // 缁撹涓庢渶缁堝�煎湪杩欓噷涓�涓�瀵瑰簲,浠ヤ笅涓や釜鍒楄〃闀垮害鑲畾鏄竴鏍风殑,濡傛灉鏈変笉涓�鏍�,閭d箞澶氬崐鏄ā鏉块厤缃緱闂
-        conclusionList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "缁撹"
-        ); //缁撹鍒楄〃
-        finalList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "鏈�缁堝��"
-        ); //鏈�缁堝�煎垪琛�
         a.template.forEach((b) => {
           if (
             b.v.ps != undefined &&
@@ -2018,61 +1700,18 @@
             count1++;
             b.v.v = count1;
           }
-          if (b.v.ps != undefined && b.v.ps.value === "瑕佹眰鍊�") {
-            // 瀵硅姹傚�艰繘琛岃祴鍊�
-            b.v.v = this.getAsk(b.i);
-          }
-          // 瀵归〉闈㈢殑鍜岀粰鍚庣浼犲弬鐨勬楠屽��,璁$畻鍊�,璁惧缂栫爜,璁惧鍚嶇О,鏈�缁堝��,缁撹杩涜鍒濆鍖�
+          // 鍒濆鍖栧彲濉啓/鍙绠楀崟鍏冩牸,鍚庣画鎸夊潗鏍囧洖鏄�
           if (
             b.v.ps != undefined &&
             typeof b.v.ps.value === "string" &&
-            b.v.ps.value.includes("妫�楠屽��")
+            (b.v.ps.value.includes("妫�楠屽��") ||
+              b.v.ps.value === "璁$畻鍊�" ||
+              b.v.ps.value === "鏈�缁堝��" ||
+              b.v.ps.value === "璁惧鍚嶇О")
           ) {
             this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.u = "";
-            b.i && this.param[b.i] && this.param[b.i].insValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁$畻鍊�") {
-            this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].comValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧缂栫爜") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            b.i && this.param[b.i] && this.param[b.i].equipValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧鍚嶇О") {
-            this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].equipName.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "鏈�缁堝��") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].resValue
-            ) {
-              this.param[b.i].resValue = b;
-            }
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "缁撹") {
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].insResult
-            ) {
-              this.param[b.i].insResult = b;
-              conclusionList.forEach((n, i) => {
-                if (n.r == b.r && n.c == b.c) {
-                  b.v.f = `(${this.comparisonList.find((j) => j.value == finalList[i].c)
-                    .label
-                  }${finalList[i].r + 1})`;
-                }
-              });
+            if (b.v.ps.value.includes("妫�楠屽��")) {
+              b.u = "";
             }
           }
           set.add(b.r);
@@ -2100,110 +1739,56 @@
             a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i];
         }
       });
-      // 鏈寰幆涓昏鏄椤甸潰鍙婂悗绔紶鍙傝繘琛屽垵濮嬪寲璧嬪��
-      this.currentSample.insProduct.forEach(async (a) => {
-        try {
-          // 璁$畻鍊艰祴鍊�
-          let comValue = JSON.parse(a.insProductResult.comValue);
-          for (var i = 0; i < comValue.length; i++) {
-            if (
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              )
-            ) {
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              ).v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue.find(
-                  (m) => m.c == comValue[i].c && m.r == comValue[i].r
-                ).v.ct
-              );
-            } else if (!comValue[i].c || !comValue[i].r) {
-              this.param[a.id].comValue[i].v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue[i].v.ct
-              );
-            }
-          }
-        } catch (e) { }
-        try {
-          // 妫�楠屽�艰祴鍊�
-          let insValue = JSON.parse(a.insProductResult.insValue);
-          for (let i = 0; i < insValue.length; i++) {
-            if (
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              )
-            ) {
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).v.v = this.toFixed(
-                insValue[i].v,
-                this.param[a.id].insValue.find(
-                  (m) => m.c == insValue[i].c && m.r == insValue[i].r
-                ).v.ct
-              );
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).u = insValue[i].u;
-              // this.param[a.id].insValue[i].v.v = insValue[i].v
-              // this.param[a.id].insValue[i].u = insValue[i].u
-            }
-          }
-        } catch (e) { }
-        try {
-          // 璁惧缂栧彿璧嬪��
-          let equipValue = JSON.parse(a.insProductResult.equipValue);
-          for (let i = 0; i < equipValue.length; i++) {
-            // 鏅�氳澶囪祴鍊�
-            this.param[a.id].equipValue[i].v.v = equipValue[i].v;
-          }
-        } catch (e) { }
-        try {
-          // 璁惧鍚嶇О璧嬪��
-          let equipName = JSON.parse(a.insProductResult.equipName);
-          for (let i = 0; i < equipName.length; i++) {
-            equipName[i].v !== "" &&
-            equipName[i].v.map((val) => {
-              const index = this.equipOptions.findIndex(
-                (item) => item.value === val
-              );
-              if (index > -1) {
-                // 鏍规嵁璁惧缂栫爜杞崲涓虹浉搴旂殑璁惧鍚嶇О
-                val = this.equipOptions[index].deviceName;
-              }
-            });
-          }
-          for (let i = 0; i < equipName.length; i++) {
-            // 鏅�氳澶囧悕绉拌祴鍊�
-            this.param[a.id].equipName[i].v.v = equipName[i].v;
-          }
-        } catch (e) {
-          console.log("璁惧鍚嶇О璧嬪��----", e);
-        }
-        try {
-          // 鏈�缁堝�艰祴鍊�
-          this.param[a.id].resValue.v.v = this.toFixed(
-            a.lastValue,
-            this.param[a.id].resValue.v.ct
-          );
-          // 缁撹璧嬪��
-          this.param[a.id].insResult.v.v = a.insResult;
-        } catch (e) { }
-      });
+      // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+      this.initParamByCoordinate();
       // 瀵筫xcel鍑芥暟杩涜澶勭悊
       this.handleExcelMethod();
     },
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+    initParamByCoordinate() {
+      this.param = {};
+      this.tableList.forEach((a) => {
+        this.param[a.templateId] = {};
+        const product = this.currentSample.insProduct.find(
+          (m) => m.templateId === a.templateId
+        );
+        let saved =
+          (product && (product.recordValues || product.insProductResult)) || {};
+        if (typeof saved === "string") {
+          try {
+            saved = JSON.parse(saved);
+          } catch (e) {
+            saved = {};
+          }
+        }
+        a.template.forEach((cell) => {
+          const key = `${cell.r}-${cell.c}`;
+          const item = saved[key];
+          if (item === undefined || item === null) {
+            return;
+          }
+          const value = typeof item === "object" ? item.v : item;
+          if (value === undefined || value === null) {
+            return;
+          }
+          cell.v.v = value;
+          if (typeof item === "object" && item.u) {
+            cell.u = item.u;
+          }
+          this.param[a.templateId][key] = {
+            v: value,
+            u: typeof item === "object" ? item.u : cell.u,
+          };
+        });
+      });
+    },
     // 妫�楠屽�艰緭鍏ュ悗瑙﹀彂鐨勫嚱鏁�
-    changeInput(m, code, n, getDataType, changeSelect) {
+    changeInput(m, code, n, getDataType) {
       // 涓烘暟閲囧畾涔変竴涓�昏緫鍙傛暟
       if (getDataType == "getDataType") {
         this.getDataType = 2;
       }
-      let currentInsItemId = null; //褰撳墠妫�楠岄」id
       if (n) {
-        currentInsItemId = JSON.parse(JSON.stringify(n.i));
         // 瀹氫箟涓�涓嚱鏁版潵楠岃瘉鍒嗘暟鏄惁鏈夋晥
         if (typeof n.v.v == "string") {
           function isValidFraction(fraction) {
@@ -2233,6 +1818,11 @@
             currentInsItem: n,
           })
         );
+        // 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
+        // 杩欐牱鍗充娇鐢ㄦ埛杈撳叆鍚庣珛鍗冲埛鏂般�佸垏鎹㈡垨杩斿洖锛屾渶鍚庣紪杈戠殑鍗曞厓鏍间篃涓嶄細涓㈠け銆�
+        if (n) {
+          this.saveInsContext();
+        }
       } catch (error) {
         console.log(444, error);
       }
@@ -2245,36 +1835,13 @@
           case "saveInsContext":
             this.$nextTick(() => {
               const resultValue = workerResult.value;
-              // this.$delete(this.tableList[0],'arr')
               this.$set(
                 this.tableList[0],
                 "arr",
                 resultValue.tableList[0].arr
               );
               this.param = resultValue.param;
-              // 鐗规畩澶勭悊涓�涓嬬粨璁�,浼氭湁杩欑鐗规畩鎯呭喌
-              for (var i in this.param) {
-                if (
-                  this.param[i].insResult &&
-                  this.param[i].insResult.v &&
-                  this.param[i].insResult.v.v
-                ) {
-                  if (this.param[i].insResult.v.v == "鍚堟牸") {
-                    this.$set(this.param[i].insResult.v, "v", 1);
-                  } else if (this.param[i].insResult.v.v == "涓嶅悎鏍�") {
-                    this.$set(this.param[i].insResult.v, "v", 0);
-                  }
-                }
-              }
-              const sourceInsItemId =
-                resultValue.sourceInsItemId != null &&
-                  resultValue.sourceInsItemId !== ""
-                  ? resultValue.sourceInsItemId
-                  : currentInsItemId;
-              this.saveInsContext([
-                sourceInsItemId,
-                resultValue.currentInsItemId,
-              ]);
+              this.saveInsContext();
             });
             break;
           case "tableList":
@@ -2282,117 +1849,10 @@
               // 鏇存柊鏁版嵁
               this.$delete(this.tableList[0], "arr");
               this.$set(this.tableList[0], "arr", workerResult.value[0].arr);
-              // this.param = this.result.value.param
             });
-            break;
-          case "getCurrentInsProduct":
-            // 鏇存柊椤甸潰鏁版嵁
-            this.getCurrentInsProduct(workerResult.value);
             break;
         }
       };
-      // 淇濆瓨鏁版嵁
-      setTimeout(() => {
-        if (changeSelect) {
-          this.saveInsContext(currentInsItemId);
-        }
-      }, 200);
-    },
-    // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁   param => this.tableList[0].insProductResult
-    getCurrentInsProduct(pId) {
-      if (!this.tableList[0].insProductResult) {
-        this.tableList[0].insProductResult = {};
-      }
-      for (let m in this.param[pId]) {
-        let value = this.param[pId][m];
-        switch (m) {
-          case "comValue":
-            // 璧嬪�艰绠楀��
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(555, error);
-              }
-            }
-            break;
-          // 璧嬪�兼楠屽��
-          case "insValue":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                  u: a.u,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(666, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囩紪鍙�
-          case "equipValue":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(777, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囧悕绉�
-          case "equipName":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(888, error);
-              }
-            }
-            break;
-          // 璧嬪�兼渶缁堝��
-          case "resValue":
-            this.tableList[0].lastValue = value ? value.v.v : "";
-            break;
-          // 璧嬪�肩粨璁�
-          case "insResult":
-            this.tableList[0].insResult = value ? value.v.v : "";
-            break;
-        }
-      }
     },
     // 瀵笶XCEL鍑芥暟杩涜澶勭悊
     handleExcelMethod() {
@@ -2436,14 +1896,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鎻忚堪
-    getTell(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].tell;
-        }
-      }
-    },
     // 鍔ㄦ�佽幏鍙栧崟鍏冩牸瀹藉害
     handleWidth(n) {
       let sum = 0;
@@ -2484,14 +1936,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鍊�
-    getAsk(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].ask;
-        }
-      }
-    },
     // 鑾峰彇鎵�鏈夎澶�
     getEquipOptions(e, id) {
       if (e) {
@@ -2510,17 +1954,6 @@
           });
       }
     },
-    // getDic(e, id) {
-    //   if (e) {
-    //     for (var a in this.currentSample.insProduct) {
-    //       if (this.currentSample.insProduct[a].id == id) {
-    //         let str = this.currentSample.insProduct[a].dic;
-    //         this.selectEnumByCategoryOfSelect(str);
-    //         return str;
-    //       }
-    //     }
-    //   }
-    // },
     openAddCheck() {
       this.addCheck = true;
     },
@@ -2692,100 +2125,110 @@
         });
       return;
     },
-    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
-    saveInsContext(currentInsItemIds) {
-      try {
-        if (this.param) {
-          const ids = (Array.isArray(currentInsItemIds)
-            ? currentInsItemIds
-            : [currentInsItemIds]
-          )
-            .filter((id) => id != null && id !== "")
-            .map((id) => String(id));
-          let param = this.param;
-          if (ids.length > 0) {
-            param = {};
-            [...new Set(ids)].forEach((id) => {
-              if (this.param[id]) {
-                param[id] = this.param[id];
-              }
-            });
-            if (Object.keys(param).length === 0) {
-              return;
-            }
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濅粠褰撳墠妯℃澘蹇収鍑哄緟淇濆瓨鍙傛暟
+    buildParam() {
+      const param = {};
+      this.tableList.forEach((a) => {
+        param[a.templateId] = {};
+        a.template.forEach((cell) => {
+          const isEditable =
+            cell.v.ps != undefined &&
+            typeof cell.v.ps.value === "string" &&
+            (cell.v.ps.value.includes("妫�楠屽��") ||
+              cell.v.ps.value === "璁$畻鍊�" ||
+              cell.v.ps.value === "鏈�缁堝��" ||
+              cell.v.ps.value === "璁惧鍚嶇О");
+          if (!isEditable) {
+            return;
           }
-          saveInsContext({
-            param: JSON.stringify(param),
-            currentTable: this.currentTable,
-            sampleId: this.currentSample.id,
-            orderId: this.orderId,
-            sonLaboratory: this.sonLaboratory
-          }).then((res) => {
-            this.$message.success("宸蹭繚瀛�");
-          });
-          // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
-          this.worker.postMessage(
-            JSON.stringify({
-              modelType: this.sampleProduct[0].model,
-              type: "saveData",
-              tableList: this.tableList,
-              param: this.param,
-              currentTable: this.currentTable,
-            })
-          );
+          if (
+            cell.v.ps.value.includes("妫�楠屽��") &&
+            (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+          ) {
+            return;
+          }
+          param[a.templateId][`${cell.r}-${cell.c}`] = {
+            v: cell.v.v,
+            u: cell.u,
+          };
+        });
+      });
+      return param;
+    },
+    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
+    saveInsContext() {
+      try {
+        if (!this.param) {
+          return;
         }
+        const param = this.buildParam();
+        this.param = param;
+        let isNoTestValue = "";
+        this.tableList.forEach((a) => {
+          a.template.forEach((cell) => {
+            if (
+              cell.v.ps != undefined &&
+              typeof cell.v.ps.value === "string" &&
+              cell.v.ps.value.includes("妫�楠屽��") &&
+              (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+            ) {
+              isNoTestValue = 1;
+            }
+          });
+        });
+        const payload = {
+          param: JSON.stringify(param),
+          currentTable: this.currentTable,
+          sampleId: this.currentSample.id,
+          orderId: this.orderId,
+          sonLaboratory: this.sonLaboratory,
+          isNoTestValue: isNoTestValue
+        };
+        const previousSave = this.saveQueue || Promise.resolve();
+        this.saveQueue = previousSave
+          .catch(() => undefined)
+          .then(() => saveInsContext(payload))
+          .then(() => {
+            this.$message.success("宸蹭繚瀛�");
+          })
+          .catch((error) => {
+            console.error("妫�楠屾暟鎹繚瀛樺け璐�", error);
+            this.$message.error("妫�楠屾暟鎹繚瀛樺け璐ワ紝璇烽噸璇�");
+          });
+        // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+        this.worker.postMessage(
+          JSON.stringify({
+            modelType: this.sampleProduct[0].model,
+            type: "saveData",
+            tableList: this.tableList,
+            param: this.param,
+            currentTable: this.currentTable,
+          })
+        );
       } catch (error) {
         console.log(999, error);
       }
     },
     // 璁惧鏀瑰彉
-    changeEquip(val, n, v) {
-      try {
-        // this.$set(n.v,'v',val)
-        this.tableList[0].arr.forEach((item, index) => {
-          item.forEach((m, i) => {
-            if (this.param[m.i]) {
-              this.param[m.i].state = 1;
+    changeEquip(val, n) {
+      const selectedDevices = Array.isArray(val) ? [...val] : [];
+      const deviceCodes = selectedDevices.join("锛�");
+      this.$set(n.v, "v", selectedDevices);
+      this.tableList.forEach((table) => {
+        (table.arr || []).forEach((row) => {
+          row.forEach((cell) => {
+            if (cell.i == n.i && cell.v.ps) {
+              if (cell.v.ps.value === "璁惧鍚嶇О") {
+                this.$set(cell.v, "v", [...selectedDevices]);
+              } else if (cell.v.ps.value === "璁惧缂栫爜") {
+                this.$set(cell.v, "v", deviceCodes);
+              }
             }
-            // if(m.i==n.i&&m.v.ps&&m.v.ps.value=='璁惧鍚嶇О'&&v){
-            //   this.$set(m.v,'v',v)
-            // }
           });
         });
-        for (let i in this.param) {
-          if (this.param[i].state != 1) {
-            delete this.param[i];
-          }
-        }
-        // this.equipOptions涓鸿澶囧悕绉颁笅鎷夋閫夐」鏁版嵁
-        for (let i1 in this.param[n.i].equipName) {
-          if (
-            this.param[n.i].equipName[i1].i === n.i &&
-            this.param[n.i].equipName[i1].r === n.r
-          ) {
-            this.$delete(this.param[n.i].equipValue[i1].v, "v");
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipValue[i1].v, "v", val.join("锛�"));
-            this.$delete(this.param[n.i].equipName[i1].v, "v");
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipName[i1].v, "v", val);
-            this.tableList[0].arr.forEach((item, index) => {
-              item.forEach((m) => {
-                if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧缂栫爜") {
-                  this.$set(m.v, "v", val.join("锛�"));
-                }
-                if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧鍚嶇О") {
-                  this.$set(m.v, "v", val);
-                }
-              });
-            });
-          }
-        }
-        // 淇濆瓨鏁版嵁
-        this.saveInsContext(n.i);
-      } catch (e) {
-        console.log("changeEquip----", e);
-      }
+      });
+      // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
+      this.saveInsContext();
     },
     getAuthorizedPerson() {
       selectUserCondition({ type: 1 }).then((res) => {
@@ -2845,16 +2288,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 椤甸潰鏁版嵁澶勭悊
       this.getTableLists();
       // 鏇存柊鍒板绾跨▼
diff --git a/src/workers/InspectionWorker.worker.js b/src/workers/InspectionWorker.worker.js
index 5cd696e..a8756a7 100644
--- a/src/workers/InspectionWorker.worker.js
+++ b/src/workers/InspectionWorker.worker.js
@@ -26,6 +26,8 @@
 let param = null;
 // 褰撳墠鐨勬ā鏉�
 let currentTable = "";
+// 褰撳墠妯℃澘鐨勭粨鏋勭鍚�(琛屽垪鍧愭爣+鍗犱綅绗�),鐢ㄤ簬鍒ゆ柇妯℃澘鍐呭鏄惁琚敼杩�
+let currentTemplateSig = "";
 // 浼樺寲鏁伴噰杈冨鏁版嵁鏃�-璁板綍鏈�鍚庝竴涓楠岄」鐨刬d
 let getDataTypeId = null;
 //褰撳墠妫�楠岄」
@@ -33,15 +35,51 @@
 // 褰撳墠杩欐杈撳叆瀵瑰簲鐨勫師濮嬫楠岄」銆傝绠楄繃绋嬩腑 pId 浼氬垏鎹㈠埌涓嬫父璁$畻椤癸紝
 // 淇濆瓨鏃跺繀椤诲悓鏃跺甫鍥炲師濮嬫楠岄」锛屽惁鍒欏彧浼氫繚瀛樿绠楃粨鏋溿��
 let sourceInsItemId = null;
+
+/**
+ * 鐢熸垚妯℃澘缁撴瀯绛惧悕
+ * 鍙寘鍚鍒楀潗鏍囦笌鍗犱綅绗�,涓嶅惈鍊�,鎵�浠ョ敤鎴峰~鍊间笉浼氳Е鍙戠鍚嶅彉鍖�
+ *
+ * @param list 涓荤嚎绋嬩紶杩囨潵鐨勮〃鏍兼暟鎹�
+ * @returns 缁撴瀯绛惧悕瀛楃涓�
+ */
+function buildTemplateSig(list) {
+  if (!list || !list.length) {
+    return "";
+  }
+  return list
+    .map((table) => {
+      const tpl = table && table.template;
+      if (!tpl || !tpl.length) {
+        return `${table && table.templateId}:0`;
+      }
+      const cells = tpl
+        .map((cell) => {
+          const ps = cell.v && cell.v.ps ? cell.v.ps.value : "";
+          return `${cell.r}-${cell.c}-${ps}`;
+        })
+        .join("|");
+      return `${table.templateId}:${tpl.length}:${cells}`;
+    })
+    .join(";");
+}
+
 // 鎺ユ敹鍒颁富绾跨▼澶勭悊閫昏緫鐨勬秷鎭�
 self.onmessage = function (event) {
   // 淇濆瓨涓荤嚎绋嬩紶杩囨潵鐨勫��
   const data = JSON.parse(event.data);
-  if (currentTable != data.currentTable) {
-    // 妫�楠屾ā鏉挎敼鍙樺悗闇�瑕佸埛鏂拌〃鏍�
+  // 妯℃澘鍐呭鍙樹簡(涓嶅彧鏄ā鏉縤d鍙樹簡)涔熻鍒锋柊琛ㄦ牸,鍚﹀垯鏀瑰畬妯$増鍚� Worker 浠嶇敤鏃фā鏉胯绠楀苟鎶婃棫鐗堝紡鍥炲啓椤甸潰
+  const nextTemplateSig = buildTemplateSig(data.tableList);
+  if (
+    currentTable != data.currentTable ||
+    (nextTemplateSig && nextTemplateSig != currentTemplateSig)
+  ) {
     tableList = data.tableList;
   }
   currentTable = data.currentTable;
+  if (nextTemplateSig) {
+    currentTemplateSig = nextTemplateSig;
+  }
   if (data.type && data.type == "saveData") {
     // 鏇存柊琛ㄦ牸鏁版嵁鍜屼紶閫掑埌鍚庣鐨勫弬鏁�
     tableList = data.tableList;
@@ -85,10 +123,9 @@
     tableList = data.tableList;
   }
   if (param) {
-    // 濡傛灉浼犻�掑埌鍚庣鐨勫弬鏁板瓨鍦紝鍒欐洿鏂板綋鍓嶄慨鏀规楠岄」鐨勪紶閫掑埌鍚庣鐨勫弬鏁�
+    // 鍙傛暟鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍団�濆瓨,妯℃澘id鍗� code 鐨勭涓�娈�
     let str = code.split("-");
-    let pId = str[3];
-    param[pId] = data.param[pId];
+    param[str[0]] = data.param[str[0]];
   } else {
     // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�
     param = data.param;
@@ -105,12 +142,64 @@
   changeInput("", code);
 };
 
+/**
+ * 鍒ゆ柇鍏紡鏄惁涓烘暟鍊煎叕寮�(鍚畻鏈繍绠楁垨 Excel 鍑芥暟)
+ * 杩欑被鍏紡蹇呴』璧版暟鍊艰绠楀垎鏀�,鍚﹀垯鍙細鎶婄畻寮忓綋鏂囨湰鍘熸牱鏄剧ず
+ *
+ * @param f 鍏紡瀛楃涓�
+ * @returns 鏄惁鎸夋暟鍊艰绠�
+ */
+function isNumericFormula(f) {
+  if (typeof f !== "string") {
+    return false;
+  }
+  // 鍘绘帀鍙屽紩鍙峰唴鐨勬枃鏈�,閬垮厤鎶� "A-B" 杩欑被鏂囨湰瀛楅潰閲忚鍒や负绠楁湳
+  const probe = f.replace(/"[^"]*"/g, "");
+  // 鍙鏀寔鐨勭畻鏈繍绠楃鍜� Excel 鍑芥暟,鎷彿鍗曠嫭鍑虹幇涓嶈涓烘暟鍊煎叕寮�,
+  // 浠ュ厤 IF 绛変笉鏀寔鐨勫嚱鏁拌璇垽
+  if (
+    /[+\-*/^%]/.test(probe) ||
+    /SUM|MAX|MIN|AVERAGE|ABS|MEDIAN/.test(probe)
+  ) {
+    return true;
+  }
+  // 绾崟鍏冩牸寮曠敤涔熸槸鏁板�煎叕寮忋�傛ā鐗堥噷"鏈�缁堝��"甯稿啓鎴� =F4 杩欑褰㈠紡,
+  // 涓嶈鐨勮瘽浼氭帀杩涙枃鏈垎鏀�,鎶婃渶缁堝�煎彉鎴愬甫绌烘牸鐨勫瓧绗︿覆
+  return /^[A-Za-z]{1,3}\d{1,7}$/.test(f.replace(/[=\s]/g, ""));
+}
+
+/**
+ * 鎸夋楠岄」id鍙栧綋鍓嶆牱鍝佷笅鐨勬楠岄」淇℃伅,鍙栦笉鍒版椂杩斿洖绌哄璞�,閬垮厤鍏紡璁$畻鍥犵己椤逛腑鏂�
+ *
+ * @param id 妫�楠岄」id
+ * @returns 妫�楠岄」淇℃伅
+ */
+function findInsItem(id) {
+  if (!currentSample || !currentSample.insProduct) {
+    return {};
+  }
+  return currentSample.insProduct.find((m) => m.id == id) || {};
+}
+
+/**
+ * 鍒ゆ柇璁$畻缁撴灉鏄惁鍙互鍐欏洖鍗曞厓鏍�
+ *
+ * @param r 璁$畻缁撴灉
+ * @returns 缁撴灉鏈夋晥杩斿洖 true
+ */
+function isValidComputedResult(r) {
+  if (r === "" || r === null || r === undefined) {
+    return false;
+  }
+  return !(typeof r === "number" && isNaN(r));
+}
+
 function changeInput(m, code) {
   let str = code.split("-");
   let r = str[1]; //褰撳墠琛�
   let c = str[2]; //褰撳墠鍒�
   let id = str[0];
-  let pId = str[3]; //褰撳墠妫�楠岄」id锛宲aram[pId]涓哄綋鍓嶆楠岄」鐨勬墍鏈夊�硷紝鍖呭惈锛氳繃绋嬪�糹nsValue銆佽绠楀�糲omValue銆佽澶囩紪鐮乪quipValue銆佽澶囧悕绉癳quipName銆佹渶缁堝�紃esValue銆佺粨璁篿nsResult
+  let pId = str[3]; //褰撳墠妫�楠岄」id锛岀敤浜庤绠楀畬鎴愬悗鎶婄粨鏋滃啓鍥炶妫�楠岄」鎵�鍦ㄨ
   var list = []; //涓�涓弻灞傛暟缁勶紝閲岄潰淇濆瓨鏈夊綋鍓嶉〉闈㈡覆鏌撶殑鎵�鏈夋暟鎹�
   // 璧嬪�煎綋鍓嶆ā鏉跨殑琛ㄦ牸鏁版嵁
   for (let a in tableList) {
@@ -157,7 +246,8 @@
                 list2.push(c.v.v);
                 // 缁勮鍙傛暟鐨勫璞¢泦鍚堝苟璧嬪�硷紝鍒楀{A3:12,B4:15}
                 if (
-                  getInspectionValueType(item.i) == 1 &&
+                  (getInspectionValueType(item.i) == 1 ||
+                    isNumericFormula(item.v.f)) &&
                   !isNaN(parseFloat(c.v.v))
                 ) {
                   // 濡傛灉鏄暟瀛楄緭鍏ユ
@@ -177,362 +267,26 @@
           }
         });
       });
-      // 濡傛灉姝xcel鏂规硶鏄粨璁哄垽鏂柟娉曪紝鍒欐墽琛屾鏂规硶
-      // console.log('item.v.ps.value---', item.v.ps.value)
-      if (item.v.ps != undefined && item.v.ps.value == "缁撹") {
-        try {
-          if (currentSample.insProduct.find((m) => m.id == item.i)) {
-            // 濡傛灉褰撳墠妫�楠岄」鏄骇鍝佹楠岄」锛屽垯鎵ц姝ゆ柟娉曪紝鎵惧埌姝ゆ楠岄」鐨勮姹傚��
-            let ask = currentSample.insProduct.find((m) => m.id == item.i).ask
-              ? currentSample.insProduct
-                  .find((m) => m.id == item.i)
-                  .ask.split("&")
-              : null;
-            // 鑾峰彇褰撳墠缁撹鐨勫弬鏁帮紝涔熷氨鏄綋鍓嶆楠岄」鐨勬渶缁堝��
-            let res = Object.values(comValue)[0];
-            if (typeof res == "string" && res.includes(">")) {
-              res = res.replace(">", "");
-            }
-            if (typeof res == "string" && res.includes("鈮�")) {
-              res = res.replace("鈮�", "");
-            }
-            if (typeof res == "string" && res.includes("鈮�")) {
-              res = res.replace("鈮�", "");
-            }
-            if (typeof res == "string" && res.includes("<")) {
-              res = res.replace("<", "");
-            }
-            if (typeof res == "string" && res.includes("锛�")) {
-              res = res.replace("锛�", "");
-            }
-            if (typeof res == "string" && res.includes("锛�")) {
-              res = res.replace("锛�", "");
-            }
-            if (
-              typeof res == "string" &&
-              (res === "鏂" || res === "鑴嗗寲" || res === "鏂鑴嗗寲")
-            ) {
-              item.v.v = 0;
-              list.forEach((a) => {
-                if (a[0].r == item.r) {
-                  for (let b = 0; b < a.length; b++) {
-                    if (a[b].c == item.c) {
-                      a[b].v.v = 0;
-                      break;
-                    }
-                  }
-                }
-              });
-            }
-            let comp = [];
-            // 鍒ゆ柇褰撳墠缁撹鐨勫弬鏁帮紙褰撳墠妫�楠岄」鐨勬渶缁堝�硷級鏄惁涓虹┖锛屽鏋滀负绌猴紝鍒欑洿鎺ヨ祴鍊�
-            if (
-              res === "" ||
-              res === null ||
-              res === undefined ||
-              res === "Infinity"
-            ) {
-              item.v.v = null;
-              list.forEach((a) => {
-                if (a[0].r == item.r) {
-                  for (let b = 0; b < a.length; b++) {
-                    if (a[b].c == item.c) {
-                      a[b].v.v = null;
-                      break;
-                    }
-                  }
-                }
-              });
-            } else {
-              // 濡傛灉涓嶄负绌猴紝鍒欏垽鏂綋鍓嶇粨璁哄氨闇�瑕佽繘琛屽垽鏂�
-              //瑕佹眰鍊间负-锛�/锛屸�旓紝鍒欑粨璁鸿缃负涓嶅垽瀹氾紝缁撹璧嬪�间负3
-              if (
-                ask == null ||
-                ask[0] == "-" ||
-                ask[0] == "/" ||
-                ask[0] == "鈥�"
-              ) {
-                item.v.v = 3;
-                list.forEach((a) => {
-                  if (a[0].r == item.r) {
-                    for (let b = 0; b < a.length; b++) {
-                      if (a[b].c == item.c) {
-                        a[b].v.v = 3;
-                        break;
-                      }
-                    }
-                  }
-                });
-              } else {
-                // 瑕佹眰鍊间笉涓�-锛�/锛屸�旓紝鍒欒繘琛屽垽鏂�
-                if (ask) {
-                  // 寰幆瑕佹眰鍊煎垪琛紝鍒ゆ柇褰撳墠缁撹鐨勫弬鏁版槸鍚︾鍚堣姹�
-                  comp = ask.map((m, i) => {
-                    // 濡傛灉瑕佹眰鍊煎寘鍚�=锛屽垯鍒ゆ柇褰撳墠缁撹鐨勫弬鏁版槸鍚︾瓑浜庤姹傚�硷紝
-                    // 浠ヤ笅鍒ゆ柇鍩烘湰涓�鑷达紝鍙槸鍒ゆ柇绫诲瀷涓嶄竴鏍凤紝灏变笉鍋氭敞閲婁簡
-                    if (m.includes("=")) {
-                      // 澶勭悊瑕佹眰鍊�
-                      let str = handleFraction(m.split("=")[1]);
-                      if (typeof res == "string" && typeof str == "string") {
-                        // 濡傛灉瑕佹眰鍊煎拰褰撳墠缁撹鐨勫弬鏁伴兘鏄瓧绗︿覆锛屽垯鎵ц
-                        if (res.includes("/")) {
-                          // 濡傛灉缁撹鐨勫弬鏁版槸鍒嗘暟锛屽垯鍒ゆ柇
-                          if (m.includes("/")) {
-                            // 濡傛灉瑕佹眰鍊兼槸鍒嗘暟锛屽垯鍒ゆ柇
-                            return eval(res) == eval(str);
-                          } else {
-                            // 濡傛灉瑕佹眰鍊间笉鏄垎鏁帮紝鍒欏垽鏂�
-                            return handleMoreParam(res, m.split("=")[1], "=");
-                          }
-                        } else {
-                          // 濡傛灉缁撹鐨勫弬鏁颁笉鏄垎鏁帮紝鍒欏垽鏂�
-                          return (
-                            res.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, "") ==
-                            str.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, "")
-                          );
-                        }
-                      } else {
-                        // 濡傛灉瑕佹眰鍊煎拰褰撳墠缁撹鐨勫弬鏁版湁涓�涓槸鏁板瓧锛屽垯鎵ц
-                        return eval(res) == eval(str);
-                      }
-                    } else if (m.includes("鈮�")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split("鈮�")[1]);
-                          return eval(res) >= eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split("鈮�")[1], "鈮�");
-                        }
-                      } else {
-                        let str = handleFraction(m.split("鈮�")[1]);
-                        return eval(res) >= eval(str);
-                      }
-                    } else if (m.includes("鈮�")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split("鈮�")[1]);
-                          return eval(res) <= eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split("鈮�")[1], "鈮�");
-                        }
-                      } else {
-                        let str = handleFraction(m.split("鈮�")[1]);
-                        if (typeof str == "string" && str.includes("A")) {
-                          str = str.replace("A", "");
-                        }
-                        if (typeof str == "string" && str.includes("D")) {
-                          str = str.replace("D", "");
-                        }
-                        if (typeof res == "string" && res.includes("A")) {
-                          res = res.replace("A", "");
-                        }
-                        if (typeof res == "string" && res.includes("D")) {
-                          res = res.replace("D", "");
-                        }
-                        return eval(res) <= eval(str);
-                      }
-                    } else if (m.includes("<")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split("<")[1]);
-                          return eval(res) < eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split("<")[1], "<");
-                        }
-                      } else {
-                        let str = handleFraction(m.split("<")[1]);
-                        return eval(res) < eval(str);
-                      }
-                    } else if (m.includes(">")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split(">")[1]);
-                          return eval(res) > eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split(">")[1], ">");
-                        }
-                      } else {
-                        let str = handleFraction(m.split(">")[1]);
-                        return eval(res) > eval(str);
-                      }
-                    } else if (m.includes("~")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let k = m.split("~");
-                          return (
-                            eval(res) >= eval(handleFraction(k[0])) &&
-                            eval(res) <= eval(handleFraction(k[1]))
-                          );
-                        } else {
-                          return handleMoreParam(res, m, "~");
-                        }
-                      } else {
-                        let k = m.split("~");
-                        return (
-                          eval(res) >= eval(handleFraction(k[0])) &&
-                          eval(res) <= eval(handleFraction(k[1]))
-                        );
-                      }
-                    } else if (m.includes("-")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let k = m.split("-");
-                          return (
-                            eval(res) >= eval(handleFraction(k[0])) &&
-                            eval(res) <= eval(handleFraction(k[1]))
-                          );
-                        } else {
-                          return handleMoreParam(res, m, "-");
-                        }
-                      } else {
-                        let k = m.split("-");
-                        return (
-                          eval(res) >= eval(handleFraction(k[0])) &&
-                          eval(res) <= eval(handleFraction(k[1]))
-                        );
-                      }
-                    } else if (m.includes("卤")) {
-                      if (modelType.includes("蠁-")) {
-                        if (m.indexOf("卤") == 0) {
-                          m =
-                            modelType.substring(modelType.indexOf("-") + 1) + m;
-                        }
-                      }
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let k = m.split("卤");
-                          return (
-                            eval(res) >=
-                              eval(
-                                handleFraction(k[0]) - handleFraction(k[1])
-                              ) &&
-                            eval(res) <=
-                              eval(
-                                Number(handleFraction(k[0])) +
-                                  Number(handleFraction(k[1]))
-                              )
-                          );
-                        } else {
-                          return handleMoreParam(res, m, "卤");
-                        }
-                      } else {
-                        let k = m.split("卤");
-                        return (
-                          eval(res) >=
-                            eval(handleFraction(k[0]) - handleFraction(k[1])) &&
-                          eval(res) <=
-                            eval(
-                              Number(handleFraction(k[0])) +
-                                Number(handleFraction(k[1]))
-                            )
-                        );
-                      }
-                    } else if (m.includes("锛�")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split("锛�")[1]);
-                          return eval(res) > eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split("锛�")[1], ">");
-                        }
-                      } else {
-                        let str = handleFraction(m.split("锛�")[1]);
-                        return eval(res) > eval(str);
-                      }
-                    } else if (m.includes("锛�")) {
-                      if (typeof res == "string" && res.includes("/")) {
-                        if (m.includes("/")) {
-                          let str = handleFraction(m.split("锛�")[1]);
-                          return eval(res) < eval(str);
-                        } else {
-                          return handleMoreParam(res, m.split("锛�")[1], "<");
-                        }
-                      } else {
-                        let str = handleFraction(m.split("锛�")[1]);
-                        return eval(res) < eval(str);
-                      }
-                    }
-                  });
-                }
-                // 濡傛灉瑕佹眰鍊肩殑姣忎釜鏉′欢閮界鍚堬紝鍒欑粰缁撹璧嬪�间负1锛屽悎鏍�
-                if (comp.every((m) => m)) {
-                  item.v.v = 1;
-                  list.forEach((a) => {
-                    if (a[0].r == item.r) {
-                      for (let b = 0; b < a.length; b++) {
-                        if (a[b].c == item.c) {
-                          a[b].v.v = 1;
-                          break;
-                        }
-                      }
-                    }
-                  });
-                } else {
-                  // 鍚﹀垯缁欑粨璁鸿祴鍊间负0锛屼笉鍚堟牸
-                  item.v.v = 0;
-                  list.forEach((a) => {
-                    if (a[0].r == item.r) {
-                      for (let b = 0; b < a.length; b++) {
-                        if (a[b].c == item.c) {
-                          a[b].v.v = 0;
-                          break;
-                        }
-                      }
-                    }
-                  });
-                }
-              }
-            }
-            let getDataType0 = false;
-            // 浼樺寲鏁伴噰杈冨鏁版嵁鏃�-璁板綍鏈�鍚庝竴涓楠岄」鐨刬d锛屽鏋滃綋鍓嶆楠岄」鐨刬d涓庤褰曠殑id鐩稿悓锛屽垯澶氫紶涓�涓弬鏁板埌涓荤嚎绋嬶紝杩涜鏁版嵁淇濆瓨锛屽惁鍒欐暟閲囧氨涓嶈繘琛屼繚瀛�
-            if (item.i == getDataTypeId) {
-              getDataType0 = true;
-            }
-            // 璧嬪�间紶閫掑埌涓荤嚎绋嬬殑鏁版嵁锛宮ethod锛歴aveInsContext琛ㄧず姝ゆ秷鎭渶瑕佷繚瀛樻暟鎹�
-            currentInsItemId = item.i;
-            // 璧嬪�间紶閫掑埌涓荤嚎绋嬬殑鏁版嵁锛宮ethod锛歴aveInsContext琛ㄧず姝ゆ秷鎭渶瑕佷繚瀛樻暟鎹�
-            result = {
-              method: "saveInsContext",
-              value: {
-                tableList, // 琛ㄦ牸鏁版嵁
-                param: getParam(), //浼犵粰鍚庣鐨勫弬鏁�
-                getDataTypeId: getDataTypeId,
-                currentInsItemId: item.i,
-                sourceInsItemId: sourceInsItemId,
-              },
-            };
-            // 鍙戞秷鎭粰涓荤嚎绋�
-            self.postMessage(JSON.stringify(result));
-          }
-        } catch (error) {
-          console.log("error---", error);
-        }
-      } else {
         // 濡傛灉鏄嚱鏁版柟娉曪紝鍒欐墽琛屾鏂规硶
         let comResult = ""; //鍒濆鍖栬绠楃粨鏋�
         try {
-          if (getInspectionValueType(item.i) == 1) {
-            // 濡傛灉妫�楠屽�肩被鍨嬫槸鏁板瓧杈撳叆妗�
-            let tell = currentSample.insProduct.find((m) => m.id == item.i).tell
-              ? currentSample.insProduct
-                  .find((m) => m.id == item.i)
-                  .tell.split("&")
-              : null;
+          if (
+            getInspectionValueType(item.i) == 1 ||
+            isNumericFormula(item.v.f)
+          ) {
+            // 濡傛灉妫�楠屽�肩被鍨嬫槸鏁板瓧杈撳叆妗�,鎴栧叕寮忔湰韬惈绠楁湳杩愮畻/Excel鍑芥暟
+            const itemInfo = findInsItem(item.i);
+            let tell =
+              typeof itemInfo.tell == "string" ? itemInfo.tell.split("&") : null;
             isPoint =
               tell &&
               tell.length > 0 &&
               typeof tell[0] == "string" &&
               tell[0].includes("/") &&
               tell[0] !== "/"; // 鍒ゆ柇瑕佹眰鍊兼槸鍚︿负鍒嗘暟
-            const inspectionItemClass = currentSample.insProduct.find(
-              (m) => m.id == item.i
-            ).inspectionItemClass; // 妫�楠岄」鍒嗙被
-            const inspectionItem = currentSample.insProduct.find(
-              (m) => m.id == item.i
-            ).inspectionItem; // 妫�楠岄」
-            const inspectionItemSubclass = currentSample.insProduct.find(
-              (m) => m.id == item.i
-            ).inspectionItemSubclass; // 妫�楠屽瓙椤�
+            const inspectionItemClass = itemInfo.inspectionItemClass; // 妫�楠岄」鍒嗙被
+            const inspectionItem = itemInfo.inspectionItem; // 妫�楠岄」
+            const inspectionItemSubclass = itemInfo.inspectionItemSubclass; // 妫�楠屽瓙椤�
             let isHaveSymbol = false;
             let symbol = "";
             for (var a in comValue) {
@@ -585,7 +339,12 @@
             ) {
               comResult = comResult + "";
             }
-            if (inspectionItem === "閭垫皬纭害" && tell[0].includes("A")) {
+            if (
+              inspectionItem === "閭垫皬纭害" &&
+              tell &&
+              tell[0] &&
+              tell[0].includes("A")
+            ) {
               // 瑕佹眰鍊煎鏋滄湁鍖呭惈瀛楁瘝锛屾渶缁堢粨鏋滆灞曠ず鍑哄瓧姣�
               comResult = comResult + "A";
             }
@@ -593,6 +352,8 @@
               inspectionItemClass === "缁濈紭鏈烘鐗╃悊鎬ц兘" &&
               inspectionItem === "寮洸鎬ц兘" &&
               inspectionItemSubclass === "鏈�灏忓集鏇插崐寰�" &&
+              tell &&
+              tell[0] &&
               tell[0].includes("D")
             ) {
               // 瑕佹眰鍊煎鏋滄湁鍖呭惈瀛楁瘝锛屾渶缁堢粨鏋滆灞曠ず鍑哄瓧姣�
@@ -644,7 +405,7 @@
         try {
           // 寰幆琛ㄦ牸鏁版嵁锛岀粰琛ㄦ牸鏁版嵁杩涜璧嬪��
           list.forEach((a) => {
-            if (a[0].r == item.r && comResult !== "") {
+            if (a[0].r == item.r && isValidComputedResult(comResult)) {
               // 鍒ゆ柇褰撳墠琛屾槸鍚︿负褰撳墠妫�楠岄」鎵�鍦ㄨ锛屽鏋滀负褰撳墠琛岋紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪��
               for (var b in a) {
                 if (a[b].c == item.c) {
@@ -672,9 +433,7 @@
                       // 鍒ゆ柇璁$畻缁撴灉鏄惁涓虹瀛﹁鏁版硶锛屽鏋滀负绉戝璁℃暟娉曪紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪�间负绉戝璁℃暟娉�
                       a[b].v.v = comResult;
                     } else {
-                      const inspectionItem = currentSample.insProduct.find(
-                        (m) => m.id == item.i
-                      ).inspectionItem;
+                      const inspectionItem = findInsItem(item.i).inspectionItem;
                       // 鍒ゆ柇璁$畻缁撴灉鏄惁涓烘暟瀛楋紝濡傛灉涓烘暟瀛楋紝鍒欑粰琛ㄦ牸鏁版嵁璧嬪�间负鏁板瓧
                       if (inspectionItem == "閾滅嚎鐢甸樆鐜囅�20鏈�澶у��") {
                         let val = parseFloat(Number(comResult).toFixed(5));
@@ -695,12 +454,14 @@
             }
           });
           // 濡傛灉姝よ绠楃粨鏋滄墍灞炲崟鍏冩牸锛屽悓鏃朵篃鏄彟涓�涓猠xcel鍑芥暟鐨勫弬鏁帮紝閭d箞灏遍渶瑕侀�掑綊杩涜璁$畻
-          changeInput(comResult, `${id}-${item.r}-${item.c}-${pId}`); //鏀瑰彉鏈�缁堝��
+          // 鍙湁绠楀嚭鏈夋晥缁撴灉鎵嶇户缁悜涓嬫父鍏紡浼犻��,閬垮厤鎶婄┖鍊�/NaN 浼犳煋缁欏叾瀹冨崟鍏冩牸
+          if (isValidComputedResult(comResult)) {
+            changeInput(comResult, `${id}-${item.r}-${item.c}-${pId}`); //鏀瑰彉鏈�缁堝��
+          }
           currentInsItemId = item.i;
         } catch (error) {
           console.log("error---", error);
         }
-      }
     }
   });
   if (index === -1 || (inputType === undefined && isSave === "true")) {
@@ -726,17 +487,6 @@
   };
   // 鍙戦�佷富绾跨▼鏁版嵁
   self.postMessage(JSON.stringify(result));
-  try {
-    // 璧嬪�煎绾跨▼浼犺緭鏁版嵁
-    result = {
-      method: "getCurrentInsProduct",
-      value: pId,
-    };
-    // 鍙戦�佷富绾跨▼鏁版嵁
-    self.postMessage(JSON.stringify(result));
-  } catch (error) {
-    console.log("error---", error);
-  }
 }
 /**
  * 鑾峰彇妫�娴嬪�肩被鍨�
@@ -835,68 +585,33 @@
  * @returns 杩斿洖澶勭悊鍚庣殑鍙傛暟瀵硅薄
  */
 function getParam() {
-  tableList[0].arr.forEach((a) => {
-    a.forEach((b) => {
-      // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁�
-      if (param[b.i]) {
-        param[b.i].insValue = [];
-        param[b.i].comValue = [];
-        param[b.i].equipValue = [];
-        param[b.i].equipName = [];
-        param[b.i].resValue = null;
-        param[b.i].insResult = null;
-      }
-    });
-  });
-  tableList[0].arr.forEach((a) => {
-    a.forEach((b) => {
-      // 鏍规嵁琛ㄦ牸鏁版嵁锛岃祴鍊间紶閫掑埌鍚庣鐨勫弬鏁�
-      if (
-        b.v.ps != undefined &&
-        typeof b.v.ps.value == "string" &&
-        b.v.ps.value.includes("妫�楠屽��")
-      ) {
-        // 璧嬪�兼楠屽��
-        b.i &&
-          b.v.v !== "" &&
-          b.v.v !== null &&
-          b.v.v !== undefined &&
-          param[b.i].insValue.push(b);
-      }
-      if (b.v.ps != undefined && b.v.ps.value === "璁$畻鍊�") {
-        // 璧嬪�艰绠楀��
-        b.i &&
-          b.v.v &&
-          b.valueList &&
-          b.valueList.length > 0 &&
-          param[b.i].comValue.push(b);
-      }
-      if (b.v.ps != undefined && b.v.ps.value === "璁惧缂栫爜") {
-        // 璧嬪�艰澶囩紪鐮�
-        b.i && b.v && param[b.i].equipValue.push(b);
-      }
-      if (b.v.ps != undefined && b.v.ps.value === "璁惧鍚嶇О") {
-        // 璧嬪�艰澶囧悕绉�
-        b.i && b.v && param[b.i].equipName.push(b);
-      }
-      if (b.v.ps != undefined && b.v.ps.value === "鏈�缁堝��") {
-        // 璧嬪�兼渶缁堝��
-        b.i &&
-          b.v &&
-          b.valueList &&
-          b.valueList.length > 0 &&
-          (param[b.i].resValue = b);
-      }
-      if (b.v.ps != undefined && b.v.ps.value === "缁撹") {
-        if (b.i && (b.v.v || b.v.v === 0 || b.v.v === "0")) {
-          if (b.v.v != "鍚堟牸" && b.v.v != "涓嶅悎鏍�") {
-            // 璧嬪�肩粨璁�
-            param[b.i].insResult = b;
-          }
+  // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濅粠褰撳墠妯℃澘蹇収鍑哄緟淇濆瓨鍙傛暟
+  const resultParam = {};
+  tableList.forEach((t) => {
+    resultParam[t.templateId] = {};
+    (t.arr || []).forEach((a) => {
+      a.forEach((b) => {
+        const isEditable =
+          b.v.ps != undefined &&
+          typeof b.v.ps.value == "string" &&
+          (b.v.ps.value.includes("妫�楠屽��") ||
+            b.v.ps.value === "璁$畻鍊�" ||
+            b.v.ps.value === "鏈�缁堝��" ||
+            b.v.ps.value === "璁惧鍚嶇О");
+        if (!isEditable) {
+          return;
         }
-      }
+        if (
+          b.v.ps.value.includes("妫�楠屽��") &&
+          (b.v.v === "" || b.v.v === null || b.v.v === undefined)
+        ) {
+          return;
+        }
+        resultParam[t.templateId][`${b.r}-${b.c}`] = { v: b.v.v, u: b.u };
+      });
     });
   });
+  param = resultParam;
   return param;
 }
 
@@ -1191,6 +906,7 @@
  */
 function getIdFromColumnName(id, arr) {
   try {
+    id = String(id).replace(/\$/g, "");
     // Get the letters
     var t = /^[a-zA-Z]+/.exec(id);
     if (t) {
@@ -1271,6 +987,9 @@
  */
 function getABCList(f) {
   try {
+    if (typeof f !== "string") {
+      return [];
+    }
     let regex = /[=\+\-\*\%\(\)\/\^\s]/g;
     // 涓婇潰璁$畻鍑芥暟鏂板鍚庯紝杩欓噷涔熻鍚屾澧炲姞
     let fouList = [
@@ -1284,8 +1003,12 @@
       "IF",
       "LOG",
     ];
-    // 鏇挎崲鐗规畩瀛楃
+    // 鏇挎崲鐗规畩瀛楃,鍘绘帀 Excel 缁濆寮曠敤绗﹀彿($D$14 涓� D14 绛変环)
     f = f
+      .replace(/\$/g, "")
+      // 鍖洪棿鍐欐硶閲岀殑绌烘牸(AVERAGE( D14 : D15 ))浼氳涓嬮潰鐨勭┖鐧芥浛鎹㈠悆鎺夊啋鍙�,
+      // 瀵艰嚧鍖洪棿琚媶鎴愪袱涓嫭绔嬪崟鍏冩牸,鍏堟妸鍖洪棿瑙勬暣鎴� D14:D15
+      .replace(/\s*:\s*/g, ":")
       .replace(regex, ",")
       .replace(new RegExp('"&', "g"), "")
       .replace(new RegExp('&"', "g"), "");
@@ -1322,6 +1045,22 @@
 }
 
 /**
+ * 鎶婂崟鍏冩牸鍊艰浆鎴愬彲鍙備笌 eval 鐨勫瓧闈㈤噺,绌虹櫧鍗曞厓鏍兼寜 0 澶勭悊(涓� Excel 涓�鑷�)
+ *
+ * @param value 鍗曞厓鏍肩殑鍊�
+ * @returns 鏁板��/鍘熷鍊�,绌哄�艰繑鍥� 0
+ */
+function toNumberLiteral(value) {
+  if (value === null || value === undefined) {
+    return 0;
+  }
+  if (typeof value === "string" && value.trim() === "") {
+    return 0;
+  }
+  return value;
+}
+
+/**
  * 璁$畻鍑芥暟
  *
  * @param f 瀛楃涓茬被鍨嬶紝琛ㄧず寰呰绠楃殑鍏紡
@@ -1330,7 +1069,9 @@
  */
 function compute(f, comValue, isPoint) {
   try {
-    let str = f;
+    // 鍘绘帀 Excel 缁濆寮曠敤绗﹀彿,$D$14 涓� D14 绛変环;
+    // 鍖洪棿閲岀殑绌烘牸涔熻涓�骞跺幓鎺�,鍚﹀垯涓嬮潰鎶� ":" 鎹㈡垚 "-" 鍚� D14-D15 浼氬洜绌烘牸鍖归厤涓嶄笂鑰屽睍寮�澶辫触
+    let str = f.replace(/\$/g, "").replace(/\s*:\s*/g, ":");
     // 鑾峰彇鍗曞厓鏍煎搴斿��
     let arr = getAllCell(f);
     for (var a in comValue) {
@@ -1397,9 +1138,18 @@
     for (var a in obj) {
       str = str.replace(new RegExp(a, "g"), obj[a]);
     }
-    // 璁$畻
-    for (var a in arr) {
-      str = str.replace(new RegExp(a, "g"), arr[a]);
+    // 璁$畻:涓�娆℃�ф浛鎹㈡墍鏈夊弬鏁�,閬垮厤 D1 涓� D14 杩欑被鍓嶇紑浜掔浉姹℃煋;
+    // 绌虹櫧鍗曞厓鏍兼寜 0 澶勭悊,閬垮厤鎶� null/undefined 甯﹁繘琛ㄨ揪寮忓鑷存暣鏉″叕寮忕畻涓嶅嚭鏉�
+    const cellKeys = Object.keys(arr);
+    if (cellKeys.length > 0) {
+      const pattern = new RegExp(
+        cellKeys
+          .sort((x, y) => y.length - x.length)
+          .map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
+          .join("|"),
+        "g"
+      );
+      str = str.replace(pattern, (m) => String(toNumberLiteral(arr[m])));
     }
     if (str.includes(",,")) {
       str = str.replace(new RegExp(",,", "g"), ",");
@@ -1421,8 +1171,9 @@
       return str
         .replace(new RegExp('&"/"&', "g"), "/")
         .replace(new RegExp("//", "g"), "");
-    } else if (isPoint) {
-      // 璁$畻甯﹀皬鏁扮偣鐨�
+    } else if (isPoint && !/SUM|MAX|MIN|AVERAGE|ABS|MEDIAN/.test(str)) {
+      // 鍒嗘暟褰㈠紡鐨勮緭鍏�(濡� 3/4)鎸夊師鏂囪繑鍥炲睍绀�;
+      // 浣嗗惈 Excel 鍑芥暟鍚嶇殑鍏紡涓嶈兘璧拌繖閲�,鍚﹀垯浼氭妸 "AVERAGE(...)" 杩欑绠楀紡鏂囨湰褰撴垚缁撴灉鍐欏洖鍗曞厓鏍�
       return str.replace("ABS", "").replace(/\(|\)/g, "");
     } else {
       if (str.includes("IF")) {
@@ -1449,7 +1200,12 @@
         }
       }
       // 璁$畻甯歌鐨�
-      return eval(str);
+      const value = eval(str);
+      // 闄ら浂绛夐潪鏈夐檺缁撴灉涓嶅啓鍥炲崟鍏冩牸(涓� Excel 鐨� #DIV/0! 涓�鑷�:涓嶅嚭鍊�)
+      if (typeof value === "number" && !isFinite(value)) {
+        return undefined;
+      }
+      return value;
     }
   } catch (error) {
     console.log("error", error);
diff --git a/vue.config.js b/vue.config.js
index 8eef954..2b9b9e4 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -106,6 +106,13 @@
     config.plugins.delete("preload"); // TODO: need test
     config.plugins.delete("prefetch"); // TODO: need test
 
+    // 璁╂敼 src/workers/*.worker.js 涔熻兘瑙﹀彂 dev server 閲嶅缓銆�
+    // *.worker.js 宸茬敱 worker-loader 澶勭悊,浣� vue-cli 鍐呯疆鐨� js 瑙勫垯(/\\.m?jsx?$/,
+    // 鍚� cache-loader + babel-loader)鍚屾牱浼氬懡涓畠銆俢ache-loader 浼氱紦瀛� worker 妯″潡鐨�
+    // 浜х墿,worker 婧愭枃浠舵敼鍔ㄥ悗鍗充娇妯″潡琚垽澶辨晥骞堕噸寤�,cache-loader 浠嶇洿鎺ヨ繑鍥炴棫缂撳瓨,
+    // 浜庢槸 dev server 涓�鐩村彂鏃у寘(鏀逛簡 worker 涓嶇敓鏁�)銆傛妸瀹冩帓闄ゆ帀鍗冲彲銆�
+    config.module.rule("js").exclude.add(/\.worker\.js$/);
+
     // set svg-sprite-loader
     config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
     config.module

--
Gitblit v1.9.3