mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
feat(baTable):表格右侧操作按钮增加是否显示该按钮的属性
This commit is contained in:
parent
09a1aa37ed
commit
61eff1e74f
@ -74,60 +74,75 @@
|
||||
<!-- 按钮组 -->
|
||||
<div v-if="field.render == 'buttons' && field.buttons">
|
||||
<template v-for="(btn, idx) in field.buttons">
|
||||
<el-tooltip
|
||||
v-if="btn.render == 'tipButton'"
|
||||
:disabled="btn.title ? false : true"
|
||||
:content="btn.title ? t(btn.title) : ''"
|
||||
placement="top"
|
||||
>
|
||||
<el-button
|
||||
v-if="btn.name == 'edit'"
|
||||
v-auth="'edit'"
|
||||
v-blur
|
||||
@click="onButtonClick(btn.name)"
|
||||
:class="btn.class"
|
||||
class="table-operate"
|
||||
:type="btn.type"
|
||||
<template v-if="btn.display ? btn.display(row, field) : true">
|
||||
<el-tooltip
|
||||
v-if="btn.render == 'tipButton'"
|
||||
:disabled="btn.title ? false : true"
|
||||
:content="btn.title ? t(btn.title) : ''"
|
||||
placement="top"
|
||||
>
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur @click="onButtonClick(btn.name)" :class="btn.class" class="table-operate" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-popconfirm v-if="btn.render == 'confirmButton'" v-bind="btn.popconfirm" @confirm="onButtonClick(btn.name)">
|
||||
<template #reference>
|
||||
<div class="ml-6">
|
||||
<el-tooltip :disabled="btn.title ? false : true" :content="btn.title ? t(btn.title) : ''" placement="top">
|
||||
<el-button v-if="btn.name == 'delete'" v-auth="'del'" v-blur :class="btn.class" class="table-operate" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur :class="btn.class" class="table-operate" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-tooltip
|
||||
v-if="btn.render == 'moveButton'"
|
||||
:disabled="btn.title && !btn.disabledTip ? false : true"
|
||||
:content="btn.title ? t(btn.title) : ''"
|
||||
placement="top"
|
||||
>
|
||||
<el-button v-if="btn.name == 'weigh-sort'" v-auth="'sortable'" :class="btn.class" class="table-operate move-button" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur :class="btn.class" class="table-operate move-button" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
v-if="btn.name == 'edit'"
|
||||
v-auth="'edit'"
|
||||
v-blur
|
||||
@click="onButtonClick(btn.name)"
|
||||
:class="btn.class"
|
||||
class="table-operate"
|
||||
:type="btn.type"
|
||||
>
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur @click="onButtonClick(btn.name)" :class="btn.class" class="table-operate" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-popconfirm v-if="btn.render == 'confirmButton'" v-bind="btn.popconfirm" @confirm="onButtonClick(btn.name)">
|
||||
<template #reference>
|
||||
<div class="ml-6">
|
||||
<el-tooltip :disabled="btn.title ? false : true" :content="btn.title ? t(btn.title) : ''" placement="top">
|
||||
<el-button
|
||||
v-if="btn.name == 'delete'"
|
||||
v-auth="'del'"
|
||||
v-blur
|
||||
:class="btn.class"
|
||||
class="table-operate"
|
||||
:type="btn.type"
|
||||
>
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur :class="btn.class" class="table-operate" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-tooltip
|
||||
v-if="btn.render == 'moveButton'"
|
||||
:disabled="btn.title && !btn.disabledTip ? false : true"
|
||||
:content="btn.title ? t(btn.title) : ''"
|
||||
placement="top"
|
||||
>
|
||||
<el-button
|
||||
v-if="btn.name == 'weigh-sort'"
|
||||
v-auth="'sortable'"
|
||||
:class="btn.class"
|
||||
class="table-operate move-button"
|
||||
:type="btn.type"
|
||||
>
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
<el-button v-else v-blur :class="btn.class" class="table-operate move-button" :type="btn.type">
|
||||
<Icon :name="btn.icon" />
|
||||
<div v-if="btn.text" class="table-operate-text">{{ btn.text }}</div>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
2
web/types/table.d.ts
vendored
2
web/types/table.d.ts
vendored
@ -112,6 +112,8 @@ declare global {
|
||||
icon: string
|
||||
popconfirm?: any
|
||||
disabledTip?: boolean
|
||||
// 按钮是否显示,请返回布尔值
|
||||
display?: (row: TableRow, field: TableColumn) => boolean
|
||||
}
|
||||
|
||||
/* 表格行 */
|
||||
|
Loading…
Reference in New Issue
Block a user