refactor: 清理代码 - 移除死代码和调试语句

- 移除未使用的 currentListId 变量
- 移除空的 setupInfiniteScroll 函数
- 移除重复的 partner 变量声明
- 移除调试用的 console.log 语句

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lizhilun
2026-03-25 22:18:49 +08:00
co-authored by Claude Opus 4.6
parent 9126348d1b
commit 19e5a48f07
2 changed files with 1 additions and 24 deletions
+1 -23
View File
@@ -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'); }
-1
View File
@@ -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;