he wei
2022-11-17 cd327dcbaca3476df44b064e56b950dc054cbb87
src/components/menuList.vue
@@ -141,116 +141,170 @@
        <table class="table">
          <thead>
            <tr>
              <th>系数名称</th>
              <th>系数值</th>
              <th>评价</th>
              <th colspan="2">
                <div class="cell-box">
                  一般告警
                  <div class="color warn"></div>
                </div>
              </th>
              <th colspan="2">
                <div class="cell-box">
                  严重告警
                  <div class="color alarm"></div>
                </div>
              </th>
            </tr>
            <tr>
              <th>告警名称</th>
              <th>告警值</th>
              <th>告警名称</th>
              <th>告警值</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>低压告警(1.2V)</td>
              <td>
                <el-form-item prop="vol1d2LowCoeK1">
                  <el-input
                    v-model="p_params.vol1d2LowCoeK1"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(1.2V)</td>
              <td>
                <el-form-item prop="vol1d2HighCoeK2">
                  <el-input
                    v-model="p_params.vol1d2HighCoeK2"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <td>低压告警(2V)</td>
              <td>
                <el-form-item prop="vol2LowCoeK1">
                  <el-input
                    type="number"
                    v-model="p_params.vol2LowCoeK1"
                    placeholder="请输入低压告警"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="alarm"></td>
            </tr>
            <tr>
              <td>高压告警(2V)</td>
              <td>
                <el-form-item prop="vol2HighCoeK2">
                  <el-input
                    type="number"
                    v-model="p_params.vol2HighCoeK2"
                    placeholder="请输入高压告警"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="warn"></td>
            </tr>
            <tr>
              <td>低压告警(6V)</td>
              <td>
                <el-form-item prop="vol6LowCoeK1">
                  <el-input
                    v-model="p_params.vol6LowCoeK1"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td>高压告警(6V)</td>
              <td>
                <el-form-item prop="vol6HighCoeK2">
                  <el-input
                    v-model="p_params.vol6HighCoeK2"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <td>低压告警(12V)</td>
              <td>
                <el-form-item prop="vol12LowCoeK1">
                  <el-input
                    type="number"
                    v-model="p_params.vol12LowCoeK1"
                    placeholder="请输入低压告警"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="alarm"></td>
            </tr>
            <tr>
              <td>高压告警(12V)</td>
              <td>
                <el-form-item prop="vol12HighCoeK2">
                  <el-input
                    type="number"
                    v-model="p_params.vol12HighCoeK2"
                    placeholder="请输入高压告警"
                    placeholder="请输入"
                  >
                    <template slot="append">V</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="warn"></td>
            </tr>
            <tr>
              <td>内阻告警</td>
              <td>
                <el-form-item prop="resGoodCoeK3">
                  <el-input
                    type="number"
                    v-model="p_params.resGoodCoeK3"
                    placeholder="请输入内阻告警"
                    placeholder="请输入"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="warn"></td>
            </tr>
            <tr>
              <td>内阻更换</td>
              <td>
                <el-form-item prop="resBadCoeK4">
                  <el-input
                    type="number"
                    v-model="p_params.resBadCoeK4"
                    placeholder="请输入内阻更换"
                    placeholder="请输入"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="alarm"></td>
            </tr>
            <tr>
              <td>连接条告警</td>
              <td>
                <el-form-item prop="chainResCoeK5">
                  <el-input
                    type="number"
                    v-model="p_params.chainResCoeK5"
                    placeholder="请输入连接条告警"
                    placeholder="请输入"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
              <td class="alarm"></td>
              <td>连接条更换</td>
              <td>
                <el-form-item prop="chainResChange">
                  <el-input
                    v-model="p_params.chainResChange"
                    placeholder="请输入"
                  >
                    <template slot="append">%</template>
                  </el-input>
                </el-form-item>
              </td>
            </tr>
          </tbody>
        </table>
@@ -296,6 +350,48 @@
      ></el-progress>
    </div>
    <div class="process-mask" v-show="processVisible"></div>
    <!-- 更新日志 -->
    <el-dialog
      title="检测到新版本,请确认是否下载"
      class="update-info"
      :visible.sync="updateInfoVisible"
      append-to-body
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      width="450px"
    >
      <div class="title">
        检测到新版本
        <div class="version">V{{ pkgVersion }}</div>
        <div class="size">大小:{{ pkgSize }} MB</div>
      </div>
      <div class="log">
        <div class="title">更新日志:</div>
        <div class="log-list">
          <div
            class="log-item"
            v-for="(item, index) in logList"
            :key="'list_' + index"
          >
            <div class="item-version">V{{ item.version }}</div>
            <div class="item-info">
              <div
                class="sub-item"
                v-for="(note, idx) in item.notes"
                :key="'note_' + idx"
              >
                <span class="index">{{ idx + 1 }})</span
                >{{ note }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="footer">
        <el-button type="primary" @click="downloadOk">下载更新</el-button>
        <el-button @click="downloadCancel">暂不更新</el-button>
      </div>
    </el-dialog>
    <!-- 是否安装更新 -->
    <el-dialog
      title="是否安装更新"
@@ -330,6 +426,7 @@
  setParams,
  updateFileParam,
} from "@/apis";
import axios from "axios";
import { mapGetters, mapMutations } from "vuex";
import CONST from "@/assets/js/const";
import testVal from "@/assets/js/testVal";
@@ -436,12 +533,18 @@
      },
    ];
    const p_params = {
      // chainResChange
      chainResChange: 160,
      chainResCoeK5: 120,
      enabled: 1,
      resBadCoeK4: 160,
      resGoodCoeK3: 125,
      vol1d2HighCoeK2: 1.44,
      vol1d2LowCoeK1: 0.96,
      vol2HighCoeK2: 2.35,
      vol2LowCoeK1: 1.8,
      vol6HighCoeK2: 7.05,
      vol6LowCoeK1: 5.4,
      vol12HighCoeK2: 14.1,
      vol12LowCoeK1: 10.8,
    };
@@ -452,6 +555,24 @@
      trigger: ["change", "blur"],
    };
    const rules = {
      vol1d2LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol1d2LowCoeK1);
          },
          trigger: ["change", "blur"],
        },
      ],
      vol1d2HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol1d2HighCoeK2);
          },
          trigger: ["change", "blur"],
        },
      ],
      vol2LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
@@ -466,6 +587,24 @@
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol2HighCoeK2);
          },
          trigger: ["change", "blur"],
        },
      ],
      vol6LowCoeK1: [
        { required: true, message: "请输入低压阈值", trigger: "blur" },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol6LowCoeK1);
          },
          trigger: ["change", "blur"],
        },
      ],
      vol6HighCoeK2: [
        { required: true, message: "请输入高压阈值", trigger: "blur" },
        {
          validator(rule, value, callback) {
            testVal(rule, value, callback, O_rules.vol6HighCoeK2);
          },
          trigger: ["change", "blur"],
        },
@@ -500,12 +639,19 @@
        { required: true, message: "请输入连接条告警系数", trigger: "blur" },
        R_resGoodCoeK3,
      ],
      chainResChange: [
        { required: true, message: "请输入连接条更换系数", trigger: "blur" },
        R_resGoodCoeK3,
      ],
    };
    return {
      rules,
      askInstallVisible: false,
      updateInfoVisible: false,
      pkgVersion: "",
      pkgPath: "",
      pkgSize: 0,
      logList: [],
      percent: 0,
      processVisible: false,
      fileParseVisible: false,
@@ -570,7 +716,7 @@
    },
    params(n) {
      this.p_params = Object.assign({}, n);
    }
    },
  },
  methods: {
    ...mapMutations("setting", [
@@ -650,6 +796,9 @@
        this.askInstallVisible = true;
      });
      // 检测到更新  更新信息
      window.api.receive("update-info", this.showUpdateInfo);
      // this.$bus.$on("checkCloseAll", this.checkCloseAll);
      this.$bus.$on("setAlarmValue", this.viewsParams);
@@ -665,6 +814,41 @@
    },
    installCancel() {
      this.askInstallVisible = false;
    },
    downloadOk() {
      this.updateInfoVisible = false;
      window.api.send("download-update");
    },
    downloadCancel() {
      this.updateInfoVisible = false;
    },
    showUpdateInfo(data) {
      const { info, updataPath, currentVersion } = data;
      axios({
        method: "GET",
        url: `${updataPath}/update.info.json?t=${Math.random()}`,
      }).then((res) => {
        // console.log(res, info, "====json");
        let { data, status } = res;
        if (200 == status && data) {
          const { versions, notes } = data;
          let list = [];
          this.pkgSize = Math.round(info.files[0].size / 1024 / 1024 * 100) / 100;
          this.pkgVersion = info.version;
          for (let i = versions.length; i-- >= 0; ) {
            let version = versions[i];
            if (version == currentVersion) {
              break;
            }
            list.push({
              version,
              notes: notes[version],
            });
          }
          this.logList = list;
          this.updateInfoVisible = true;
        }
      });
    },
    updateProgress(progressObj) {
      if (!this.processVisible) {
@@ -869,13 +1053,18 @@
          });
        } else {
          const field = {
            vol2LowCoeK1: "低压阈值",
            vol2HighCoeK2: "高压阈值",
            vol12LowCoeK1: "低压阈值",
            vol12HighCoeK2: "高压阈值",
            vol1d2LowCoeK1: "低压阈值(1.2V)",
            vol1d2HighCoeK2: "高压阈值(1.2V)",
            vol2LowCoeK1: "低压阈值(2V)",
            vol2HighCoeK2: "高压阈值(2V)",
            vol6LowCoeK1: "低压阈值(6V)",
            vol6HighCoeK2: "高压阈值(6V)",
            vol12LowCoeK1: "低压阈值(12V)",
            vol12HighCoeK2: "高压阈值(12V)",
            resGoodCoeK3: "内阻告警系数",
            resBadCoeK4: "内阻更换系数",
            chainResCoeK5: "连接条告警系数",
            chainResChange: "连接条更换系数",
          };
          let errStr = "";
          Object.keys(info).forEach((val) => {
@@ -1063,20 +1252,30 @@
    border: 1px #333 solid;
    padding: 4px;
  }
  td {
    // color: #13c2c2;
    &.warn {
      background: #ff0;
    }
    &.alarm {
      background: #d9001b;
  .cell-box {
    display: flex;
    justify-content: center;
    align-items: center;
    .color {
      width: 6em;
      height: 1.6em;
      margin-left: 4px;
      // border: 0.5px #000 solid;
      box-shadow: 1px 1px #000;
      display: inline-block;
      &.warn {
        background: #ff0;
      }
      &.alarm {
        background: #d9001b;
      }
    }
  }
}
:deep(input)[type="number"]::-webkit-outer-spin-button,
:deep(input)[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
}
// :deep(input)[type="number"]::-webkit-outer-spin-button,
// :deep(input)[type="number"]::-webkit-inner-spin-button {
//   -webkit-appearance: none !important;
// }
.process-wrap {
  position: fixed;
  left: 50%;
@@ -1105,4 +1304,36 @@
    text-align: right;
  }
}
.update-info :deep(.el-dialog__body) {
  padding: 10px 20px;
  .title {
    display: flex;
    margin-bottom: 10px;
  }
  .size {
    margin-left: 3em;
  }
  .item-version,
  .version {
    margin-left: 0.4em;
    display: inline-block;
    font-weight: 700;
    color: #090;
  }
  .log-list {
    max-height: 200px;
    overflow-y: auto;
  }
  .item-info {
    padding-left: 2em;
    .index {
      display: inline-block;
      margin-right: 0.6em;
    }
  }
  .footer {
    margin-top: 1.6em;
    text-align: right;
  }
}
</style>