From ec9aafbe51578426c70aea9986e4a57577fd7110 Mon Sep 17 00:00:00 2001 From: yueli Date: Wed, 2 Sep 2026 18:39:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=80=9F=E5=BA=93=E5=BD=92=E8=BF=98?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=B4=AF=E7=A9=BF=E7=94=B3=E8=AF=B7/?= =?UTF-8?q?=E5=AE=A1=E6=89=B9/=E6=89=AB=E7=A0=81=E5=80=9F=E5=BA=93?= =?UTF-8?q?=EF=BC=9BBOM=20=E5=A5=97=E9=A4=90=E6=B7=BB=E5=8A=A0=E4=B8=8E?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E3=80=81=E7=BC=BA=E8=B4=A7=E5=86=99=E5=85=A5?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/borrow/apply/index.vue | 169 +++++++++++++++++- .../src/views/borrow/approval/index.vue | 17 ++ .../src/views/transaction/borrow.vue | 16 +- 3 files changed, 194 insertions(+), 8 deletions(-) diff --git a/inventory-web/src/views/borrow/apply/index.vue b/inventory-web/src/views/borrow/apply/index.vue index fff50f7..12b63a1 100644 --- a/inventory-web/src/views/borrow/apply/index.vue +++ b/inventory-web/src/views/borrow/apply/index.vue @@ -247,6 +247,7 @@ + + + + @@ -219,6 +228,14 @@ const getApplicantName = (id: number | null) => { return userNameCache.value[id] ?? `用户 #${id}` } +// 从申请单明细快照中读取归还期限(旧申请单无此字段时返回空串) +const getReturnDeadline = (row: any) => { + const first = row?.items?.[0] + if (first?.is_indefinite) return '长期借用' + if (first?.expected_return_time) return first.expected_return_time + return '' +} + const getApproverName = (id: number | null) => { if (!id) return '-' return userNameCache.value[id] ?? `用户 #${id}` diff --git a/inventory-web/src/views/transaction/borrow.vue b/inventory-web/src/views/transaction/borrow.vue index dbb0613..58f4058 100644 --- a/inventory-web/src/views/transaction/borrow.vue +++ b/inventory-web/src/views/transaction/borrow.vue @@ -416,11 +416,25 @@ const loadApprovalRequests = async () => { } } -// ★ 切换审批单时:清空购物车和签名,防止跨单据污染 +// ★ 切换审批单时:带出申请时填写的归还日期/长期借用,并清空购物车和签名,防止跨单据污染 const handleApprovalChange = (val: number | null) => { if (!val) { selectedApprovalId.value = null } + // 从申请单明细快照中带出"预计归还日期"(申请时通过 items_json 存储,无需改数据库) + const req = approvalRequests.value.find(r => r.id === val) + const firstItem = req?.items?.[0] + if (firstItem?.is_indefinite) { + isIndefinite.value = true + form.expected_return_time = '' + } else if (firstItem?.expected_return_time) { + isIndefinite.value = false + form.expected_return_time = firstItem.expected_return_time + } else { + // 旧申请单/未填时间:保持手动选择 + isIndefinite.value = false + form.expected_return_time = '' + } cartItems.value = [] signatureFile.value = null signaturePreviewUrl.value = ''