fix: 停用溯源模板前增加确认
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -203,6 +203,8 @@
|
||||
"useCount": "使用作品数",
|
||||
"create": "新建模板",
|
||||
"edit": "编辑模板",
|
||||
"disableConfirmTitle": "确认停用模板",
|
||||
"disableConfirmContent": "确认停用“{name}”?停用后新建档案时将不能选择该模板。",
|
||||
"namePlaceholder": "请输入模板名称",
|
||||
"fieldKeyTip": "英文唯一标识",
|
||||
"sortHint": "字段顺序即客户端展示顺序,可用上下箭头调整",
|
||||
|
||||
@@ -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