/** 我的物料领用记录 · 双 Tab Demo 通用交互 */ function initPanelTabs(rootId) { const root = document.getElementById(rootId) if (!root) return const tabBtns = root.querySelectorAll('[data-tab]') const panels = root.querySelectorAll('[data-panel]') const track = root.querySelector('.tabs-02') const singleContent = root.querySelector('#content') function activate(name, index) { tabBtns.forEach((btn) => { btn.classList.toggle('is-active', btn.dataset.tab === name) }) panels.forEach((panel) => { panel.classList.toggle('is-active', panel.dataset.panel === name) }) if (track) { track.dataset.active = String(index) } if (singleContent && typeof mockContent === 'function') { singleContent.innerHTML = mockContent(name) } } tabBtns.forEach((btn, index) => { btn.addEventListener('click', () => activate(btn.dataset.tab, index)) }) } function mockContent(tabName) { if (tabName === 'consumption') { return `