|
6 | 6 | :model="formData"
|
7 | 7 | :rules="formRules"
|
8 | 8 | >
|
9 |
| - <template v-for="item in formItems" :key="item.prop"> |
10 |
| - <el-form-item v-show="!item.hidden" :label="item.label" :prop="item.prop"> |
11 |
| - <!-- Label --> |
12 |
| - <template #label v-if="item.tips"> |
13 |
| - <span> |
14 |
| - {{ item.label }} |
15 |
| - <el-tooltip |
16 |
| - placement="bottom" |
17 |
| - effect="light" |
18 |
| - :content="item.tips" |
19 |
| - :raw-content="true" |
20 |
| - > |
21 |
| - <el-icon style="vertical-align: -0.15em" size="16"> |
22 |
| - <QuestionFilled /> |
23 |
| - </el-icon> |
24 |
| - </el-tooltip> |
25 |
| - </span> |
26 |
| - </template> |
27 |
| - <!-- Input 输入框 --> |
28 |
| - <template v-if="item.type === 'input' || item.type === undefined"> |
29 |
| - <el-input v-model="formData[item.prop]" v-bind="item.attrs" /> |
30 |
| - </template> |
31 |
| - <!-- Select 选择器 --> |
32 |
| - <template v-else-if="item.type === 'select'"> |
33 |
| - <el-select v-model="formData[item.prop]" v-bind="item.attrs"> |
34 |
| - <template v-for="option in item.options" :key="option.value"> |
35 |
| - <el-option v-bind="option" /> |
| 9 | + <el-row :gutter="20"> |
| 10 | + <template v-for="item in formItems" :key="item.prop"> |
| 11 | + <el-col v-show="!item.hidden" v-bind="item.col"> |
| 12 | + <el-form-item :label="item.label" :prop="item.prop"> |
| 13 | + <!-- Label --> |
| 14 | + <template #label v-if="item.tips"> |
| 15 | + <span> |
| 16 | + {{ item.label }} |
| 17 | + <el-tooltip |
| 18 | + placement="bottom" |
| 19 | + effect="light" |
| 20 | + :content="item.tips" |
| 21 | + :raw-content="true" |
| 22 | + > |
| 23 | + <el-icon style="vertical-align: -0.15em" size="16"> |
| 24 | + <QuestionFilled /> |
| 25 | + </el-icon> |
| 26 | + </el-tooltip> |
| 27 | + </span> |
36 | 28 | </template>
|
37 |
| - </el-select> |
38 |
| - </template> |
39 |
| - <!-- Radio 单选框 --> |
40 |
| - <template v-else-if="item.type === 'radio'"> |
41 |
| - <el-radio-group v-model="formData[item.prop]" v-bind="item.attrs"> |
42 |
| - <template v-for="option in item.options" :key="option.value"> |
43 |
| - <el-radio v-bind="option" /> |
| 29 | + <!-- Input 输入框 --> |
| 30 | + <template v-if="item.type === 'input' || item.type === undefined"> |
| 31 | + <el-input v-model="formData[item.prop]" v-bind="item.attrs" /> |
44 | 32 | </template>
|
45 |
| - </el-radio-group> |
46 |
| - </template> |
47 |
| - <!-- Checkbox 多选框 --> |
48 |
| - <template v-else-if="item.type === 'checkbox'"> |
49 |
| - <el-checkbox-group v-model="formData[item.prop]" v-bind="item.attrs"> |
50 |
| - <template v-for="option in item.options" :key="option.value"> |
51 |
| - <el-checkbox v-bind="option" /> |
| 33 | + <!-- Select 选择器 --> |
| 34 | + <template v-else-if="item.type === 'select'"> |
| 35 | + <el-select v-model="formData[item.prop]" v-bind="item.attrs"> |
| 36 | + <template v-for="option in item.options" :key="option.value"> |
| 37 | + <el-option v-bind="option" /> |
| 38 | + </template> |
| 39 | + </el-select> |
52 | 40 | </template>
|
53 |
| - </el-checkbox-group> |
54 |
| - </template> |
55 |
| - <!-- Input Number 数字输入框 --> |
56 |
| - <template v-else-if="item.type === 'input-number'"> |
57 |
| - <el-input-number v-model="formData[item.prop]" v-bind="item.attrs" /> |
58 |
| - </template> |
59 |
| - <!-- TreeSelect 树形选择 --> |
60 |
| - <template v-else-if="item.type === 'tree-select'"> |
61 |
| - <el-tree-select v-model="formData[item.prop]" v-bind="item.attrs" /> |
62 |
| - </template> |
63 |
| - <!-- DatePicker 日期选择器 --> |
64 |
| - <template v-else-if="item.type === 'date-picker'"> |
65 |
| - <el-date-picker v-model="formData[item.prop]" v-bind="item.attrs" /> |
66 |
| - </template> |
67 |
| - <!-- Text 文本 --> |
68 |
| - <template v-else-if="item.type === 'text'"> |
69 |
| - <el-text v-bind="item.attrs">{{ formData[item.prop] }}</el-text> |
70 |
| - </template> |
71 |
| - <!-- 自定义 --> |
72 |
| - <template v-else-if="item.type === 'custom'"> |
73 |
| - <slot |
74 |
| - :name="item.slotName ?? item.prop" |
75 |
| - :prop="item.prop" |
76 |
| - :formData="formData" |
77 |
| - :attrs="item.attrs" |
78 |
| - ></slot> |
79 |
| - </template> |
80 |
| - </el-form-item> |
81 |
| - </template> |
| 41 | + <!-- Radio 单选框 --> |
| 42 | + <template v-else-if="item.type === 'radio'"> |
| 43 | + <el-radio-group v-model="formData[item.prop]" v-bind="item.attrs"> |
| 44 | + <template v-for="option in item.options" :key="option.value"> |
| 45 | + <el-radio v-bind="option" /> |
| 46 | + </template> |
| 47 | + </el-radio-group> |
| 48 | + </template> |
| 49 | + <!-- Checkbox 多选框 --> |
| 50 | + <template v-else-if="item.type === 'checkbox'"> |
| 51 | + <el-checkbox-group |
| 52 | + v-model="formData[item.prop]" |
| 53 | + v-bind="item.attrs" |
| 54 | + > |
| 55 | + <template v-for="option in item.options" :key="option.value"> |
| 56 | + <el-checkbox v-bind="option" /> |
| 57 | + </template> |
| 58 | + </el-checkbox-group> |
| 59 | + </template> |
| 60 | + <!-- Input Number 数字输入框 --> |
| 61 | + <template v-else-if="item.type === 'input-number'"> |
| 62 | + <el-input-number |
| 63 | + v-model="formData[item.prop]" |
| 64 | + v-bind="item.attrs" |
| 65 | + /> |
| 66 | + </template> |
| 67 | + <!-- TreeSelect 树形选择 --> |
| 68 | + <template v-else-if="item.type === 'tree-select'"> |
| 69 | + <el-tree-select |
| 70 | + v-model="formData[item.prop]" |
| 71 | + v-bind="item.attrs" |
| 72 | + /> |
| 73 | + </template> |
| 74 | + <!-- DatePicker 日期选择器 --> |
| 75 | + <template v-else-if="item.type === 'date-picker'"> |
| 76 | + <el-date-picker |
| 77 | + v-model="formData[item.prop]" |
| 78 | + v-bind="item.attrs" |
| 79 | + /> |
| 80 | + </template> |
| 81 | + <!-- Text 文本 --> |
| 82 | + <template v-else-if="item.type === 'text'"> |
| 83 | + <el-text v-bind="item.attrs">{{ formData[item.prop] }}</el-text> |
| 84 | + </template> |
| 85 | + <!-- 自定义 --> |
| 86 | + <template v-else-if="item.type === 'custom'"> |
| 87 | + <slot |
| 88 | + :name="item.slotName ?? item.prop" |
| 89 | + :prop="item.prop" |
| 90 | + :formData="formData" |
| 91 | + :attrs="item.attrs" |
| 92 | + ></slot> |
| 93 | + </template> |
| 94 | + </el-form-item> |
| 95 | + </el-col> |
| 96 | + </template> |
| 97 | + </el-row> |
82 | 98 | </el-form>
|
83 | 99 | </template>
|
84 | 100 |
|
|
0 commit comments