fix: 停用溯源模板前增加确认

This commit is contained in:
Nixevol
2026-07-05 04:15:49 +08:00
parent e8e514f6dd
commit af79627228
4 changed files with 21 additions and 3 deletions
+2
View File
@@ -203,6 +203,8 @@
"useCount": "Used By",
"create": "New Template",
"edit": "Edit Template",
"disableConfirmTitle": "Disable Template",
"disableConfirmContent": "Disable \"{name}\"? It will no longer be available when creating new artwork files.",
"namePlaceholder": "Enter template name",
"fieldKeyTip": "Unique English key",
"sortHint": "Field order = display order on consumer page; use arrows to reorder",
+2
View File
@@ -203,6 +203,8 @@
"useCount": "使用作品数",
"create": "新建模板",
"edit": "编辑模板",
"disableConfirmTitle": "确认停用模板",
"disableConfirmContent": "确认停用“{name}”?停用后新建档案时将不能选择该模板。",
"namePlaceholder": "请输入模板名称",
"fieldKeyTip": "英文唯一标识",
"sortHint": "字段顺序即客户端展示顺序,可用上下箭头调整",
+16 -3
View File
@@ -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() {