逻辑信息相关功能更新:

1. 更新 LogicInfo 组件界面
2. 完善 useLogicInfo 钩子函数
3. 更新逻辑信息类型定义
4. 优化分析相关 API 接口
This commit is contained in:
Huangzhe
2025-05-14 15:03:01 +08:00
parent 774ec83149
commit a91e6792bc
5 changed files with 95 additions and 31 deletions

3
components.d.ts vendored
View File

@@ -66,4 +66,7 @@ declare module 'vue' {
YLPicker: typeof import('./src/components/YLPicker.vue')['default']
YLSelect: typeof import('./src/components/YLSelect.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}

View File

@@ -3,12 +3,35 @@ import type { CycleProgressResponse } from "../types/response";
/**
*
* @param sn 循环题组配额列表
* @param sn 循环题组sn
* @param params 可选的页数信息
*/
export function fetchCycleProgress (sn: string, params?: ParticalParams) {
export function cycleProgress (sn: string, params?: ParticalParams) {
return request<CycleProgressResponse>({
url: `console/survey_publishes/${sn}/cycle_progress_h5`,
params
});
}
/**
* 随机题组列表查询
* @param sn 随机题组sn
* @param params 可选的页数信息
*/
export function randomProgress (sn: string, params?: ParticalParams) {
return request<CycleProgressResponse>({
url: `console/survey_publishes/${sn}/random_progress_h5`,
params
});
}
/**
* 逻辑配额列表查询
* @param sn 逻辑配额sn
* @param params 可选的页数信息
*/
export function quotaProgress (sn: string, params?: ParticalParams) {
return request<CycleProgressResponse>({
url: `console/survey_publishes/${sn}/publish_statistics_h5/quota_progress`,
params
});
}

View File

@@ -1,32 +1,48 @@
<script setup lang="ts">
import { ref } from 'vue';
import { fetchCycleProgressData, cycleProgress } from "@/views/Survey/views/Analysis/components/LogicInfo/hooks/useLogicInfo"
import {
updateDate, cycle, loading
} from '@/views/Survey/views/Analysis/components/LogicInfo/hooks/useLogicInfo';
import { useRoute, useRouter } from 'vue-router';
import YlTable from "@/components/YlTable/Index.vue"
import YlTable from '@/components/YlTable/Index.vue';
const router = useRouter();
const route = useRoute()
const activeTab = ref();
const route = useRoute();
updateDate(route.query.sn as string);
const activeTab = ref(0);
const tabs = ref<LogicInfoTab[]>([{
title: '逻辑配额'
title: '逻辑配额',
props: [
{ prop: '', label: '题号', width: 120 },
{ prop: 'option', label: '选项', width: 90 },
{ prop: 'sample_num', label: '样本量', width: 90 },
{ prop: 'precent', label: '进度', width: 90 }
],
data: []
}, {
title: '随机题组配额'
title: '随机题组配额',
props: [
{ prop: '', label: '题组', width: 120 },
{ prop: '', label: '题组位置', width: 120 },
{ prop: '', label: '样本量', width: 120 },
{ prop: '', label: '进度', width: 120 }
],
data: []
}, {
title: '循环题组配额'
title: '循环题组配额',
props: [
{ prop: 'question_title', label: '关联题目', width: 120 },
{ prop: 'group_info', label: '题组', width: 120 },
{ prop: 'sample_num', label: '样本量', width: 120 },
{ prop: 'precent', label: '进度', width: 120 }
],
data: cycle
}]);
const props = [
{ prop: "question_title", label: "题号", width: 120 },
{ prop: "option", label: "选项", width: 90 },
{ prop: "sample_num", label: "样本量", width: 90 },
{ prop: "precent", label: "进度", width: 90 },
]
fetchCycleProgressData(route.query.sn as string)
</script>
<template>
<section>
<section style="width:86vw" v-loading="loading">
<!-- tabs 选项列表 -->
<van-tabs v-model:active="activeTab">
<van-tab v-for="tab in tabs">
@@ -35,7 +51,7 @@ fetchCycleProgressData(route.query.sn as string)
</template>
</van-tab>
<yl-table :data="cycleProgress" :props="props"></yl-table>
</van-tabs>
<yl-table :data="tabs[activeTab].data" :props="tabs[activeTab].props"></yl-table>
</section>
</template>

View File

@@ -1,14 +1,34 @@
import { fetchCycleProgress } from "@/api/anslysis";
import { ref } from "vue";
import type { CycleProgressItem } from "../types/cycleProgress";
import { cycleProgress, randomProgress, quotaProgress } from '@/api/anslysis';
import { ref } from 'vue';
import type { CycleProgressItem } from '../types/cycleProgress';
const cycleProgress = ref<CycleProgressItem[]>([])
const loading = ref(false);
async function fetchCycleProgressData (sn: string) {
const response = await fetchCycleProgress(sn)
console.log(response.data.data.cycle_progress);
// 循环逻辑配额列表
const cycle = ref<CycleProgressItem[]>([]);
// 随机题组配额列表
const random = ref();
// 逻辑配额
const quota = ref();
cycleProgress.value = response.data.data.cycle_progress
async function updateDate(sn: string) {
loading.value = false;
// 获取逻辑配额相关数据
let response = await quotaProgress(sn);
// console.log(response.data.data);
quota.value = response.data.data;
// 获取循环配额相关数据
response = await cycleProgress(sn);
// console.log(response.data.data.cycle_progress);
cycle.value = response.data.data.cycle_progress;
response = await randomProgress(sn);
// console.log(response.data.data.randomProgress);
random.value = response.data.data.randomProgress;
loading.value = false;
}
export { fetchCycleProgressData, cycleProgress }
export { updateDate, cycle, loading };

View File

@@ -1,3 +1,5 @@
type LogicInfoTab = {
title: string,
props: unknown,
data: unknown
}