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
866c1b33
Commit
866c1b33
authored
Mar 10, 2024
by
tyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
element ui table 固定列 行错位 自带bug修复 => 重新计算dom元素高度 通过css变量重新插入赋值
parent
b91b4446
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
20 deletions
+61
-20
package.json
dsk-operate-ui/package.json
+1
-1
index.vue
dsk-operate-ui/src/components/CustomTable/index.vue
+57
-16
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+1
-1
index.vue
dsk-operate-ui/src/views/projectCostLedger/detail/index.vue
+2
-2
No files found.
dsk-operate-ui/package.json
View file @
866c1b33
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"author"
:
"若依"
,
"author"
:
"若依"
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"
set NODE_OPTIONS=--openssl-legacy-provider &
vue-cli-service serve"
,
"dev"
:
"vue-cli-service serve"
,
"devmac"
:
"export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve"
,
"devmac"
:
"export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve"
,
"build:prod"
:
"vue-cli-service build"
,
"build:prod"
:
"vue-cli-service build"
,
"build:test"
:
"vue-cli-service build --mode test"
,
"build:test"
:
"vue-cli-service build --mode test"
,
...
...
dsk-operate-ui/src/components/CustomTable/index.vue
View file @
866c1b33
<
template
>
<
template
>
<div
class=
"table-list-com-ins"
:class=
"
{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight}">
<div
class=
"table-list-com-ins"
:class=
"
{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight}"
:style="maxBodyFixedStyle">
<div
class=
"table-item"
>
<div
class=
"table-item"
>
<el-table
v-if=
"tableDataTotal>0"
class=
"fixed-table"
v-loading=
"tableLoading"
:data=
"tableData"
element-loading-text=
"Loading"
ref=
"tableRef"
<el-table
v-if=
"tableDataTotal>0"
class=
"fixed-table"
v-loading=
"tableLoading"
:data=
"tableData"
element-loading-text=
"Loading"
border
fit
highlight-current-row
:default-sort=
"defaultSort?defaultSort:
{}" @sort-change="sortChange" @selection-change="selection
Change"
ref=
"customTableRef"
border
fit
highlight-current-row
:default-sort=
"defaultSort?defaultSort:
{}" @sort-change="sort
Change"
:cell-class-name="cellClassName" :cell-style="cellStyle" :row-class-name="rowClassName" :row-style="rowStyle" :height="height
"
@selection-change="selectionChange" :cell-class-name="cellClassName" :cell-style="cellStyle" :row-class-name="rowClassName
"
:maxHeight="comMaxHeight" v-sticky-header="stickyHeader">
:
row-style="rowStyle" :height="height" :
maxHeight="comMaxHeight" v-sticky-header="stickyHeader">
<el-table-column
type=
"selection"
:width=
"needSelection.width ? needSelection.width : '38px'"
v-if=
"needSelection.flag"
<el-table-column
type=
"selection"
:width=
"needSelection.width ? needSelection.width : '38px'"
v-if=
"needSelection.flag"
:fixed=
"needSelection.fixed"
:align=
"needSelection.align"
:show-overflow-tooltip=
"needSelection.showOverflowTooltip"
>
:fixed=
"needSelection.fixed"
:align=
"needSelection.align"
:show-overflow-tooltip=
"needSelection.showOverflowTooltip"
>
</el-table-column>
</el-table-column>
...
@@ -138,7 +139,8 @@ export default {
...
@@ -138,7 +139,8 @@ export default {
current_page
:
this
.
queryParams
.
pageNum
,
current_page
:
this
.
queryParams
.
pageNum
,
show_page
:
this
.
paging
,
show_page
:
this
.
paging
,
comMaxHeight
:
null
,
comMaxHeight
:
null
,
hasQueryParams
:
false
hasQueryParams
:
false
,
comMaxBodyHeight
:
0
};
};
},
},
watch
:
{
watch
:
{
...
@@ -159,6 +161,13 @@ export default {
...
@@ -159,6 +161,13 @@ export default {
deep
:
true
deep
:
true
}
}
},
},
computed
:
{
maxBodyFixedStyle
()
{
return
{
"--body-max-height"
:
`
${
this
.
comMaxBodyHeight
}
px`
};
}
},
created
()
{
created
()
{
this
.
maxHeight
?
this
.
maxHeightInit
()
:
null
;
this
.
maxHeight
?
this
.
maxHeightInit
()
:
null
;
},
},
...
@@ -167,19 +176,38 @@ export default {
...
@@ -167,19 +176,38 @@ export default {
async
maxHeightInit
()
{
async
maxHeightInit
()
{
try
{
try
{
await
this
.
$nextTick
();
await
this
.
$nextTick
();
if
(
typeof
this
.
maxHeight
==
"number"
)
{
// 固定数值
this
.
comMaxHeight
=
`
${
this
.
maxHeight
}
px`
;
const
isFixedNumber
=
typeof
this
.
maxHeight
==
"number"
;
return
;
// 最大高度
let
containerMaxHeight
=
null
;
if
(
isFixedNumber
)
{
containerMaxHeight
=
this
.
maxHeight
;
}
else
{
/**
* @type {HTMLDivElement}
*/
const
container
=
this
.
$el
.
querySelector
(
".table-item"
);
if
(
container
)
{
containerMaxHeight
=
container
.
offsetHeight
;
}
}
}
/**
// 列表自适应高度
* @type {HTMLDivElement}
this
.
comMaxHeight
=
containerMaxHeight
?
`
${
containerMaxHeight
}
px`
:
null
;
*/
// 重新计算表格高度 减去滚动条高度差 16 - 6
const
container
=
this
.
$el
.
querySelector
(
".table-item"
);
if
(
containerMaxHeight
)
{
if
(
container
)
{
/**
this
.
comMaxHeight
=
`
${
container
.
offsetHeight
}
px`
;
* @type {HTMLDivElement}
*/
const
tableRightHeader
=
this
.
$el
.
querySelector
(
".el-table__fixed-header-wrapper"
);
if
(
tableRightHeader
)
{
const
headerHeight
=
parseInt
(
window
.
getComputedStyle
(
tableRightHeader
).
height
);
//原滚动条高度为6px 差 10px
const
bodyMaxHeight
=
containerMaxHeight
-
headerHeight
-
16
;
this
.
comMaxBodyHeight
=
bodyMaxHeight
;
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
},
},
pagingHandler
(
hasQueryParams
,
queryParams
,
scope
)
{
pagingHandler
(
hasQueryParams
,
queryParams
,
scope
)
{
...
@@ -235,6 +263,7 @@ export default {
...
@@ -235,6 +263,7 @@ export default {
/* maxHeight自适应样式 */
/* maxHeight自适应样式 */
&
.auto-max-height
{
&
.auto-max-height
{
::v-deep
.table-item
{
::v-deep
.table-item
{
// 原滚动条为6px 现在多10px
.el-table
{
.el-table
{
/* 右侧fixed列 */
/* 右侧fixed列 */
.el-table__fixed-right
{
.el-table__fixed-right
{
...
@@ -253,6 +282,18 @@ export default {
...
@@ -253,6 +282,18 @@ export default {
border-left
:
unset
;
border-left
:
unset
;
border-bottom
:
unset
;
border-bottom
:
unset
;
}
}
// 自动适配下 减去滚动条高度
.el-table__fixed
{
height
:
calc
(
100%
-
15px
)
!
important
;
}
.el-table__fixed-right
{
height
:
calc
(
100%
-
15px
)
!
important
;
}
// 重新计算隐藏列表高度 减去滚动条16px高度
.el-table__fixed-body-wrapper
{
max-height
:
var
(
--
body-max-height
)
!
important
;
}
}
}
}
}
}
}
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
866c1b33
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
<!-- 数据列表部分 -->
<!-- 数据列表部分 -->
<div
class=
"project-feedsummary-list-container"
>
<div
class=
"project-feedsummary-list-container"
>
<dsk-skeleton
v-if=
"tableLoading"
></dsk-skeleton>
<dsk-skeleton
v-if=
"tableLoading"
></dsk-skeleton>
<custom-table
:tableData=
"tableDataList"
:formColum=
"formColum"
v-else-if=
"!tableLoading"
:tableDataTotal=
"total"
<custom-table
:tableData=
"tableDataList"
:formColum=
"formColum"
v-else-if=
"!tableLoading"
:
max-height=
"true"
:
tableDataTotal=
"total"
:paging=
"false"
>
:paging=
"false"
>
<
template
slot=
"action-field-bar"
slot-scope=
"scope"
>
<
template
slot=
"action-field-bar"
slot-scope=
"scope"
>
<div
class=
"project-action-field-bar"
v-if=
"scope.row.id != '0'"
>
<div
class=
"project-action-field-bar"
v-if=
"scope.row.id != '0'"
>
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/index.vue
View file @
866c1b33
...
@@ -193,8 +193,8 @@ export default {
...
@@ -193,8 +193,8 @@ export default {
const
detail
=
await
getProjectDetailApi
(
projectId
);
const
detail
=
await
getProjectDetailApi
(
projectId
);
if
(
detail
.
code
==
200
&&
detail
.
data
)
{
if
(
detail
.
code
==
200
&&
detail
.
data
)
{
if
(
detail
.
data
.
id
)
detail
.
data
[
"projectId"
]
=
detail
.
data
.
id
;
if
(
detail
.
data
.
id
)
detail
.
data
[
"projectId"
]
=
detail
.
data
.
id
;
detail
.
data
[
"projectId"
]
=
"1754425038355890177"
;
//
detail.data["projectId"] = "1754425038355890177";
detail
.
data
[
"cbStage"
]
=
0
;
//
detail.data["cbStage"] = 0;
this
.
detailInfo
=
detail
.
data
;
this
.
detailInfo
=
detail
.
data
;
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
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