Implement issue 1 search, order reuse and tracking

This commit is contained in:
reddaniel110
2026-10-14 11:25:43 +08:00
parent 0e45a58e5b
commit 4aaa6c6a14
17 changed files with 363 additions and 19 deletions
+16
View File
@@ -0,0 +1,16 @@
/* Filter existing supplier/material options without changing their submitted IDs. */
window.POFilterSelect = {
bind: function (input, select) {
if (!input || !select) return;
const options = Array.from(select.options);
const normalize = value => String(value || '').trim().toLocaleLowerCase();
input.addEventListener('input', function () {
const term = normalize(input.value);
const matches = options.filter((option, index) => index === 0 ||
normalize(option.textContent + ' ' + (option.dataset.search || '')).includes(term));
select.replaceChildren(...matches);
select.selectedIndex = 0;
select.setAttribute('aria-label', term ? `匹配 ${matches.length - 1} 项,请选择` : '请选择');
});
}
};