Commit 48158898 authored by 王康's avatar 王康

form

parent baf28444
......@@ -3,12 +3,12 @@
```jsx
<hm-complex-form
:schema="{
'model': 'HmUser2',
'modelPlural': 'HmUser2S',
'modelCamel': 'hmUser2',
'modelCamelPlural': 'hmUser2S',
'modelUnderscore': 'hm_user2',
'modelUnderscorePlural': 'hm_user2S',
'model': 'HmUser',
'modelPlural': 'HmUserS',
'modelCamel': 'hmUser',
'modelCamelPlural': 'hmUserS',
'modelUnderscore': 'hm_user',
'modelUnderscorePlural': 'hm_userS',
'columns': [
{
'id': 'o50',
......@@ -214,7 +214,7 @@
'type': 'string'
}
]
}"></hm-complex-form>
}"></hm-complex-form>
```
### 指定显示的表单类型
......@@ -223,7 +223,7 @@
<div>
<hm-complex-form
:tableId="tableId"
:schema="schema['HmUser2']"
:schema="schema['HmUser']"
:columns="showUserColumns">
</hm-complex-form>
</div>
......@@ -231,7 +231,7 @@
<script>
export default {
name: 'HmComplexForm',
name: 'HmComplexFormIndex',
data() {
return {
schema: {
......
......@@ -13,7 +13,7 @@
v-model="formModel[column.codeCamel]"></el-input>-->
<!-- 富文本 -->
<quill-editor v-if="column.codeCamel==='securityLevel'" class="editor-example bubble"
<quill-editor v-if="column.widgetType==='richText'"
ref="textEditor"
v-model="formModel[column.codeCamel]"
:options="editorOption"
......@@ -31,7 +31,7 @@
:picker-options="pickerOptions">
</el-date-picker>
<!-- 下拉框 -->
<el-select v-else-if="column.codeCamel === 'type'" v-model="formModel[column.codeCamel]">
<el-select v-else-if="column.widgetType === 'selectType'" v-model="formModel[column.codeCamel]">
<el-option v-for="item in selectOptions"
:key="item.value"
:label="item.label"
......@@ -39,11 +39,13 @@
</el-option>
</el-select>
<!-- 文本域 -->
<el-input v-else-if="column.codeCamel === 'departmentId'" v-model="formModel[column.codeCamel]"
<el-input v-else-if="column.widgetType === 'textarea'" v-model="formModel[column.codeCamel]"
type="textarea"
:autosize="{ minRows: 2, maxRows: 5}"
:rows="2">
</el-input>
<!-- 复选框 -->
<el-checkbox v-else-if="column.widgetType === 'checkbox'" v-model="formModel[column.codeCamel]"></el-checkbox>
<!-- 普通input -->
<el-input v-else v-model="formModel[column.codeCamel]"></el-input>
</el-form-item>
......
......@@ -2981,7 +2981,8 @@ const ModelSchema = {
'codeCamelPlural': 'avatars',
'codeUnderscore': 'avatar',
'codeUnderscorePlural': 'avatars',
'type': 'string'
'type': 'string',
'widgetType': 'checkbox'
},
{
'id': 'o335',
......@@ -3045,7 +3046,8 @@ const ModelSchema = {
'codeCamelPlural': 'securityLevels',
'codeUnderscore': 'security_level',
'codeUnderscorePlural': 'security_levels',
'type': 'number'
'type': 'number',
'widgetType': 'richText'
},
{
'id': 'o339',
......@@ -3062,7 +3064,8 @@ const ModelSchema = {
'codeCamelPlural': 'types',
'codeUnderscore': 'type',
'codeUnderscorePlural': 'types',
'type': 'number'
'type': 'number',
'widgetType': 'selectType'
},
{
'id': 'o340',
......@@ -3079,7 +3082,8 @@ const ModelSchema = {
'codeCamelPlural': 'departmentIds',
'codeUnderscore': 'department_id',
'codeUnderscorePlural': 'department_ids',
'type': 'string'
'type': 'string',
'widgetType': 'textarea'
}
]
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment