feat: 脚本录制功能完善
This commit is contained in:
@@ -193,7 +193,7 @@ function openEditDialog(script: AutomationScript) {
|
||||
}
|
||||
|
||||
function handleCreateDialogClose() {
|
||||
editingScript.value = undefined;
|
||||
// editingScript lifecycle is handled by handleSave / handleEditDialogClose
|
||||
}
|
||||
|
||||
function handleEditDialogClose() {
|
||||
@@ -207,8 +207,17 @@ async function handleSave(input: ScriptSaveInput) {
|
||||
await store.saveScript(input);
|
||||
ElMessage.success(t('script.toast.updated'));
|
||||
} else {
|
||||
await store.saveScript(input);
|
||||
const result = await store.saveScript(input);
|
||||
ElMessage.success(t('script.toast.created'));
|
||||
ElMessage.info(t('script.toast.codegenStarting', '正在启动 Playwright codegen 录制,请在新窗口中操作,完成后关闭窗口即可自动保存代码'));
|
||||
const codegenResult = await store.codegen(result.id, input.channel || 'about:blank');
|
||||
if (codegenResult.success) {
|
||||
ElMessage.success(t('script.toast.codegenFinished', '录制完成,代码已保存'));
|
||||
editingScript.value = { ...result, code: codegenResult.code || '' };
|
||||
editDialogVisible.value = true;
|
||||
} else {
|
||||
ElMessage.error(codegenResult.error || t('script.toast.codegenFailed', '录制失败'));
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
|
||||
Reference in New Issue
Block a user