29 lines
817 B
TypeScript
29 lines
817 B
TypeScript
/**
|
|
* 二次确认打开入口(module 13 task 245):把模型计划交给 ElMessageBox,并对
|
|
* 确认/取消统一归约为 boolean;并发锁拒绝重复弹出。
|
|
*/
|
|
import { ElMessageBox } from 'element-plus'
|
|
import {
|
|
acquireConfirmLock,
|
|
createConfirmPlan,
|
|
releaseConfirmLock,
|
|
type AdminConfirmOptions,
|
|
} from './admin-confirm-model'
|
|
|
|
export async function openAdminConfirm(options: AdminConfirmOptions = {}): Promise<boolean> {
|
|
const plan = createConfirmPlan(options)
|
|
if (!acquireConfirmLock()) return false
|
|
try {
|
|
return await ElMessageBox.confirm(plan.message, plan.title, {
|
|
confirmButtonText: plan.confirmText,
|
|
cancelButtonText: plan.cancelText,
|
|
type: plan.type,
|
|
}).then(
|
|
() => true,
|
|
() => false,
|
|
)
|
|
} finally {
|
|
releaseConfirmLock()
|
|
}
|
|
}
|