fix: 停用溯源模板前增加确认
This commit is contained in:
@@ -213,9 +213,22 @@ const columns: DataTableColumns<any> = [
|
||||
|
||||
async function toggleStatus(r: any) {
|
||||
const next = r.status === TemplateStatus.ENABLED ? TemplateStatus.DISABLED : TemplateStatus.ENABLED;
|
||||
await templateApi.update(r.id, { status: next });
|
||||
message.success(t('common.msg.updated'));
|
||||
load();
|
||||
const update = async () => {
|
||||
await templateApi.update(r.id, { status: next });
|
||||
message.success(t('common.msg.updated'));
|
||||
load();
|
||||
};
|
||||
if (next === TemplateStatus.DISABLED) {
|
||||
dialog.warning({
|
||||
title: t('pages.template.disableConfirmTitle'),
|
||||
content: t('pages.template.disableConfirmContent', { name: r.name || '-' }),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: update,
|
||||
});
|
||||
return;
|
||||
}
|
||||
await update();
|
||||
}
|
||||
|
||||
async function load() {
|
||||
|
||||
Reference in New Issue
Block a user