修复:完善装填状态与确认权限

This commit is contained in:
焦龙言
2026-07-27 10:12:05 +08:00
parent a223971a3c
commit 4340d03a70
4 changed files with 111 additions and 51 deletions
@@ -98,7 +98,7 @@
filterable
style="width: 100%"
:loading="optionLoading"
:disabled="operationPending || optionLoading"
:disabled="operationPending || scanLoading || optionLoading"
>
<el-option
v-for="option in strainOptions"
@@ -115,7 +115,7 @@
maxlength="64"
show-word-limit
placeholder="请输入生产批次"
:disabled="operationPending"
:disabled="operationPending || scanLoading"
/>
</el-form-item>
<el-form-item label="包装规格" prop="packageSpec">
@@ -125,7 +125,7 @@
maxlength="64"
show-word-limit
placeholder="请输入包装规格"
:disabled="operationPending"
:disabled="operationPending || scanLoading"
/>
</el-form-item>
<el-form-item label="初始包数" prop="initialPackages">
@@ -136,7 +136,7 @@
:precision="0"
controls-position="right"
style="width: 100%"
:disabled="operationPending"
:disabled="operationPending || scanLoading"
/>
</el-form-item>
</el-form>
@@ -285,6 +285,19 @@ function clearFillingIdempotencyKey() {
fillingIdempotencyKey.value = ''
}
function clearFillingPayload() {
clearFillingIdempotencyKey()
scannedPallet.value = null
form.value = {
qrToken: '',
warehouseId: undefined,
strainId: undefined,
batchNo: '',
packageSpec: '',
initialPackages: undefined
}
}
function ensureFillingIdempotencyKey() {
if (!fillingIdempotencyKey.value) {
fillingIdempotencyKey.value = createIdempotencyKey()
@@ -296,9 +309,7 @@ function resetFillingOperation() {
dialogSession += 1
invalidateOptionRequest()
invalidateScanRequest()
clearFillingIdempotencyKey()
scannedPallet.value = null
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
clearFillingPayload()
optionError.value = ''
scanError.value = ''
formError.value = ''
@@ -337,9 +348,7 @@ function resetQuery() {
function handleFillingScan(qrToken) {
if (operationPending.value || scanLoading.value) return
clearFillingIdempotencyKey()
scannedPallet.value = null
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
clearFillingPayload()
const scanContext = { generation: ++scanGeneration, dialogSession, qrToken }
scanLoading.value = true
scanError.value = ''
@@ -347,6 +356,7 @@ function handleFillingScan(qrToken) {
if (!isCurrentScanRequest(scanContext)) return
const pallet = response.data
if (pallet.flowState !== 'EMPTY_IN_WAREHOUSE') {
clearFillingPayload()
scanError.value = '该托盘当前不可装填'
return
}
@@ -361,6 +371,7 @@ function handleFillingScan(qrToken) {
form.value.warehouseId = pallet.warehouseId
}).catch(() => {
if (!isCurrentScanRequest(scanContext)) return
clearFillingPayload()
scanError.value = '托盘扫码校验失败,请检查后重试'
}).finally(() => {
if (!isCurrentScanRequest(scanContext)) return
@@ -369,9 +380,7 @@ function handleFillingScan(qrToken) {
}
function handleScanInvalid(message) {
clearFillingIdempotencyKey()
scannedPallet.value = null
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
clearFillingPayload()
scanError.value = message
}
@@ -80,7 +80,7 @@
v-hasPermi="['business:inbound:remove']"
>删除</el-button>
<el-button
v-if="scope.row.status === 'DRAFT' && canConfirmInbound"
v-if="scope.row.status === 'DRAFT'"
link
type="success"
icon="CircleCheck"
@@ -232,7 +232,6 @@ const editDetailReady = ref(false)
const isEdit = computed(() => Boolean(form.value.inboundId))
const canAddInbound = computed(() => proxy.$auth.hasPermiAnd(['business:inbound:query', 'business:inbound:add']))
const canEditInbound = computed(() => proxy.$auth.hasPermiAnd(['business:inbound:query', 'business:inbound:edit']))
const canConfirmInbound = computed(() => proxy.$auth.hasPermiAnd(['business:inbound:query', 'business:inbound:confirm']))
const operationPending = computed(() => submitLoading.value || deleteLoading.value || confirmLoading.value)
let listGeneration = 0
let optionGeneration = 0
@@ -77,7 +77,7 @@
v-hasPermi="['business:shipment:remove']"
>删除</el-button>
<el-button
v-if="scope.row.status === 'DRAFT' && canConfirmShipment"
v-if="scope.row.status === 'DRAFT'"
link
type="success"
icon="CircleCheck"
@@ -245,7 +245,6 @@ const editDetailReady = ref(false)
const isEdit = computed(() => Boolean(form.value.shipmentId))
const canAddShipment = computed(() => proxy.$auth.hasPermiAnd(['business:shipment:query', 'business:shipment:add']))
const canEditShipment = computed(() => proxy.$auth.hasPermiAnd(['business:shipment:query', 'business:shipment:edit']))
const canConfirmShipment = computed(() => proxy.$auth.hasPermiAnd(['business:shipment:query', 'business:shipment:confirm']))
const operationPending = computed(() => submitLoading.value || deleteLoading.value || confirmLoading.value)
let listGeneration = 0
let optionGeneration = 0
@@ -429,7 +428,10 @@ function handleUpdate(row) {
strainCode: item.strainCode,
strainName: item.strainName,
batchNo: item.batchNo,
remainingPackages: item.remainingPackages ?? item.packageQty ?? null
remainingPackages:
item.remainingPackages === undefined
? (item.packageQty ?? null)
: item.remainingPackages
}))
hydratingForm = false
editDetailReady.value = true