feat: 支持采购任务追溯并安全重新创建 (#186)
This commit is contained in:
@@ -363,6 +363,12 @@ tr.empty small { color: #aaa; }
|
||||
}
|
||||
.button-link:hover { background: #f0f2f4; }
|
||||
.button-link.disabled { color: #999; background: #f5f6f8; }
|
||||
.button-link.primary {
|
||||
background: #1f6feb;
|
||||
border-color: #1f6feb;
|
||||
color: #fff;
|
||||
}
|
||||
.button-link.primary:hover { background: #1a5fd0; }
|
||||
.sync-history-table { max-height: 460px; }
|
||||
.sync-history-table td { vertical-align: top; }
|
||||
.sync-history-table .sync-error {
|
||||
|
||||
+34
-12
@@ -255,6 +255,22 @@
|
||||
var input = row.querySelector("[data-unit-price-input]");
|
||||
if (input) input.addEventListener("input", function () { updateTotalPrice(row); });
|
||||
});
|
||||
function showPurchaseSelection(selected) {
|
||||
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) updateTotalPrice(row);
|
||||
if (enabled) shown += 1;
|
||||
});
|
||||
var empty = form.querySelector("[data-purchase-empty]");
|
||||
if (empty) empty.hidden = shown > 0;
|
||||
return shown;
|
||||
}
|
||||
|
||||
openButtons.forEach(function (openButton) {
|
||||
openButton.addEventListener("click", function () {
|
||||
var selected = {};
|
||||
@@ -266,20 +282,23 @@
|
||||
if (supportsSelectAction(box, "purchase")) 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) updateTotalPrice(row);
|
||||
if (enabled) shown += 1;
|
||||
});
|
||||
var empty = form.querySelector("[data-purchase-empty]");
|
||||
if (empty) empty.hidden = shown > 0;
|
||||
showPurchaseSelection(selected);
|
||||
});
|
||||
});
|
||||
|
||||
/* 任务详情的“重新创建”只把稳定 syb_id 带回当前确认流程。
|
||||
找不到或当前已不可采购时服务端不会输出这个 ID,前端绝不自行放宽。 */
|
||||
var autoPurchaseID = form.getAttribute("data-auto-open-purchase-id") || "";
|
||||
var autoSelected = {};
|
||||
if (autoPurchaseID) autoSelected[autoPurchaseID] = true;
|
||||
if (autoPurchaseID && showPurchaseSelection(autoSelected) > 0) {
|
||||
var purchaseModal = form.closest(".modal-backdrop");
|
||||
if (purchaseModal) {
|
||||
openModal(purchaseModal);
|
||||
var clientSelect = form.querySelector("select[name=client_id]");
|
||||
if (clientSelect) clientSelect.focus({ preventScroll: true });
|
||||
}
|
||||
}
|
||||
form.addEventListener("submit", function (event) {
|
||||
if (event.defaultPrevented || !submitButton) return;
|
||||
submitButton.disabled = true;
|
||||
@@ -438,6 +457,9 @@
|
||||
loadDetail(button.getAttribute("data-detail-open-id"));
|
||||
});
|
||||
});
|
||||
|
||||
var autoDetailID = modal.getAttribute("data-auto-open-detail-id") || "";
|
||||
if (autoDetailID) loadDetail(autoDetailID);
|
||||
}
|
||||
|
||||
/* 顺运宝缩略图使用上游图片 URL。这里只在弹窗里放大展示,
|
||||
|
||||
Reference in New Issue
Block a user