清除“Task”模块
This commit is contained in:
@@ -11,10 +11,12 @@
|
||||
|
||||
<el-row :gutter="16" class="kpi-row">
|
||||
<el-col :span="6">
|
||||
<KpiCard title="任务完成率" :value="formatPercent(progress?.completion_rate)" :loading="loading.progress" />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<KpiCard title="逾期任务" :value="progress?.tasks_overdue ?? 0" :loading="loading.progress" />
|
||||
<KpiCard
|
||||
title="节点完成率"
|
||||
:value="milestoneCompletionRate"
|
||||
:subtext="milestoneCompletionText"
|
||||
:loading="loading.progress"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<KpiCard title="逾期 AE" :value="overdueAes" :loading="loading.overdueAes" />
|
||||
@@ -32,15 +34,12 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-card class="section-card" header="我的待办任务">
|
||||
<el-alert v-if="errors.tasks" type="warning" :title="errors.tasks" show-icon class="mb-8" />
|
||||
<el-table v-else :data="todoTasks" style="width: 100%" v-loading="loading.tasks" @row-click="goTasks">
|
||||
<el-table-column prop="title" label="标题" />
|
||||
<el-table-column prop="priority" label="优先级" width="100" />
|
||||
<el-table-column prop="status" label="状态" width="120" />
|
||||
<el-table-column prop="due_date" label="截止日期" width="140" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-alert
|
||||
type="info"
|
||||
title="任务模块已并入伦理与启动管理,请在节点下处理相关事项"
|
||||
show-icon
|
||||
class="section-card"
|
||||
/>
|
||||
|
||||
<QuickActions class="mt-16" />
|
||||
</div>
|
||||
@@ -50,39 +49,38 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { ElAlert } from "element-plus";
|
||||
import { useRouter } from "vue-router";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { useAuthStore } from "../store/auth";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import { fetchFinanceSummary, fetchMyTodoTasks, fetchOverdueAesCount, fetchOverdueQueriesCount, fetchProgress } from "../api/dashboard";
|
||||
import { fetchFinanceSummary, fetchOverdueAesCount, fetchOverdueQueriesCount, fetchProgress } from "../api/dashboard";
|
||||
import KpiCard from "../components/KpiCard.vue";
|
||||
import QuickActions from "../components/QuickActions.vue";
|
||||
|
||||
const auth = useAuthStore();
|
||||
const study = useStudyStore();
|
||||
const router = useRouter();
|
||||
|
||||
const progress = ref<any>(null);
|
||||
const financeSummary = ref<any>(null);
|
||||
const todoTasks = ref<any[]>([]);
|
||||
const overdueAes = ref<number>(0);
|
||||
const overdueQueries = ref<number>(0);
|
||||
|
||||
const loading = ref({
|
||||
progress: false,
|
||||
finance: false,
|
||||
tasks: false,
|
||||
overdueAes: false,
|
||||
overdueQueries: false,
|
||||
});
|
||||
|
||||
const errors = ref({
|
||||
progress: "",
|
||||
finance: "",
|
||||
tasks: "",
|
||||
overdueAes: "",
|
||||
overdueQueries: "",
|
||||
const milestoneCompletionRate = computed(() => {
|
||||
const total = progress.value?.milestones_total ?? 0;
|
||||
if (!total) return "-";
|
||||
return formatPercent((progress.value?.milestones_done ?? 0) / total);
|
||||
});
|
||||
|
||||
const milestoneCompletionText = computed(() => {
|
||||
const total = progress.value?.milestones_total ?? 0;
|
||||
const done = progress.value?.milestones_done ?? 0;
|
||||
return total ? `已完成 ${done}/${total}` : "暂无节点数据";
|
||||
});
|
||||
|
||||
const formatPercent = (v?: number | null) => {
|
||||
@@ -90,61 +88,38 @@ const formatPercent = (v?: number | null) => {
|
||||
return `${(v * 100).toFixed(0)}%`;
|
||||
};
|
||||
|
||||
const goTasks = () => {
|
||||
if (study.currentStudy) {
|
||||
router.push("/study/tasks");
|
||||
}
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
const studyId = study.currentStudy?.id;
|
||||
const userId = auth.user?.id;
|
||||
if (!studyId || !userId) return;
|
||||
if (!studyId) return;
|
||||
|
||||
loading.value.progress = true;
|
||||
loading.value.finance = true;
|
||||
loading.value.tasks = true;
|
||||
loading.value.overdueAes = true;
|
||||
loading.value.overdueQueries = true;
|
||||
|
||||
try {
|
||||
const [pRes, fRes, aesRes, dqRes, tasksRes] = await Promise.allSettled([
|
||||
const [pRes, fRes, aesRes, dqRes] = await Promise.allSettled([
|
||||
fetchProgress(studyId),
|
||||
fetchFinanceSummary(studyId),
|
||||
fetchOverdueAesCount(studyId),
|
||||
fetchOverdueQueriesCount(studyId),
|
||||
fetchMyTodoTasks(studyId, userId),
|
||||
]);
|
||||
|
||||
if (pRes.status === "fulfilled") {
|
||||
progress.value = pRes.value.data;
|
||||
} else {
|
||||
errors.value.progress = "进度数据加载失败";
|
||||
}
|
||||
if (fRes.status === "fulfilled") {
|
||||
financeSummary.value = fRes.value.data;
|
||||
} else {
|
||||
errors.value.finance = "费用汇总加载失败";
|
||||
}
|
||||
if (aesRes.status === "fulfilled") {
|
||||
overdueAes.value = aesRes.value.data?.total ?? 0;
|
||||
} else {
|
||||
errors.value.overdueAes = "逾期 AE 加载失败";
|
||||
}
|
||||
if (dqRes.status === "fulfilled") {
|
||||
overdueQueries.value = dqRes.value.data?.total ?? 0;
|
||||
} else {
|
||||
errors.value.overdueQueries = "逾期数据问题加载失败";
|
||||
}
|
||||
if (tasksRes.status === "fulfilled") {
|
||||
todoTasks.value = tasksRes.value.data?.items ?? [];
|
||||
} else {
|
||||
errors.value.tasks = "待办任务加载失败";
|
||||
}
|
||||
} finally {
|
||||
loading.value.progress = false;
|
||||
loading.value.finance = false;
|
||||
loading.value.tasks = false;
|
||||
loading.value.overdueAes = false;
|
||||
loading.value.overdueQueries = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user