<template>
  <div class="table_in_s">
    <el-select
      ref="inp"
      v-model="selectValue"
      :disabled="couldNotEdit"
      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>
      <template v-else>
        <el-option label="是" value="1"></el-option>
        <el-option label="否" value="0"></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: ""
    },
    rowId: {
      type: Number,
      default: 0
    },
    couldNotEdit: {
      type: Boolean,
      default: false
    }
  },
  data: () => ({
    selectValue: ""
  }),
  mounted() {
    this.selectValue = this.item;
  },
  methods: {
    changeValue() {
      this.$emit("changeInputValue", {
        rowId: this.rowId,
        header: this.header,
        inputValue: this.selectValue
      });
    }
  }
};
</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>