<template>
  <div class="el-input-all">
    <el-input v-if="item.dataType === 1" v-model="value" class="input-item" :placeholder="'请输入' + item.name" clearable :disabled="!!item.relationField"/>
    <el-input-number v-if="item.dataType === 2" v-model="value" class="input-item" :placeholder="'请输入' + item.name" clearable :disabled="!!item.relationField"/>
    <el-input-money v-if="item.dataType === 3" v-model="value" class="input-item" :placeholder="'请输入' + item.name" clearable :disabled="!!item.relationField"/>
    <el-date-picker v-if="item.dataType === 4" v-model="value" class="input-item" :placeholder="'请选择' + item.name" clearable :disabled="!!item.relationField" type="date"/>
    <el-time-picker v-if="item.dataType === 5"  v-model="value" class="input-item" :placeholder="'请选择' + item.name" clearable :disabled="!!item.relationField"/>
    <el-date-picker v-if="item.dataType === 6" v-model="value" class="input-item" :placeholder="'请选择' + item.name" clearable :disabled="!!item.relationField" type="datetime"/>
    <el-select v-if="item.dataType === 7" v-model="value" class="input-item" :placeholder="'请选择' + item.name" clearable filterable :disabled="!!item.relationField">
      <el-option v-for="option in item.dictDataList" :key="option.id" :value="option.value" :label="option.name"/>
    </el-select>
  </div>
</template>

<script>

export default {
  name: 'ElInputAll',
  model: {
    prop: 'val',
    event: 'update',
  },
  props: {
    val: {type: [Number, String, Date, Array, Object]},
    item: {type: Object, required: true},
  },
  computed: {
    value: {
      get() {
        return this.val
      },
      set(val) {
        this.$emit('update', val)
      }
    }
  },
  data() {
    return {}
  },
  methods: {},
  created() {

  }
}
</script>

<style scoped>
.input-item {
  width: 100%;
}
</style>
