feat: 实现 Admin 采购员账号管理 (#51)
This commit is contained in:
@@ -247,6 +247,7 @@ tr.empty small { color: #aaa; }
|
||||
}
|
||||
.modal-body { padding: 16px; }
|
||||
.modal-body h3 { font-size: 14px; margin: 20px 0 8px; }
|
||||
.form-stack { display: grid; gap: 16px; }
|
||||
.modal-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -307,6 +308,22 @@ input[type="date"] {
|
||||
}
|
||||
input.wide { width: 100%; }
|
||||
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.row-actions form { margin: 0; }
|
||||
.status-pill {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid currentColor;
|
||||
}
|
||||
.status-active { color: #1a7f37; background: #f0fff4; }
|
||||
.status-disabled { color: #777; background: #f3f4f6; }
|
||||
|
||||
select {
|
||||
padding: 5px 8px;
|
||||
border: 1px solid #ccd1d6;
|
||||
|
||||
+31
-1
@@ -1,7 +1,7 @@
|
||||
/* Admin 的全部 JavaScript。
|
||||
*
|
||||
* 原生 JS,没有框架、没有构建步骤——见 admin/AGENTS.md 前端约束。
|
||||
* 只做三件纯前端的事:全选、删除前二次确认、按钮禁用。
|
||||
* 只做轻量界面交互:全选、操作前确认、按钮禁用和弹窗。
|
||||
* 搜索、删除、导入本身都是普通表单 POST,服务端渲染,不需要 JS。
|
||||
*
|
||||
* 不要往这里加业务逻辑。业务逻辑在服务端。
|
||||
@@ -83,6 +83,34 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* ── 普通敏感操作的二次确认 ───────────────
|
||||
账号启停和密码重置不是删除,但同样会撤销登录。服务端仍负责权限和事务,
|
||||
这里仅降低误操作概率。 */
|
||||
function setupConfirmSubmit() {
|
||||
document.querySelectorAll("form[data-confirm-submit]").forEach(function (form) {
|
||||
form.addEventListener("submit", function (e) {
|
||||
if (!window.confirm(form.getAttribute("data-confirm-submit"))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* 用户列表共用一个重置密码弹窗。按钮只把用户编号和显示名放进表单,
|
||||
不在前端处理权限、密码或 Session。 */
|
||||
function setupUserResetModal() {
|
||||
var modal = document.getElementById("reset-password-modal");
|
||||
if (!modal) return;
|
||||
var idInput = modal.querySelector("[data-reset-user-id-input]");
|
||||
var nameLabel = modal.querySelector("[data-reset-username-label]");
|
||||
document.querySelectorAll("[data-reset-user-id]").forEach(function (button) {
|
||||
button.addEventListener("click", function () {
|
||||
idInput.value = button.getAttribute("data-reset-user-id") || "";
|
||||
nameLabel.textContent = button.getAttribute("data-reset-username") || "";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* ── 弹窗 ──────────────────────────────────
|
||||
弹窗**内容由服务端渲染**,这里只负责显示、隐藏和把内容取回来。
|
||||
不要在这里拼业务数据——价格格式、规格顺序都是业务规则,
|
||||
@@ -190,6 +218,8 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.querySelectorAll("table").forEach(setupCheckAll);
|
||||
setupConfirmDelete();
|
||||
setupConfirmSubmit();
|
||||
setupUserResetModal();
|
||||
setupModals();
|
||||
setupRowDetail();
|
||||
setupCaptchaRefresh();
|
||||
|
||||
Reference in New Issue
Block a user