liding
8 天以前 e3bf21045fc29371449c7e888d786370dc962ae1
src/views/business/inspectionView/index.vue
@@ -2224,20 +2224,19 @@
      // 监听 Worker 返回的结果
      this.worker.onmessage = (event) => {
        this.result = JSON.parse(event.data);
        switch (this.result.method) {
        const workerResult = JSON.parse(event.data);
        this.result = workerResult;
        switch (workerResult.method) {
          case "saveInsContext":
            this.$nextTick(() => {
              const resultValue = workerResult.value;
              // this.$delete(this.tableList[0],'arr')
              this.$set(
                this.tableList[0],
                "arr",
                this.result.value.tableList[0].arr
                resultValue.tableList[0].arr
              );
              this.param = this.result.value.param;
              if (this.result.value.currentInsItemId) {
                currentInsItemId = this.result.value.currentInsItemId;
              }
              this.param = resultValue.param;
              // 特殊处理一下结论,会有这种特殊情况
              for (var i in this.param) {
                if (
@@ -2252,23 +2251,28 @@
                  }
                }
              }
              this.saveInsContext(currentInsItemId);
              const sourceInsItemId =
                resultValue.sourceInsItemId != null &&
                  resultValue.sourceInsItemId !== ""
                  ? resultValue.sourceInsItemId
                  : currentInsItemId;
              this.saveInsContext([
                sourceInsItemId,
                resultValue.currentInsItemId,
              ]);
            });
            break;
          case "tableList":
            this.$nextTick(() => {
              // 更新数据
              this.$delete(this.tableList[0], "arr");
              this.$set(this.tableList[0], "arr", this.result.value[0].arr);
              this.$set(this.tableList[0], "arr", workerResult.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);
            this.getCurrentInsProduct(workerResult.value);
            break;
        }
      };
@@ -2674,14 +2678,26 @@
      return;
    },
    // 统一在这里保存数据
    saveInsContext(currentInsItemId) {
    saveInsContext(currentInsItemIds) {
      try {
        if (this.param) {
          let param = null;
          if (currentInsItemId) {
            param = { [currentInsItemId]: this.param[currentInsItemId] };
          } else {
            param = 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;
            }
          }
          saveInsContext({
            param: JSON.stringify(param),