he wei
2022-11-13 b4816f6294646157b50bb49f1d19eaf306e0ac8c
src/pages/compare.vue
@@ -112,6 +112,10 @@
import offset from "@/assets/js/offset";
import { comparedList, testCompareReport } from "@/apis";
import { mapGetters } from "vuex";
import { toFixed } from "@/assets/js/util";
// 保留三位小数
const BIT = 3;
export default {
  name: "",
@@ -218,20 +222,35 @@
          this.fileData.data2 = data2;
          this.fileData.data3 = data3;
          const {
            chainResCoeK5,
            resBadCoeK4,
            resGoodCoeK3,
            volHighCoeK2,
            volLowCoeK1,
            vol2HighCoeK2,
            vol2LowCoeK1,
            vol12HighCoeK2,
            vol12LowCoeK1,
          } = this.params;
          const { battRes, battVol } = data3.fileParamBase;
          this.marks.resChart[0].y = resGoodCoeK3 * battRes;
          this.marks.resChart[1].y = resBadCoeK4 * battRes;
          this.marks.resChart[0].y = toFixed(
            (resGoodCoeK3 * battRes) / 100,
            BIT
          );
          this.marks.resChart[1].y = toFixed(
            (resBadCoeK4 * battRes) / 100,
            BIT
          );
          this.marks.volChart[0].y = volHighCoeK2 * battVol;
          this.marks.volChart[1].y = volLowCoeK1 * battVol;
          this.initChart();
          if (2 == battVol) {
            this.marks.volChart[0].y = toFixed(vol2HighCoeK2, BIT);
            this.marks.volChart[1].y = toFixed(vol2LowCoeK1, BIT);
          } else if (12 == battVol) {
            this.marks.volChart[0].y = toFixed(vol12HighCoeK2, BIT);
            this.marks.volChart[1].y = toFixed(vol12LowCoeK1, BIT);
          } else {
            this.marks.volChart = [];
          }
          this.$nextTick(() => {
            this.initChart();
          });
        } else {
          this.$message.error("文件解析失败");
        }
@@ -281,6 +300,9 @@
      );
      this.$bus.$on("export", this.exportReport);
      this.$bus.$on("paramsUpdated", () => {
        this.refreshPage(true);
      });
    },
    removeListener() {
      document.removeEventListener("fullscreenchange", this.fullScreenListener);
@@ -476,9 +498,20 @@
        return this.$refs[ref][0];
      }
    },
    activeFN() {
      this.$nextTick(() => {
        this.resize();
      });
    },
    refreshPage(force) {
      if (!force && (this._isDestroyed || this._directInactive)) {
        return false;
      }
      this.comparedList();
    },
    exportReport() {
      // console.log(this, 'export')
      if (this._directInactive) {
      if (this._isDestroyed || this._directInactive) {
        return false;
      }
      const {
@@ -492,7 +525,7 @@
        fileId,
        fileId2,
      };
      testCompareReport(params, {resPic, volPic}).then((res) => {
      testCompareReport(params, { resPic, volPic }).then((res) => {
        let { headers, data, status } = res;
        if (200 == status && data) {
          let url = window.URL.createObjectURL(data);