feat: add workflow brand tree reset action
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-04-02 22:04:35 +08:00
parent 427e99b51e
commit 1963c84d7c

View File

@ -1161,6 +1161,28 @@ export function AgentWorkflowSettingsClient({
});
};
const handleClearBrandTree = () => {
if (brandStoreEntries.length === 0) {
toast.error("当前没有可清空的层级树数据");
return;
}
const confirmed = window.confirm(
`确认清空当前所有${firstCategoryLabel}/${secondCategoryLabel}及分类层级数据吗?此操作不会影响价格带和其它系统设置。`
);
if (!confirmed) {
return;
}
updateInputOptions([]);
setBrandDraft("");
setStoreDrafts({});
setThirdCategoryDrafts({});
setFourthCategoryDrafts({});
setFifthCategoryDrafts({});
toast.success("层级树数据已清空,可重新导入表格");
};
const handleAddThirdCategoryToStore = (brandName: string, storeName: string) => {
const draftKey = createStoreDraftKey(brandName, storeName);
const nextValue = normalizeInputOptionValue(thirdCategoryDrafts[draftKey] || "");
@ -3572,6 +3594,16 @@ export function AgentWorkflowSettingsClient({
)}
导入表格
</Button>
<Button
type="button"
variant="outline"
onClick={handleClearBrandTree}
className="h-8 border-destructive/25 text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive"
disabled={brandStoreEntries.length === 0}
>
<Trash2 className="mr-2 h-4 w-4" />
清空当前数据
</Button>
</div>
</div>
<input