Commit 48158898 authored by 王康's avatar 王康

form

parent baf28444
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
```jsx ```jsx
<hm-complex-form <hm-complex-form
:schema="{ :schema="{
'model': 'HmUser2', 'model': 'HmUser',
'modelPlural': 'HmUser2S', 'modelPlural': 'HmUserS',
'modelCamel': 'hmUser2', 'modelCamel': 'hmUser',
'modelCamelPlural': 'hmUser2S', 'modelCamelPlural': 'hmUserS',
'modelUnderscore': 'hm_user2', 'modelUnderscore': 'hm_user',
'modelUnderscorePlural': 'hm_user2S', 'modelUnderscorePlural': 'hm_userS',
'columns': [ 'columns': [
{ {
'id': 'o50', 'id': 'o50',
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
'type': 'string' 'type': 'string'
} }
] ]
}"></hm-complex-form> }"></hm-complex-form>
``` ```
### 指定显示的表单类型 ### 指定显示的表单类型
...@@ -223,7 +223,7 @@ ...@@ -223,7 +223,7 @@
<div> <div>
<hm-complex-form <hm-complex-form
:tableId="tableId" :tableId="tableId"
:schema="schema['HmUser2']" :schema="schema['HmUser']"
:columns="showUserColumns"> :columns="showUserColumns">
</hm-complex-form> </hm-complex-form>
</div> </div>
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
<script> <script>
export default { export default {
name: 'HmComplexForm', name: 'HmComplexFormIndex',
data() { data() {
return { return {
schema: { schema: {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
v-model="formModel[column.codeCamel]"></el-input>--> 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" ref="textEditor"
v-model="formModel[column.codeCamel]" v-model="formModel[column.codeCamel]"
:options="editorOption" :options="editorOption"
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </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" <el-option v-for="item in selectOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
</el-option> </el-option>
</el-select> </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" type="textarea"
:autosize="{ minRows: 2, maxRows: 5}" :autosize="{ minRows: 2, maxRows: 5}"
:rows="2"> :rows="2">
</el-input> </el-input>
<!-- 复选框 -->
<el-checkbox v-else-if="column.widgetType === 'checkbox'" v-model="formModel[column.codeCamel]"></el-checkbox>
<!-- 普通input --> <!-- 普通input -->
<el-input v-else v-model="formModel[column.codeCamel]"></el-input> <el-input v-else v-model="formModel[column.codeCamel]"></el-input>
</el-form-item> </el-form-item>
......
...@@ -2981,7 +2981,8 @@ const ModelSchema = { ...@@ -2981,7 +2981,8 @@ const ModelSchema = {
'codeCamelPlural': 'avatars', 'codeCamelPlural': 'avatars',
'codeUnderscore': 'avatar', 'codeUnderscore': 'avatar',
'codeUnderscorePlural': 'avatars', 'codeUnderscorePlural': 'avatars',
'type': 'string' 'type': 'string',
'widgetType': 'checkbox'
}, },
{ {
'id': 'o335', 'id': 'o335',
...@@ -3045,7 +3046,8 @@ const ModelSchema = { ...@@ -3045,7 +3046,8 @@ const ModelSchema = {
'codeCamelPlural': 'securityLevels', 'codeCamelPlural': 'securityLevels',
'codeUnderscore': 'security_level', 'codeUnderscore': 'security_level',
'codeUnderscorePlural': 'security_levels', 'codeUnderscorePlural': 'security_levels',
'type': 'number' 'type': 'number',
'widgetType': 'richText'
}, },
{ {
'id': 'o339', 'id': 'o339',
...@@ -3062,7 +3064,8 @@ const ModelSchema = { ...@@ -3062,7 +3064,8 @@ const ModelSchema = {
'codeCamelPlural': 'types', 'codeCamelPlural': 'types',
'codeUnderscore': 'type', 'codeUnderscore': 'type',
'codeUnderscorePlural': 'types', 'codeUnderscorePlural': 'types',
'type': 'number' 'type': 'number',
'widgetType': 'selectType'
}, },
{ {
'id': 'o340', 'id': 'o340',
...@@ -3079,7 +3082,8 @@ const ModelSchema = { ...@@ -3079,7 +3082,8 @@ const ModelSchema = {
'codeCamelPlural': 'departmentIds', 'codeCamelPlural': 'departmentIds',
'codeUnderscore': 'department_id', 'codeUnderscore': 'department_id',
'codeUnderscorePlural': 'department_ids', '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