1.优化谷歌验证器-前端不显示验证器按钮

This commit is contained in:
2026-06-24 16:49:34 +08:00
parent 21def75ef1
commit ceb4386440
4 changed files with 41 additions and 6 deletions

View File

@@ -45,7 +45,7 @@
<!-- 带确认框的按钮 -->
<el-popconfirm
v-if="btn.render == 'confirmButton' && ((btn.name == 'delete' && baTable.auth('del')) || btn.name != 'delete')"
v-if="btn.render == 'confirmButton' && isConfirmButtonVisible(btn)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="invokeTableContextDataFun(btn.popconfirm, { row, field, cellValue: btn, column, index })"
@confirm="onButtonClick(btn)"
@@ -108,6 +108,7 @@ import { inject } from 'vue'
import { useI18n } from 'vue-i18n'
import { invokeTableContextDataFun } from '/@/components/table/index'
import type baTableClass from '/@/utils/baTable'
import { useAdminInfo } from '/@/stores/adminInfo'
interface Props {
row: TableRow
@@ -119,6 +120,7 @@ interface Props {
const { t, te } = useI18n()
const props = defineProps<Props>()
const baTable = inject('baTable') as baTableClass
const adminInfo = useAdminInfo()
const onButtonClick = (btn: OptButton) => {
if (typeof btn.click === 'function') {
@@ -128,6 +130,16 @@ const onButtonClick = (btn: OptButton) => {
baTable.onTableAction(btn.name as BaTableActionEventName, props)
}
const isConfirmButtonVisible = (btn: OptButton) => {
if (btn.name === 'delete') {
return baTable.auth('del')
}
if (btn.name === 'resetTotp') {
return adminInfo.super || baTable.auth('resetTotp')
}
return true
}
const getTranslation = (key?: string) => {
if (!key) return ''
return te(key) ? t(key) : key