<template>
  <div class="table_in_s">
    <el-select
      ref="inp"
      v-model="selectValue"
      :disabled="couldNotEdit || name == ''"
      size="small"
      @input="changeValue"
      class="table_in_select"
      placeholder="请选择"
    >
      <template v-if="selectArr && selectArr.length > 0">
        <el-option
          v-for="(item,index) in selectArr"
          :key="index+3500"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </template>
    </el-select>
  </div>
</template>

<script>
import helper from "@/services/helper";
export default {
  props: {
    selectArr: {
      type: Array,
      default: () => {
        [];
      }
    },
    item: {
      type: String,
      default: ""
    },
    header: {
      type: String,
      default: ""
    },
    id: {
      type: String,
      default: ""
    },
    name: {
      type: String,
      default: ""
    },
    rowId: {
      type: Number,
      default: 0
    },
    couldNotEdit: {
      type: Boolean,
      default: false
    }
  },
  data: () => ({
    selectValue: "1"
  }),
  mounted() {
    this.selectValue = this.item;
    if (!this.selectValue || this.selectValue == "") {
      this.selectValue = this.selectArr[0].value;
    }
  },
  methods: {
    changeValue() {
      this.$emit("changeInputValue", {
        rowId: this.rowId,
        header: this.header,
        inputValue: this.selectValue,
        id: this.id
      });
    }
  }
};
</script>
<style scoped>
.table_in_s {
  height: 32px;
}

.table_in_select {
  text-align: center;
  font-size: 14px;
}
</style>
<style>
.table_in_s input {
  width: 100%;
  background-color: #f7f8f9;
  border-radius: 4px;
}
.table_in_s .el-input.is-disabled .el-input__inner {
  color: #70747c;
}
</style>