he wei
2023-12-08 f182d3bafb07fe93a4109742cb3553b795c6c919
src/views/powerCabinetControl/components/ipCard.vue
@@ -15,11 +15,19 @@
      </div>
      <div class="row">
        模拟:
        <ip-input class="input" :onChange="change" :onBlur="blur" :ip="ip"></ip-input>
        <ip-input
          class="input"
          :onChange="change"
          :onBlur="blur"
          :ip="ip"
        ></ip-input>
        <div class="btn">
          <gradient-btn :active="setFlag" size="xs">{{
            setFlag ? "设定中" : "设定"
          }}</gradient-btn>
          <gradient-btn
            :active="setFlag"
            size="xs"
            :disabled="!hasPermission"
            >{{ setFlag ? "设定中" : "设定" }}</gradient-btn
          >
        </div>
      </div>
    </div>
@@ -42,8 +50,8 @@
    },
    ip: {
      type: String,
      required: true
    }
      required: true,
    },
  },
  data() {
    return {
@@ -55,21 +63,26 @@
    gradientBtn,
    IpInput,
  },
  computed: {
    hasPermission() {
      return this.$store.state.user.downloadFlag == 1;
    },
  },
  methods: {
    change(value) {
      // console.log(value, 'ip change', value.split('.'));
      let segments = value.split('.');
      if(!segments.some(v=>v=='')){
      let segments = value.split(".");
      if (!segments.some((v) => v == "")) {
        // console.log(value, 'ip', this.ip);
        this.$emit('update:ip', value);
        this.$emit('change', value);
        this.$emit("update:ip", value);
        this.$emit("change", value);
      }
    },
    blur(value) {
      // console.log(value, 'blur', this.ip);
      this.$emit('update:ip', value);
      this.$emit('blur', value)
    }
      this.$emit("update:ip", value);
      this.$emit("blur", value);
    },
  },
  mounted() {},