fix: add optional remark field to inventory profit/loss entry modal

This commit is contained in:
DXC
2026-03-19 11:18:55 +08:00
parent 44bd23ab77
commit ae4b4d586e

View File

@ -181,6 +181,19 @@
/>
<p class="unit-text">单位: {{ currentItem.unit || '个' }}</p>
</div>
<!-- 新增: 备注输入框 -->
<div class="remark-area" style="margin-top: 15px;">
<el-form-item label="备注:" label-width="60px">
<el-input
v-model="inputRemark"
placeholder="选填,可填写差异原因说明"
type="textarea"
:rows="2"
clearable
/>
</el-form-item>
</div>
</div>
<template #footer>
<div class="dialog-footer">
@ -451,6 +464,7 @@ const searchKeyword = ref('')
const currentItem = ref<StockItem | null>(null)
const inputQty = ref<number | undefined>(undefined)
const inputRemark = ref('')
const qtyInputRef = ref()
// ★ 新增: 多人协同心跳刷新定时器
@ -831,8 +845,10 @@ const handleManualConfirm = () => {
if (!currentItem.value) return
const val = inputQty.value === undefined ? 0 : inputQty.value
updateAndSync(currentItem.value, val)
updateAndSync(currentItem.value, val, inputRemark.value)
showQtyDialog.value = false
// 重置备注
inputRemark.value = ''
ElMessage.success(`已记录实盘: ${val}`)
// ★★★ 核心修改:确认数量后自动重新打开全屏扫码,实现无缝闭环
@ -843,14 +859,14 @@ const handleManualConfirm = () => {
})
}
const updateAndSync = async (item: StockItem, quantity: number) => {
const updateAndSync = async (item: StockItem, quantity: number, remark: string = '') => {
item.scanned = true
item.qty_actual = quantity
scannedMap.value.set(item.uuid, quantity)
syncStatus.value = 'syncing'
try {
await api.addDraft({ uuid: item.uuid, quantity: quantity })
await api.addDraft({ uuid: item.uuid, quantity: quantity, remark: remark })
syncStatus.value = 'success'
} catch (e) {
syncStatus.value = 'failed'