|
|
@ -1142,6 +1142,28 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 编辑新鲜程度选择弹窗 --> |
|
|
|
|
|
<div id="editFreshnessSelectModal" class="select-modal"> |
|
|
|
|
|
<div class="select-content"> |
|
|
|
|
|
<div class="select-header"> |
|
|
|
|
|
<h3>选择新鲜程度</h3> |
|
|
|
|
|
<button class="close-btn" onclick="hideEditFreshnessSelectModal()">×</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-search"> |
|
|
|
|
|
<input type="text" id="editFreshnessSearchInput" placeholder="搜索新鲜程度" oninput="filterEditFreshnessOptions()" style="width: 100%; padding: 10px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; box-sizing: border-box;"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-body"> |
|
|
|
|
|
<div id="editFreshnessOptionsList" class="select-list"> |
|
|
|
|
|
<!-- 新鲜程度选项将通过JavaScript动态生成 --> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-footer" style="padding: 16px 20px; display: flex; justify-content: space-between; border-top: 1px solid #f0f0f0; background-color: #fafafa;"> |
|
|
|
|
|
<button onclick="hideEditFreshnessSelectModal()" style="padding: 10px 24px; background-color: #f5f5f5; color: #666; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.3s ease;">取消</button> |
|
|
|
|
|
<button onclick="confirmEditFreshnessSelection()" style="padding: 10px 24px; background-color: #1677ff; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.3s ease;">确定</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- 搜索框 --> |
|
|
<!-- 搜索框 --> |
|
|
<div class="search-container"> |
|
|
<div class="search-container"> |
|
|
@ -2265,7 +2287,29 @@ |
|
|
startAutoOfflineCheck(); |
|
|
startAutoOfflineCheck(); |
|
|
|
|
|
|
|
|
// 启动定期刷新数据,确保label字段变化能实时显示 |
|
|
// 启动定期刷新数据,确保label字段变化能实时显示 |
|
|
timers.loadSupplies = setInterval(loadSupplies, 5000); // 每5秒刷新一次 |
|
|
timers.loadSupplies = setInterval(() => { |
|
|
|
|
|
console.log('定期刷新数据,检查label字段变化'); |
|
|
|
|
|
loadSupplies(); |
|
|
|
|
|
}, 5000); // 每5秒刷新一次 |
|
|
|
|
|
|
|
|
|
|
|
// 增强WebSocket消息处理,确保所有相关消息都能触发数据刷新 |
|
|
|
|
|
console.log('增强WebSocket消息处理'); |
|
|
|
|
|
if (ws) { |
|
|
|
|
|
// 添加额外的消息监听器,确保所有相关消息都能触发数据刷新 |
|
|
|
|
|
ws.addEventListener('message', function(event) { |
|
|
|
|
|
try { |
|
|
|
|
|
const data = JSON.parse(event.data); |
|
|
|
|
|
console.log('增强的WebSocket消息处理:', data); |
|
|
|
|
|
// 对于任何类型的WebSocket消息,都重新加载数据,确保label字段实时更新 |
|
|
|
|
|
if (data.type !== 'ping' && data.type !== 'pong') { |
|
|
|
|
|
console.log('收到相关WebSocket消息,刷新数据'); |
|
|
|
|
|
loadSupplies(); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('解析WebSocket消息失败:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 页面卸载时清理资源 |
|
|
// 页面卸载时清理资源 |
|
|
@ -5606,8 +5650,8 @@ |
|
|
const userInfo = checkLogin(); |
|
|
const userInfo = checkLogin(); |
|
|
if (!userInfo) return; |
|
|
if (!userInfo) return; |
|
|
|
|
|
|
|
|
// 获取规格和件数数据 |
|
|
// 获取规格和件数数据 - 只获取创建货源表单中的规格和件数对 |
|
|
const pairs = document.querySelectorAll('.spec-quantity-pair'); |
|
|
const pairs = document.querySelectorAll('#specQuantityContainer .spec-quantity-pair'); |
|
|
const specifications = []; |
|
|
const specifications = []; |
|
|
const quantities = []; |
|
|
const quantities = []; |
|
|
|
|
|
|
|
|
@ -6282,6 +6326,11 @@ |
|
|
document.getElementById('editCostprice').value = supply.costprice || ''; |
|
|
document.getElementById('editCostprice').value = supply.costprice || ''; |
|
|
document.getElementById('editGrossWeight').value = supply.grossWeight || ''; |
|
|
document.getElementById('editGrossWeight').value = supply.grossWeight || ''; |
|
|
|
|
|
|
|
|
|
|
|
// 新鲜程度 |
|
|
|
|
|
document.getElementById('editFreshnessDisplayText').textContent = supply.freshness || '请选择新鲜程度'; |
|
|
|
|
|
document.getElementById('editFreshness').value = supply.freshness || ''; |
|
|
|
|
|
editSelectedFreshness = supply.freshness || ''; |
|
|
|
|
|
|
|
|
// 自动下架时间(将小时转换为分钟) |
|
|
// 自动下架时间(将小时转换为分钟) |
|
|
const autoOfflineMinutes = (parseFloat(supply.autoOfflineHours) || 24) * 60; |
|
|
const autoOfflineMinutes = (parseFloat(supply.autoOfflineHours) || 24) * 60; |
|
|
document.getElementById('editAutoOfflineMinutes').value = Math.round(autoOfflineMinutes); |
|
|
document.getElementById('editAutoOfflineMinutes').value = Math.round(autoOfflineMinutes); |
|
|
|