fix:产品库存数据展示调整

dev_1.0.2
jiangpeng 2026-07-08 10:58:01 +08:00
parent 3d94027618
commit cabdd4c531
2 changed files with 160 additions and 27 deletions

View File

@ -54,25 +54,25 @@
<el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="在库现存" align="center" prop="inventoryNum">
<template slot-scope="scope">
<el-link v-if="scope.row.inventoryNum" type="primary" @click="handleInventoryInner(scope.row)">{{ scope.row.inventoryNum }}</el-link>
<span v-else>0</span>
<el-link v-if="scope.row.inventoryNum" class="inventory-num inventory-num--stock" :underline="false" @click="handleInventoryInner(scope.row)">{{ scope.row.inventoryNum }}</el-link>
<span v-else class="inventory-num inventory-num--empty">0</span>
</template>
</el-table-column>
<el-table-column label="在途库存" align="center" prop="purchaseNum">
<template slot-scope="scope">
<el-link v-if="scope.row.purchaseNum" type="primary" @click="handlePurchaseStock(scope.row)">{{ scope.row.purchaseNum }}</el-link>
<span v-else>0</span>
<el-link v-if="scope.row.purchaseNum" class="inventory-num inventory-num--bind" :underline="false" @click="handlePurchaseStock(scope.row)">{{ scope.row.purchaseNum }}</el-link>
<span v-else class="inventory-num inventory-num--bind">0</span>
</template>
</el-table-column>
<el-table-column label="可用量" align="center" prop="usableNum">
<template slot-scope="scope">
<span>{{ scope.row.usableNum || 0 }}</span>
<span class="inventory-num inventory-num--usable">{{ scope.row.usableNum || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="锁单量" align="center" prop="bindNum">
<template slot-scope="scope">
<el-link v-if="scope.row.bindNum" type="primary" @click="handleBindOrder(scope.row)">{{ scope.row.bindNum }}</el-link>
<span v-else>0</span>
<el-link v-if="scope.row.bindNum" class="inventory-num inventory-num--purchase" :underline="false" @click="handleBindOrder(scope.row)">{{ scope.row.bindNum }}</el-link>
<span v-else class="inventory-num inventory-num--purchase">0</span>
</template>
</el-table-column>
<el-table-column label="累计发货" align="center" prop="outerNum">
@ -224,12 +224,18 @@
</el-dialog>
<!-- 在库现存对话框 -->
<el-dialog :close-on-click-modal="false" title="在库现存" :visible.sync="inventoryInnerVisible" width="70%" append-to-body>
<div class="purchase-stock-summary">
<span>产品信息{{ currentInventoryInnerProductName || '-' }}{{ inventoryInnerQuery.productCode || '-' }}</span>
<span>在库现存总量{{ currentInventoryInnerTotal || 0 }}</span>
<el-dialog :close-on-click-modal="false" title="在库现存" :visible.sync="inventoryInnerVisible" width="55%" append-to-body>
<div class="inventory-inner-summary">
<div>
<div class="inventory-inner-summary__label">产品信息</div>
<div class="inventory-inner-summary__value">{{ currentInventoryInnerProductName || '-' }}{{ inventoryInnerQuery.productCode || '-' }}</div>
</div>
<div class="inventory-inner-summary__total">
<div class="inventory-inner-summary__label">在库现存总量</div>
<div class="inventory-num inventory-num--stock">{{ currentInventoryInnerTotal || 0 }}</div>
</div>
</div>
<el-table v-loading="inventoryInnerLoading" :data="inventoryInnerList">
<el-table class="inventory-inner-table" v-loading="inventoryInnerLoading" :data="inventoryInnerList">
<el-table-column label="序号" type="index" width="50" align="center" :index="inventoryInnerIndex" />
<el-table-column label="入库单号" align="center" prop="innerCode">
<template slot-scope="scope">
@ -237,8 +243,16 @@
</template>
</el-table-column>
<el-table-column label="入库数量" align="center" prop="innerNum" />
<el-table-column label="在库现存" align="center" prop="inventoryNum" />
<el-table-column label="锁单量" align="center" prop="bindNum" />
<el-table-column label="在库现存" align="center" prop="inventoryNum">
<template slot-scope="scope">
<span class="inventory-num inventory-num--stock">{{ scope.row.inventoryNum || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="锁单量" align="center" prop="bindNum">
<template slot-scope="scope">
<span class="inventory-num inventory-num--purchase">{{ scope.row.bindNum || 0 }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="inventoryInnerTotal > 0"
@ -247,6 +261,9 @@
:limit.sync="inventoryInnerQuery.pageSize"
@pagination="getInventoryInnerList"
/>
<div class="inventory-dialog-footer">
<el-button @click="inventoryInnerVisible = false">关闭</el-button>
</div>
</el-dialog>
<el-drawer :title="inventoryInnerDetailTitle" :visible.sync="inventoryInnerDetailOpen" direction="rtl" size="70%" append-to-body>
@ -254,19 +271,29 @@
</el-drawer>
<!-- 在途库存对话框 -->
<el-dialog :close-on-click-modal="false" title="在途库存" :visible.sync="purchaseStockVisible" width="70%" append-to-body>
<div class="purchase-stock-summary">
<span>产品信息{{ currentPurchaseStockProductName || '-' }}{{ purchaseStockQuery.productCode || '-' }}</span>
<span>在途总量{{ currentPurchaseStockTotal || 0 }}</span>
<el-dialog :close-on-click-modal="false" title="在途库存" :visible.sync="purchaseStockVisible" width="55%" append-to-body>
<div class="inventory-inner-summary">
<div>
<div class="inventory-inner-summary__label">产品信息</div>
<div class="inventory-inner-summary__value">{{ currentPurchaseStockProductName || '-' }}{{ purchaseStockQuery.productCode || '-' }}</div>
</div>
<div class="inventory-inner-summary__total">
<div class="inventory-inner-summary__label">在途总量</div>
<div class="inventory-num inventory-num--bind">{{ currentPurchaseStockTotal || 0 }}</div>
</div>
</div>
<el-table v-loading="purchaseStockLoading" :data="purchaseStockList">
<el-table class="inventory-inner-table" v-loading="purchaseStockLoading" :data="purchaseStockList">
<el-table-column label="序号" type="index" width="50" align="center" :index="purchaseStockIndex" />
<el-table-column label="采购单号" align="center" prop="purchaseNo">
<template slot-scope="scope">
<el-link type="primary" @click="handleViewPurchaseOrder(scope.row)">{{ scope.row.purchaseNo }}</el-link>
</template>
</el-table-column>
<el-table-column label="在途库存" align="center" prop="purchaseNum" />
<el-table-column label="在途库存" align="center" prop="purchaseNum">
<template slot-scope="scope">
<span class="inventory-num inventory-num--bind">{{ scope.row.purchaseNum || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="采购员" align="center" prop="purchaserName" />
</el-table>
<pagination
@ -276,6 +303,9 @@
:limit.sync="purchaseStockQuery.pageSize"
@pagination="getPurchaseStockList"
/>
<div class="inventory-dialog-footer">
<el-button @click="purchaseStockVisible = false">关闭</el-button>
</div>
</el-dialog>
<el-drawer title="采购单详情" :visible.sync="purchaseOrderDetailOpen" direction="rtl" size="80%" append-to-body>
@ -308,12 +338,18 @@
</el-drawer>
<!-- 锁单对话框 -->
<el-dialog :close-on-click-modal="false" title="锁单量" :visible.sync="bindOrderVisible" width="70%" append-to-body>
<div class="purchase-stock-summary">
<span>产品信息{{ currentBindOrderProductName || '-' }}{{ bindOrderQuery.productCode || '-' }}</span>
<span>锁单总量{{ currentBindOrderTotal || 0 }}</span>
<el-dialog :close-on-click-modal="false" title="锁单量" :visible.sync="bindOrderVisible" width="55%" append-to-body>
<div class="inventory-inner-summary">
<div>
<div class="inventory-inner-summary__label">产品信息</div>
<div class="inventory-inner-summary__value">{{ currentBindOrderProductName || '-' }}{{ bindOrderQuery.productCode || '-' }}</div>
</div>
<div class="inventory-inner-summary__total">
<div class="inventory-inner-summary__label">锁单总量</div>
<div class="inventory-num inventory-num--purchase">{{ currentBindOrderTotal || 0 }}</div>
</div>
</div>
<el-table v-loading="bindOrderLoading" :data="bindOrderList">
<el-table class="inventory-inner-table" v-loading="bindOrderLoading" :data="bindOrderList">
<el-table-column label="序号" type="index" width="50" align="center" :index="bindOrderIndex" />
<el-table-column label="项目编号" align="center" prop="projectCode">
<template slot-scope="scope">
@ -322,7 +358,11 @@
</el-table-column>
<el-table-column label="项目名称" align="center" prop="projectName" show-overflow-tooltip />
<el-table-column label="汇智负责人" align="center" prop="userName" />
<el-table-column label="锁单量" align="center" prop="bindNum" />
<el-table-column label="锁单量" align="center" prop="bindNum">
<template slot-scope="scope">
<span class="inventory-num inventory-num--purchase">{{ scope.row.bindNum || 0 }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="bindOrderTotal > 0"
@ -331,6 +371,9 @@
:limit.sync="bindOrderQuery.pageSize"
@pagination="getBindOrderList"
/>
<div class="inventory-dialog-footer">
<el-button @click="bindOrderVisible = false">关闭</el-button>
</div>
</el-dialog>
<project-detail-drawer :visible.sync="projectDrawerVisible" :project-id="currentProjectId" :z-index="4000" />
@ -781,4 +824,94 @@ export default {
margin-bottom: 12px;
font-weight: 600;
}
.inventory-inner-summary {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
padding: 12px;
border: 1px solid #e5e7eb;
border-radius: 6px;
background: #f8fafc;
}
.inventory-inner-summary__label {
margin-bottom: 4px;
color: #64748b;
font-size: 12px;
line-height: 16px;
}
.inventory-inner-summary__value {
color: #1f2937;
font-size: 13px;
font-weight: 600;
line-height: 18px;
}
.inventory-inner-summary__total {
min-width: 100px;
text-align: right;
}
.inventory-inner-summary__total .inventory-num {
font-size: 18px;
line-height: 22px;
}
.inventory-inner-table {
border: 1px solid #e5e7eb;
border-radius: 6px;
overflow: hidden;
}
.inventory-inner-table ::v-deep .el-table__header th {
padding: 8px 0;
background: #f8fafc;
}
.inventory-inner-table ::v-deep .el-table__header th .cell {
color: #64748b;
font-size: 12px;
font-weight: 600;
}
.inventory-inner-table ::v-deep .el-table__body td {
padding: 9px 0;
}
.inventory-inner-table ::v-deep .el-table__body td .cell {
font-size: 12px;
line-height: 18px;
}
.inventory-dialog-footer {
margin-top: 16px;
text-align: right;
}
.inventory-num {
font-weight: 600;
}
.inventory-num--stock {
color: #1d4ed8;
}
.inventory-num--purchase {
color: #d97706;
}
.inventory-num--bind {
color: #4338ca;
}
.inventory-num--usable {
color: #00856f;
}
.inventory-num--empty {
color: #cbd5e1;
}
</style>

View File

@ -139,7 +139,7 @@
t2.outer_num,
t2.purchase_num,
t2.bind_num,
ifnull(t2.inventory_num,0) + ifnull(t2.purchase_num,0) as usable_num
ifnull(t2.inventory_num,0) + ifnull(t2.purchase_num,0) - (ifnull(t2.bind_num,0) - ifnull(t2.outer_num,0)) as usable_num
FROM product_info t1
LEFT JOIN (
SELECT product_code, warehouse_id,