<template>
  <div class="form-container">
    <LabelComp :label="formItemObj.name" :popText="formItemObj.note" />
    <component
      v-bind:is="cur_comp[formItemObj.dataType]"
      :initValue="info[formItemObj.path]"
      :isDisabled="!formItemObj.unDisabled"
      :unit="formItemObj.unit"
      :selectData="formItemObj.dataSource"
      :formItemObj="formItemObj"
    />
  </div>
</template>
<script>
// import LabelComp from "./items/label.vue";
import LabelComp from "./items/label.vue";
import InputComp from "./items/input.vue";
import SelectComp from "./items/select.vue";
import DateComp from "./items/date.vue";
import UploadComp from "./items/upload.vue";
export default {
  components: {
    LabelComp,
  },
  props: {
    formItemObj: {
      type: Object,
      default: () => {
        return {};
      },
    },
    info: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      cur_comp: {
        INTEGER: InputComp,
        STRING: InputComp,
        DOUBLE: InputComp,
        TEXT: InputComp,
        ENUM: SelectComp,
        DATETIME: DateComp,
        ATTACHMENT: UploadComp,
      },
    };
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.form-container {
  display: flex;
  align-items: center;
}
</style>
