Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
fulixin
dsk-operate-sys-cscec
Commits
97080f85
Commit
97080f85
authored
Apr 02, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 滚动条判断 固定列优化
parent
f1c96ebd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
index.vue
dsk-operate-ui/src/components/CustomTable/index.vue
+40
-11
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+1
-1
No files found.
dsk-operate-ui/src/components/CustomTable/index.vue
View file @
97080f85
<
template
>
<
template
>
<div
class=
"custom-table-list-com-ins"
<div
class=
"custom-table-list-com-ins"
:class=
"
{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight,'has-y-
Scroll' : maxHeight
&&
hasY
Scroll}"
:class=
"
{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight,'has-y-
scroll' : maxHeight
&&
hasYScroll,'has-x-scroll' : maxHeight
&&
hasX
Scroll}"
:style="maxBodyFixedStyle">
:style="maxBodyFixedStyle">
<div
class=
"custom-table-item"
>
<div
class=
"custom-table-item"
>
<el-table
v-if=
"tableDataTotal>0"
class=
"custom-table"
v-loading=
"comTableLoading"
:data=
"tableData"
element-loading-text=
"加载中"
<el-table
v-if=
"tableDataTotal>0"
class=
"custom-table"
v-loading=
"comTableLoading"
:data=
"tableData"
element-loading-text=
"加载中"
...
@@ -160,6 +160,7 @@ export default {
...
@@ -160,6 +160,7 @@ export default {
comMaxBodyHeight
:
0
,
comMaxBodyHeight
:
0
,
headerLastBlockHeight
:
0
,
headerLastBlockHeight
:
0
,
hasYScroll
:
false
,
hasYScroll
:
false
,
hasXScroll
:
false
,
observer
:
null
,
observer
:
null
,
resizeTimer
:
null
,
resizeTimer
:
null
,
comTableLoading
:
this
.
tableLoading
comTableLoading
:
this
.
tableLoading
...
@@ -245,27 +246,32 @@ export default {
...
@@ -245,27 +246,32 @@ export default {
}
}
// 列表自适应高度
// 列表自适应高度
this
.
comMaxHeight
=
containerMaxHeight
?
`
${
containerMaxHeight
}
px`
:
null
;
this
.
comMaxHeight
=
containerMaxHeight
?
`
${
containerMaxHeight
}
px`
:
null
;
// 重新计算表格高度 减去滚动条高度差 16 - 6 有固定列的情况
// 重新计算表格高度
有横向滚动条则需要
减去滚动条高度差 16 - 6 有固定列的情况
if
(
containerMaxHeight
)
{
if
(
containerMaxHeight
)
{
/**
/**
* @type {HTMLDivElement}
* @type {HTMLDivElement}
*/
*/
const
tableRightHeader
=
this
.
$el
.
querySelector
(
".el-table__fixed-header-wrapper"
);
const
tableFixedHeader
=
this
.
$el
.
querySelector
(
".el-table__fixed-header-wrapper"
);
if
(
tableRightHeader
)
{
if
(
tableFixedHeader
)
{
const
headerHeight
=
parseInt
(
window
.
getComputedStyle
(
tableRightHeader
).
height
);
const
headerHeight
=
parseInt
(
window
.
getComputedStyle
(
tableFixedHeader
).
height
);
// 未自适应下 正常表主体
const
defaultTableBody
=
this
.
$el
.
querySelector
(
".el-table__body-wrapper"
);
// 是否有横向滚动条
const
_hasXScroll
=
defaultTableBody
.
clientWidth
>=
defaultTableBody
.
scrollWidth
?
false
:
true
;
//原滚动条高度为6px 差 10px
//原滚动条高度为6px 差 10px
const
bodyMaxHeight
=
containerMaxHeight
-
headerHeight
-
16
;
const
bodyMaxHeight
=
containerMaxHeight
-
headerHeight
-
(
_hasXScroll
?
16
:
0
)
;
// console.log(bodyMaxHeight, "bodyMaxHeight");
// console.log(bodyMaxHeight, "bodyMaxHeight");
this
.
comMaxBodyHeight
=
bodyMaxHeight
;
this
.
comMaxBodyHeight
=
bodyMaxHeight
;
// 表体 判断是否有
竖向滚动条 容器 bodyMaxHeight 整体 最大高度大于 内部列表高
度 则没有滚动条
// 表体 判断是否有
横竖向滚动条 容器 bodyMaxHeight 整体 最大高度宽度大于 内部列表高度宽
度 则没有滚动条
const
fixedTableBody
=
this
.
$el
.
querySelector
(
".el-table__fixed-body-wrapper"
);
const
fixedTableBody
=
this
.
$el
.
querySelector
(
".el-table__fixed-body-wrapper"
);
// dom更新后 重新比较 高度
// dom更新后 重新比较
宽
高度
await
this
.
$nextTick
();
await
this
.
$nextTick
();
// 拿到 固定列表体实际高度 包含滚动高度
// 拿到 固定列表体实际高度 包含滚动高度
const
fixedBodyHeight
=
fixedTableBody
.
scrollHeight
;
const
fixedBodyHeight
=
fixedTableBody
.
scrollHeight
;
// console.log(bodyMaxHeight,"bodyMaxHeight");
// console.log(bodyMaxHeight,"bodyMaxHeight");
// console.log(parseFloat(fixedBodyHeight),"fixedBodyHeight");
// console.log(parseFloat(fixedBodyHeight),"fixedBodyHeight");
this
.
hasYScroll
=
bodyMaxHeight
>=
parseFloat
(
fixedBodyHeight
)
?
false
:
true
;
this
.
hasYScroll
=
bodyMaxHeight
>=
parseFloat
(
fixedBodyHeight
)
?
false
:
true
;
this
.
hasXScroll
=
_hasXScroll
;
}
else
{
}
else
{
// 没有固定列 正常情况下 计算默认header高度
// 没有固定列 正常情况下 计算默认header高度
const
defaultHeader
=
this
.
$el
.
querySelector
(
".el-table__header-wrapper"
);
const
defaultHeader
=
this
.
$el
.
querySelector
(
".el-table__header-wrapper"
);
...
@@ -278,6 +284,9 @@ export default {
...
@@ -278,6 +284,9 @@ export default {
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
},
getsSimulateScrollBar
()
{
},
},
pagingHandler
(
hasQueryParams
,
queryParams
,
scope
)
{
pagingHandler
(
hasQueryParams
,
queryParams
,
scope
)
{
// 有分页参数
// 有分页参数
...
@@ -355,10 +364,10 @@ export default {
...
@@ -355,10 +364,10 @@ export default {
}
}
// 自动适配下 减去滚动条高度
// 自动适配下 减去滚动条高度
.el-table__fixed
{
.el-table__fixed
{
height
:
calc
(
100%
-
15px
)
!
important
;
height
:
calc
(
100%
)
!
important
;
}
}
.el-table__fixed-right
{
.el-table__fixed-right
{
height
:
calc
(
100%
-
15px
)
!
important
;
height
:
calc
(
100%
)
!
important
;
}
}
// 重新计算隐藏列表高度 减去滚动条16px高度
// 重新计算隐藏列表高度 减去滚动条16px高度
...
@@ -369,7 +378,7 @@ export default {
...
@@ -369,7 +378,7 @@ export default {
}
}
// 是否存在Y轴滚动条
// 是否存在Y轴滚动条
&
.has-y-
S
croll
{
&
.has-y-
s
croll
{
::v-deep
.custom-table-item
{
::v-deep
.custom-table-item
{
.el-table
{
.el-table
{
/* 右侧fixed列 */
/* 右侧fixed列 */
...
@@ -382,6 +391,18 @@ export default {
...
@@ -382,6 +391,18 @@ export default {
}
}
}
}
}
}
// 是否存在X轴滚动条
&
.has-x-scroll
{
.el-table
{
.el-table__fixed
{
height
:
calc
(
100%
-
15px
)
!
important
;
}
.el-table__fixed-right
{
height
:
calc
(
100%
-
15px
)
!
important
;
}
}
}
}
}
/* 不需要分页 或没有分页参数 */
/* 不需要分页 或没有分页参数 */
...
@@ -453,6 +474,14 @@ export default {
...
@@ -453,6 +474,14 @@ export default {
font-size
:
14px
;
font-size
:
14px
;
color
:
#232323
;
color
:
#232323
;
.el-table-column--selection
{
.cell
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
.cell
{
.cell
{
padding-right
:
12px
;
padding-right
:
12px
;
padding-left
:
12px
;
padding-left
:
12px
;
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
97080f85
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
<
template
slot=
"action-field-bar"
slot-scope=
"scope"
>
<
template
slot=
"action-field-bar"
slot-scope=
"scope"
>
<div
class=
"project-action-field-bar"
>
<div
class=
"project-action-field-bar"
>
<span
class=
"push-project-use"
:class=
"
{'is-emty-quantities' : !parseFloat(scope.row.quantities)}"
<span
class=
"push-project-use"
:class=
"
{'is-emty-quantities' : !parseFloat(scope.row.quantities)}"
@click="parseFloat(scope.row.quantities) ? pushProjectUse(scope.row) : ''">推送物资
用量
</span>
@click="parseFloat(scope.row.quantities) ? pushProjectUse(scope.row) : ''">推送物资
</span>
</div>
</div>
</
template
>
</
template
>
</entity-materials-table>
</entity-materials-table>
...
...
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