refactor(survey): 重构问卷数据管理逻辑

- 新增 clearSurveys 函数用于清空问卷数据
- 在复制问卷和删除问卷后调用 clearSurveys函数
- 在组件卸载和重置搜索时调用 clearSurveys 函数
- 优化了问卷数据的更新逻辑,解决了内容不更新的问题
- 重新添加了 .prettierrc 文件,规范代码格式
This commit is contained in:
Huangzhe
2025-05-25 13:14:15 +08:00
parent 4989bc07d7
commit 04d63eb141
4 changed files with 22 additions and 10 deletions

View File

@@ -63,7 +63,7 @@ function deleteItem(item: SurveyItem, form: any) {
showToast('删除成功!');
}
form.page = 1;
survey.value = [];
clearSurveys();
await fetchSurveys(form);
})
.catch(() => {
@@ -85,6 +85,10 @@ async function saveTemplate(item: SurveyItem) {
}
}
function clearSurveys() {
survey.value = [];
}
export {
fetchSurveys,
loading,
@@ -96,5 +100,6 @@ export {
saveTemplate,
currentSurvey,
requestLoading,
fetchSingleSurvey
fetchSingleSurvey,
clearSurveys
};