he wei
2024-11-09 5cc9eb2d302ffe6218221208a28b60f91b57e41e
src/views/test/devCard.vue
@@ -3,6 +3,10 @@
import { ref, computed } from "vue";
import formatSeconds from "@/assets/js/tools/formatSeconds";
import toFixed from "@/assets/js/tools/toFixed.js";
import const_digits from "@/assets/js/const/const_digits";
const { VOL, GROUPVOL, CURR_YT, CURR_JH } = const_digits;
const props = defineProps({
  devIdcode: {
    type: [String, Number],
@@ -17,20 +21,30 @@
  info: {
    type: Object,
    required: true,
  }
  },
});
// 是否只有一组
const isOnlyOne = computed(() => {
  return 1 == props.info.state[0].batteryCount;
});
const testStates = computed(() => {
  if (1 == props.devType) {
    return ["--", "放电测试", "充电测试"][props.info.state?.testType];
    if (props.info.state.testPause) {
      return "暂停中";
    } else if (props.info.state.isTesting) {
      return ["--", "放电测试", "充电测试"][props.info.state?.testType];
    } else {
      return "--";
    }
  } else {
    let states = ["充电", "放电", "均衡"];
    let [res1, res2] = [0, 1].map((v) =>
      props.info.state
        ? states[props.info.state[v].workMode] || "--"
        : "--"
    );
    return `组1:${res1}, 组2: ${res2}`;
    // let states = ["充电", "放电", "均衡"];
    // let [res1, res2] = [0, 1].map((v) =>
    //   props.info.state ? states[props.info.state[v].workMode] || "--" : "--"
    // );
    let [res1, res2] = [0, 1].map((v) => props.info.state[v].moduleStatus);
    return isOnlyOne.value ? `组1:${res1}` : `组1:${res1}, 组2: ${res2}`;
  }
});
</script>
@@ -59,11 +73,11 @@
        <div class="info">
          <template v-if="1 == props.devType">
            <div class="item">
              {{ info.state.storageVoltage }}V
              {{ toFixed(info.state.storageVoltage, GROUPVOL) }}V
              <div class="link"></div>
            </div>
            <div class="item">
             {{ info.state.testCurrent }}A
              {{ toFixed(info.state.testCurrent, CURR_YT) }}A
              <div class="link"></div>
            </div>
            <div class="item">
@@ -85,11 +99,11 @@
              <div class="link"></div>
            </div>
            <div class="item index">
              #2
              {{ isOnlyOne ? "--" : "#2" }}
              <div class="link"></div>
            </div>
            <div class="item">
              {{ info.state[1].moduleStatus }}
              {{ isOnlyOne ? "--" : info.state[1].moduleStatus }}
              <div class="link"></div>
            </div>
          </template>
@@ -104,7 +118,9 @@
        {{ onLine ? "在线" : "离线" }}
      </div>
      <div class="wrap" v-else>
        <div class="workstate">{{ info.state.isTesting ? testStates : '--' }}</div>
        <div class="workstate">
          {{ testStates }}
        </div>
        <icon-arrow-right class="icon"></icon-arrow-right>
      </div>
    </div>