feat(table): 优化表格样式和功能

- 新增 normal-button样式,用于自定义按钮样式
- 实现表格按钮的重新渲染,增加更多自定义选项- 添加表格行悬停样式和按钮间的间距
- 优化知识详情页面的表格展示效果
- 调整预处理结果预览对话框的关闭方式
This commit is contained in:
陈昱达
2025-04-23 15:51:45 +08:00
parent fb3f8dc1d0
commit 22c13505b7
10 changed files with 327 additions and 443 deletions

View File

@@ -171,6 +171,10 @@ export default {
}
},
props: {
visible: {
type: Boolean,
default: false
},
documentId: {
type: String,
default: '1361351897324294144'
@@ -539,9 +543,11 @@ ${text}`
switch (mineruStatus) {
case 0:
case '0':
setTimeout(() => {
this.getMinerUStatus()
}, 5000)
if (!this.visible) {
setTimeout(() => {
this.getMinerUStatus()
}, 5000)
}
break
case 1:
case '1':

View File

@@ -16,8 +16,64 @@ const RenderSlot = {
row: data.props.row,
index: data.props.index
}
if (data.props.column) params.column = data.props.column
return data.props.render(h, params)
if (data.props.column) {
params.column = data.props.column
}
if (params.column.isRedraw) {
let content = data.props.render(h, params)
let contentDiv = content.children
if (contentDiv.length > 2) {
console.log(content)
// 切割掉第一个div
const first = contentDiv.splice(0, 1)
const other = contentDiv.splice(0, contentDiv.length)
first[0].data.class = 'normal-button'
first[0].data.props.type = null
first[0].data.props.size = null
other.forEach(item => {
item.data.class = 'normal-button popver-button'
})
const renderPopver = () => {
return h(
'el-popover',
{
props: {
placement: 'top-start',
width: '100',
trigger: 'click',
popperClass: 'table-popver'
},
class: 'table-popver',
scopedSlots: {
reference: () =>
h('el-button', {
props: {
size: 'mini',
type: 'text',
icon: 'el-icon-more'
},
class: 'normal-button'
})
}
},
other
)
}
content.children = [...first, renderPopver()]
return content
} else {
return data.props.render(h, params)
}
// let div =
} else {
return data.props.render(h, params)
}
// return data.props.render(h, params)
}
}
export default {

View File

@@ -44,8 +44,8 @@
<!--</el-form>-->
<!--自带的btn 不能有prop 属性-->
<div v-if="!item.selfBtn && !item.prop && !item.type && !item.render" :fixed="item.fixed ? item.fixed : fixed">
<el-button type="primary" size="mini" plain :disabled="disabled" @click="edit(scope.row, scope.$index)">编辑</el-button>
<el-button type="danger" size="mini" plain :disabled="disabled" @click="del(scope.row, scope.$index)">删除</el-button>
<el-button class="normal-button" :disabled="disabled" icon="el-icon-delete" @click="del(scope.row, scope.$index)"></el-button>
<el-button class="normal-button" icon="el-icon-edit-outline" :disabled="disabled" @click="edit(scope.row, scope.$index)"></el-button>
</div>
<!--如果渲染的是selfBtn-->
<div v-if="item.selfBtn && !item.render">
@@ -193,7 +193,7 @@ export default {
//表格边框 border
border: {
type: Boolean,
default: true
default: false
},
// 是否剧中 align
align: {