问卷分析功能增强与UI优化

This commit is contained in:
Huangzhe
2025-05-14 00:22:19 +08:00
parent e87a064156
commit 7a5670ac66
21 changed files with 662 additions and 260 deletions

View File

@@ -9,6 +9,7 @@ import {
showFailToast,
showToast
} from 'vant';
import { getSurveysDetail } from '@/api/design';
const form = ref({
page: 0,
@@ -21,6 +22,15 @@ const survey = ref<SurveyItem[]>([]);
const total = ref(0);
const loading = ref(false);
const finished = ref(false);
const currentSurvey = ref<SurveyItem>();
async function fetchSingleSurvey(sn: string) {
const res = await getSurveysDetail(sn);
// console.log(res);
if (res.data.code === 0) {
currentSurvey.value = res.data.data;
}
}
async function fetchSurveys() {
const params = {
@@ -53,9 +63,9 @@ async function fetchSurveys() {
} else {
// Toast()
}
};
}
function deleteItem(item) {
function deleteItem(item: SurveyItem) {
showDialog({
title: `确认删除问卷${item.project_name} ?`,
showCancelButton: true,
@@ -78,7 +88,7 @@ function deleteItem(item) {
};
// 保存为模板
async function saveTemplate(item) {
async function saveTemplate(item: SurveyItem) {
const data = JSON.parse(JSON.stringify(item));
const res = await saveTemplates(item.sn, data);
if (res.data.code === 200 || res.data.code === 201) {
@@ -90,6 +100,18 @@ async function saveTemplate(item) {
showFailToast(res.data);
}
}
;
export { form, fetchSurveys, loading, finished, survey, total, searchValue, deleteItem, saveTemplate };
export {
form,
fetchSurveys,
loading,
finished,
survey,
total,
searchValue,
deleteItem,
saveTemplate,
currentSurvey,
fetchSingleSurvey
}
;