|
@@ -5,52 +5,54 @@
|
|
<template v-if="!loading">
|
|
<template v-if="!loading">
|
|
<el-form-item v-if="display(item)" :key="'form-field-' + index" :label="getField('label', item)" :prop="item.model" :required="item.required">
|
|
<el-form-item v-if="display(item)" :key="'form-field-' + index" :label="getField('label', item)" :prop="item.model" :required="item.required">
|
|
<template v-if="!item.custom">
|
|
<template v-if="!item.custom">
|
|
- <template v-if="item.type === `date` || item.type === `datetime`">
|
|
|
|
- <el-date-picker v-model="form[item.model]" :type="item.type" placeholder="选择择" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
|
|
|
|
- </el-date-picker>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === `year` || item.type === `week` || item.type === `day`">
|
|
|
|
- <el-date-picker
|
|
|
|
- v-model="form[item.model]"
|
|
|
|
- :type="item.type"
|
|
|
|
- placeholder="选择择"
|
|
|
|
- :format="`${item.type === 'year' ? 'yyyy' : item.type === 'week' ? 'MM' : 'dd'}`"
|
|
|
|
- :value-format="`${item.type === 'year' ? 'yyyy' : item.type === 'week' ? 'MM' : 'dd'}`"
|
|
|
|
- >
|
|
|
|
- </el-date-picker>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'radio'">
|
|
|
|
- <el-radio-group v-model="form[item.model]" size="mini" v-bind="item.options">
|
|
|
|
- <slot name="radios" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'checkbox'">
|
|
|
|
- <el-checkbox-group v-model="form[item.model]" v-bind="item.options">
|
|
|
|
- <slot name="checkboxs" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
- </el-checkbox-group>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'select'">
|
|
|
|
- <el-select v-model="form[item.model]" v-bind="item.options" filterable>
|
|
|
|
- <slot name="options" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
- </el-select>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'textarea'">
|
|
|
|
- <el-input v-model="form[item.model]" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }"></el-input>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'editor'">
|
|
|
|
- <wang-editor v-model="form[item.model]"></wang-editor>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="item.type === 'text'">
|
|
|
|
- {{ form[item.model] }}
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <el-input
|
|
|
|
- v-model="form[item.model]"
|
|
|
|
- :type="getField('type', item)"
|
|
|
|
- :placeholder="getField('placeholder', item)"
|
|
|
|
- v-bind="item.options"
|
|
|
|
- ></el-input>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-tooltip class="item" effect="dark" :content="item.tip" placement="top-start" :disabled="!item.tip">
|
|
|
|
+ <template v-if="item.type === `date` || item.type === `datetime`">
|
|
|
|
+ <el-date-picker v-model="form[item.model]" :type="item.type" placeholder="选择择" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === `year` || item.type === `week` || item.type === `day`">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="form[item.model]"
|
|
|
|
+ :type="item.type"
|
|
|
|
+ placeholder="选择择"
|
|
|
|
+ :format="`${item.type === 'year' ? 'yyyy' : item.type === 'week' ? 'MM' : 'dd'}`"
|
|
|
|
+ :value-format="`${item.type === 'year' ? 'yyyy' : item.type === 'week' ? 'MM' : 'dd'}`"
|
|
|
|
+ >
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'radio'">
|
|
|
|
+ <el-radio-group v-model="form[item.model]" size="mini" v-bind="item.options">
|
|
|
|
+ <slot name="radios" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'checkbox'">
|
|
|
|
+ <el-checkbox-group v-model="form[item.model]" v-bind="item.options">
|
|
|
|
+ <slot name="checkboxs" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'select'">
|
|
|
|
+ <el-select v-model="form[item.model]" v-bind="item.options" filterable>
|
|
|
|
+ <slot name="options" v-bind="{ item, form, fieldChange }"></slot>
|
|
|
|
+ </el-select>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'textarea'">
|
|
|
|
+ <el-input v-model="form[item.model]" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'editor'">
|
|
|
|
+ <wang-editor v-model="form[item.model]"></wang-editor>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="item.type === 'text'">
|
|
|
|
+ {{ form[item.model] }}
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form[item.model]"
|
|
|
|
+ :type="getField('type', item)"
|
|
|
|
+ :placeholder="getField('placeholder', item)"
|
|
|
|
+ v-bind="item.options"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </el-tooltip>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<slot name="custom" v-bind="{ item, form, fieldChange }"></slot>
|
|
<slot name="custom" v-bind="{ item, form, fieldChange }"></slot>
|