Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
supply-web
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 4a225a0f
authored
Sep 15, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
表格-滚动
1 parent
0c05d68c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
11 deletions
src/assets/style/reset.scss
src/components/d2-drop-table/index.vue
src/assets/style/reset.scss
View file @
4a225a0
td
,
td
,
th
{
th
{
padding
:
0
!
important
;
padding
:
0
!
important
;
background-color
:
rgba
(
42
,
88
,
173
,
.05
);
}
table
{
background-color
:
rgba
(
42
,
88
,
173
,
0
.2
)
!
important
;
}
tbody
tr
td
:last-child
,
tbody
tr
th
:last-child
{
padding-right
:
10px
!
important
;
}
}
.el-card__body
{
.el-card__body
{
padding
:
5px
;
padding
:
5px
;
}
}
...
...
src/components/d2-drop-table/index.vue
View file @
4a225a0
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
<
template
>
<
template
>
<div
ref=
"tableCom"
>
<div
ref=
"tableCom"
>
<div
class=
"table"
>
<div
class=
"table"
>
<!--
<el-scrollbar
:native=
"false"
class=
"table-scroll"
>
-->
<el-table
<el-table
:ref=
"tableParams.tableId + 'MutiTable' || 'mutiTable'"
:ref=
"tableParams.tableId + 'MutiTable' || 'mutiTable'"
v-loading=
"tableLoading"
v-loading=
"tableLoading"
...
@@ -12,6 +16,7 @@
...
@@ -12,6 +16,7 @@
size=
"small"
size=
"small"
:row-key=
"tableParams.uniqueKey || 'id'"
:row-key=
"tableParams.uniqueKey || 'id'"
border
border
:max-height=
"tableMaxHeight"
v-if=
"tableParams.dropCol.length"
v-if=
"tableParams.dropCol.length"
>
>
<el-table-column
<el-table-column
...
@@ -64,7 +69,7 @@
...
@@ -64,7 +69,7 @@
<el-button
<el-button
v-show=
"item.showConf ? (scope.row[item.showConf.attr] == item.showConf.showVal) : true"
v-show=
"item.showConf ? (scope.row[item.showConf.attr] == item.showConf.showVal) : true"
:type=
"item.type || 'primary'"
:type=
"item.type || 'primary'"
size=
"mini
"
:size=
"btn_size
"
plain
plain
@
click=
"item.handleClick(scope.row)"
@
click=
"item.handleClick(scope.row)"
>
{{
item
.
label
}}
</el-button>
>
{{
item
.
label
}}
</el-button>
...
@@ -73,7 +78,7 @@
...
@@ -73,7 +78,7 @@
</el-table-column>
</el-table-column>
</transition>
</transition>
</el-table>
</el-table>
<div>
<div
class=
"sort-btns"
>
<el-tooltip
<el-tooltip
effect=
"dark"
effect=
"dark"
content=
"重置表头顺序"
content=
"重置表头顺序"
...
@@ -90,16 +95,17 @@
...
@@ -90,16 +95,17 @@
<el-button
<el-button
type=
"primary"
type=
"primary"
class=
"opt-btn"
class=
"opt-btn"
size=
"mini
"
:size=
"btn_size
"
style=
"margin-left: 0;"
style=
"margin-left: 0;"
@
click=
"handleOptShow"
@
click=
"handleOptShow"
>
{{isShowOption ? '收起' : '展开'}}
</el-button>
>
{{isShowOption ? '收起' : '展开'}}
</el-button>
</div>
</div>
<!-- </el-scrollbar> -->
</div>
</div>
<div
ref=
"page"
>
<div
ref=
"page"
>
<el-pagination
<el-pagination
v-if=
"hasPage"
v-if=
"hasPage"
small
:size=
"btn_size"
background
background
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
...
@@ -126,6 +132,7 @@ export default {
...
@@ -126,6 +132,7 @@ export default {
loading
:
false
,
loading
:
false
,
isShowOption
:
false
,
isShowOption
:
false
,
isMove
:
false
,
isMove
:
false
,
tableMaxHeight
:
0
,
timer
:
''
,
timer
:
''
,
data
:
[],
data
:
[],
// 页码
// 页码
...
@@ -236,6 +243,9 @@ export default {
...
@@ -236,6 +243,9 @@ export default {
event
.
preventDefault
()
event
.
preventDefault
()
event
.
stopPropagation
()
event
.
stopPropagation
()
}
}
this
.
row
=
0
this
.
tableParams
.
isMuti
&&
(
++
this
.
row
)
this
.
hasNum
&&
(
++
this
.
row
)
this
.
handleGet
()
this
.
handleGet
()
const
btn
=
document
.
getElementById
(
this
.
tableParams
.
btnId
)
const
btn
=
document
.
getElementById
(
this
.
tableParams
.
btnId
)
btn
&&
btn
.
addEventListener
(
'click'
,
this
.
refreshEmit
)
btn
&&
btn
.
addEventListener
(
'click'
,
this
.
refreshEmit
)
...
@@ -249,8 +259,10 @@ export default {
...
@@ -249,8 +259,10 @@ export default {
// var parentHeight = document.querySelector('.table').parentElement.parentElement.clientHeight
// var parentHeight = document.querySelector('.table').parentElement.parentElement.clientHeight
var
parentHeight
=
this
.
$refs
.
tableCom
.
parentElement
.
clientHeight
var
parentHeight
=
this
.
$refs
.
tableCom
.
parentElement
.
clientHeight
var
pageHeight
=
this
.
hasPage
?
this
.
$refs
.
page
.
clientHeight
:
0
var
pageHeight
=
this
.
hasPage
?
this
.
$refs
.
page
.
clientHeight
:
0
document
.
querySelector
(
'.table'
).
style
.
height
=
parentHeight
-
pageHeight
-
50
+
'px'
// console.log(parentHeight - pageHeight - 50 + 'px')
this
.
loading
=
false
// document.querySelector('.table').style.height = parentHeight - pageHeight - 50 + 'px'
// this.loading = false
this
.
tableMaxHeight
=
parentHeight
-
pageHeight
-
50
},
400
)
},
400
)
},
},
...
@@ -304,8 +316,8 @@ export default {
...
@@ -304,8 +316,8 @@ export default {
if
(
this
.
hasNum
&&
evt
.
newIndex
===
0
)
{
if
(
this
.
hasNum
&&
evt
.
newIndex
===
0
)
{
this
.
handleGet
()
this
.
handleGet
()
}
else
{
}
else
{
var
oldIndex
=
this
.
hasNum
?
(
evt
.
oldIndex
-
1
)
:
evt
.
oldIndex
var
oldIndex
=
this
.
row
?
(
evt
.
oldIndex
-
this
.
row
)
:
evt
.
oldIndex
var
newIndex
=
this
.
hasNum
?
(
evt
.
newIndex
-
1
)
:
evt
.
newIndex
var
newIndex
=
this
.
row
?
(
evt
.
newIndex
-
this
.
row
)
:
evt
.
newIndex
const
oldItem
=
this
.
tableParams
.
dropCol
[
oldIndex
]
const
oldItem
=
this
.
tableParams
.
dropCol
[
oldIndex
]
this
.
tableParams
.
dropCol
.
splice
(
oldIndex
,
1
)
this
.
tableParams
.
dropCol
.
splice
(
oldIndex
,
1
)
this
.
tableParams
.
dropCol
.
splice
(
newIndex
,
0
,
oldItem
)
this
.
tableParams
.
dropCol
.
splice
(
newIndex
,
0
,
oldItem
)
...
@@ -394,11 +406,24 @@ export default {
...
@@ -394,11 +406,24 @@ export default {
</
script
>
</
script
>
<
style
>
<
style
>
.table
{
.table
{
display
:
flex
;
/* display: flex; */
/* align-items: center; */
/* align-items: center; */
}
}
.el-table
{
/*
.el-table {
overflow-y: scroll;
overflow-y: scroll;
} */
.el-scrollbar__wrap
{
overflow-x
:
hidden
;
}
.table-scroll
{
height
:
100%
;
width
:
100%
;
/* display: flex; */
}
.sort-btns
{
position
:
fixed
;
top
:
300px
;
right
:
36px
;
}
}
.refresh-btn
{
.refresh-btn
{
display
:
block
;
display
:
block
;
...
...
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