Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-components
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a10ae227
authored
Oct 01, 2021
by
limin
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/npm/glsx-components
into master
2 parents
3db59efa
2ac76878
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
44 deletions
src/packages/Table/src/index.vue
src/theme/theme.scss
src/packages/Table/src/index.vue
View file @
a10ae22
<!-- 表格+分页 v-show="tableShow"-->
<
template
>
<
template
>
<div
class=
"glsx-table"
:class=
"
{'hasTableContent':showClass}">
<div
class=
"glsx-table"
:class=
"
{'hasTableContent':showClass}">
<el-table
id=
"initTable"
:ref=
"tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'"
:data=
"getListApi ? data : tableData"
:row-key=
"tableParams.mutiSelectUniqueKey || ''"
v-loading=
"loading"
:border=
"border"
:height=
"height"
:highlight-current-row=
"true"
:stripe=
"true"
@
sort-change=
"sortChange"
@
selection-change=
"handleSelect"
:size=
"size"
:header-cell-style=
"headerStyle"
>
<el-table
id=
"initTable"
:ref=
"tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'"
:data=
"getListApi ? data : tableData"
:row-key=
"tableParams.mutiSelectUniqueKey || ''"
v-loading=
"loading"
:border=
"border"
:highlight-current-row=
"true"
:stripe=
"true"
@
sort-change=
"sortChange"
@
selection-change=
"handleSelect"
:size=
"size"
:header-cell-style=
"headerStyle"
>
<el-table-column
v-if=
"tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName"
type=
"selection"
width=
"55"
:selectable=
"checkSelectable"
:reserve-selection=
"true"
></el-table-column>
<el-table-column
v-if=
"tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName"
type=
"selection"
width=
"55"
:selectable=
"checkSelectable"
:reserve-selection=
"true"
></el-table-column>
<el-table-column
v-if=
"hasNum"
align=
"center"
width=
"60px"
label=
"序号"
type=
"index"
:index=
"index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"
></el-table-column>
<el-table-column
v-if=
"hasNum"
align=
"center"
width=
"60px"
label=
"序号"
type=
"index"
:index=
"index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"
></el-table-column>
<el-table-column
v-for=
"(item, index) in tableColumns"
:key=
"index"
:label=
"item.label"
:prop=
"item.prop"
:width=
"item.width"
:min-width=
"item.minWidth"
:align=
"item.align || 'center'"
:sortable=
"item.sortable"
>
<el-table-column
v-for=
"(item, index) in tableColumns"
:key=
"index"
:label=
"item.label"
:prop=
"item.prop"
:width=
"item.width"
:min-width=
"item.minWidth"
:align=
"item.align || 'center'"
:sortable=
"item.sortable"
>
...
@@ -37,21 +36,14 @@
...
@@ -37,21 +36,14 @@
</template>
</template>
<
script
>
<
script
>
import
{
Table
,
TableColumn
,
Pagination
}
from
'element-ui'
export
default
{
export
default
{
name
:
'glsx-table'
,
name
:
'GLTable'
,
data
()
{
return
{
loading
:
false
,
data
:
[],
// 页码
page
:
{},
total
:
10
,
// 多选数组
mutiSelectArr
:
{},
tableColumns
:
[],
showClass
:
false
components
:
{
}
[
Table
.
name
]:
Table
,
[
TableColumn
.
name
]:
TableColumn
,
[
Pagination
.
name
]:
Pagination
},
},
props
:
{
props
:
{
...
@@ -184,6 +176,21 @@ export default {
...
@@ -184,6 +176,21 @@ export default {
}
}
},
},
data
()
{
return
{
loading
:
false
,
data
:
[],
// 页码
page
:
{},
total
:
10
,
// 多选数组
mutiSelectArr
:
{},
tableColumns
:
[],
showClass
:
false
}
},
watch
:
{
watch
:
{
customHeadShowList
(
val
)
{
customHeadShowList
(
val
)
{
this
.
isCustomHead
&&
this
.
findShowHeadCol
()
this
.
isCustomHead
&&
this
.
findShowHeadCol
()
...
@@ -197,33 +204,6 @@ export default {
...
@@ -197,33 +204,6 @@ export default {
}
}
},
},
mounted
()
{
this
.
isCustomHead
?
this
.
findShowHeadCol
()
:
(
this
.
tableColumns
=
this
.
tableParams
.
tableColumns
)
this
.
page
=
{}
this
.
page
[
this
.
pageConf
.
pageSize
]
=
10
this
.
page
[
this
.
pageConf
.
pageNum
]
=
1
this
.
getListApi
&&
this
.
refreshTable
()
this
.
$nextTick
(()
=>
{
var
_this
=
this
setTimeout
(()
=>
{
// 使用getListApi获取和返回数组为空时算高度 !(_this.getListApi && _this.data.length==0)
if
(
_this
.
getListApi
){
let
offsettop
=
document
.
getElementById
(
'initTable'
).
offsetTop
console
.
log
(
'表格距离顶部'
,
offsettop
)
let
clientHeight
=
document
.
body
.
clientHeight
console
.
log
(
clientHeight
)
// _this.height=(clientHeight - offsettop - 101)+''
document
.
getElementById
(
'initTable'
).
style
.
height
=
(
clientHeight
-
offsettop
-
231
)
+
'px'
;
}
},
200
)
})
},
methods
:
{
methods
:
{
findShowHeadCol
()
{
findShowHeadCol
()
{
this
.
tableColumns
=
[]
this
.
tableColumns
=
[]
...
@@ -257,6 +237,25 @@ export default {
...
@@ -257,6 +237,25 @@ export default {
this
.
mutiSelectArr
[
this
.
tableParams
.
mutiSelectName
]
=
[]
this
.
mutiSelectArr
[
this
.
tableParams
.
mutiSelectName
]
=
[]
this
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
clearSelection
()
this
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
clearSelection
()
},
},
//设置表格高度
setTableHeightFun
(){
let
offsettop
=
document
.
getElementById
(
'initTable'
).
offsetTop
console
.
log
(
'表格距离顶部'
,
offsettop
)
let
clientHeight
=
document
.
documentElement
.
clientHeight
console
.
log
(
'页面整体高度'
,
clientHeight
)
console
.
log
(
document
.
getElementsByClassName
(
'scrm-base-nav'
).
length
)
if
(
document
.
getElementsByClassName
(
'scrm-base-nav'
).
length
&&
document
.
getElementsByClassName
(
'scrm-base-nav'
).
length
){
var
baseNavHeight
=
document
.
getElementsByClassName
(
'scrm-base-nav'
)[
0
].
clientHeight
;
var
subNavHeight
=
document
.
getElementsByClassName
(
'scrm-base-sub-nav'
)[
0
].
clientHeight
document
.
getElementById
(
'initTable'
).
style
.
height
=
(
clientHeight
-
offsettop
-
121
-
baseNavHeight
-
subNavHeight
)
+
'px'
;
}
else
{
document
.
getElementById
(
'initTable'
).
style
.
height
=
(
clientHeight
-
offsettop
-
121
)
+
'px'
;
}
},
refreshTable
(
isResetPageNum
=
true
,
isClearMuti
=
true
)
{
refreshTable
(
isResetPageNum
=
true
,
isClearMuti
=
true
)
{
this
.
beforeSearchFn
().
then
(
res
=>
{
this
.
beforeSearchFn
().
then
(
res
=>
{
...
@@ -304,9 +303,31 @@ export default {
...
@@ -304,9 +303,31 @@ export default {
this
.
page
[
this
.
pageConf
.
pageNum
]
=
value
this
.
page
[
this
.
pageConf
.
pageNum
]
=
value
this
.
getListApi
?
this
.
refreshTable
(
false
,
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
this
.
getListApi
?
this
.
refreshTable
(
false
,
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
}
}
},
mounted
()
{
this
.
isCustomHead
?
this
.
findShowHeadCol
()
:
(
this
.
tableColumns
=
this
.
tableParams
.
tableColumns
)
this
.
page
=
{}
this
.
page
[
this
.
pageConf
.
pageSize
]
=
10
this
.
page
[
this
.
pageConf
.
pageNum
]
=
1
this
.
getListApi
&&
this
.
refreshTable
()
// this.$nextTick(() => {
// var _this=this
// setTimeout(() => {
// // 使用getListApi获取和返回数组为空时算高度 !(_this.getListApi && _this.data.length==0)
// if(_this.getListApi ){
// }
// }, 200)
// })
}
}
}
}
;
</
script
>
</
script
>
<
style
>
<
style
>
.a-click
{
.a-click
{
cursor
:
pointer
;
cursor
:
pointer
;
...
@@ -331,7 +352,7 @@ export default {
...
@@ -331,7 +352,7 @@ export default {
}
}
.glsx-table
.emptyBg
{
.glsx-table
.emptyBg
{
display
:
inline-block
;
display
:
inline-block
;
margin-top
:
150px
;
/* margin-top: 150px; */
height
:
100%
;
height
:
100%
;
}
}
.glsx-table
.emptyBg
div
{
.glsx-table
.emptyBg
div
{
...
...
src/theme/theme.scss
View file @
a10ae22
...
@@ -329,6 +329,12 @@ $dackColor: #4f48e6;
...
@@ -329,6 +329,12 @@ $dackColor: #4f48e6;
color
:
$defaultColor
;
color
:
$defaultColor
;
}
}
.el-pagination
{
display
:
flex
;
margin-top
:
10px
;
align-items
:
center
;
}
.el-pagination
button
:hover
{
.el-pagination
button
:hover
{
color
:
$defaultColor
;
color
:
$defaultColor
;
}
}
...
@@ -341,6 +347,14 @@ $dackColor: #4f48e6;
...
@@ -341,6 +347,14 @@ $dackColor: #4f48e6;
border-color
:
$defaultColor
;
border-color
:
$defaultColor
;
}
}
.el-pagination__jump
{
margin-left
:
5px
;
}
.el-pagination
.el-select
.el-input
{
margin-left
:
10px
;
}
.el-form-item__label
{
.el-form-item__label
{
font-size
:
14px
;
font-size
:
14px
;
font-weight
:
400
;
font-weight
:
400
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment