U
he wei
2024-01-15 9fc930b8eab61b7a20a2cc59a32d1cc5a4d1ba23
src/components/menuList.vue
@@ -24,7 +24,7 @@
    <div class="mask" v-show="maskVisible" @click="closeMenu"></div>
    <!-- 文件属性 -->
    <el-dialog
      title="属性"
      :title="$t('Properties')"
      class="file-info"
      :visible.sync="fileInfoVisible"
      append-to-body
@@ -43,7 +43,7 @@
    </el-dialog>
    <!-- 对比分析 -->
    <el-dialog
      title="对比分析"
      :title="$t('ComparativeAnalysis')"
      class="compare"
      :visible.sync="compareVisible"
      append-to-body
@@ -52,11 +52,11 @@
      width="800px"
    >
      <el-form ref="compareForm" :model="compareForm" label-width="80px">
        <el-form-item label="参照对象">
        <el-form-item :label="$t('ReferenceObject')">
          <el-select
            v-model="compareForm.id1"
            clearable
            placeholder="请选择参照对象"
            :placeholder="$t('Pleaseselectthereferenceobject')"
          >
            <el-option
              v-for="item in fileList1"
@@ -66,11 +66,11 @@
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="比较对象">
        <el-form-item :label="$t('ComparisonObject')">
          <el-select
            v-model="compareForm.id2"
            clearable
            placeholder="请选择比较对象"
            :placeholder="$t('Pleaseselectthecomparisonobject')"
          >
            <el-option
              v-for="item in fileList2"
@@ -80,20 +80,26 @@
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="对比项目">
        <el-form-item :label="$t('ComparisonItem')">
          <el-checkbox-group v-model="compareForm.type">
            <el-checkbox :label="1" name="type">电池电压</el-checkbox>
            <el-checkbox :label="2" name="type">电池内阻</el-checkbox>
            <el-checkbox :label="1" name="type">{{
              $t("BatteryVoltage")
            }}</el-checkbox>
            <el-checkbox :label="2" name="type">{{
              $t("BatteryResistance")
            }}</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <div class="footer">
        <el-button type="primary" @click="goCompare">开始对比分析</el-button>
        <el-button type="primary" @click="goCompare">{{
          $t("StartComparativeAnalysis")
        }}</el-button>
      </div>
    </el-dialog>
    <!-- 窗口配置 -->
    <el-dialog
      title="窗口配置"
      :title="$t('WindowConfiguration')"
      class="winconfig"
      :visible.sync="winConfigVisible"
      append-to-body
@@ -102,26 +108,40 @@
      width="600px"
    >
      <el-form ref="form" :model="winConfigForm" label-position="top">
        <el-form-item label="请勾选要显示的模块">
        <el-form-item :label="$t('Pleasecheckthemodulestobedisplayed')">
          <el-checkbox-group v-model="winConfigForm.type">
            <el-checkbox label="Vol" name="type">电压(V)</el-checkbox>
            <el-checkbox label="Res" name="type">内阻(mΩ)</el-checkbox>
            <!-- <el-checkbox label="Cap" name="type">容量(Ah)</el-checkbox> -->
            <el-checkbox label="Chain" name="type">连接条(μΩ)</el-checkbox>
            <el-checkbox label="Cond" name="type">电导(S)</el-checkbox>
            <el-checkbox label="Table" name="type">表格</el-checkbox>
            <el-checkbox label="Vol" name="type"
              >{{ $t("Voltage") }}(V)</el-checkbox
            >
            <el-checkbox label="Res" name="type"
              >{{ $t("Resistance") }}(mΩ)</el-checkbox
            >
            <!-- <el-checkbox label="Cap" name="type">{{ $t('Capacity') }}(Ah)</el-checkbox> -->
            <el-checkbox label="Chain" name="type"
              >{{ $t("ConnectionBar") }}(μΩ)</el-checkbox
            >
            <el-checkbox label="Cond" name="type"
              >{{ $t("Conductance") }}(S)</el-checkbox
            >
            <el-checkbox label="Table" name="type">{{
              $t("Sheet")
            }}</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <div class="footer">
        <el-button @click="winConfigCancel">取消</el-button>
        <el-button type="primary" @click="winConfigOk">确定</el-button>
        <el-button @click="winConfigCancel">{{
          $t("operate.cancel")
        }}</el-button>
        <el-button type="primary" @click="winConfigOk">{{
          $t("operate.ok")
        }}</el-button>
      </div>
    </el-dialog>
    <!-- 分级评价 -->
    <el-dialog
      title="分级评价"
      :title="$t('GradedEvaluation')"
      class="winconfig"
      :visible.sync="paramsVisible"
      append-to-body
@@ -143,43 +163,43 @@
            <tr>
              <th colspan="2">
                <div class="cell-box">
                  一般告警
                  {{ $t("GeneralAlarm") }}
                  <div class="color warn"></div>
                </div>
              </th>
              <th colspan="2">
                <div class="cell-box">
                  严重告警
                  {{ $t("SeriousAlarm") }}
                  <div class="color alarm"></div>
                </div>
              </th>
            </tr>
            <tr>
              <th>告警名称</th>
              <th>告警值</th>
              <th>告警名称</th>
              <th>告警值</th>
              <th>{{ $t("AlarmName") }}</th>
              <th>{{ $t("AlarmValue") }}</th>
              <th>{{ $t("AlarmName") }}</th>
              <th>{{ $t("AlarmValue") }}</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>低压告警(1.2V)</td>
              <td>{{ $t("LowvoltageAlarm") }}(1.2V)</td>
              <td>
                <el-form-item prop="vol1d2LowCoeK1">
                  <el-input
                    v-model="p_params.vol1d2LowCoeK1"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(1.2V)</td>
              <td>{{ $t("HighvoltageAlarm") }}(1.2V)</td>
              <td>
                <el-form-item prop="vol1d2HighCoeK2">
                  <el-input
                    v-model="p_params.vol1d2HighCoeK2"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
@@ -187,23 +207,23 @@
              </td>
            </tr>
            <tr>
              <td>低压告警(2V)</td>
              <td>{{ $t("LowvoltageAlarm") }}(2V)</td>
              <td>
                <el-form-item prop="vol2LowCoeK1">
                  <el-input
                    v-model="p_params.vol2LowCoeK1"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(2V)</td>
              <td>{{ $t("HighvoltageAlarm") }}(2V)</td>
              <td>
                <el-form-item prop="vol2HighCoeK2">
                  <el-input
                    v-model="p_params.vol2HighCoeK2"
                    placeholder="请输入"
                    placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
@@ -211,23 +231,23 @@
              </td>
            </tr>
            <tr>
              <td>低压告警(6V)</td>
              <td>{{ $t("LowvoltageAlarm") }}(6V)</td>
              <td>
                <el-form-item prop="vol6LowCoeK1">
                  <el-input
                    v-model="p_params.vol6LowCoeK1"
                    placeholder="请输入"
                    placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(6V)</td>
              <td>{{ $t("HighvoltageAlarm") }}(6V)</td>
              <td>
                <el-form-item prop="vol6HighCoeK2">
                  <el-input
                    v-model="p_params.vol6HighCoeK2"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
@@ -235,23 +255,23 @@
              </td>
            </tr>
            <tr>
              <td>低压告警(12V)</td>
              <td>{{ $t("LowvoltageAlarm") }}(12V)</td>
              <td>
                <el-form-item prop="vol12LowCoeK1">
                  <el-input
                    v-model="p_params.vol12LowCoeK1"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(12V)</td>
              <td>{{ $t("HighvoltageAlarm") }}(12V)</td>
              <td>
                <el-form-item prop="vol12HighCoeK2">
                  <el-input
                    v-model="p_params.vol12HighCoeK2"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">V</template>
                  </el-input>
@@ -259,44 +279,47 @@
              </td>
            </tr>
            <tr>
              <td>内阻告警</td>
              <td>{{ $t("ResistanceAlarm") }}</td>
              <td>
                <el-form-item prop="resGoodCoeK3">
                  <el-input
                    v-model="p_params.resGoodCoeK3"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>内阻更换</td>
              <td>{{ $t("ResistanceFail") }}</td>
              <td>
                <el-form-item prop="resBadCoeK4">
                  <el-input v-model="p_params.resBadCoeK4" placeholder="请输入">
                  <el-input
                    v-model="p_params.resBadCoeK4"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <td>连接条告警</td>
              <td>{{ $t("ConnectionBarAlarm") }}</td>
              <td>
                <el-form-item prop="chainResCoeK5">
                  <el-input
                    v-model="p_params.chainResCoeK5"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>连接条更换</td>
              <td>{{ $t("ConnectionBarFail") }}</td>
              <td>
                <el-form-item prop="chainResChange">
                  <el-input
                    v-model="p_params.chainResChange"
                    placeholder="请输入"
                    :placeholder="$t('form.inputMsg')"
                  >
                    <template slot="append">%</template>
                  </el-input>
@@ -307,13 +330,15 @@
        </table>
      </el-form>
      <div class="footer">
        <el-button @click="paramsCancel">取消</el-button>
        <el-button type="primary" @click="paramsOk">确定</el-button>
        <el-button @click="paramsCancel">{{ $t("operate.cancel") }}</el-button>
        <el-button type="primary" @click="paramsOk">{{
          $t("operate.ok")
        }}</el-button>
      </div>
    </el-dialog>
    <!-- 单数据分析 -->
    <el-dialog
      title="单数据分析"
      :title="$t('SingleDataAnalysis')"
      class="fileParse"
      :visible.sync="fileParseVisible"
      append-to-body
@@ -322,8 +347,12 @@
      width="800px"
    >
      <el-form ref="compareForm" label-width="80px">
        <el-form-item label="文件">
          <el-select v-model="fileUrl" clearable placeholder="请选择分析对象">
        <el-form-item :label="$t('File')">
          <el-select
            v-model="fileUrl"
            clearable
            :placeholder="$t('PleaseselecttheanalysisObjectm')"
          >
            <el-option
              v-for="item in fileList"
              :key="item.fileId"
@@ -336,7 +365,9 @@
        </el-form-item>
      </el-form>
      <div class="footer">
        <el-button type="primary" @click="fileParseOk">开始分析</el-button>
        <el-button type="primary" @click="fileParseOk">{{
          $t("StartAnalysis")
        }}</el-button>
      </div>
    </el-dialog>
    <div class="process-wrap" v-show="processVisible">
@@ -429,70 +460,76 @@
import { versionBig } from "@/assets/js/util";
import config from "@/assets/js/config.js";
import i18n from './i18n/menuList';
import { createI18nOption } from '@/assets/js/tools/i18n';
const i18nMixin = createI18nOption(i18n);
const { isStandard } = config;
const O_rules = CONST.rules;
export default {
  name: "MenuList",
  mixins: [i18nMixin],
  data() {
    // const $t = this.$t;
    const menuList = [
      {
        title: "文件",
        title: this.$t("File"),
        visible: false,
        children: [
          {
            title: "打开文件",
            title: this.$t("OpenFile"),
            method: "openFile",
          },
          {
            title: "关闭文件",
            title: this.$t("Closethefile"),
            method: "closeFile",
          },
          // {
          //   title: "关闭所有文件",
          //   title: $t('Closeallfiles'),
          //   method: "closeAllFiles",
          // },
        ],
      },
      {
        title: "分析",
        title: this.$t("Analyze"),
        visible: false,
        children: [
          {
            title: "单数据分析",
            title: this.$t("SingleDataAnalysis"),
            method: "parseOneFile",
          },
          {
            title: "对比分析",
            title: this.$t("ComparativeAnalysis"),
            method: "compareFiles",
          },
          {
            title: "分级评价",
            title: this.$t("GradedEvaluation"),
            method: "viewsParams",
          },
          {
            title: "查看属性",
            title: this.$t("ViewProperties"),
            method: "viewProp",
            disabled: true,
          },
          {
            title: "生成报告",
            title: this.$t("GenerateReport"),
            method: "exportReport",
            disabled: true,
          },
        ],
      },
      {
        title: "配置",
        title: this.$t("Configuration"),
        visible: false,
        children: [
          {
            title: "窗口配置",
            title: this.$t("WindowConfiguration"),
            method: "windowConfig",
          },
          {
            title: "数据管理",
            title: this.$t("DataManagement"),
            method: "goData",
          },
          // {
@@ -501,13 +538,13 @@
        ],
      },
      {
        title: "帮助",
        title: this.$t("Help"),
        visible: false,
        children: [
          {
            title: "升级",
            title: this.$t("Update"),
            method: "checkForUpdate",
          }
          },
        ],
      },
    ];
@@ -515,27 +552,27 @@
    if (isStandard) {
      menuList[3].children = [
        {
          title: "仪表说明书",
          title: this.$t("AnalyzerManual"),
          method: "instructionBook",
        },
        {
          title: "软件说明书",
          title: this.$t("SoftwareManual"),
          method: "softwareBook",
        },
        {
          title: "操作视频",
          title: this.$t("OperatingVideo"),
          method: "video",
        },
        {
          title: "升级",
          title: this.$t("Update"),
          method: "checkForUpdate",
        },
        {
          title: "联系支持",
          title: this.$t("Support"),
          method: "contact",
        },
        {
          title: "关于福光",
          title: this.$t("AboutFUGUANG"),
          method: "others",
        },
      ];
@@ -564,7 +601,11 @@
    };
    const rules = {
      vol1d2LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthelowvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol1d2LowCoeK1);
@@ -573,7 +614,11 @@
        },
      ],
      vol1d2HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthehighvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol1d2HighCoeK2);
@@ -582,7 +627,11 @@
        },
      ],
      vol2LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthelowvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol2LowCoeK1);
@@ -591,7 +640,11 @@
        },
      ],
      vol2HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthehighvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol2HighCoeK2);
@@ -600,7 +653,11 @@
        },
      ],
      vol6LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthelowvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol6LowCoeK1);
@@ -609,7 +666,11 @@
        },
      ],
      vol6HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthehighvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol6HighCoeK2);
@@ -618,7 +679,11 @@
        },
      ],
      vol12LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthelowvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol12LowCoeK1);
@@ -627,7 +692,11 @@
        },
      ],
      vol12HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseenterthehighvoltagethreshold"),
          trigger: "blur",
        },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol12HighCoeK2);
@@ -636,19 +705,35 @@
        },
      ],
      resGoodCoeK3: [
        { required: true, message: "请输入内阻告警系数", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseentertheresistancealarmfactor"),
          trigger: "blur",
        },
        R_resGoodCoeK3,
      ],
      resBadCoeK4: [
        { required: true, message: "请输入内阻更换系数", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseentertheresistancefailfactor"),
          trigger: "blur",
        },
        R_resGoodCoeK3,
      ],
      chainResCoeK5: [
        { required: true, message: "请输入连接条告警系数", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseentertheconnectionbaralarmfactor"),
          trigger: "blur",
        },
        R_resGoodCoeK3,
      ],
      chainResChange: [
        { required: true, message: "请输入连接条更换系数", trigger: "blur" },
        {
          required: true,
          message: this.$t("Pleaseentertheconnectionbarfailfactor"),
          trigger: "blur",
        },
        R_resGoodCoeK3,
      ],
    };
@@ -881,7 +966,7 @@
          this.currFile.fileId = undefined;
          this.fileInfoVisible = true;
        } else {
          this.$message.error("文件解析失败");
          this.$message.error(this.$t("FileParsingFailed"));
        }
      });
    },
@@ -900,7 +985,7 @@
            cbfn();
          }
        } else {
          this.$message.error("文件解析失败");
          this.$message.error(this.$t("FileParsingFailed"));
        }
      });
    },
@@ -914,9 +999,9 @@
      updateFileParam(this.currFile.stationId, data).then((res) => {
        const { code, data } = res.data;
        if (code && data) {
          this.$message.success("修改成功");
          this.$message.success(this.$t("ModifySuccessfully"));
        } else {
          this.$message.error("修改失败");
          this.$message.error(this.$t("ModifyFailed"));
        }
      });
      this.toRes();
@@ -966,15 +1051,15 @@
    goCompare() {
      const { id1: baseFileId, id2: fileId, type } = this.compareForm;
      if (!baseFileId) {
        this.$message.warning("请选择参照对象");
        this.$message.warning(this.$t("Pleaseselectthereferenceobject"));
        return false;
      }
      if (!fileId) {
        this.$message.warning("请选择比较对象");
        this.$message.warning(this.$t("Pleaseselectthecomparisonobject"));
        return false;
      }
      if (!type.length) {
        this.$message.warning("请勾选对比项目");
        this.$message.warning(this.$t("PleaseselectComparisonItem"));
        return false;
      }
      const opts = type.reduce((total, num) => total + num);
@@ -998,7 +1083,7 @@
    winConfigOk() {
      const type = this.winConfigForm.type;
      if (!type.length) {
        this.$message.warning("请至少勾选一个模块");
        this.$message.warning(this.$t("Pleaseselectatleastonemodule"));
        return false;
      }
      ["Vol", "Res", "Cap", "Table", "Chain", "Cond"].forEach((v) => {
@@ -1058,27 +1143,27 @@
            const { code, data } = res.data;
            if (code) {
              this.setParams(this.p_params);
              this.$message.success("更新成功");
              this.$message.success(this.$t("Updatesuccessfully"));
              this.paramsVisible = false;
              this.$bus.$emit("paramsUpdated");
            } else {
              this.$message.error("操作失败");
              this.$message.error(this.$t("OperationFailed"));
            }
          });
        } else {
          const field = {
            vol1d2LowCoeK1: "低压阈值(1.2V)",
            vol1d2HighCoeK2: "高压阈值(1.2V)",
            vol2LowCoeK1: "低压阈值(2V)",
            vol2HighCoeK2: "高压阈值(2V)",
            vol6LowCoeK1: "低压阈值(6V)",
            vol6HighCoeK2: "高压阈值(6V)",
            vol12LowCoeK1: "低压阈值(12V)",
            vol12HighCoeK2: "高压阈值(12V)",
            resGoodCoeK3: "内阻告警系数",
            resBadCoeK4: "内阻更换系数",
            chainResCoeK5: "连接条告警系数",
            chainResChange: "连接条更换系数",
            vol1d2LowCoeK1: this.$t("LowvoltageThreshold") + "(1.2V)",
            vol1d2HighCoeK2: this.$t("HighvoltageThreshold") + "(1.2V)",
            vol2LowCoeK1: this.$t("LowvoltageThreshold") + "(2V)",
            vol2HighCoeK2: this.$t("HighvoltageThreshold") + "(2V)",
            vol6LowCoeK1: this.$t("LowvoltageThreshold") + "(6V)",
            vol6HighCoeK2: this.$t("HighvoltageThreshold") + "(6V)",
            vol12LowCoeK1: this.$t("LowvoltageThreshold") + "(12V)",
            vol12HighCoeK2: this.$t("HighvoltageThreshold") + "(12V)",
            resGoodCoeK3: this.$t("ResistanceAlarmFactor"),
            resBadCoeK4: this.$t("ResistanceFailFactor"),
            chainResCoeK5: this.$t("ConnectionBarAlarmFactor"),
            chainResChange: this.$t("ConnectionBarFailFactor"),
          };
          let errStr = "";
          Object.keys(info).forEach((val) => {
@@ -1087,7 +1172,7 @@
            });
          });
          this.$message.error({
            message: "存在校验未通过的数据!" + errStr,
            message: this.$t('Thereexistsunverifieddata') + errStr,
            duration: 5000,
          });
          return false;
@@ -1096,7 +1181,7 @@
    },
    fileParseOk() {
      if (!this.fileUrl) {
        this.$message.warning("请选择要分析的文件");
        this.$message.warning(this.$t('Pleaseselectthefiletoanalyze'));
        return false;
      }
      // console.log(this.fileUrl);
@@ -1350,4 +1435,4 @@
    text-align: right;
  }
}
</style>
</style>