cleanup(web): 删除零引用死代码:3 个函数、3 个 state 字段、6 组死样式与过时注释

- app.js: regionOptions / stackBar / barList(grep 全库零调用)
- state: idle / projects / customStage(定义后再无读写,也不在 UI_FIELDS)
- styles.css: .board-grid/.pcard*/.svg-chart/.legend/.risk-item 整块删除;
  b-name .star 选择器收敛(bar-row 系列仍被人员归属卡使用,保留)
- 注释纠偏:定制 tab 数量(3 个)、分类筛选器入口现址;README 同步
- node --check 通过
main
mula.liu 2026-10-29 14:21:54 +08:00
parent 01a9521bc7
commit e1fbb89c6e
3 changed files with 5 additions and 67 deletions

View File

@ -410,7 +410,7 @@ python scripts/legacy/add_entry_date.py --force # 全部重算
- **表格防竖排**:`table.tbl th` / `.pill` / `.tag-mini` 统一 `white-space:nowrap`,容易挤窄的列(区域、负责人)在 `<td>` 上加 `class="nowrap"`;实在挤不下交给 `.tbl-wrap { overflow:auto }` 横向滚动。
- **抽屉不被内容撑破**:`.form-row > div { min-width: 0 }`(grid 子项默认 `min-width:auto`,会被交付环节步骤条撑出整表横向滚动),步骤条本身 `flex:1 1 132px`(132px = 日期输入框含日历图标的最小可用宽度)。
> 备注:`styles.css` 里的 `.pcard`、`.board-grid` 当前没有任何 JS 引用(历史遗留样式),此处只做记录,未删除。
> 备注:历史遗留的 `.pcard`、`.board-grid`、`.svg-chart`、`.legend`、`.risk-item` 等零引用样式已随死代码清理删除(2026-10-29)。
## 数据导出

View File

@ -12,23 +12,20 @@
monthIdx: null,
categoryId: null,
keyword: "",
idle: "key",
showArchived: false,
meta: null,
periods: null,
categories: [],
projects: [],
drawerProject: null,
// 详情抽屉:周期反馈的显示粒度 / 范围 / 往前翻页偏移
dw: { group: "week", range: 2, back: 0 },
// 定制项目
customMeta: null,
finance: null, // /custom/finance 汇总:统计条与年度任务的唯一数据源
// 定制:项目明细 / 本周进展 两个 tab(原交付流水线 / 阶段看板 / 财务跟踪已下线)
// 定制:项目总览 / 本周进展 / 年度任务 三个 tab
customTab: "list",
customAnnualEdit: false, // 年度任务:默认查看模式,点「编辑」才可改
customRegion: "",
customStage: "",
customStatus: "",
customRisk: "",
customOrigin: "",
@ -592,22 +589,6 @@
return `<span class="tag-mini" style="background:${cat.color}18;color:${cat.color}">${esc(cat.name)}</span>`;
}
/** 规范省级行政区下拉(按大区分组)。selected 不在标准列表时补一个选项,避免丢值。 */
function regionOptions(selected, withEmpty) {
const groups = (state.customMeta && state.customMeta.region_groups) || [];
const all = groups.reduce((acc, g) => acc.concat(g.regions), []);
let html = withEmpty === false ? "" : `<option value="" ${!selected ? "selected" : ""}>(未标注)</option>`;
for (const g of groups) {
html += `<optgroup label="${esc(g.group)}">` +
g.regions.map((r) => `<option value="${esc(r)}" ${r === selected ? "selected" : ""}>${esc(r)}</option>`).join("") +
`</optgroup>`;
}
if (selected && all.indexOf(selected) < 0) {
html += `<option value="${esc(selected)}" selected>${esc(selected)}(非标准)</option>`;
}
return html;
}
/** 触发浏览器下载(导出 Excel) */
function download(url) {
const a = document.createElement("a");
@ -821,27 +802,6 @@
return note ? `<span class="tag-mini warn">${Ico.svg("alert")}${esc(note)}</span>` : "";
}
/* ---------------------------------------------------------------- charts */
function stackBar(items) {
const total = items.reduce((a, b) => a + b.count, 0) || 1;
let x = 0, segs = "";
items.filter((i) => i.count > 0).forEach((d) => {
const w = (d.count / total) * 100;
segs += `<rect x="${x.toFixed(2)}%" y="0" width="${w.toFixed(2)}%" height="14" fill="${d.color}"><title>${esc(d.name)}: ${d.count}</title></rect>`;
x += w;
});
return `<svg class="svg-chart" viewBox="0 0 100 14" preserveAspectRatio="none" style="height:14px;border-radius:99px;overflow:hidden">${segs}</svg>`;
}
function barList(rows) {
return rows.map((r) => `
<div class="bar-row">
<div class="b-name" title="${esc(r.name)}">${r.is_key ? starMark(true) + " " : ""}${esc(r.name)}</div>
<div class="b-track"><i style="width:${Math.min(100, r.progress)}%;background:${r.color}"></i></div>
<div class="b-val">${r.progress}${r.estimated ? "*" : ""}</div>
</div>`).join("");
}
/* ---------------------------------------------------------------- periods */
/** 新建周期:只填「9月第1周」,年份自动接在最新周期之后(也支持写全年份) */
function createNewPeriod() {
@ -1687,7 +1647,7 @@
</select>`;
const chips = `<button class="chip ${state.projIdleOnly ? "active" : ""}" data-pidle="1">只看本${state.gran === "week" ? "周" : "月"}未更新</button>`;
// 原来挂在左侧菜单栏的分类筛选器,收进卡头,能力不变
// 分类筛选器在卡头
const catFilter = `<select id="pCat" class="sel" style="width:120px" title="分类">
<option value="">全部分类</option>
${state.categories.map((c) => `<option value="${c.id}" ${c.id === state.categoryId ? "selected" : ""}>${esc(c.name)}(${c.project_count})</option>`).join("")}
@ -3939,7 +3899,7 @@
/* ---------------------------------------------------------------- shell */
async function loadCategories() {
// 侧栏的分类筛选器已下线,这里只给「自研产品」子 header 上的分类下拉供数据
// 给「自研产品」卡头的分类下拉供数据
if (!canR("projects")) { state.categories = []; return; }
state.categories = await api("/categories");
}

View File

@ -418,27 +418,10 @@ tr:hover .row-ops, .row-ops:focus-within { opacity: 1; }
color: var(--primary); font-weight: 600; margin-bottom: -1px;
}
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard {
background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
padding: 14px 15px; cursor: pointer; box-shadow: var(--shadow);
transition: transform .12s, box-shadow .12s;
}
.pcard:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,24,40,.09); }
.pcard.idle { opacity: .62; }
.pcard-top { display: flex; align-items: flex-start; gap: 8px; }
.pcard-name { font-weight: 600; font-size: 14px; line-height: 1.35; flex: 1; }
.star { display: inline-flex; color: #d7dbe2; line-height: 1; user-select: none; cursor: pointer; flex: none; }
.star .ic { width: 14px; height: 14px; }
.star.on { color: #f0a500; }
.star.on .ic { fill: currentColor; }
.pcard-cat { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pcard-summary {
margin-top: 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.6;
display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
min-height: 20px;
}
.pcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pill {
display: inline-flex; align-items: center; gap: 4px;
font-size: 11px; padding: 2px 8px; border-radius: 999px; line-height: 1.6; font-weight: 500;
@ -570,7 +553,7 @@ textarea.inp { height: auto; padding: 8px 10px; line-height: 1.6; }
background: var(--panel-2); border-radius: 9px;
}
.sec-hint { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.wk-i-name .star, .wk-head-title .star, .b-name .star, .drawer-head h3 .star { margin-right: 4px; vertical-align: -2px; }
.wk-i-name .star, .wk-head-title .star, .drawer-head h3 .star { margin-right: 4px; vertical-align: -2px; }
.star.readonly { cursor: default; }
.star.readonly:not(.on) { opacity: .35; }
@ -606,7 +589,6 @@ textarea.inp { height: auto; padding: 8px 10px; line-height: 1.6; }
.timeline-row .t-val { width: 46px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bullet-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.risk-item { color: var(--amber); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .b-name { width: 150px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@ -639,10 +621,6 @@ textarea.inp { height: auto; padding: 8px 10px; line-height: 1.6; }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.svg-chart { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
/* ---------------- modal ---------------- */
.modal-mask {
position: fixed; inset: 0; background: rgba(18,24,38,.38);