<template>
  <el-input-number :id="id" :class="{'highlight': highlight}" ref="form-item" v-model="model" :controls="false" v-bind="$attrs" v-on="$listeners" v-bind:disabled="isDisable"/>
</template>

<script>
export default {
  props: {
    value: {
      type: Number,
      default: undefined
    },
    disabled: {
      type: Boolean,
      default: false
    },
    id: {
      type: String,
      default: undefined
    }
  },
  computed: {
    model: {
      get () {
        return this.value
      },
      set (newVal) {
        this.$emit('input', newVal)
      }
    },
    mode () {
      return this.$store.state.Status.mode
    },
    isDisable: {
      get () {
        return this.mode === 'display' || this.disabled
      }
    },
    highlight () {
      return this.$store.state.Status.highlights.indexOf(this.id) !== -1
    }
  }
}
</script>
<style scope>
.el-input-number .el-input__inner  {
  text-align: left;
}
.el-input.highlight .el-input__inner{
  border-color: red;
}
</style>