feat: 完成规格映射与采购任务创建 (#69)

This commit is contained in:
chengma
2026-08-09 22:55:14 +08:00
parent 610e9e3749
commit 4433e3af37
18 changed files with 976 additions and 135 deletions
+28 -2
View File
@@ -19,7 +19,7 @@
if (!table) return;
function rowBoxes() {
return table.querySelectorAll("tbody input[type=checkbox]");
return table.querySelectorAll("tbody input[type=checkbox]:not(:disabled)");
}
master.addEventListener("change", function () {
@@ -42,7 +42,7 @@
/* ── 选中数量 ────────────────────────────── */
function checkedCount() {
return document.querySelectorAll(
"tbody input[type=checkbox]:checked"
"tbody input[type=checkbox]:checked:not(:disabled)"
).length;
}
@@ -134,6 +134,31 @@
});
}
/* 采购确认弹窗只负责把服务端已经渲染的本页行按勾选结果显示出来。
规格有效性、价格和客户端权限仍由服务端重新校验。 */
function setupPurchaseModal() {
var openButton = document.querySelector("[data-purchase-open]");
var form = document.querySelector("[data-purchase-form]");
if (!openButton || !form) return;
openButton.addEventListener("click", function () {
var selected = {};
document.querySelectorAll("tbody input[name=ids]:checked").forEach(function (box) {
selected[box.value] = true;
});
var shown = 0;
form.querySelectorAll("[data-purchase-row]").forEach(function (row) {
var enabled = !!selected[row.getAttribute("data-purchase-row")];
row.hidden = !enabled;
row.querySelectorAll("input").forEach(function (input) {
input.disabled = !enabled;
});
if (enabled) shown += 1;
});
var empty = form.querySelector("[data-purchase-empty]");
if (empty) empty.hidden = shown > 0;
});
}
/* ── 弹窗 ──────────────────────────────────
弹窗**内容由服务端渲染**,这里只负责显示、隐藏和把内容取回来。
不要在这里拼业务数据——价格格式、规格顺序都是业务规则,
@@ -349,6 +374,7 @@
setupConfirmSubmit();
setupUserResetModal();
setupClientAssignmentModal();
setupPurchaseModal();
setupModals();
setupRowDetail();
setupCaptchaRefresh();