1.优化后台菜单页面

This commit is contained in:
2026-06-24 17:00:46 +08:00
parent 58b22cfb64
commit e40de47b8b
3 changed files with 11 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div v-memo="[field]" class="ba-table-operate-buttons"> <div v-memo="[field]">
<template v-for="(btn, idx) in field.buttons" :key="idx"> <template v-for="(btn, idx) in field.buttons" :key="idx">
<template v-if="btn.display ? btn.display(row, field) : true"> <template v-if="btn.display ? btn.display(row, field) : true">
<!-- 常规按钮 --> <!-- 常规按钮 -->
@@ -147,34 +147,16 @@ const getTranslation = (key?: string) => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.ba-table-operate-buttons {
display: inline-flex;
align-items: center;
justify-content: center;
flex-wrap: nowrap;
width: 100%;
gap: 0;
vertical-align: middle;
}
.ba-table-render-buttons-item { .ba-table-render-buttons-item {
width: 40px;
min-width: 40px;
height: 32px;
padding: 0 !important;
margin: 0 !important;
display: inline-flex;
align-items: center;
justify-content: center;
.text { .text {
font-size: 12px; font-size: 14px;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
} }
.icon + .text { .icon + .text {
padding-left: 2px; padding-left: 5px;
}
&.el-button--small {
padding: 4px 5px;
height: auto;
} }
} }
.ba-table-render-buttons-move { .ba-table-render-buttons-move {
@@ -182,10 +164,9 @@ const getTranslation = (key?: string) => {
} }
.buttons-popconfirm-reference-box { .buttons-popconfirm-reference-box {
display: inline-flex; display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
min-width: 40px;
vertical-align: middle; vertical-align: middle;
} }
.buttons-ml-6 + .buttons-ml-6 {
margin-left: 6px;
}
</style> </style>

View File

@@ -152,17 +152,15 @@ export const getButtonsColumnWidth = (buttons?: OptButton[]): number => {
} }
/** /**
* 统一操作列:右侧固定,宽度 = 按钮数 × OPERATE_BUTTON_WIDTH * 统一操作列宽度:按钮数 × OPERATE_BUTTON_WIDTH
*/ */
export const normalizeButtonsColumn = (column: TableColumn): TableColumn => { export const normalizeButtonsColumn = (column: TableColumn): TableColumn => {
if (column.render !== 'buttons') { if (column.render !== 'buttons') {
return column return column
} }
const className = column.className ? `${column.className} ba-table-operate-column` : 'ba-table-operate-column'
return { return {
...column, ...column,
fixed: 'right', fixed: 'right',
width: getButtonsColumnWidth(column.buttons), width: getButtonsColumnWidth(column.buttons),
className,
} }
} }

View File

@@ -239,13 +239,6 @@ defineExpose({
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.ba-data-table :deep(.ba-table-operate-column) {
.cell {
padding-left: 0;
padding-right: 0;
overflow: visible;
}
}
.table-pagination { .table-pagination {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;