Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
b2f96e4b
Commit
b2f96e4b
authored
Jan 29, 2026
by
水玉婷
Browse files
feat:表格固定前两列
parent
c11c4929
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/views/components/AiChat.vue
View file @
b2f96e4b
...
...
@@ -475,7 +475,7 @@ const sendMessage = async (type: MessageType = 'text', params: MessageParams = {
}
const
simulatedMessage
=
{
message
:
'
检测到SSE连接错误,触发重连,请
重新发送
消息
'
,
message
:
'
消息发送失败,系统检测到网络波动,您可以稍后
重新发送
。
'
,
status
:
-
1
,
// 错误状态
type
:
0
// 错误类型
};
...
...
src/views/components/ChartComponent.vue
View file @
b2f96e4b
...
...
@@ -353,7 +353,7 @@ onMounted(() => {
}
.chart-controls {
padding:
8
px
6
px;
padding:
6
px
12
px;
background-color: #fafafa;
border-bottom: 1px solid #e8e8e8;
display: flex;
...
...
src/views/components/TableComponent.vue
View file @
b2f96e4b
...
...
@@ -8,7 +8,7 @@
:columns=
"tableColumns"
:data-source=
"processedTableData"
size=
"middle"
:scroll=
"
{ x: 'max-content' }
"
:scroll=
"
getTableScroll()
"
:pagination=
"
{
current: paginationState.current,
pageSize: paginationState.pageSize,
...
...
@@ -160,13 +160,28 @@ const tableColumns = computed(() => {
// 使用处理后的数据的字段作为表头
const
headers
=
Object
.
keys
(
processedTableData
.
value
[
0
]);
return
headers
.
map
(
header
=>
{
// 判断是否需要固定列(列数大于6时固定前两列)
const
shouldFixColumns
=
headers
.
length
>
6
;
return
headers
.
map
((
header
,
index
)
=>
{
// 将字段名中的FORMAT后缀去掉
const
displayHeader
=
header
.
replace
(
/FORMAT$/
,
''
);
// 判断当前字段是否为indexFields字段
const
isIndexField
=
indexFields
.
includes
(
header
);
// 设置固定列配置
let
fixedConfig
=
{};
if
(
shouldFixColumns
)
{
if
(
index
===
0
)
{
// 第一列固定在左侧
fixedConfig
=
{
fixed
:
'
left
'
};
}
else
if
(
index
===
1
)
{
// 第二列固定在左侧
fixedConfig
=
{
fixed
:
'
left
'
};
}
}
return
{
title
:
displayHeader
,
dataIndex
:
header
,
...
...
@@ -174,6 +189,7 @@ const tableColumns = computed(() => {
align
:
getColumnAlign
(
header
),
width
:
getColumnWidth
(
header
),
ellipsis
:
true
,
...
fixedConfig
,
sorter
:
isNumericColumn
(
header
)
?
(
a
,
b
)
=>
{
// 对于indexFields字段,使用存储的原始值进行排序
if
(
isIndexField
&&
a
[
header
]
&&
a
[
header
].
value
!==
undefined
)
{
...
...
@@ -258,6 +274,22 @@ const renderCellContent = (header: string, value: any, record: any) => {
}
return
value
;
};
// 获取表格滚动配置
const
getTableScroll
=
()
=>
{
if
(
processedTableData
.
value
.
length
===
0
)
return
{
x
:
'
max-content
'
};
const
headers
=
Object
.
keys
(
processedTableData
.
value
[
0
]);
// 当列数大于6时,启用横向滚动(不设置固定高度,避免纵向滚动条)
if
(
headers
.
length
>
6
)
{
return
{
x
:
'
max-content
'
};
}
return
{
x
:
'
max-content
'
};
};
</
script
>
<
style
scoped
>
...
...
@@ -356,9 +388,6 @@ const renderCellContent = (header: string, value: any, record: any) => {
font-size
:
14px
;
border-right
:
1px
solid
rgb
(
202
181
181
/
20%
);
height
:
35px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
min-width
:
80px
;
&:last-child
{
...
...
@@ -375,9 +404,6 @@ const renderCellContent = (header: string, value: any, record: any) => {
border-bottom
:
1px
solid
#f0f0f0
;
color
:
#323232
;
height
:
35px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
vertical-align
:
middle
;
min-width
:
80px
;
font-weight
:
400
;
...
...
@@ -399,6 +425,9 @@ const renderCellContent = (header: string, value: any, record: any) => {
.ant-table-tbody
>
tr
:last-child
>
td
{
border-bottom
:
none
;
}
.ant-table-pagination.ant-pagination
{
margin
:
12px
0
0
;
}
...
...
@@ -406,4 +435,15 @@ const renderCellContent = (header: string, value: any, record: any) => {
display
:
none
;
}
}
/* 移除表格滚动时的阴影效果 */
/* :deep(.ant-table-ping-left:not(.ant-table-has-fix-left) .ant-table-container::before) {
box-shadow: none;
}
:deep(.ant-table-ping-right:not(.ant-table-has-fix-right) .ant-table-container::after) {
box-shadow: none;
}
:deep(.ant-table-container table > thead > tr:first-child th:first-child) {
border-top-left-radius: 0;
} */
</
style
>
\ No newline at end of file
src/views/components/style.less
View file @
b2f96e4b
...
...
@@ -939,14 +939,9 @@ li {
max-width: 100%;
margin:8px 0;
border-radius:8px;
// background-color: @white;
// border: 1px solid @blue-light-3;
// border-top: 1px solid @blue-light-3;
// box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
.markdown-content {
// padding: 12px 16px;
font-size: 14px;
line-height: 1.6;
color: @gray-9;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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