Commit 47cbaf72 authored by 高天阳's avatar 高天阳

Merge remote-tracking branch 'origin/master'

parents d812dcce 775f6b27
### 开发新组件
\ No newline at end of file
关于如何进行组件化开发,请见文档:http://factory.haomo-studio.com/frontend/react/react-element-based.html
### 基本使用
```jsx
<hm-complex-detail :userId="0e26566e953449a7a7500c34be39fd26"
<hm-complex-detail :tableId="0e26566e953449a7a7500c34be39fd26"
:schema="{
'model': 'HmUser',
'modelPlural': 'HmUsers',
......@@ -205,7 +205,7 @@
<template>
<div>
<hm-complex-detail :schema="schema['HmUser']"
:userId="userId"
:tableId="tableId"
:columns="showUserColumns">
</hm-complex-detail>
</div>
......@@ -430,7 +430,7 @@
filters: {
},
created() {
this.userId = '0e26566e953449a7a7500c34be39fd26'
this.tableId = '0e26566e953449a7a7500c34be39fd26'
},
methods: {}
}
......
<template>
<el-row type="flex">
<el-col :span="24" class="detail-content">
<h2 class="title">详情页面</h2>
<el-form :data="detail" label-width="110px" status-icon style="width:80%;margin:0 auto">
<el-form-item v-for="(column,index) in showColumns" :key="index" :label="column.name">
<div>{{detail[column.codeCamel]}}</div>
......@@ -56,11 +55,11 @@
return true
}
},
/*
* 在详情页需要传入用户的id用来带出用户信息
* */
userId: {
type: null,
/**
* 在详情页需要传入用户的id用来带出用户信息
*/
tableId: {
type: String,
required: true
}
},
......@@ -68,7 +67,7 @@
return {
list: null,
detail: null,
showColumns: [] // 要显示的列数据
showColumns: [] // 要显示的列数据,
}
},
computed: {
......@@ -138,7 +137,7 @@
self.list = resp.data
// 匹配需要展示的用户
_.each(self.list, function(item) {
if (item.id === self.userId) {
if (item.id === self.tableId) {
self.detail = item
}
})
......
<template>
<div>
<hm-complex-detail :schema="schema['HmUser']" :userId="userId">
<hm-complex-detail :schema="schema['HmUser']" :tableId="tableId">
</hm-complex-detail>
<hm-complex-detail :schema="schema['HmUser']" :userId="userId" :columns="showUserColumns">
<hm-complex-detail :schema="schema['HmUser']" :tableId="tableId" :columns="showUserColumns">
</hm-complex-detail>
</div>
</template>
......@@ -30,7 +30,7 @@
},
created() {
this.schema = schema
this.userId = '0e26566e953449a7a7500c34be39fd26'
this.tableId = '0e26566e953449a7a7500c34be39fd26'
},
methods: {}
}
......
......@@ -200,6 +200,7 @@
}"></hm-complex-form>
```
### 指定显示的表单类型
```vue
<template>
<div>
......@@ -210,17 +211,8 @@
</template>
<script>
import HmComplexForm from './HmComplexForm.vue'
import schema from '../../schemas/hm_org_schema'
export default {
name: 'HmComplexForm',
// 继承其他组件
extends: {},
// 使用其它组件
components: {
'hm-complex-form': HmComplexForm
},
data() {
return {
schema: {
......@@ -424,16 +416,9 @@
showFields: ['username', 'loginid', 'password', 'mobile', 'email']
}
},
computed: {
},
filters: {
},
created() {
this.schema = schema
},
methods: {}
}
}
</script>
<style scoped>
</style>
```
\ No newline at end of file
<template>
<el-row type="flex" class="hm-form">
<el-row type="flex" class="hm-form" style="margin-top: 50px">
<el-col :span="6">
<div></div>
</el-col>
<el-col :span="12" style="border:1px solid orange">
<el-col :span="12">
<div>
<h2 class="title">表单页面</h2>
<!--表单部分-->
<el-form ref="form" :model="formModel" :rules="rules" label-width="110px"
style="width:80%;margin:0 auto">
......@@ -136,6 +135,7 @@
_.each(self.showFields, function(column, index) {
if (typeof column === 'string') {
// 生成一个新对象
console.log(column)
const tmp = _.keyBy(self.schema['columns'], 'code')[column.toUpperCase()]
// console.log(tmp)
// self.$set(tmp, 'code', tmp.code.toLowerCase())
......@@ -209,12 +209,5 @@
}
</script>
<style scoped>
.title {
line-height: 40px;
background: orange;
color: #fff;
text-align: center;
margin-top: 0;
}
</style>
......@@ -83,19 +83,12 @@
},
/**
* 搜索过滤选项。默认没有过滤功能。完整的示例为:
*
* {
*
* "column1": {
*
* like: '%abc%', 模糊查询,包含字符”abc”
*
* notLike: '' 模糊查询,不包含字符
*
* between: [1, 10], 取值在[1,10]之间,包含1与10
*
* notBetween: [1, 10], 取值小于1大于10
*
* isNull: true, // 只能为true 判断字段是否为空
* isNotNull: true, // 只能为true 判断字段是否不为空
* equalTo: "abc", 相等于
......
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