diff --git a/static/app.js b/static/app.js
index 4cbbf00..d703ad0 100644
--- a/static/app.js
+++ b/static/app.js
@@ -2,6 +2,7 @@ const state = {
active: "home",
data: null,
opFilter: "all",
+ projectView: null,
chart: null,
chart2: null,
productPlatform: "all",
@@ -216,8 +217,6 @@ window.submitTaskForm = async (event, projectId) => {
await api("/api/tasks", { method: "POST", body: JSON.stringify({ data }) });
}
await load();
- closeTaskDrawer(projectId);
- showTaskModal(Number(projectId));
} catch (error) {
alert("保存失败:" + error.message);
}
@@ -226,6 +225,10 @@ window.createFinance = (event) => createResource(event, "finance");
window.switchTab = switchTab;
function renderProjects() {
+ // 二级页面:项目任务详情
+ if (state.projectView) {
+ return renderProjectTasks(state.projectView);
+ }
const items = state.data.operations;
const rows = items.map((x) => [
`${x.project_name}`,
@@ -233,7 +236,7 @@ function renderProjects() {
badge(x.current_stage || x.project_status),
x.expected_contract_amount ? money(x.expected_contract_amount) : "—",
text(x.owner || "—"),
- ``
+ ``
]);
document.querySelector("#projects").innerHTML = `
@@ -253,6 +256,48 @@ function renderProjects() {
`;
}
+function renderProjectTasks(projectId) {
+ const project = state.data.operations.find((x) => x.id === projectId);
+ if (!project) { state.projectView = null; renderProjects(); return; }
+ const tasks = (state.data.tasks || []).filter((t) => t.project_id === projectId);
+ const phases = ["商务洽谈", "系统上线", "团队分工", "项目交付", "上线推广", "结项验收"];
+ document.querySelector("#projects").innerHTML = `
+
+
+
+ ${project.project_name}
+
+
+
+
+
+ ${phases.map((phase) => {
+ const pt = tasks.filter((t) => t.phase === phase);
+ if (!pt.length) return "";
+ return `
${phase}${pt.length}
${pt.map((t) => `
${t.task}${t.notes ? `${t.notes}` : ""}${t.blockers ? `⚠ ${t.blockers}` : ""}
${t.owner || ""}${t.due_date || ""}`).join("")}
`;
+ }).join("")}
+
+
+
+
`;
+ if (window.lucide) window.lucide.createIcons();
+}
+
function showTaskModal(projectId) {
const project = state.data.operations.find((x) => x.id === projectId);
const tasks = (state.data.tasks || []).filter((t) => t.project_id === projectId);
diff --git a/static/styles.css b/static/styles.css
index c1ff82f..4a7a01f 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -513,7 +513,7 @@ td {
padding: 4px; border-radius: 6px; display: flex;
}
.task-close:hover { color: #475569; background: #f1f5f9; }
-.task-body-wrap { position: relative; overflow: hidden; }
+.task-body-wrap, .task-page-wrap { position: relative; overflow: hidden; }
.task-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; transition: margin-right 0.25s ease; }
.task-drawer {
position: absolute; top: 0; right: 0; width: 420px; height: 100%;