删除项目列表模块(重复内容)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
.todo-card[data-v-addac169]{min-height:200px}.section-header[data-v-addac169]{font-weight:600;margin-bottom:8px}.input-row[data-v-addac169]{display:flex;gap:8px;margin-bottom:8px}.todo-list[data-v-addac169]{display:flex;flex-direction:column;gap:6px}.todo-item[data-v-addac169]{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid #ebeef5;border-radius:6px}.empty[data-v-addac169]{color:#888}
|
||||
@@ -1 +0,0 @@
|
||||
.section-card[data-v-63b635fd]{min-height:220px}.section-header[data-v-63b635fd]{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.list[data-v-63b635fd]{display:flex;flex-direction:column;gap:8px}.row[data-v-63b635fd]{padding:8px;border:1px solid #ebeef5;border-radius:6px;cursor:pointer}.row[data-v-63b635fd]:hover{background:#f5f7fa}.title[data-v-63b635fd]{font-weight:600}.meta[data-v-63b635fd]{margin-top:4px;display:flex;align-items:center;gap:8px;color:#666;font-size:12px}.sub[data-v-63b635fd],.empty[data-v-63b635fd]{color:#888}
|
||||
Vendored
+2
-2
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CTMS</title>
|
||||
<script type="module" crossorigin src="/assets/index-B28dIBQG.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Dvp__k11.css">
|
||||
<script type="module" crossorigin src="/assets/index-cQqawB_h.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BtT9sBSg.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<router-view />
|
||||
<!-- TODO: 预留聚合接口页面:/studies/{id}/overview /subjects/{id}/detail /sites/{id}/summary -->
|
||||
<!-- TODO: 预留聚合接口页面:/study/{id}/overview /subjects/{id}/detail /sites/{id}/summary -->
|
||||
</template>
|
||||
|
||||
@@ -46,7 +46,7 @@ instance.interceptors.response.use(
|
||||
}
|
||||
router.push("/login");
|
||||
};
|
||||
// 如果当前项目不存在或已失效,清理项目并跳到项目列表
|
||||
// 如果当前项目不存在或已失效,清理项目并跳到工作台
|
||||
if (status === 404 && typeof data?.message === "string" && data.message.toLowerCase().includes("study")) {
|
||||
try {
|
||||
const studyStore = useStudyStore();
|
||||
@@ -54,7 +54,7 @@ instance.interceptors.response.use(
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
router.push("/studies");
|
||||
router.push("/workbench");
|
||||
}
|
||||
if (status === 401) {
|
||||
handleUnauthorized();
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
<el-icon><Suitcase /></el-icon>
|
||||
<span>项目管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/studies">
|
||||
<el-icon><List /></el-icon>
|
||||
<span>项目列表</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
|
||||
<template v-if="study.currentStudy">
|
||||
@@ -136,7 +132,7 @@ import { useAuthStore } from "../store/auth";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import StudySelector from "./StudySelector.vue";
|
||||
import {
|
||||
Monitor, User, Suitcase, List, House, Timer, UserFilled,
|
||||
Monitor, User, Suitcase, House, Timer, UserFilled,
|
||||
Warning, InfoFilled, QuestionFilled, Checked, Management,
|
||||
Money, Collection, Memo, ArrowDown, SwitchButton
|
||||
} from "@element-plus/icons-vue";
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
<template>
|
||||
<el-dropdown trigger="click" class="study-selector-dropdown">
|
||||
<el-dropdown trigger="click" class="study-selector-dropdown" @command="onCommand">
|
||||
<div class="selector-trigger">
|
||||
<el-icon class="trigger-icon"><OfficeBuilding /></el-icon>
|
||||
<span class="current-study-name">{{ study.currentStudy?.name || "选择项目" }}</span>
|
||||
<el-icon class="arrow-icon"><ArrowDown /></el-icon>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="goSelect">
|
||||
<el-icon><Switch /></el-icon>切换项目
|
||||
<el-dropdown-menu class="study-dropdown">
|
||||
<el-dropdown-item v-if="loading" disabled>
|
||||
<el-icon><Loading /></el-icon>加载项目中...
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided @click="clearStudy" class="danger-item">
|
||||
<el-dropdown-item v-else-if="!studies.length" disabled>暂无可用项目</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-for="item in studies"
|
||||
:key="item.id"
|
||||
:command="{ type: 'switch', study: item }"
|
||||
:class="{ active: study.currentStudy?.id === item.id }"
|
||||
>
|
||||
<div class="study-item">
|
||||
<div class="name">{{ item.name }}</div>
|
||||
<div class="code">{{ item.code }}</div>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided command="clear" class="danger-item">
|
||||
<el-icon><Close /></el-icon>退出当前项目
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@@ -19,21 +31,46 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import { OfficeBuilding, ArrowDown, Switch, Close } from "@element-plus/icons-vue";
|
||||
import { fetchStudies } from "../api/studies";
|
||||
import type { Study } from "../types/api";
|
||||
import { OfficeBuilding, ArrowDown, Close, Loading } from "@element-plus/icons-vue";
|
||||
|
||||
const router = useRouter();
|
||||
const study = useStudyStore();
|
||||
const studies = ref<Study[]>([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const goSelect = () => {
|
||||
router.push("/studies");
|
||||
const loadStudies = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const { data } = await fetchStudies();
|
||||
studies.value = data.items || [];
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.response?.data?.message || "项目列表加载失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const clearStudy = () => {
|
||||
study.clearCurrentStudy();
|
||||
router.push("/studies");
|
||||
const onCommand = (cmd: any) => {
|
||||
if (cmd === "clear") {
|
||||
study.clearCurrentStudy();
|
||||
router.push("/workbench");
|
||||
return;
|
||||
}
|
||||
if (cmd?.type === "switch" && cmd.study) {
|
||||
study.setCurrentStudy(cmd.study as Study);
|
||||
router.push("/study/home");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadStudies();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -74,6 +111,32 @@ const clearStudy = () => {
|
||||
color: var(--ctms-text-secondary);
|
||||
}
|
||||
|
||||
.study-dropdown {
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.study-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.study-item .name {
|
||||
font-weight: 600;
|
||||
color: var(--ctms-text-main);
|
||||
}
|
||||
|
||||
.study-item .code {
|
||||
font-size: 12px;
|
||||
color: var(--ctms-text-secondary);
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: var(--ctms-primary-light);
|
||||
}
|
||||
|
||||
.danger-item {
|
||||
color: var(--ctms-danger);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useStudyStore } from "../store/study";
|
||||
import Layout from "../components/Layout.vue";
|
||||
import Login from "../views/Login.vue";
|
||||
import Register from "../views/Register.vue";
|
||||
import StudyList from "../views/StudyList.vue";
|
||||
import StudyHome from "../views/StudyHome.vue";
|
||||
import Milestones from "../views/Milestones.vue";
|
||||
import MilestoneDetail from "../views/MilestoneDetail.vue";
|
||||
@@ -52,7 +51,7 @@ const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
component: Layout,
|
||||
redirect: "/studies",
|
||||
redirect: "/workbench",
|
||||
children: [
|
||||
{
|
||||
path: "workbench",
|
||||
@@ -243,18 +242,6 @@ const routes: RouteRecordRaw[] = [
|
||||
component: ProjectDetail,
|
||||
meta: { title: "项目详情", requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "/studies",
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
name: "StudyList",
|
||||
component: StudyList,
|
||||
meta: { title: "项目列表" },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
@@ -280,12 +267,12 @@ router.beforeEach(async (to, _from, next) => {
|
||||
}
|
||||
if ((to.path === "/login" || to.path === "/register") && token) {
|
||||
if (!auth.forceLogin) {
|
||||
next({ path: studyStore.currentStudy ? "/study/home" : "/studies" });
|
||||
next({ path: studyStore.currentStudy ? "/study/home" : "/workbench" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (to.meta.requiresAdmin && auth.user?.role !== "ADMIN") {
|
||||
next({ path: "/studies" });
|
||||
next({ path: "/workbench" });
|
||||
return;
|
||||
}
|
||||
if (to.name === "AuditLogs") {
|
||||
@@ -297,7 +284,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
}
|
||||
}
|
||||
if (to.path.startsWith("/study") && !studyStore.currentStudy) {
|
||||
next({ path: "/studies" });
|
||||
next({ path: "/workbench" });
|
||||
return;
|
||||
}
|
||||
next();
|
||||
|
||||
@@ -83,12 +83,12 @@
|
||||
</div>
|
||||
|
||||
<div v-else class="empty-state-container">
|
||||
<el-empty description="请先在顶部或项目列表选择一个当前项目" />
|
||||
<el-empty description="请先在顶部选择一个当前项目" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useAuthStore } from "../store/auth";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import { fetchFinanceSummary, fetchOverdueAesCount, fetchOverdueQueriesCount, fetchProgress } from "../api/dashboard";
|
||||
@@ -151,9 +151,24 @@ const loadData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const resetData = () => {
|
||||
progress.value = null;
|
||||
financeSummary.value = null;
|
||||
overdueAes.value = 0;
|
||||
overdueQueries.value = 0;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadData();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => study.currentStudy?.id,
|
||||
() => {
|
||||
resetData();
|
||||
loadData();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<template>
|
||||
<div class="study-list">
|
||||
<el-card>
|
||||
<div class="header">
|
||||
<h3>项目列表</h3>
|
||||
</div>
|
||||
<el-table :data="studies" style="width: 100%" v-loading="loading">
|
||||
<el-table-column prop="code" label="项目编号" width="160" />
|
||||
<el-table-column prop="name" label="项目名称" />
|
||||
<el-table-column prop="status" label="状态" width="120" />
|
||||
<el-table-column label="操作" width="140">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="small" @click="enterStudy(scope.row)">进入项目</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { fetchStudies } from "../api/studies";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import type { Study } from "../types/api";
|
||||
|
||||
const studies = ref<Study[]>([]);
|
||||
const loading = ref(false);
|
||||
const router = useRouter();
|
||||
const studyStore = useStudyStore();
|
||||
|
||||
const loadStudies = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const { data } = await fetchStudies();
|
||||
studies.value = data.items;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const enterStudy = (study: Study) => {
|
||||
studyStore.setCurrentStudy(study);
|
||||
router.push("/study/home");
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadStudies();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.study-list {
|
||||
padding: 16px;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- 提示未选择项目 -->
|
||||
<el-alert
|
||||
v-if="!currentStudyId"
|
||||
title="请先在顶部导航或项目列表中选择一个项目,以开启完整的工作台功能。"
|
||||
title="请先在顶部导航选择一个项目,以开启完整的工作台功能。"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
|
||||
Reference in New Issue
Block a user