3 Commits

Author SHA1 Message Date
0c3e57f5b5 fix(nginx): 生产 nginx 代理指向容器名 inventory_api_prod 避免 DNS 冲突
- 服务器上有多个 compose 项目(inventory-app / Track)都使用 backend 服务名
- nginx 中 proxy_pass http://backend:8000 会随机解析到 track_backend_prod
  导致 /api/ 请求 404
- 改为使用固定容器名 inventory_api_prod:8000
2026-08-28 16:46:02 +08:00
2ff0f92f94 fix(stocktake): 修复盘点报告导出 500 错误
- 导出盘点报告时第1126行使用了 func.sum()/func.coalesce()
  但文件未导入 sqlalchemy 的 func
- 改为 db.func.sum()/db.func.coalesce(),与文件内其他用法一致
2026-08-28 15:53:03 +08:00
57a6ab38d1 fix(outbound): 修复选单列表移除按钮排序后索引错位导致删错行
- 表格绑定 sortedSelectedItems(按库位排序),但移除按钮用 $index 操作原始 selectedItems
- 排序后索引与原始数组不一致,导致删除错误的行
- 改为按 uniqueKey 精确定位删除
2026-08-13 17:17:54 +08:00
3 changed files with 12 additions and 6 deletions

View File

@ -1123,7 +1123,7 @@ def export_stocktake():
borrow_rows = db.session.query(
TransBorrow.source_table,
TransBorrow.stock_id,
func.sum(func.coalesce(TransBorrow.quantity, 0) - func.coalesce(TransBorrow.returned_quantity, 0)).label('pending')
db.func.sum(db.func.coalesce(TransBorrow.quantity, 0) - db.func.coalesce(TransBorrow.returned_quantity, 0)).label('pending')
).filter(
TransBorrow.is_returned == False
).group_by(

View File

@ -37,8 +37,10 @@ server {
}
# 3. 后端 API 接口代理
# ★ 使用容器名 inventory_api_prod 而非服务名 backend
# 避免与其他 compose 项目的 backend 服务 DNS 冲突track_backend_prod
location /api/ {
proxy_pass http://backend:8000;
proxy_pass http://inventory_api_prod:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View File

@ -105,8 +105,8 @@
</el-table-column>
<el-table-column label="操作" width="80" align="center" fixed="right">
<template #default="{ $index }">
<el-button v-if="!isBulkMode && userStore.hasPermission('outbound_selection:operation')" type="danger" link @click="removeRow($index)">移除</el-button>
<template #default="{ row }">
<el-button v-if="!isBulkMode && userStore.hasPermission('outbound_selection:operation')" type="danger" link @click="removeRow(row)">移除</el-button>
</template>
</el-table-column>
</el-table>
@ -884,8 +884,12 @@ const batchRemove = () => {
}).catch(() => {})
}
const removeRow = (index: number) => {
selectedItems.value.splice(index, 1)
const removeRow = (row: any) => {
// ★ 按 uniqueKey 精确定位删除,避免排序后索引错位导致删错
const idx = selectedItems.value.findIndex(item => item.uniqueKey === row.uniqueKey)
if (idx > -1) {
selectedItems.value.splice(idx, 1)
}
}
const handlePreview = () => {