<template>
  <div class="el-input-all">
    <el-input v-if="item.dataType == 1" v-model.trim="value" class="input-item" :placeholder="$t('请输入') + item.name" clearable :disabled="!!item.field"/>
    <el-input v-else-if="item.dataType == 2" v-model.number="value" class="input-item" :placeholder="$t('请输入') + item.name" clearable :disabled="!!item.field"/>
    <el-input-money v-else-if="item.dataType == 3" v-model="value" class="input-item" :placeholder="$t('请输入') + item.name" clearable :disabled="!!item.field"/>
    <el-date-picker v-else-if="item.dataType == 4" v-model="value" class="input-item" :placeholder="$t('请选择') + item.name" clearable :disabled="!!item.field" type="date"/>
    <el-time-picker v-else-if="item.dataType == 5"  v-model="value" class="input-item" :placeholder="$t('请选择') + item.name" clearable :disabled="!!item.field"/>
    <el-date-picker v-else-if="item.dataType == 6" v-model="value" class="input-item" :placeholder="$t('请选择') + item.name" clearable :disabled="!!item.field" type="datetime"/>
    <el-select v-else-if="item.dataType == 7" v-model="value" class="input-item" :placeholder="$t('请选择') + item.name" clearable filterable :disabled="!!item.field">
      <el-option v-for="option in item.dictList" :key="option.id" :value="option.value" :label="option.name"/>
    </el-select>
    <el-cascader v-else-if="item.dataType == 8" v-model="value" class="input-item" :placeholder="$t('请选择') + item.name" clearable :disabled="!!item.field" :options="item.dictList"/>
  </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: {
    showChildren() {

    },
  },
  created() {

  }
}
</script>

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