dyncFormItemComponent.vue 1.63 KB
Newer Older
何虹's avatar
何虹 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
<template>
    <div  v-if='isShowItem(item)' class="itemBox">
      <label v-if="showLabel(item)" class="el-form-item__label labelDefaultWidth labelTextOverflow"  :style="{width:item.labelWidth+'px'}">
        <i v-if="item.isRequired" class="isRequiredIcon">*</i>
           {{item.label}}
      </label>
      <div class="el-form-item__label" :style="{width:item.width+'px'}">
         <childItem
           :readonlyStatus='readonlyStatus'
           :item='item'
           :formParms='formParms'
           :type='type'
           :jsoneditorOpenAfter='jsoneditorOpenAfter'
           @enterInput='enterInput'
         ></childItem>
      </div>
  </div>
</template>
<script>
import childItem from './dyncFormItemComponentChild'
export default {
  name: 'asyncFormItemComponent',
  components: {
    childItem
  },
  props: {
    type: {},
    item: {},
    formParms: {},
    jsoneditorOpenAfter: {
      type: Function
    },
    readonlyStatus: {}
  },
  data() {
    return {}
  },
  mounted() {
  },
  methods: {
    enterInput(val) {
      this.$emit('enterInput', val)
    },
    showLabel(item) {
      if (item.isHideLabel) {
        return false
      }
      if (!item.label) {
        return false
      }
      return true
    },
    isShowItem(item) {
      if (this.type === 'queryArea' && item.isMoreSearch) {
        return false
      }
      if (!item.isHide) {
        return true
      }
    }
  }
}
</script>
<style scoped>
.isRequiredIcon{
  color: red;
}
.itemBox{
  display: flex;
}
.labelTextOverflow{
    overflow: hidden;
    text-overflow: initial !important;
    white-space: nowrap;
}
.labelDefaultWidth{
  width: 120px;
}
</style>