feat: 完善编辑工作台保存与离开体验
This commit is contained in:
1 parent
860d9266fe
commit
fa6b492bce
7 files changed
+168
-15
No files matched your search
@@ -11,10 +11,12 @@ export function InquiryPreviewEditor({
|
||||
runtime,
|
||||
fieldKey,
|
||||
onDraft,
|
||||
onSaved,
|
||||
}: {
|
||||
runtime: RuntimeInquiryForm;
|
||||
fieldKey: string;
|
||||
onDraft: (fields: RuntimeInquiryForm["fields"]) => void;
|
||||
onSaved?: () => void;
|
||||
}) {
|
||||
const [form] = Form.useForm<Record<string, unknown>>();
|
||||
const cache = useQueryClient();
|
||||
@@ -46,6 +48,7 @@ export function InquiryPreviewEditor({
|
||||
return createApiClient().updateAdminInquiryForm(record.id, { fieldsSnapshot });
|
||||
},
|
||||
onSuccess: () => {
|
||||
onSaved?.();
|
||||
message.success("表单字段已保存为草稿");
|
||||
void cache.invalidateQueries({ queryKey: ["admin-inquiry-forms"] });
|
||||
void cache.invalidateQueries({ queryKey: ["admin-preview-workspace"] });
|
||||
|
||||
Reference in new issue
Block a user