feat: 增加档口入库码独立页面 (#233)
This commit is contained in:
@@ -615,6 +615,30 @@ input.wide { width: 100%; }
|
||||
}
|
||||
.status-active { color: #1a7f37; background: #f0fff4; }
|
||||
.status-disabled { color: #777; background: #f3f4f6; }
|
||||
.inner-code-status-ready,
|
||||
.inner-code-status-updated,
|
||||
.inner-code-status-already_filled { color: #1a7f37; background: #f0fff4; }
|
||||
.inner-code-status-applying { color: #0969da; background: #eef6ff; }
|
||||
.inner-code-status-skipped,
|
||||
.inner-code-status-needs_check { color: #7a4b00; background: #fff8c5; }
|
||||
.inner-code-status-failed { color: #b42318; background: #fff1f0; }
|
||||
.inner-code-status-pending { color: #57606a; background: #f3f4f6; }
|
||||
.inner-code-toolbar { flex: 0 0 auto; }
|
||||
.inner-code-toolbar input[type="date"] { width: 138px; }
|
||||
.inner-code-toolbar .inner-code-search { width: 220px; }
|
||||
.inner-code-toolbar .file-field {
|
||||
display: inline-block;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: #57606a;
|
||||
}
|
||||
.inner-code-notice { flex: 0 0 auto; margin: -4px 0 10px; }
|
||||
.inner-code-table-wrap { flex: 1 1 auto; min-height: 180px; overflow: auto; scrollbar-gutter: stable; }
|
||||
.inner-code-table { min-width: 1500px; }
|
||||
.inner-code-table th { position: sticky; top: 0; z-index: 1; }
|
||||
.inner-code-table .inner-code-message { min-width: 260px; max-width: 360px; }
|
||||
.mapping-source { white-space: nowrap; font-size: 12px; }
|
||||
.source-ai { color: #6f42c1; background: #f7f0ff; }
|
||||
.source-rule { color: #0969da; background: #eef6ff; }
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"/shops": [],
|
||||
"/tasks": ["type", "status", "creator", "q", "page"],
|
||||
"/clients": ["name", "page"],
|
||||
"/inner-codes": ["date", "status", "q", "page"],
|
||||
"/users": ["q", "status", "page"]
|
||||
};
|
||||
var MODULE_STATE_PREFIX = "cmautobuy:module-state:";
|
||||
@@ -348,6 +349,70 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* 档口入库码页只有轻量表单联动:一个可见业务日期同步给三个普通表单,
|
||||
并在确认弹窗里显示当前选中数量。匹配和回写规则仍全部在服务端。 */
|
||||
function setupInnerCodePage() {
|
||||
var root = document.querySelector("[data-inner-code-page]");
|
||||
if (!root) return;
|
||||
var dateInput = root.querySelector("[data-inner-code-date]");
|
||||
var fileInput = root.querySelector("[data-file-input]");
|
||||
var fileName = root.querySelector("[data-file-name]");
|
||||
var fileOpen = root.querySelector("[data-inner-code-file-open]");
|
||||
var applyButton = root.querySelector("[data-inner-code-apply-open]");
|
||||
|
||||
function syncDate() {
|
||||
document.querySelectorAll("[data-inner-code-date-field]").forEach(function (field) {
|
||||
field.value = dateInput ? dateInput.value : field.value;
|
||||
});
|
||||
}
|
||||
|
||||
function updateSelectionSummary() {
|
||||
var selected = Array.prototype.slice.call(document.querySelectorAll(
|
||||
'input[name="ids"][form="inner-code-apply-form"]:checked:not(:disabled)'
|
||||
));
|
||||
var replacements = selected.filter(function (box) {
|
||||
return box.getAttribute("data-inner-code-old-value") === "1";
|
||||
}).length;
|
||||
document.querySelectorAll("[data-inner-code-selected-count], [data-inner-code-confirm-count]")
|
||||
.forEach(function (node) { node.textContent = selected.length; });
|
||||
document.querySelectorAll("[data-inner-code-replace-count]")
|
||||
.forEach(function (node) { node.textContent = replacements; });
|
||||
}
|
||||
|
||||
if (dateInput) dateInput.addEventListener("change", syncDate);
|
||||
if (fileOpen && fileInput) fileOpen.addEventListener("click", function () { fileInput.click(); });
|
||||
if (fileInput && fileName) {
|
||||
fileInput.addEventListener("change", function () {
|
||||
fileName.textContent = fileInput.files.length ? fileInput.files[0].name : "未选择文件";
|
||||
fileName.title = fileName.textContent;
|
||||
});
|
||||
}
|
||||
root.addEventListener("change", updateSelectionSummary);
|
||||
var table = document.querySelector(".inner-code-table");
|
||||
if (table) table.addEventListener("change", updateSelectionSummary);
|
||||
if (applyButton) applyButton.addEventListener("click", updateSelectionSummary);
|
||||
var matchForm = document.getElementById("inner-code-match-form");
|
||||
if (matchForm) matchForm.addEventListener("submit", function () {
|
||||
var button = document.querySelector('[form="inner-code-match-form"]');
|
||||
if (button) {
|
||||
button.disabled = true;
|
||||
button.setAttribute("aria-busy", "true");
|
||||
button.textContent = "匹配中…";
|
||||
}
|
||||
});
|
||||
var applyForm = document.getElementById("inner-code-apply-form");
|
||||
if (applyForm) applyForm.addEventListener("submit", function () {
|
||||
var button = document.querySelector('#inner-code-apply-modal button[type="submit"]');
|
||||
if (button) {
|
||||
button.disabled = true;
|
||||
button.setAttribute("aria-busy", "true");
|
||||
button.textContent = "回写中…";
|
||||
}
|
||||
});
|
||||
syncDate();
|
||||
updateSelectionSummary();
|
||||
}
|
||||
|
||||
/* ── 弹窗 ──────────────────────────────────
|
||||
弹窗**内容由服务端渲染**,这里只负责显示、隐藏和把内容取回来。
|
||||
不要在这里拼业务数据——价格格式、规格顺序都是业务规则,
|
||||
@@ -759,6 +824,7 @@
|
||||
setupPurchaseModal();
|
||||
setupCollectModals();
|
||||
setupUploadFeedback();
|
||||
setupInnerCodePage();
|
||||
setupModals();
|
||||
setupRowDetail();
|
||||
setupImagePreview();
|
||||
|
||||
Reference in New Issue
Block a user