import { ElMessageBox } from 'element-plus';

export async function modalConfirm(
  title: string,
  content: string
): Promise<string> {
  return ElMessageBox.confirm(content, title, {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
    autofocus: false, // 根据需要调整
    closeOnClickModal: false, // maskClosable
    closeOnPressEscape: false, // escToClose
    showClose: false, // closable
  })
    .then(() => {
      return 'confirm';
    })
    .catch(() => {
      throw new Error('取消'); // 或者 return Promise.reject();
    });
}

export const intFormatter = (value: string) => {
  return value.replace('.', '');
};
