45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
export const ElConfirmBeforeOpert = (title = '操作确认', text = "是否确定删除数据?", callBack: any, confirmText = '确定', cancelText = '取消', row: any) => {
|
|
ElMessageBox.confirm(
|
|
text,
|
|
title,
|
|
{
|
|
confirmButtonText: confirmText,
|
|
cancelButtonText: cancelText,
|
|
type: 'warning',
|
|
}
|
|
)
|
|
.then(() => {
|
|
callBack(row)
|
|
})
|
|
.catch(() => {
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
export const ElMessageBoxOpert = (title = '', text = "", onfirmText = "", cancelText = "", inputValidator:any, inputErrorMessage = "",callBack: any,row:any,inputType="text",confirmButtonClass="") => {
|
|
ElMessageBox.prompt(text, title, {
|
|
draggable:true,
|
|
confirmButtonText: onfirmText,
|
|
cancelButtonText: cancelText,
|
|
inputValidator: (val)=>{
|
|
return inputValidator(val)
|
|
},
|
|
inputType: inputType,
|
|
inputErrorMessage: inputErrorMessage,
|
|
confirmButtonClass:confirmButtonClass
|
|
})
|
|
.then(( value ) => {
|
|
callBack(row,value)
|
|
})
|
|
.catch(() => {
|
|
ElMessage({
|
|
type: 'info',
|
|
message: 'Input canceled',
|
|
})
|
|
})
|
|
} |