Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
8d4eb921
Commit
8d4eb921
authored
Apr 02, 2018
by
杨柠瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coding
parent
fbd137a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
64 deletions
+52
-64
HmComplexTable.vue
src/views/haomo/components/tables/HmComplexTable.vue
+40
-54
index.vue
src/views/haomo/components/tables/index.vue
+12
-10
No files found.
src/views/haomo/components/tables/HmComplexTable.vue
View file @
8d4eb921
...
@@ -134,16 +134,14 @@
...
@@ -134,16 +134,14 @@
<!-- @TODO 补充详情弹窗 -->
<!-- @TODO 补充详情弹窗 -->
<el-dialog
:title=
"dialogName"
:visible
.
sync=
"dialogFormVisible"
:close-on-click-modal=
"closeOnClickModal"
width=
"dialogWidth"
v-if=
"dialogFormVisible"
>
<el-dialog
:title=
"dialogName"
:visible
.
sync=
"dialogFormVisible"
:close-on-click-modal=
"closeOnClickModal"
width=
"dialogWidth"
v-if=
"dialogFormVisible"
>
<el-form
v-if=
"dialogName == '详情'"
>
<el-form-item
:label=
"dialog.name"
:label-width=
"formLabelWidth"
v-for=
"dialog in dialogForm"
>
<el-input
v-model=
"dialog.value"
disabled
auto-complete=
"off"
></el-input>
</el-form-item>
</el-form>
<hm-complex-form
:schema=
"formSchema"
<hm-complex-form
:schema=
"formSchema"
:columns=
"showUserColumns"
:columns=
"showUserColumns"
:buttons=
"showUserButtons"
:buttons=
"showUserButtons"
:layout=
"layout"
:layout=
"layout"
:tableId=
"tableId"
v-if=
"dialogName != '详情'"
ref=
"selectfood"
>
:tableId=
"tableId"
:tips=
"formTips"
:formStyle=
"formStyle"
ref=
"selectfood"
>
</hm-complex-form>
</hm-complex-form>
</el-dialog>
</el-dialog>
...
@@ -277,7 +275,7 @@
...
@@ -277,7 +275,7 @@
},
},
/**
/**
* 表格的选项,包括:pageSize、showExport、sortItem、sortOrder、showRefresh、showDeleteButton、
* 表格的选项,包括:pageSize、showExport、sortItem、sortOrder、showRefresh、showDeleteButton、
* buttonGroup、showDetail、dataProcessing、changeValue、newData、editData完整的示例为:
* buttonGroup、showDetail、dataProcessing、
promiseProcessing、
changeValue、newData、editData完整的示例为:
* {
* {
* "pageSize": 10, // 默认为10条数据/页
* "pageSize": 10, // 默认为10条数据/页
* "showExport": false, // 默认为不显示导出按钮
* "showExport": false, // 默认为不显示导出按钮
...
@@ -287,11 +285,8 @@
...
@@ -287,11 +285,8 @@
* "showDeleteButton": false, //默认不显示删除按钮
* "showDeleteButton": false, //默认不显示删除按钮
* "buttonGroup": false //默认不以按钮组的方式呈现button
* "buttonGroup": false //默认不以按钮组的方式呈现button
* tableCurrentChange(value){} // 设置点击某行所执行方法
* tableCurrentChange(value){} // 设置点击某行所执行方法
* showDetail: {
* dataProcessing(value, params, definedOperate){} // 对接口返回数据进行处理(必须有返回值,返回值需为 [{}] 的形式,支持放回Promise对象)
* isShow: false, // 默认不显示详情
* promiseProcessing(value, params, definedOperate){} // 对接口返回数据进行处理(必须有返回值,返回Promise对象)
* showColumns: ['mobile', 'loginid', 'username', 'email']
* },
* dataProcessing(value){} // 对接口返回数据进行处理(必须有返回值,返回值需为 [{}] 的形式,支持放回Promise对象)
* "changeValue": { // 数据库字段转化显示,例如(0=否,1=是)
* "changeValue": { // 数据库字段转化显示,例如(0=否,1=是)
* username: {1: '是', 0: '否'},
* username: {1: '是', 0: '否'},
* type: { 1: 'Hm-isChecked', 0: 'Hm-noChecked' } // 以多选框的形式展示Hm-isChecked(选择状态)、Hm-noChecked(未选择状态)
* type: { 1: 'Hm-isChecked', 0: 'Hm-noChecked' } // 以多选框的形式展示Hm-isChecked(选择状态)、Hm-noChecked(未选择状态)
...
@@ -307,7 +302,10 @@
...
@@ -307,7 +302,10 @@
* showUserColumns: [], // 编辑表单的Columns配置,详情参考Form组件
* showUserColumns: [], // 编辑表单的Columns配置,详情参考Form组件
* formSchema: {}, // 编辑表单的schema配置
* formSchema: {}, // 编辑表单的schema配置
* layout: {} // 布局方式
* layout: {} // 布局方式
* }
* },
* showDetail: { // 同编辑的的配置
* isShow: false, // 默认不显示详情
* },
* }
* }
*/
*/
options
:
{
options
:
{
...
@@ -362,12 +360,11 @@
...
@@ -362,12 +360,11 @@
isShowExport
:
false
,
// 是否显示导出按钮
isShowExport
:
false
,
// 是否显示导出按钮
formSchema
:
{},
// form弹窗的Schema定义
formSchema
:
{},
// form弹窗的Schema定义
showUserColumns
:
[],
// form弹窗的Columns定义
showUserColumns
:
[],
// form弹窗的Columns定义
showUserButtons
:
[
// from弹窗显示按钮
showUserButtons
:
[],
// from弹窗显示按钮,
{
text
:
'确定'
,
type
:
1
,
method
:
this
.
formConfirm
},
{
text
:
'取消'
,
type
:
2
,
method
:
this
.
formCancel
}
],
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
// form弹窗的布局方式
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
// form弹窗的布局方式
tableId
:
''
,
tableId
:
''
,
formTips
:
''
,
formStyle
:
''
,
isShowRefresh
:
false
,
isShowRefresh
:
false
,
buttonGroup
:
false
,
buttonGroup
:
false
,
...
@@ -402,17 +399,15 @@
...
@@ -402,17 +399,15 @@
},
},
created
()
{
created
()
{
// this.validate()
// this.validate()
const
self
=
this
if
(
this
.
userDefined
&&
Object
.
prototype
.
toString
.
apply
(
this
.
userDefined
.
pretreatment
())
===
'[object Promise]'
)
{
if
(
this
.
userDefined
&&
this
.
userDefined
.
pretreatment
)
{
this
.
userDefined
.
pretreatment
().
then
(
function
()
{
self
.
userDefined
.
pretreatment
().
then
(
function
()
{})
this
.
init
()
self
.
init
()
self
.
getList
()
this
.
getList
()
console
.
log
(
'IS-[object Promise]'
)
})
}
else
{
}
else
{
this
.
init
()
self
.
init
()
self
.
getList
()
this
.
getList
()
}
}
},
},
methods
:
{
methods
:
{
...
@@ -553,15 +548,13 @@
...
@@ -553,15 +548,13 @@
// 数据处理
// 数据处理
if
(
self
.
options
&&
self
.
options
.
dataProcessing
)
{
if
(
self
.
options
&&
self
.
options
.
dataProcessing
)
{
if
(
Object
.
prototype
.
toString
.
apply
(
self
.
options
.
dataProcessing
(
resp
.
data
,
params
,
self
.
definedOperate
))
===
'[object Promise]'
)
{
console
.
log
(
'IS-[object Promise]'
)
self
.
options
.
dataProcessing
(
resp
.
data
,
params
,
self
.
definedOperate
).
then
(
function
(
dataList
)
{
self
.
list
=
dataList
})
}
else
{
console
.
log
(
'NO-[object Promise]'
)
console
.
log
(
'NO-[object Promise]'
)
self
.
list
=
self
.
options
.
dataProcessing
(
resp
.
data
,
params
,
self
.
definedOperate
)
self
.
list
=
self
.
options
.
dataProcessing
(
resp
.
data
,
params
,
self
.
definedOperate
)
}
}
if
(
self
.
options
&&
self
.
options
.
promiseProcessing
)
{
self
.
options
.
promiseProcessing
(
resp
.
data
,
params
,
self
.
definedOperate
).
then
(
function
(
dataList
)
{
self
.
list
=
dataList
})
}
}
self
.
total
=
parseInt
(
resp
.
headers
.
total
)
self
.
total
=
parseInt
(
resp
.
headers
.
total
)
self
.
listLoading
=
false
self
.
listLoading
=
false
...
@@ -617,12 +610,9 @@
...
@@ -617,12 +610,9 @@
self
.
tableId
=
''
self
.
tableId
=
''
if
(
type
===
'editData'
)
{
if
(
type
===
'editData'
)
{
self
.
dialogName
=
'编辑'
self
.
dialogName
=
'编辑'
self
.
showUserColumns
=
self
.
options
.
editData
.
showUserColumns
if
(
self
.
options
.
editData
.
showUserButtons
)
{
if
(
self
.
options
.
editData
.
showUserButtons
)
{
self
.
showUserButtons
=
self
.
options
.
editData
.
showUserButtons
self
.
showUserButtons
=
self
.
options
.
editData
.
showUserButtons
}
}
self
.
formSchema
=
self
.
options
.
editData
.
formSchema
self
.
layout
=
self
.
options
.
editData
.
layout
self
.
tableId
=
data
.
id
self
.
tableId
=
data
.
id
}
}
if
(
type
===
'newData'
)
{
if
(
type
===
'newData'
)
{
...
@@ -630,26 +620,22 @@
...
@@ -630,26 +620,22 @@
if
(
self
.
options
.
newData
.
showUserButtons
)
{
if
(
self
.
options
.
newData
.
showUserButtons
)
{
self
.
showUserButtons
=
self
.
options
.
newData
.
showUserButtons
self
.
showUserButtons
=
self
.
options
.
newData
.
showUserButtons
}
}
self
.
showUserColumns
=
self
.
options
.
newData
.
showUserColumns
self
.
formSchema
=
self
.
options
.
newData
.
formSchema
self
.
layout
=
self
.
options
.
newData
.
layout
}
}
if
(
type
===
'detail'
)
{
if
(
type
===
'detail'
)
{
self
.
dialogName
=
'详情'
self
.
dialogName
=
'详情'
self
.
dialogForm
=
[]
_
.
each
(
self
.
options
.
showDetail
.
showColumns
,
function
(
columns
)
{
_
.
each
(
self
.
schema
.
columns
,
function
(
item
,
index
)
{
if
(
columns
===
item
.
codeCamel
)
{
self
.
dialogForm
.
push
(
item
)
}
})
})
_
.
map
(
self
.
dialogForm
,
function
(
item
,
index
)
{
if
(
self
.
options
.
detailData
.
showUserButtons
)
{
item
.
value
=
data
[
item
.
code
]
self
.
showUserButtons
=
self
.
options
.
detailData
.
showUserButtons
item
.
id
=
data
.
id
}
})
self
.
tableId
=
data
.
id
}
}
self
.
showUserColumns
=
self
.
options
.
editData
.
showUserColumns
self
.
formSchema
=
self
.
options
.
editData
.
formSchema
self
.
layout
=
self
.
options
.
editData
.
layout
self
.
formTips
=
self
.
options
.
editData
.
tips
self
.
formStyle
=
self
.
options
.
editData
.
formStyle
self
.
dialogFormVisible
=
true
self
.
dialogFormVisible
=
true
},
},
// 表单的提交
// 表单的提交
...
...
src/views/haomo/components/tables/index.vue
View file @
8d4eb921
...
@@ -62,26 +62,30 @@
...
@@ -62,26 +62,30 @@
],
],
showUserButtons
:
[],
showUserButtons
:
[],
formSchema
:
schema
[
'HmUser'
],
formSchema
:
schema
[
'HmUser'
],
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
}
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
tips
:
{},
formStyle
:
{}
},
},
editData
:
{
editData
:
{
isShow
:
true
,
isShow
:
true
,
showUserColumns
:
[{
name
:
'姓名'
,
codeCamel
:
'username'
,
widgetType
:
1
}],
showUserColumns
:
[{
name
:
'姓名'
,
codeCamel
:
'username'
,
widgetType
:
1
}],
showUserButtons
:
[],
showUserButtons
:
[],
formSchema
:
schema
[
'HmUser'
],
formSchema
:
schema
[
'HmUser'
],
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
}
layout
:
{
left
:
0
,
middle
:
24
,
right
:
0
},
tips
:
{},
formStyle
:
{}
},
showDetail
:
{
isShow
:
true
},
},
showRefresh
:
true
,
showRefresh
:
true
,
showExport
:
true
,
showExport
:
true
,
showDeleteButton
:
true
,
showDeleteButton
:
true
,
buttonGroup
:
false
,
buttonGroup
:
false
,
showSelection
:
false
,
showSelection
:
false
,
showDetail
:
{
isShow
:
true
,
showColumns
:
[
'mobile'
,
'loginid'
,
'username'
,
'email'
]
},
tableCurrentChange
(
value
)
{}
tableCurrentChange
(
value
)
{}
// dataProcessing(value, params, definedOperate) {} // 处理返回后的数据,必须return 处理后的数据
// dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据
// promiseProcessing(value, params, definedOperate) {} // 处理返回后的数据,必须return Promise对象
}
}
this
.
userDefined
=
{
this
.
userDefined
=
{
definedParams
(
params
,
operate
)
{
definedParams
(
params
,
operate
)
{
...
@@ -101,10 +105,8 @@
...
@@ -101,10 +105,8 @@
},
},
definedDetail
()
{
definedDetail
()
{
},
pretreatment
()
{
}
}
// pretreatment() {}
}
}
},
},
methods
:
{
methods
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment