cleanup(web): 审计 B 节死代码全清——死变量/死 state/死样式块/死图标/兼容分支
- app.js:intakeParsed(只写不读)、state.drawerProject / state.drawerCustom(定义 + 赋值、 无任何读取)、孤立注释「添加动态落到顶栏…」删除; UI_KEY 升 v2 作废旧 sessionStorage,随之删 restoreUI 里 focusFilter=="later" 兼容分支。 - styles.css:删 5 组零引用死样式块——旧侧栏分类筛选器 .side-block/.side-title/.side-list/ .side-item/.dot;阶段看板 kanban 整块(.kcard-remark 仍被看板右栏使用,保留并注释); 财务漏斗 .funnel/.fun-*;登录页遗留 .ab-foot/.af-foot(含 media 引用);.ic-sm。 .kpi.accent-red 看似零引用实为 renderStaff 动态拼接,保留。 - icons.js:删 6 个零引用图标 chevron-down/download/flag/user/bell/link(含 STATUS/STAGE/ PIPE/TITLE/EMPTY 映射与 index.html data-icon 全查);hydrate/auto 选择器里的 .kcol-title 死引用清除;无人调用的 names 导出删除。剩余 48 个全部在用(脚本核验)。 - node --check app.js / icons.js 通过main
parent
7ff0242c30
commit
5601950896
|
|
@ -404,7 +404,7 @@ python scripts/legacy/add_entry_date.py --force # 全部重算
|
|||
|
||||
- **禁用「彩色描边」**:卡片、列表、步骤条、表格一律中性灰边框(`--border` / `--border-strong`)或无边框,不用圆角多色边框表达状态。
|
||||
- **重点色只出现在三处**:图标、关键数字/文本、小面积 tinted 底板(`.ic-badge`、`.tag-mini`、`.kpi.accent-*`)。状态色(`statusMeta`)与阶段色(`stageMeta`)是唯一配色来源,避免各页面自己调色。
|
||||
- **图标系统**:`web/icons.js` 内置 50 个 24×24 线性 SVG,`stroke=currentColor`,颜色跟着文字走。对外 API:
|
||||
- **图标系统**:`web/icons.js` 内置 48 个 24×24 线性 SVG(每个都被界面或状态/阶段/标题映射引用,死图标随手删),`stroke=currentColor`,颜色跟着文字走。对外 API:
|
||||
`svg(name)` 裸图标;`badge(name)` 图标 + tinted 底板(KPI 用);`status()` / `stage()` / `pipe()` 按状态·阶段·交付环节取图标;
|
||||
`nameOfStatus()` / `nameOfStage()` / `statusBadge()` 出文案与徽标;`hydrate()` 填 `[data-icon]`;`auto()` 自动补前导图标;`names()` 列全部图标名。
|
||||
- **自动图标**:`auto()` + `MutationObserver` 在每次渲染后按标题关键词给 `.card-head h4` / `.sec-title` / `.kcol-title` / `.wk-group-head` / `.notice` / `.empty` 加前导图标,并填充 `[data-icon]`;用 `data-ico` 属性防重复,标题里**自带** `<svg class="ic">`(如阶段看板按阶段取图标)时跳过自动补图,不会出现两个图标。新增区块只要标题里带对应关键词就自动带图标,不用手写。
|
||||
|
|
|
|||
12
web/app.js
12
web/app.js
|
|
@ -16,7 +16,6 @@
|
|||
meta: null,
|
||||
periods: null,
|
||||
categories: [],
|
||||
drawerProject: null,
|
||||
// 详情抽屉:周期反馈的显示粒度 / 范围 / 往前翻页偏移
|
||||
dw: { group: "week", range: 2, back: 0 },
|
||||
// 定制项目
|
||||
|
|
@ -39,7 +38,6 @@
|
|||
intakeType: "general",
|
||||
// 更新录入的两种方式:direct = 直接写入(原样存 1 条);ai = AI 整理(补结构化字段,也只存 1 条)
|
||||
intakeMode: "direct",
|
||||
drawerCustom: null,
|
||||
// 周看板(左栏总览 + 右栏详情)
|
||||
weekly: null,
|
||||
weeklySel: null,
|
||||
|
|
@ -2449,7 +2447,6 @@
|
|||
$("#drawerBody").innerHTML = `<div class="empty">加载中…</div>`;
|
||||
drawerActions("");
|
||||
const d = await api("/custom/projects/" + cid);
|
||||
state.drawerCustom = d;
|
||||
const p = d.project;
|
||||
$("#drawerTitle").innerHTML = `${p.is_key ? starMark(true) : ""}${esc(p.name)}${p.archived ? ` <span class="arch-badge">已归档</span>` : ""}`;
|
||||
const progPct = (p.project_status === "进行中" || Number(p.progress || 0) > 0) ? Math.round(p.progress || 0) + "%" : null;
|
||||
|
|
@ -2464,8 +2461,6 @@
|
|||
</div>
|
||||
<div style="font-size:12.5px;color:var(--text-2);line-height:1.7;padding:0 0 8px 120px;white-space:pre-wrap">${nl2br(t.content || "")}</div>`).join("");
|
||||
|
||||
// 「添加动态」落到顶栏当前选中的那一周,与更新录入页的周期下拉一致
|
||||
|
||||
const ro = (label, val) => `<div class="form-row"><label>${label}</label><div class="ro">${val}</div></div>`;
|
||||
const originOpts = optionHtml(cmOptions("origins"), p.origin);
|
||||
const industryOpts = optionHtml(cmOptions("industries"), p.industry);
|
||||
|
|
@ -2834,7 +2829,6 @@
|
|||
|
||||
/* ---------------------------------------------------------------- 更新录入 */
|
||||
let intakeProjectId = null;
|
||||
let intakeParsed = null;
|
||||
|
||||
async function renderIntake() {
|
||||
const host = $("#view-intake");
|
||||
|
|
@ -2956,7 +2950,6 @@
|
|||
raw_text: raw, use_ai: useAI,
|
||||
});
|
||||
intakeProjectId = r.project ? r.project.id : intakeProjectId;
|
||||
intakeParsed = r.parsed;
|
||||
renderIntakePreview(r, raw);
|
||||
} catch (e) {
|
||||
$("#intakePreview").innerHTML = `<div class="notice err">整理失败:${esc(e.message)}</div>`;
|
||||
|
|
@ -3138,11 +3131,9 @@
|
|||
$("#drawerBody").innerHTML = `<div class="empty">加载中…</div>`;
|
||||
drawerActions("");
|
||||
let d = await api("/projects/" + pid);
|
||||
state.drawerProject = d;
|
||||
// 弹窗里改完记录,只重画下面的周期反馈,抽屉不关闭、滚动位置不丢
|
||||
const reloadFeed = async () => {
|
||||
d = await api("/projects/" + pid);
|
||||
state.drawerProject = d;
|
||||
renderFeed();
|
||||
};
|
||||
const p = d.project;
|
||||
|
|
@ -4044,7 +4035,7 @@
|
|||
}
|
||||
|
||||
/* ------------------------------------------- 界面状态(刷新后保持) */
|
||||
const UI_KEY = "unis.ui.v1";
|
||||
const UI_KEY = "unis.ui.v2"; // v2:删掉 focusFilter=later 兼容分支后升版,旧 sessionStorage 直接作废
|
||||
const UI_FIELDS = ["view", "navFolded", "gran", "weekId", "monthIdx", "categoryId", "keyword",
|
||||
"projOwner", "projIdleOnly", "showArchived", "focusFilter", "focusArchived", "weeklyOwner",
|
||||
"customTab", "customArchived", "customRegion", "customOrigin", "customSort", "staffArchived", "staffGroup"];
|
||||
|
|
@ -4062,7 +4053,6 @@
|
|||
UI_FIELDS.forEach((k) => { if (k in o) state[k] = o[k]; });
|
||||
if (["board", "projects", "custom", "focus", "staff", "intake", "settings", "rbac"].indexOf(state.view) < 0) state.view = "board";
|
||||
if (state.gran !== "month") state.gran = "week";
|
||||
if (state.focusFilter === "later") state.focusFilter = "week";
|
||||
}
|
||||
|
||||
function hostNoPermission() {
|
||||
|
|
|
|||
14
web/icons.js
14
web/icons.js
|
|
@ -24,12 +24,10 @@
|
|||
x: '<path d="M6.2 6.2l11.6 11.6M17.8 6.2L6.2 17.8"/>',
|
||||
"chevron-left": '<path d="M14.8 5.4L8 12l6.8 6.6"/>',
|
||||
"chevron-right": '<path d="M9.2 5.4L16 12l-6.8 6.6"/>',
|
||||
"chevron-down": '<path d="M6 9.2l6 6 6-6"/>',
|
||||
"chevron-up": '<path d="M6 14.8l6-6 6 6"/>',
|
||||
"log-out": '<path d="M14.6 7.6V5.4a1.8 1.8 0 00-1.8-1.8H5.6a1.8 1.8 0 00-1.8 1.8v13.2a1.8 1.8 0 001.8 1.8h7.2a1.8 1.8 0 001.8-1.8v-2.2"/><path d="M9.4 12h10.2M16.6 8.8l3.2 3.2-3.2 3.2"/>',
|
||||
"arrow-right": '<path d="M4.2 12h14.4M13 6.4l5.6 5.6L13 17.6"/>',
|
||||
search: '<circle cx="11" cy="11" r="6.4"/><path d="M15.8 15.8l4.4 4.4"/>',
|
||||
download: '<path d="M12 4v10.4M8 10.8l4 4 4-4"/><path d="M4.4 19.4h15.2"/>',
|
||||
check: '<path d="M5 12.6l4.6 4.6L19 7"/>',
|
||||
"check-circle": '<circle cx="12" cy="12" r="8.4"/><path d="M8.4 12.3l2.5 2.5 4.9-5"/>',
|
||||
circle: '<circle cx="12" cy="12" r="8.4"/>',
|
||||
|
|
@ -45,11 +43,9 @@
|
|||
sparkles: '<path d="M10.8 4l1.5 3.6 3.6 1.5-3.6 1.5-1.5 3.6-1.5-3.6L5.7 9.1l3.6-1.5L10.8 4z"/><path d="M17.6 14.6l.8 1.9 1.9.8-1.9.8-.8 1.9-.8-1.9-1.9-.8 1.9-.8.8-1.9z"/>',
|
||||
trash: '<path d="M4.4 7h15.2"/><path d="M9.4 7V5.6A1.6 1.6 0 0111 4h2a1.6 1.6 0 011.6 1.6V7"/><path d="M6.6 7l.9 12.4A1.6 1.6 0 009.1 21h5.8a1.6 1.6 0 001.6-1.6L17.4 7"/>',
|
||||
archive: '<rect x="3.2" y="4.2" width="17.6" height="4.4" rx="1.5"/><path d="M5.2 8.6v10.2a1.6 1.6 0 001.6 1.6h10.4a1.6 1.6 0 001.6-1.6V8.6"/><path d="M10 12.4h4"/>',
|
||||
flag: '<path d="M6 20.6V4.2h11.6l-2.1 4.2 2.1 4.2H6"/>',
|
||||
/* 业务语义 */
|
||||
calendar: '<rect x="3.4" y="5.2" width="17.2" height="15.2" rx="2"/><path d="M3.4 10h17.2M8 3.4v3.4M16 3.4v3.4"/>',
|
||||
"calendar-check": '<rect x="3.4" y="5.2" width="17.2" height="15.2" rx="2"/><path d="M3.4 10h17.2M8 3.4v3.4M16 3.4v3.4"/><path d="M8.8 14.4l2.1 2.1 4.3-4.3"/>',
|
||||
user: '<circle cx="12" cy="8" r="3.5"/><path d="M5 20.2a7 7 0 0114 0"/>',
|
||||
layers: '<path d="M12 3.4l8.4 4.4-8.4 4.4L3.6 7.8 12 3.4z"/><path d="M4 12.4l8 4.2 8-4.2"/><path d="M4 16.6l8 4.2 8-4.2"/>',
|
||||
activity: '<path d="M3 12.4h3.8l2.4-6.2 4 12.2 2.4-6h5"/>',
|
||||
pie: '<circle cx="12" cy="12" r="8.4"/><path d="M12 3.6V12h8.4"/>',
|
||||
|
|
@ -63,9 +59,7 @@
|
|||
hourglass: '<path d="M7 3.6h10M7 20.4h10"/><path d="M7.6 3.6V7L12 11.4 16.4 7V3.6"/><path d="M7.6 20.4V17L12 12.6 16.4 17v3.4"/>',
|
||||
note: '<path d="M5 4.4h14v10.4L14.4 19.4H5V4.4z"/><path d="M19 14.8h-4.6v4.6"/><path d="M8.4 9h7M8.4 12.4h4"/>',
|
||||
database: '<ellipse cx="12" cy="6" rx="7.4" ry="2.9"/><path d="M4.6 6v11.9c0 1.6 3.3 2.9 7.4 2.9s7.4-1.3 7.4-2.9V6"/><path d="M19.4 12c0 1.6-3.3 2.9-7.4 2.9S4.6 13.6 4.6 12"/>',
|
||||
bell: '<path d="M6.6 10.4a5.4 5.4 0 0110.8 0c0 4.2 1.4 5.6 1.4 5.6H5.2s1.4-1.4 1.4-5.6z"/><path d="M10 19a2.1 2.1 0 004 0"/>',
|
||||
code: '<path d="M8.8 7.4L4.4 12l4.4 4.6"/><path d="M15.2 7.4L19.6 12l-4.4 4.6"/>',
|
||||
link: '<path d="M10.2 13.8l3.6-3.6"/><path d="M8.6 11l-2 2a3.4 3.4 0 004.8 4.8l2-2"/><path d="M15.4 13l2-2a3.4 3.4 0 00-4.8-4.8l-2 2"/>',
|
||||
};
|
||||
|
||||
var STATUS_ICON = {
|
||||
|
|
@ -166,7 +160,7 @@
|
|||
if (!root) return;
|
||||
if (root.nodeType === 1) fill(root);
|
||||
if (!root.querySelectorAll) return;
|
||||
var nodes = root.querySelectorAll("[data-icon], .card-head h4, .sec-title, .kcol-title, .wk-group-head, .empty, .notice");
|
||||
var nodes = root.querySelectorAll("[data-icon], .card-head h4, .sec-title, .wk-group-head, .empty, .notice");
|
||||
fillAll(nodes);
|
||||
}
|
||||
|
||||
|
|
@ -180,8 +174,8 @@
|
|||
el.removeAttribute("data-icon");
|
||||
return;
|
||||
}
|
||||
if (el.matches(".card-head h4, .sec-title, .kcol-title, .wk-group-head")) {
|
||||
// 模板里已经自带前导图标的标题(如阶段看板的阶段图标)不再自动补第二个
|
||||
if (el.matches(".card-head h4, .sec-title, .wk-group-head")) {
|
||||
// 模板里已经自带前导图标的标题不再自动补第二个
|
||||
if (el.querySelector(":scope > .ic")) { el.setAttribute("data-ico", "1"); return; }
|
||||
leadingIcon(el, pickIcon(text(el), TITLE_ICON), "ti");
|
||||
} else if (el.matches(".notice")) {
|
||||
|
|
@ -203,7 +197,7 @@
|
|||
|
||||
window.Icon = { svg: svg, badge: badge, status: status, stage: stage, pipe: pipe,
|
||||
nameOfStatus: nameOfStatus, nameOfStage: nameOfStage, statusBadge: statusBadge,
|
||||
hydrate: hydrate, auto: auto, names: P };
|
||||
hydrate: hydrate, auto: auto };
|
||||
function boot() {
|
||||
hydrate(document);
|
||||
auto(document);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-
|
|||
|
||||
/* ---------------- 图标基元 ---------------- */
|
||||
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
|
||||
.ic-sm { width: 13px; height: 13px; }
|
||||
.ic-lg { width: 22px; height: 22px; }
|
||||
/* 标题前的小图标 */
|
||||
.ti { width: 15px; height: 15px; flex: none; color: var(--muted); vertical-align: -2px; }
|
||||
|
|
@ -102,19 +101,6 @@ button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-
|
|||
.ni .ic { width: 16px; height: 16px; }
|
||||
.nav-item.active .ni { color: var(--primary); }
|
||||
|
||||
.side-block { margin-top: 22px; }
|
||||
.side-title { font-size: 11px; color: var(--muted); letter-spacing: .6px; margin-bottom: 8px; padding: 0 4px; }
|
||||
.side-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
|
||||
.side-item {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; border: 0; background: transparent;
|
||||
color: var(--text-2); width: 100%; text-align: left;
|
||||
}
|
||||
.side-item:hover { background: var(--panel-2); }
|
||||
.side-item.active { background: var(--primary-soft); font-weight: 600; color: var(--text); }
|
||||
.dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 8px; }
|
||||
.side-item .cnt { margin-left: auto; font-size: 11px; color: var(--muted); }
|
||||
|
||||
.switch { display: flex; align-items: center; gap: 8px; padding: 0 4px; cursor: pointer; color: var(--text-2); }
|
||||
|
||||
/* 用户信息胶囊:钉在侧栏最下方,点开是向上弹出的二级菜单 */
|
||||
|
|
@ -215,7 +201,6 @@ button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-
|
|||
.ab-mid ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
|
||||
.ab-mid li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: rgba(232,240,255,.85); }
|
||||
.ab-mid li .ic { width: 15px; height: 15px; flex: none; opacity: .85; }
|
||||
.ab-foot { position: relative; font-size: 11.5px; color: rgba(232,240,255,.6); }
|
||||
|
||||
/* 右:表单 */
|
||||
.auth-form { padding: 40px 40px 32px; display: flex; flex-direction: column; }
|
||||
|
|
@ -228,15 +213,13 @@ button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-
|
|||
.auth-form .notice.err { margin-bottom: 14px; }
|
||||
.btn.block { width: 100%; height: 42px; margin-top: 8px; justify-content: center; gap: 7px; }
|
||||
.btn.block .ic { width: 16px; height: 16px; }
|
||||
.af-foot { margin-top: auto; padding-top: 24px; font-size: 11.5px; color: var(--muted); }
|
||||
|
||||
@media (max-width: 780px) {
|
||||
.auth-mask { padding: 16px; }
|
||||
.auth-shell { grid-template-columns: 1fr; }
|
||||
.auth-brand { padding: 18px 20px; gap: 0; }
|
||||
.auth-brand .ab-mid, .auth-brand .ab-foot { display: none; }
|
||||
.auth-brand .ab-mid { display: none; }
|
||||
.auth-form { padding: 26px 22px 22px; }
|
||||
.af-foot { padding-top: 18px; }
|
||||
}
|
||||
|
||||
/* ---------------- 权限管理 ---------------- */
|
||||
|
|
@ -438,24 +421,7 @@ tr:hover .row-ops, .row-ops:focus-within { opacity: 1; }
|
|||
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }
|
||||
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
|
||||
|
||||
/* ---------------- kanban (定制项目) ---------------- */
|
||||
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
|
||||
.kcol {
|
||||
flex: 0 0 236px; background: var(--panel); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); box-shadow: var(--shadow);
|
||||
display: flex; flex-direction: column; max-height: 640px;
|
||||
}
|
||||
.kcol-head { padding: 10px 12px; border-bottom: 1px solid var(--border); }
|
||||
.kcol-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
|
||||
.kcol-title .ic { color: var(--c, var(--muted)); }
|
||||
.kcol-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
|
||||
.kcol-body { padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 9px; flex: 1; }
|
||||
.kcard { border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; background: #fff; cursor: pointer; transition: .12s; }
|
||||
.kcard:hover { border-color: var(--border-strong); box-shadow: 0 4px 12px rgba(16,24,40,.08); }
|
||||
.kcard-top { display: flex; gap: 6px; align-items: flex-start; }
|
||||
.kcard-name { font-size: 12.5px; font-weight: 600; line-height: 1.45; flex: 1; }
|
||||
.kcard-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; gap: 6px; font-size: 11.5px; color: var(--muted); }
|
||||
.kcard-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--border); }
|
||||
/* 备注块(看板右栏 / 抽屉详情共用;原阶段看板 kanban 样式已随 tab 下线删除) */
|
||||
.kcard-remark { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
|
||||
|
||||
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; text-align: center; color: var(--muted); font-size: 13px; }
|
||||
|
|
@ -719,16 +685,6 @@ table.tbl td.col-ops .btn.sm { padding: 0 7px; } /* 操作列按钮收紧,避
|
|||
.pipe-arrow { align-self: center; color: var(--muted); padding-top: 12px; flex: none; }
|
||||
.pipe-arrow .ic { width: 14px; height: 14px; }
|
||||
|
||||
/* 交付漏斗 */
|
||||
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 12px; }
|
||||
.fun-step { border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; background: var(--panel-2); }
|
||||
.fun-name { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
|
||||
.fun-name .ic { width: 13px; height: 13px; color: var(--c, var(--muted)); }
|
||||
.fun-count { font-size: 22px; font-weight: 700; letter-spacing: -.5px; margin: 3px 0 8px; color: var(--c, var(--text)); }
|
||||
.fun-bar { height: 6px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
|
||||
.fun-bar > i { display: block; height: 100%; border-radius: 99px; }
|
||||
.fun-amt { font-size: 11px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* 小字段:金额补录等内联输入 */
|
||||
.field-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue