From 19e5a48f07d386e29a9d2c5555a869ed4693eabb Mon Sep 17 00:00:00 2001 From: lizhilun Date: Wed, 25 Mar 2026 22:18:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=20-=20=E7=A7=BB=E9=99=A4=E6=AD=BB=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E8=B0=83=E8=AF=95=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除未使用的 currentListId 变量 - 移除空的 setupInfiniteScroll 函数 - 移除重复的 partner 变量声明 - 移除调试用的 console.log 语句 Co-Authored-By: Claude Opus 4.6 --- public/js/order-list.js | 24 +----------------------- public/js/record-form.js | 1 - 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/public/js/order-list.js b/public/js/order-list.js index 504735d..b456c37 100644 --- a/public/js/order-list.js +++ b/public/js/order-list.js @@ -2,9 +2,6 @@ // 通用列表管理 - 一次性加载 // ============================================ -// 当前活动的列表状态 -let currentListId = null; - // 通用列表配置 const listConfig = { orderList: { endpoint: '/api/records/orders', emptyMsg: '暂无接单记录', renderItem: renderOrderItem }, @@ -44,18 +41,12 @@ async function loadListData(listId) { if (!config || !state) return; // 防止重复加载 - if (state.loading) { - console.log('[loadListData] already loading, skip'); - return; - } + if (state.loading) return; state.loading = true; showLoading(listId, true); try { - console.log(`[loadListData] fetching ${listId}`); - - // 一次性加载全部数据,不做分页 const res = await fetch(API + config.endpoint + '?page=1&limit=1000&year=' + currentYear + '&month=' + currentMonth, { headers: headers() }); if (!res.ok) { @@ -66,14 +57,10 @@ async function loadListData(listId) { } const data = await res.json(); - console.log(`[loadListData] got ${data.records?.length || 0} records`); state.records = data.records || []; - // 渲染 renderList(listId); - - console.log(`[loadListData] ${listId} done, total records=${state.records.length}`); } catch (e) { console.error(`[loadListData] error:`, e); } finally { @@ -128,18 +115,9 @@ function renderList(listId) { container.innerHTML = html; } -// ============================================ -// 列表滚动(已简化为一次性加载) -// ============================================ - -function setupInfiniteScroll(listId) { - // 不再需要无限滚动,一次性加载全部数据 -} - // ============================================ // 兼容接口 // ============================================ - async function loadOrders() { return loadListData('orderList'); } async function loadOtherIncome() { return loadListData('otherIncomeList'); } async function loadDispatches() { return loadListData('dispatchList'); } diff --git a/public/js/record-form.js b/public/js/record-form.js index 5e36e73..c77f450 100644 --- a/public/js/record-form.js +++ b/public/js/record-form.js @@ -123,7 +123,6 @@ async function submitRecord() { const partner = document.getElementById('fPartner')?.value.trim() || ''; if (currentCategory === '派单') { const rebate = parseFloat(document.getElementById('fRebate').value); - const partner = document.getElementById('fPartner')?.value.trim() || ''; if (!quantity || !unit_price || !rebate || !boss || !partner) { showToast('请填写完整信息(包括负责打单的陪玩)'); return; } body.quantity = quantity; body.unit_price = unit_price;