he wei
2024-01-15 d592480beb70716a59b6ec5a00c73e92ff6ea986
src/pages/compare.vue
@@ -19,12 +19,12 @@
                  'icon-tuichuquanping': fullScreen,
                },
              ]"
              :title="fullScreen ? '还原' : '全屏'"
              :title="fullScreen ? $t('Restore') : $t('FullScreen')"
              @click="toggleScreen(item)"
            ></div>
            <div
              class="btn iconfont icon-guanbi"
              title="关闭"
              :title="$t('operate.close')"
              @click="closeItem(item)"
            ></div>
          </div>
@@ -56,12 +56,12 @@
                  'icon-tuichuquanping': fullScreen,
                },
              ]"
              :title="fullScreen ? '还原' : '全屏'"
              :title="fullScreen ? $t('Restore') : $t('FullScreen')"
              @click="toggleScreen(item)"
            ></div>
            <div
              class="btn iconfont icon-guanbi"
              title="关闭"
              :title="$t('operate.close')"
              @click="closeItem(item)"
            ></div>
          </div>
@@ -113,29 +113,34 @@
import { comparedList, testCompareReport } from "@/apis";
import { mapGetters } from "vuex";
import { toFixed } from "@/assets/js/util";
import i18n from './i18n/compare';
import { createI18nOption } from '@/assets/js/tools/i18n';
const i18nMixin = createI18nOption(i18n);
// 保留三位小数
const BIT = 3;
export default {
  name: "",
  mixins: [i18nMixin],
  data() {
    const titles = {
      resChart: "内阻(mΩ)",
      volChart: "电压(V)",
      resTable: "数据表(内阻/mΩ)",
      volTable: "数据表(电压/V)",
      resChart: this.$t("Resistance") + "(mΩ)",
      volChart: this.$t("Voltage") + "(V)",
      resTable: this.$t("DataSheet") + "(" + this.$t("Resistance") + "/mΩ)",
      volTable: this.$t("DataSheet") + "(" + this.$t("Voltage") + "/V)",
    };
    const marks = {
      resChart: [
        {
          name: "内阻告警",
          name: this.$t("ResistanceAlarm"),
          y: 0,
          type: "high",
          color: "#ff0",
        },
        {
          name: "内阻更换",
          name: this.$t("ResistanceFail"),
          y: 0,
          type: "high",
          color: "#d9001b",
@@ -143,13 +148,13 @@
      ],
      volChart: [
        {
          name: "高压告警",
          name: this.$t("HighvoltageAlarm"),
          y: 0,
          type: "high",
          color: "#d9001b",
        },
        {
          name: "低压告警",
          name: this.$t("LowvoltageAlarm"),
          y: 0,
          type: "low",
          color: "#ff0",
@@ -246,13 +251,13 @@
          if (!this.marks.volChart.length) {
            this.marks.volChart = [
              {
                name: "高压告警",
                name: this.$t("HighvoltageAlarm"),
                y: 0,
                type: "high",
                color: "#d9001b",
              },
              {
                name: "低压告警",
                name: this.$t("LowvoltageAlarm"),
                y: 0,
                type: "low",
                color: "#ff0",
@@ -284,7 +289,7 @@
            this.initChart();
          });
        } else {
          this.$message.error("文件解析失败");
          this.$message.error(this.$t("FileParsingFailed"));
        }
      });
    },
@@ -404,16 +409,16 @@
      resTableData.push(
        { name: time1, balanceRate: resBalanceRate[0] },
        { name: time2, balanceRate: resBalanceRate[1] },
        { name: "变化率", balanceRate: resChangeRate.pop() }
        { name: this.$t("ChangeRate"), balanceRate: resChangeRate.pop() }
      );
      volTableData.push(
        { name: time1, balanceRate: volBalanceRate[0] },
        { name: time2, balanceRate: volBalanceRate[1] },
        { name: "变化率", balanceRate: volChangeRate.pop() }
        { name: this.$t("ChangeRate"), balanceRate: volChangeRate.pop() }
      );
      headers.push({
        prop: "name",
        label: "数据",
        label: this.$t("Data"),
        minWidth: 180,
        fixed: "left",
      });
@@ -486,7 +491,7 @@
        this.toggleScreen(item);
      }
      if (this.windowList.length <= 1) {
        this.$message.warning("最少保留一个模块");
        this.$message.warning(this.$t("Keepatleastonemodule"));
        return;
      }
      const idx = this.windowList.indexOf(item);
@@ -564,7 +569,7 @@
          const matchRes = /filename=(.*)/.exec(headers["content-disposition"]);
          const fileName = matchRes
            ? decodeURI(matchRes[1].trim())
            : "未知文件名.xls";
            : this.$t("UnknownFileName") + ".xls";
          let link = document.createElement("a");
          link.style.display = "none";
          link.href = url;
@@ -574,7 +579,7 @@
          document.body.removeChild(link);
          window.URL.revokeObjectURL(url);
        } else {
          this.$message.error("操作失败");
          this.$message.error(this.$t('OperationFailed'));
        }
      });
    },