1343 lines
45 KiB
Vue
1343 lines
45 KiB
Vue
<template>
|
||
<div class="panel-stock-detail">
|
||
<div class="main-content">
|
||
<div class="header-actions">
|
||
<div class="left-actions">
|
||
<el-button
|
||
v-if="!groupByBatch"
|
||
size="small"
|
||
type="primary"
|
||
:loading="loading"
|
||
@click="loadData"
|
||
>
|
||
刷新
|
||
</el-button>
|
||
|
||
<el-tooltip
|
||
v-if="!isSpaceView"
|
||
content="请在下方明细列表勾选一条库存记录(含库存记录 ID)"
|
||
:disabled="canTransferByLocation"
|
||
>
|
||
<span class="transfer-btn-wrap">
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
plain
|
||
:disabled="!canTransferByLocation"
|
||
@click="openTransferDialog('location')"
|
||
>
|
||
按库存记录移库
|
||
</el-button>
|
||
</span>
|
||
</el-tooltip>
|
||
<el-tooltip
|
||
v-if="groupByBatch || isSpaceView"
|
||
content="请在下方列表勾选一条库位记录;仅未开启批次管理的商品支持"
|
||
:disabled="canTransferByProduct"
|
||
>
|
||
<span class="transfer-btn-wrap">
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
plain
|
||
:disabled="!canTransferByProduct"
|
||
@click="openTransferDialog('product')"
|
||
>
|
||
按商品移库
|
||
</el-button>
|
||
</span>
|
||
</el-tooltip>
|
||
<el-tooltip
|
||
content="请先在下方明细列表勾选一条库存记录(含库存记录 ID)"
|
||
:disabled="canEditExpiry"
|
||
>
|
||
<span class="transfer-btn-wrap">
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
plain
|
||
:disabled="!canEditExpiry"
|
||
@click="openExpiryDialog"
|
||
>
|
||
维护生产/到期日期
|
||
</el-button>
|
||
</span>
|
||
</el-tooltip>
|
||
</div>
|
||
|
||
<div class="right-actions">
|
||
<!-- 「总数量」数值默认遮挡,点此切换显示/隐藏(仅影响展示) -->
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
plain
|
||
@click="quantityVisible = !quantityVisible"
|
||
>
|
||
{{ quantityVisible ? '隐藏数量' : '显示数量' }}
|
||
</el-button>
|
||
<el-radio-group
|
||
v-if="!groupByBatch"
|
||
v-model="detailViewMode"
|
||
size="small"
|
||
>
|
||
<el-radio-button value="detail">按明细</el-radio-button>
|
||
<el-radio-button value="space">按库位汇总</el-radio-button>
|
||
</el-radio-group>
|
||
</div>
|
||
|
||
</div>
|
||
<el-dialog
|
||
v-model="dialogVisible"
|
||
class="transfer-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
@closed="resetTransferDialog"
|
||
>
|
||
<!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
|
||
<div class="task-panel">
|
||
<header class="task-panel__head">
|
||
<div class="task-panel__titles">
|
||
<h2>{{ dialogTitle }}</h2>
|
||
<p>{{ transferSubtitle }}</p>
|
||
</div>
|
||
<button class="task-panel__close" type="button" aria-label="关闭" @click="dialogVisible = false">
|
||
<svg viewBox="0 0 12 12" fill="none">
|
||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||
</svg>
|
||
</button>
|
||
</header>
|
||
|
||
<div class="task-panel__body">
|
||
<div class="task-panel__form">
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">商品</span>
|
||
<strong class="task-panel__field-value">{{ transferItemLabel }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">原库位</span>
|
||
<strong class="task-panel__field-value">{{ transferFromSpaceLabel }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">可移数量</span>
|
||
<strong class="task-panel__field-value">{{ transferAvailableLabel }}</strong>
|
||
</div>
|
||
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label">目标库位</span>
|
||
<el-input v-model="targetSpace" placeholder="目标库位编码或 ID,扫码或输入" clearable />
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--plain">
|
||
<span class="task-panel__field-label">库位名称</span>
|
||
<strong
|
||
class="task-panel__field-value"
|
||
:class="{ 'is-danger': transferTargetSpaceInvalid }"
|
||
>
|
||
{{ transferTargetSpaceLabel }}
|
||
</strong>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label">移库数量</span>
|
||
<el-input-number
|
||
v-model="transferQty"
|
||
:min="1"
|
||
:placeholder="transferMode === 'product' ? '必填' : '不填则全量移库'"
|
||
controls-position="right"
|
||
style="width: 100%"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<p class="task-panel__form-tip">{{ transferTipText }}</p>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">{{ transferHintText }}</span>
|
||
<div class="task-panel__actions">
|
||
<el-button size="small" @click="dialogVisible = false">取消</el-button>
|
||
<el-button size="small" type="primary" :loading="transferLoading" @click="confirmTransfer">
|
||
{{ confirmButtonText }}
|
||
</el-button>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog
|
||
v-model="expiryDialogVisible"
|
||
class="expiry-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
@opened="handleExpiryDialogOpened"
|
||
@closed="resetExpiryForm"
|
||
>
|
||
<!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
|
||
<div class="task-panel">
|
||
<header class="task-panel__head">
|
||
<div class="task-panel__titles">
|
||
<h2>维护生产日期 / 到期日期</h2>
|
||
<p>不改动=保持库内原值,改选=下发新日期,清空输入框=下发 null 置空</p>
|
||
</div>
|
||
<button class="task-panel__close" type="button" aria-label="关闭" @click="expiryDialogVisible = false">
|
||
<svg viewBox="0 0 12 12" fill="none">
|
||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||
</svg>
|
||
</button>
|
||
</header>
|
||
|
||
<div class="task-panel__body">
|
||
<div class="task-panel__form">
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">库存记录ID</span>
|
||
<strong class="task-panel__field-value">{{ expiryRow?.storage_id ?? '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">商品</span>
|
||
<strong class="task-panel__field-value">{{ expiryItemLabel }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">批次号</span>
|
||
<strong class="task-panel__field-value">{{ expiryRow?.batch_no || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">库位</span>
|
||
<strong class="task-panel__field-value">{{ expiryRow?.space_code || '—' }}</strong>
|
||
</div>
|
||
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label">生产日期</span>
|
||
<el-date-picker
|
||
ref="productionPickerRef"
|
||
v-model="expiryForm.productionDate"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
format="YYYY-MM-DD"
|
||
placeholder="请选择生产日期"
|
||
class="expiry-date-picker"
|
||
clearable
|
||
/>
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
link
|
||
class="expiry-clear-btn"
|
||
:disabled="!expiryForm.productionDate"
|
||
@click="expiryForm.productionDate = ''"
|
||
>
|
||
清空
|
||
</el-button>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--plain">
|
||
<span class="task-panel__field-label">库内生产日期</span>
|
||
<strong class="task-panel__field-value is-muted">
|
||
{{ formatExpiryValue(expiryRow?.production_date) }}
|
||
</strong>
|
||
</div>
|
||
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label">到期日期</span>
|
||
<el-date-picker
|
||
ref="expiryPickerRef"
|
||
v-model="expiryForm.expiryDate"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
format="YYYY-MM-DD"
|
||
placeholder="请选择到期日期"
|
||
class="expiry-date-picker"
|
||
clearable
|
||
/>
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
link
|
||
class="expiry-clear-btn"
|
||
:disabled="!expiryForm.expiryDate"
|
||
@click="expiryForm.expiryDate = ''"
|
||
>
|
||
清空
|
||
</el-button>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--plain">
|
||
<span class="task-panel__field-label">库内到期日期</span>
|
||
<strong class="task-panel__field-value is-muted">
|
||
{{ formatExpiryValue(expiryRow?.expiry_date) }}
|
||
</strong>
|
||
</div>
|
||
</div>
|
||
|
||
<p class="task-panel__form-tip">
|
||
两个日期至少改一项;生产日期不得晚于到期日期;清空输入框将下发 null 置空该字段。
|
||
</p>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">{{ expiryHintText }}</span>
|
||
<div class="task-panel__actions">
|
||
<el-button size="small" @click="expiryDialogVisible = false">取消</el-button>
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
:loading="expiryLoading"
|
||
:disabled="!hasExpiryChange"
|
||
@click="confirmExpiry"
|
||
>
|
||
确认维护
|
||
</el-button>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
<div ref="tableWrapRef" class="detail-table-wrap">
|
||
<upper-table
|
||
ref="detailTableRef"
|
||
table-id="inventory-stock-detail"
|
||
:data="pagedDetailList"
|
||
:columns="detailColumns"
|
||
:row-key="detailRowKey"
|
||
table-size="small"
|
||
default-align="center"
|
||
:loading="loading"
|
||
:show-selection="true"
|
||
:virtual-threshold="100000"
|
||
:pagination="tablePagination"
|
||
:page-sizes="[10, 20, 50, 100]"
|
||
@selection-change="handleDetailSelectionChange"
|
||
@page-change="handlePageChange"
|
||
@page-size-change="handlePageSizeChange"
|
||
>
|
||
<!-- 生产日期:单元格可直接点击打开维护弹窗并展开对应日历 -->
|
||
<template #column-production_date="{ row }">
|
||
<el-link
|
||
v-if="getRowStorageId(row)"
|
||
type="primary"
|
||
:underline="false"
|
||
title="点击快捷维护生产日期"
|
||
@click.stop="openExpiryDialog(row, 'production')"
|
||
>
|
||
{{ row.production_date || '--' }}
|
||
</el-link>
|
||
<span v-else>{{ row.production_date || '--' }}</span>
|
||
</template>
|
||
<!-- 到期日期:同上 -->
|
||
<template #column-expiry_date="{ row }">
|
||
<el-link
|
||
v-if="getRowStorageId(row)"
|
||
type="primary"
|
||
:underline="false"
|
||
title="点击快捷维护到期日期"
|
||
@click.stop="openExpiryDialog(row, 'expiry')"
|
||
>
|
||
{{ row.expiry_date || '--' }}
|
||
</el-link>
|
||
<span v-else>{{ row.expiry_date || '--' }}</span>
|
||
</template>
|
||
|
||
<!-- 总数量:默认遮挡具体数值,点右上「显示数量」可查看 -->
|
||
<template #column-quantity="{ row }">
|
||
<span>{{ quantityVisible ? (row.quantity ?? '--') : QUANTITY_MASK }}</span>
|
||
</template>
|
||
|
||
<template #empty>
|
||
<div class="empty-tip">暂无库存明细</div>
|
||
</template>
|
||
</upper-table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||
import * as inventoryApi from '@/api/storage.inventory/inventory'
|
||
import type { InventoryUpdateExpiryParams } from '@/api/storage.inventory/inventory'
|
||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||
import * as indexApi from '@/api/index/index'
|
||
import { ElMessage } from 'element-plus'
|
||
import UpperTable from '@/components/UpperTable/index.vue'
|
||
import { formatInventorySpaceLabel } from '../inventory-config'
|
||
|
||
type TransferMode = 'location' | 'product'
|
||
|
||
const props = defineProps<{
|
||
id: string | number
|
||
row?: any
|
||
groupByBatch?: boolean
|
||
}>()
|
||
|
||
const emit = defineEmits(['refresh'])
|
||
|
||
const loading = ref(false)
|
||
const detailList = ref<any[]>([])
|
||
const currentRow = ref<any>(null)
|
||
const tableWrapRef = ref<HTMLElement | null>(null)
|
||
const detailTableRef = ref<any>(null)
|
||
const selectedDetailRows = ref<any[]>([])
|
||
|
||
const pagination = reactive({
|
||
page: 1,
|
||
pageSize: 20,
|
||
total: 0
|
||
})
|
||
|
||
/** 前端分页(接口一次性返回该商品的全部库存明细行) */
|
||
const pagedDetailList = computed(() => {
|
||
const start = (pagination.page - 1) * pagination.pageSize
|
||
return detailList.value.slice(start, start + pagination.pageSize)
|
||
})
|
||
|
||
/** 切页后把表格滚动位置归零 */
|
||
function resetTableScroll() {
|
||
nextTick(() => {
|
||
detailTableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||
})
|
||
}
|
||
|
||
function handlePageChange(page: number) {
|
||
pagination.page = page
|
||
resetTableScroll()
|
||
}
|
||
|
||
function handlePageSizeChange(pageSize: number) {
|
||
pagination.pageSize = pageSize
|
||
pagination.page = 1
|
||
resetTableScroll()
|
||
}
|
||
/** UpperTable 分页入参(数据仍由前端切片) */
|
||
const tablePagination = computed(() => ({
|
||
currentPage: pagination.page,
|
||
pageSize: pagination.pageSize,
|
||
total: pagination.total
|
||
}))
|
||
|
||
/** 行唯一键:库存记录 ID 优先,汇总视图按库位+商品 */
|
||
function detailRowKey(row: any) {
|
||
return row?.storage_id ?? `${row?.space_id}-${row?.stock_id}`
|
||
}
|
||
|
||
const dialogVisible = ref(false)
|
||
const transferMode = ref<TransferMode | null>(null)
|
||
const targetSpace = ref<string | number>('')
|
||
const spaceName = ref<string>('')
|
||
const targetSpaceError = ref<string>('')
|
||
let spaceInfoTimer: ReturnType<typeof setTimeout> | null = null
|
||
const transferQty = ref<number | null>(null)
|
||
const transferLoading = ref(false)
|
||
|
||
const detailViewMode = ref<'detail' | 'space'>('detail')
|
||
|
||
/** 是否按库位汇总视图(仅汇总模式可切换) */
|
||
const isSpaceView = computed(() => !props.groupByBatch && detailViewMode.value === 'space')
|
||
|
||
/** 明细表格勾选变化:单选一行时作为当前操作行(按明细视图驱动按库存记录移库,按库位汇总视图驱动按商品移库) */
|
||
function handleDetailSelectionChange(rows: any[]) {
|
||
selectedDetailRows.value = rows || []
|
||
if (rows && rows.length === 1) {
|
||
currentRow.value = normalizeRow(rows[0])
|
||
} else {
|
||
currentRow.value = props.groupByBatch ? (props.row ? normalizeRow(props.row) : null) : null
|
||
}
|
||
}
|
||
|
||
const detailColumns = computed(() => {
|
||
const cols = isSpaceView.value
|
||
? [
|
||
{ prop: 'space_code', label: '库位', width: '160' },
|
||
{ prop: 'physical_quantity', label: '实物数', width: '100' },
|
||
{ prop: 'quantity', label: '总数量', width: '100' },
|
||
{ prop: 'available_quantity', label: '可用数量', width: '100' },
|
||
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },
|
||
{ prop: 'batch_count', label: '批次数', width: '80' },
|
||
{ prop: 'first_inbound_time', label: '首次入库时间', width: '160' },
|
||
{ prop: 'last_inbound_time', label: '最后入库时间', width: '160' }
|
||
]
|
||
: [
|
||
{ prop: 'storage_id', label: '库存记录ID', width: '110' },
|
||
{ prop: 'stock_id', label: '商品ID', width: '100' },
|
||
{ prop: 'item_code', label: '商品编码', width: '140' },
|
||
{ prop: 'item_name', label: '商品名称', width: '200' },
|
||
{ prop: 'batch_no', label: '批次号', width: '140' },
|
||
{ prop: 'space_code', label: '库位', width: '140' },
|
||
{ prop: 'production_date', label: '生产日期', width: '140' },
|
||
{ prop: 'expiry_date', label: '到期日期', width: '140' },
|
||
{ prop: 'quantity', label: '总数量', width: '100' },
|
||
{ prop: 'available_quantity', label: '可用数量', width: '100' },
|
||
{ prop: 'locked_quantity', label: '锁定数量', width: '100' }
|
||
]
|
||
// UpperTable 默认不开启溢出 tooltip,这里保持与旧 el-table 一致
|
||
return cols.map((col) => ({ ...col, showOverflowTooltip: true }))
|
||
})
|
||
|
||
/** 「总数量」数值是否可见:默认隐藏(只隐藏数值,列仍在;不影响数据与移库/维护日期逻辑) */
|
||
const quantityVisible = ref(false)
|
||
/** 隐藏时的占位符 */
|
||
const QUANTITY_MASK = '***'
|
||
|
||
const dialogTitle = computed(() => {
|
||
if (transferMode.value === 'location') return '按库存记录移库'
|
||
if (transferMode.value === 'product') return '按商品移库'
|
||
return '移库'
|
||
})
|
||
|
||
const confirmButtonText = computed(() => {
|
||
if (transferMode.value === 'location') return '确认按库存记录移库'
|
||
if (transferMode.value === 'product') return '确认按商品移库'
|
||
return '确认移库'
|
||
})
|
||
|
||
function isBatchMgmtEnabled(row: any) {
|
||
const flag = row?.stock?.is_batch_mgmt_enabled ?? row?.is_batch_mgmt_enabled
|
||
if (flag === true || flag === 1) return true
|
||
if (flag === false || flag === 0) return false
|
||
const s = String(flag || '').toLowerCase()
|
||
return s === 'y' || s === '1' || s === 'true'
|
||
}
|
||
|
||
const activeRow = computed(() => {
|
||
if (currentRow.value) return currentRow.value
|
||
// 批次模式:主列表选中行本身就是明细行;汇总模式:必须勾选明细/库位行才作为操作行
|
||
return props.groupByBatch ? (props.row || {}) : {}
|
||
})
|
||
|
||
const canTransferByLocation = computed(() => {
|
||
// 只要选中了含库存记录 ID 的明细行即可按库存记录移库(批次/汇总模式通用)
|
||
const row = activeRow.value
|
||
const storageId = Number(row.storage_id)
|
||
return Number.isFinite(storageId) && storageId > 0
|
||
})
|
||
|
||
const canTransferByProduct = computed(() => {
|
||
const row = activeRow.value
|
||
const spaceId = Number(row.space_id)
|
||
const stockId = Number(row.stock_id)
|
||
if (!Number.isFinite(spaceId) || spaceId <= 0) return false
|
||
if (!Number.isFinite(stockId) || stockId <= 0) return false
|
||
// 开启批次管理的商品不支持按商品移库(按原库位+商品合并会跨批次)
|
||
if (isBatchMgmtEnabled(row)) return false
|
||
return true
|
||
})
|
||
|
||
/* ───────────────── 移库弹窗:面板展示与提示 ───────────────── */
|
||
|
||
/** 商品:名称(编码) */
|
||
const transferItemLabel = computed(() => {
|
||
const row = activeRow.value || {}
|
||
const name = String(row.item_name || row.stock?.item_name || '').trim()
|
||
const code = String(row.item_code || row.stock?.item_code || '').trim()
|
||
if (name && code) return `${name}(${code})`
|
||
return name || code || '—'
|
||
})
|
||
|
||
/** 原库位 */
|
||
const transferFromSpaceLabel = computed(() => {
|
||
const row = activeRow.value || {}
|
||
return String(row.space_code || '—')
|
||
})
|
||
|
||
/** 可移数量:可用 → 总数量 → 实物数 依次兜底 */
|
||
const transferAvailableLabel = computed(() => {
|
||
const row = activeRow.value || {}
|
||
const qty = row.available_quantity ?? row.quantity ?? row.physical_quantity
|
||
return qty === null || qty === undefined || qty === '' ? '—' : String(qty)
|
||
})
|
||
|
||
/** 副标题:说明当前移库模式 */
|
||
const transferSubtitle = computed(() =>
|
||
transferMode.value === 'product'
|
||
? '按原库位 + 商品合并移库,自动合并该库位下该商品的全部库存'
|
||
: '单条库存记录移库,数量不填则整条全量移库'
|
||
)
|
||
|
||
/** 底部说明:模式差异与注意事项 */
|
||
const transferTipText = computed(() =>
|
||
transferMode.value === 'product'
|
||
? '开启批次管理且存在多批次的商品不支持按商品移库;移库数量为必填项。'
|
||
: '目标库位支持库位编码或库位 ID;移库数量不填则按整条库存记录全量移库。'
|
||
)
|
||
|
||
/** 目标库位名称:未输入 / 识别中 / 未找到 / 已识别 */
|
||
const transferTargetSpaceLabel = computed(() => {
|
||
if (!String(targetSpace.value ?? '').trim()) return '—'
|
||
if (spaceName.value) return spaceName.value
|
||
return targetSpaceError.value ? '未找到库位' : '识别中…'
|
||
})
|
||
|
||
const transferTargetSpaceInvalid = computed(
|
||
() => !!targetSpaceError.value && !!String(targetSpace.value ?? '').trim()
|
||
)
|
||
|
||
/** 页脚提示:随输入状态变化 */
|
||
const transferHintText = computed(() => {
|
||
if (!String(targetSpace.value ?? '').trim()) return '请输入或扫码目标库位'
|
||
if (transferTargetSpaceInvalid.value) return '目标库位不存在,请重新输入'
|
||
if (transferMode.value === 'product' && !transferQty.value) return '按商品移库需填写移库数量'
|
||
return '提交前请确认目标库位与移库数量'
|
||
})
|
||
|
||
function normalizeRow(r: any) {
|
||
if (!r) return null
|
||
const row = { ...r }
|
||
row.stock = row.stock || {}
|
||
if (row.stock.is_batch_mgmt_enabled === undefined || row.stock.is_batch_mgmt_enabled === null) {
|
||
row.stock.is_batch_mgmt_enabled = false
|
||
}
|
||
row.batch_count = Number(row.batch_count || 0)
|
||
return row
|
||
}
|
||
|
||
const loadData = () => {
|
||
if (!props.groupByBatch) {
|
||
void loadDetailListByStockId()
|
||
return
|
||
}
|
||
loading.value = true
|
||
setTimeout(() => {
|
||
currentRow.value = props.row ? normalizeRow(props.row) : null
|
||
detailList.value = currentRow.value ? [currentRow.value] : []
|
||
pagination.page = 1
|
||
pagination.total = detailList.value.length
|
||
loading.value = false
|
||
}, 120)
|
||
}
|
||
|
||
/** 汇总模式:按商品拉取当前仓库下 quantity > 1 的库存明细行 */
|
||
async function loadDetailListByStockId() {
|
||
const stockId = Number(props.id)
|
||
if (!Number.isInteger(stockId) || stockId <= 0) {
|
||
currentRow.value = null
|
||
detailList.value = []
|
||
pagination.total = 0
|
||
return
|
||
}
|
||
loading.value = true
|
||
pagination.page = 1
|
||
try {
|
||
const isSpace = detailViewMode.value === 'space'
|
||
const payload: any = { stock_id: stockId }
|
||
if (isSpace) payload.group_by_space = true
|
||
const res: any = await inventoryApi.getInventoryListByStockId(payload)
|
||
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
||
const data = res.data || res
|
||
const rows = Array.isArray(data.list) ? data.list : []
|
||
detailList.value = rows.map((item: any) =>
|
||
isSpace ? normalizeSpaceRow(item) : normalizeDetailRow(item)
|
||
)
|
||
} else {
|
||
detailList.value = []
|
||
}
|
||
pagination.total = detailList.value.length
|
||
await nextTick()
|
||
detailTableRef.value?.clearSelection?.()
|
||
currentRow.value = null
|
||
} catch (e) {
|
||
console.error('加载库存明细失败', e)
|
||
detailList.value = []
|
||
pagination.total = 0
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
/** 将接口明细行归一化为与主列表批次行一致的表格结构 */
|
||
function normalizeDetailRow(item: any) {
|
||
const row = normalizeRow(item)
|
||
row.storage_id = item.id ?? item.storage_id ?? null
|
||
row.stock_id = item.stock_id ?? item.stock?.id ?? null
|
||
row.item_code = item.stock?.item_code || item.item_code || ''
|
||
row.item_name = item.stock?.item_name || item.item_name || ''
|
||
row.batch_no = item.batch_no || ''
|
||
row.production_date = item.production_date || ''
|
||
row.expiry_date = item.expiry_date || ''
|
||
row.space_code = formatInventorySpaceLabel(item.space, '--')
|
||
row.space_id = item.space_id ?? item.space?.id ?? null
|
||
row.quantity = item.quantity ?? 0
|
||
row.available_quantity = item.available_quantity ?? 0
|
||
row.locked_quantity = item.locked_quantity ?? 0
|
||
return row
|
||
}
|
||
|
||
function openTransferDialog(mode: TransferMode) {
|
||
if (mode === 'location' && !canTransferByLocation.value) {
|
||
ElMessage.warning('请先在下方明细列表勾选一条库存记录')
|
||
return
|
||
}
|
||
if (mode === 'product' && !canTransferByProduct.value) {
|
||
ElMessage.warning('当前商品不支持按商品移库(需未开启批次管理,且有库位与商品)')
|
||
return
|
||
}
|
||
transferMode.value = mode
|
||
targetSpace.value = ''
|
||
transferQty.value = null
|
||
spaceName.value = ''
|
||
targetSpaceError.value = ''
|
||
dialogVisible.value = true
|
||
}
|
||
|
||
function resetTransferDialog() {
|
||
transferMode.value = null
|
||
targetSpace.value = ''
|
||
transferQty.value = null
|
||
spaceName.value = ''
|
||
targetSpaceError.value = ''
|
||
}
|
||
|
||
async function resolveTargetSpaceId(): Promise<number | null> {
|
||
const raw = String(targetSpace.value).trim()
|
||
if (!raw) return null
|
||
try {
|
||
const res: any = await indexApi.searchSpace({ keyword: raw })
|
||
const data = res && (res.data || res.list || res)
|
||
const item = Array.isArray(data) ? (data[0] || null) : data
|
||
if (item?.id !== undefined && item?.id !== null) {
|
||
const parsed = Number(item.id)
|
||
if (Number.isFinite(parsed) && parsed > 0) return parsed
|
||
}
|
||
} catch {
|
||
// ignore
|
||
}
|
||
return null
|
||
}
|
||
|
||
function parseOptionalQuantity(): number | null {
|
||
if (transferQty.value === null || transferQty.value === undefined) return null
|
||
if (String(transferQty.value).trim() === '') return null
|
||
const q = Number(transferQty.value)
|
||
if (!Number.isFinite(q) || q <= 0) return NaN
|
||
return q
|
||
}
|
||
|
||
function parseRequiredQuantity(): number | null {
|
||
const q = parseOptionalQuantity()
|
||
if (q === null || Number.isNaN(q)) return null
|
||
return q
|
||
}
|
||
|
||
async function confirmTransferLocation(row: any, targetSpaceId: number) {
|
||
const storageId = Number(row.storage_id)
|
||
const payload: { storage_id: number; target_space_id: number; quantity?: number } = {
|
||
storage_id: storageId,
|
||
target_space_id: targetSpaceId
|
||
}
|
||
const qty = parseOptionalQuantity()
|
||
if (qty !== null) {
|
||
if (Number.isNaN(qty)) {
|
||
ElMessage.warning('移库数量必须为正数')
|
||
return false
|
||
}
|
||
payload.quantity = qty
|
||
}
|
||
const res: any = await inventoryApi.transferLocation(payload)
|
||
ElMessage.success(res?.message || '按库存记录移库成功')
|
||
return true
|
||
}
|
||
|
||
async function confirmTransferByProduct(row: any, targetSpaceId: number) {
|
||
const qty = parseRequiredQuantity()
|
||
if (qty === null) {
|
||
ElMessage.warning('按商品移库时移库数量为必填')
|
||
return false
|
||
}
|
||
if (Number.isNaN(qty)) {
|
||
ElMessage.warning('移库数量必须为正数')
|
||
return false
|
||
}
|
||
const payload = {
|
||
space_id: Number(row.space_id),
|
||
stock_id: Number(row.stock_id),
|
||
target_space_id: targetSpaceId,
|
||
quantity: qty
|
||
}
|
||
const res: any = await inventoryApi.transferByProduct(payload)
|
||
ElMessage.success(res?.message || '按商品移库成功')
|
||
return true
|
||
}
|
||
|
||
async function confirmTransfer() {
|
||
if (!transferMode.value) return
|
||
if (!targetSpace.value) {
|
||
ElMessage.warning('请输入或扫码目标库位')
|
||
return
|
||
}
|
||
const row = activeRow.value
|
||
transferLoading.value = true
|
||
try {
|
||
const targetSpaceId = await resolveTargetSpaceId()
|
||
if (!targetSpaceId) {
|
||
ElMessage.warning('未找到目标库位,请检查输入后重试')
|
||
return
|
||
}
|
||
|
||
let ok = false
|
||
if (transferMode.value === 'location') {
|
||
ok = await confirmTransferLocation(row, targetSpaceId)
|
||
} else {
|
||
ok = await confirmTransferByProduct(row, targetSpaceId)
|
||
}
|
||
|
||
if (!ok) return
|
||
|
||
dialogVisible.value = false
|
||
emit('refresh')
|
||
try {
|
||
window.dispatchEvent(new CustomEvent('transfer-success'))
|
||
} catch {
|
||
// ignore
|
||
}
|
||
} catch (e: any) {
|
||
console.error('移库失败', e)
|
||
ElMessage.error(e?.message || '移库失败')
|
||
} finally {
|
||
transferLoading.value = false
|
||
}
|
||
}
|
||
|
||
/* ───────────────── 生产日期 / 到期日期维护(storage.inventory.updateExpiry) ───────────────── */
|
||
|
||
const expiryDialogVisible = ref(false)
|
||
const expiryLoading = ref(false)
|
||
const expiryRow = ref<any>(null)
|
||
/** 弹窗打开后需自动聚焦并展开日历的字段(由「生产日期 / 到期日期」单元格快捷入口指定) */
|
||
const expiryFocusField = ref<'production' | 'expiry' | null>(null)
|
||
const productionPickerRef = ref<any>(null)
|
||
const expiryPickerRef = ref<any>(null)
|
||
const expiryForm = reactive({
|
||
/** 输入框默认回显库内日期;与库内一致=不修改,清空输入框=下发 null 置空 */
|
||
productionDate: '',
|
||
expiryDate: ''
|
||
})
|
||
|
||
/**
|
||
* 由输入框内容推导单个字段的下发内容(UI 不再有额外开关,三态由「与库内值比较」自动得出):
|
||
* - undefined:与库内一致 —— 不下发,保持原值
|
||
* - null:输入框为空且库内有值 —— 清空该字段
|
||
* - string:下发该日期
|
||
*/
|
||
function resolveExpiryFieldPayload(value: string, current: unknown): string | null | undefined {
|
||
const picked = toComparableDate(value)
|
||
const currentNorm = toComparableDate(current)
|
||
if (picked === currentNorm) return undefined
|
||
return picked || null
|
||
}
|
||
|
||
/** 是否有需要下发的内容(至少一个字段被修改或清空),否则无从提交 */
|
||
const hasExpiryChange = computed(
|
||
() =>
|
||
resolveExpiryFieldPayload(expiryForm.productionDate, expiryRow.value?.production_date) !== undefined ||
|
||
resolveExpiryFieldPayload(expiryForm.expiryDate, expiryRow.value?.expiry_date) !== undefined
|
||
)
|
||
|
||
/** 页脚提示:未改动 / 日期先后不合法 / 可提交 */
|
||
const expiryHintText = computed(() => {
|
||
if (!hasExpiryChange.value) return '尚未修改日期,请至少调整一项'
|
||
const production = String(expiryForm.productionDate || '').trim()
|
||
const expiry = String(expiryForm.expiryDate || '').trim()
|
||
if (production && expiry && production > expiry) return '生产日期不能晚于到期日期'
|
||
return '提交后将更新该库存记录的日期'
|
||
})
|
||
|
||
/** 行上的库存记录 ID(无则返回 null,用于判断该行是否可维护日期) */
|
||
function getRowStorageId(row: any): number | null {
|
||
const id = Number(row?.storage_id)
|
||
return Number.isFinite(id) && id > 0 ? id : null
|
||
}
|
||
|
||
/** 是否可维护日期:需要有一条含库存记录 ID 的库存明细行 */
|
||
const canEditExpiry = computed(() => getRowStorageId(activeRow.value) !== null)
|
||
|
||
const expiryItemLabel = computed(() => {
|
||
const row = expiryRow.value || {}
|
||
const code = String(row.item_code || '').trim()
|
||
const name = String(row.item_name || '').trim()
|
||
if (code && name) return `${code} ${name}`
|
||
return code || name || '--'
|
||
})
|
||
|
||
/** 日期展示:空值统一为「(空)」 */
|
||
function formatExpiryValue(value: unknown): string {
|
||
const text = value === null || value === undefined ? '' : String(value).trim()
|
||
return text || '(空)'
|
||
}
|
||
|
||
/** 单个字段的提交描述,与接口「未传=保持原值 / null 或空串=清空」语义一一对应 */
|
||
function describeExpiryField(value: string, current: unknown): string {
|
||
const next = resolveExpiryFieldPayload(value, current)
|
||
if (next === undefined) return '不下发,保持库内原值'
|
||
if (next === null) return 'null,清空该字段'
|
||
return next
|
||
}
|
||
|
||
/** 提交内容预览(让用户明确本次请求实际下发了哪些字段) */
|
||
const expiryPayloadPreview = computed(
|
||
() =>
|
||
`production_date:${describeExpiryField(expiryForm.productionDate, expiryRow.value?.production_date)};` +
|
||
`expiry_date:${describeExpiryField(expiryForm.expiryDate, expiryRow.value?.expiry_date)}`
|
||
)
|
||
|
||
/** 归一化为 YYYY-MM-DD 以便比较先后(兼容 YYYY/MM/DD、带时间与 ISO 串) */
|
||
function toComparableDate(value: unknown): string {
|
||
const text = String(value ?? '').trim()
|
||
if (!text) return ''
|
||
const matched = text.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/)
|
||
if (!matched) return ''
|
||
return `${matched[1]}-${String(matched[2]).padStart(2, '0')}-${String(matched[3]).padStart(2, '0')}`
|
||
}
|
||
|
||
/** 变更前后文案:仅输出实际发生变化的字段 */
|
||
function buildExpiryChangeText(data: any): string {
|
||
const row = expiryRow.value || {}
|
||
const items: Array<[string, unknown, unknown]> = [
|
||
['生产日期', data?.before_production_date ?? row.production_date, data?.production_date],
|
||
['到期日期', data?.before_expiry_date ?? row.expiry_date, data?.expiry_date]
|
||
]
|
||
return items
|
||
.filter(([, before, after]) => formatExpiryValue(before) !== formatExpiryValue(after))
|
||
.map(([label, before, after]) => `${label}:${formatExpiryValue(before)} → ${formatExpiryValue(after)}`)
|
||
.join(';')
|
||
}
|
||
|
||
/**
|
||
* 打开日期维护弹窗(两个入口共用):
|
||
* 1. 工具栏「维护生产/到期日期」按钮:不传参,取当前勾选行;
|
||
* 2. 明细表「生产日期 / 到期日期」单元格:传入该行与目标字段,弹窗打开后自动展开对应日历
|
||
*/
|
||
function openExpiryDialog(row?: any, target?: 'production' | 'expiry') {
|
||
const targetRow = normalizeRow(row) || normalizeRow(activeRow.value) || {}
|
||
if (!getRowStorageId(targetRow)) {
|
||
ElMessage.warning(
|
||
row ? '该行缺少库存记录 ID,无法维护日期' : '请先在下方明细列表勾选一条库存记录'
|
||
)
|
||
return
|
||
}
|
||
expiryRow.value = targetRow
|
||
// 输入框回显库内当前日期(归一化为 YYYY-MM-DD,兼容接口返回的 ISO / 带时间格式)
|
||
expiryForm.productionDate = toComparableDate(targetRow.production_date)
|
||
expiryForm.expiryDate = toComparableDate(targetRow.expiry_date)
|
||
expiryFocusField.value = target || null
|
||
expiryDialogVisible.value = true
|
||
}
|
||
|
||
/** 弹窗打开动画结束后,聚焦并展开快捷入口指定的日期选择器 */
|
||
async function handleExpiryDialogOpened() {
|
||
const target = expiryFocusField.value
|
||
if (!target) return
|
||
await nextTick()
|
||
const picker = target === 'production' ? productionPickerRef.value : expiryPickerRef.value
|
||
picker?.focus?.()
|
||
picker?.handleOpen?.()
|
||
}
|
||
|
||
function resetExpiryForm() {
|
||
expiryRow.value = null
|
||
expiryFocusField.value = null
|
||
expiryForm.productionDate = ''
|
||
expiryForm.expiryDate = ''
|
||
}
|
||
|
||
async function confirmExpiry() {
|
||
const row = expiryRow.value || {}
|
||
const storageId = Number(row.storage_id)
|
||
if (!Number.isInteger(storageId) || storageId <= 0) {
|
||
ElMessage.warning('缺少库存记录 ID,请重新选择一条库存明细行')
|
||
return
|
||
}
|
||
const production = resolveExpiryFieldPayload(expiryForm.productionDate, row.production_date)
|
||
const expiry = resolveExpiryFieldPayload(expiryForm.expiryDate, row.expiry_date)
|
||
if (production === undefined && expiry === undefined) {
|
||
ElMessage.warning('生产日期与到期日期均未改动,请修改后再提交')
|
||
return
|
||
}
|
||
|
||
const mergedProduction = toComparableDate(expiryForm.productionDate)
|
||
const mergedExpiry = toComparableDate(expiryForm.expiryDate)
|
||
if (mergedProduction && mergedExpiry && mergedProduction > mergedExpiry) {
|
||
ElMessage.warning('生产日期不能晚于到期日期,请调整后重试')
|
||
return
|
||
}
|
||
|
||
const payload: InventoryUpdateExpiryParams = { storage_id: storageId }
|
||
if (production !== undefined) payload.production_date = production
|
||
if (expiry !== undefined) payload.expiry_date = expiry
|
||
|
||
expiryLoading.value = true
|
||
try {
|
||
const res: any = await inventoryApi.updateInventoryExpiry(payload)
|
||
if (!(res && (res.code === 200 || res.code === 1 || res.flag === 'success'))) {
|
||
ElMessage.error(res?.message || '维护生产日期/到期日期失败')
|
||
return
|
||
}
|
||
const data = res.data || {}
|
||
if (data.changed === false) {
|
||
ElMessage.info(res.message || '生产日期与到期日期均无变化,未做修改')
|
||
} else {
|
||
const changeText = buildExpiryChangeText(data)
|
||
ElMessage.success(changeText ? `维护成功:${changeText}` : res.message || '维护成功')
|
||
}
|
||
expiryDialogVisible.value = false
|
||
await loadData()
|
||
emit('refresh')
|
||
} catch (e: any) {
|
||
console.error('维护生产日期/到期日期失败', e)
|
||
ElMessage.error(e?.message || '维护生产日期/到期日期失败')
|
||
} finally {
|
||
expiryLoading.value = false
|
||
}
|
||
}
|
||
|
||
/** 实物数 = 可用数量 + 锁定数量 */
|
||
function resolvePhysicalQuantity(row: any): number {
|
||
const available = Number(row?.available_quantity ?? 0)
|
||
const locked = Number(row?.locked_quantity ?? 0)
|
||
return (Number.isFinite(available) ? available : 0) + (Number.isFinite(locked) ? locked : 0)
|
||
}
|
||
|
||
/** 按库位汇总行归一化(无批次字段,含库位/数量/批次数/入库时间) */
|
||
function normalizeSpaceRow(item: any) {
|
||
const row = normalizeRow(item)
|
||
row.space_id = item.space_id ?? item.space?.id ?? null
|
||
row.stock_id = item.stock_id ?? item.stock?.id ?? null
|
||
row.space_code = formatInventorySpaceLabel(item.space, '--')
|
||
row.quantity = item.quantity ?? 0
|
||
row.available_quantity = item.available_quantity ?? 0
|
||
row.locked_quantity = item.locked_quantity ?? 0
|
||
row.physical_quantity = resolvePhysicalQuantity(row)
|
||
row.batch_count = Number(item.batch_count || 0)
|
||
row.first_inbound_time = item.first_inbound_time || ''
|
||
row.last_inbound_time = item.last_inbound_time || ''
|
||
row.storage_id = null
|
||
return row
|
||
}
|
||
|
||
watch(detailViewMode, () => {
|
||
if (!props.groupByBatch) void loadDetailListByStockId()
|
||
})
|
||
|
||
watch(() => [props.id, props.row, props.groupByBatch], loadData, { immediate: true })
|
||
|
||
watch(targetSpace, (val) => {
|
||
if (spaceInfoTimer) clearTimeout(spaceInfoTimer)
|
||
spaceName.value = ''
|
||
targetSpaceError.value = ''
|
||
const v = String(val || '').trim()
|
||
if (!v) return
|
||
spaceInfoTimer = setTimeout(async () => {
|
||
try {
|
||
const id = Number(v)
|
||
let res: any = null
|
||
try {
|
||
res = await indexApi.searchSpace({ keyword: v })
|
||
} catch {
|
||
if (!Number.isNaN(id)) res = await warehouseApi.getSpaceInfo(id)
|
||
}
|
||
|
||
const data = res && (res.data || res.list || res)
|
||
if (data) {
|
||
const item = Array.isArray(data) ? (data[0] || null) : data
|
||
if (item) {
|
||
spaceName.value = formatInventorySpaceLabel(item)
|
||
targetSpaceError.value = ''
|
||
} else {
|
||
spaceName.value = ''
|
||
targetSpaceError.value = 'not_found'
|
||
}
|
||
} else {
|
||
spaceName.value = ''
|
||
targetSpaceError.value = 'not_found'
|
||
}
|
||
} catch (err) {
|
||
console.error('getSpaceInfo failed', err)
|
||
spaceName.value = ''
|
||
targetSpaceError.value = 'error'
|
||
}
|
||
}, 300)
|
||
})
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.panel-stock-detail {
|
||
width: 100%;
|
||
height: 100%;
|
||
padding: 6px 10px 8px;
|
||
background: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
box-sizing: border-box;
|
||
|
||
.main-content {
|
||
flex: 1;
|
||
min-height: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* 按钮行(间距 6px 对齐 toolbar)+ 右侧视图切换,样式对齐 stock/external_stock */
|
||
.header-actions {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 6px;
|
||
flex-shrink: 0;
|
||
gap: 4px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.left-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
|
||
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||
:deep(.el-button) {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
|
||
/* primary plain 禁用:白底 + 蓝边 + 蓝字(对齐工具栏既有规则) */
|
||
:deep(.el-button--primary.is-plain.is-disabled),
|
||
:deep(.el-button--primary.is-plain.is-disabled:hover),
|
||
:deep(.el-button--primary.is-plain.is-disabled:focus),
|
||
:deep(.el-button--primary.is-plain.is-disabled:active) {
|
||
color: #409eff;
|
||
background-color: #fff;
|
||
border-color: #409eff;
|
||
}
|
||
}
|
||
|
||
.right-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.detail-table-wrap {
|
||
flex: 1;
|
||
min-height: 0;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.empty-tip {
|
||
color: #909399;
|
||
font-size: 13px;
|
||
}
|
||
|
||
.transfer-btn-wrap {
|
||
display: inline-block;
|
||
}
|
||
|
||
}
|
||
|
||
/* 日期维护弹窗:日期选择器与「清空」按钮的宽度约束 */
|
||
.expiry-date-picker {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.expiry-clear-btn {
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
/* 移库弹窗:面板结构 / 尺寸对齐 storage/receiving「批量驳回收货单」 */
|
||
.task-panel {
|
||
display: flex;
|
||
flex-direction: column;
|
||
max-height: calc(100vh - 96px);
|
||
background: #fff;
|
||
color: #303133;
|
||
|
||
&__head {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 12px;
|
||
padding: 16px 16px 8px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
&__titles {
|
||
flex: 1;
|
||
min-width: 0;
|
||
|
||
h2 {
|
||
margin: 0;
|
||
font-size: 18px;
|
||
line-height: 24px;
|
||
font-weight: 400;
|
||
color: #303133;
|
||
}
|
||
|
||
p {
|
||
margin: 4px 0 0;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
}
|
||
|
||
&__close {
|
||
width: 24px;
|
||
height: 24px;
|
||
flex: none;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: none;
|
||
border-radius: 4px;
|
||
background: transparent;
|
||
color: #909399;
|
||
cursor: pointer;
|
||
transition: color 0.2s;
|
||
|
||
svg {
|
||
width: 12px;
|
||
height: 12px;
|
||
}
|
||
|
||
&:hover {
|
||
color: #409eff;
|
||
}
|
||
}
|
||
|
||
&__body {
|
||
flex: 1;
|
||
min-height: 0;
|
||
padding: 6px 16px 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
&__form {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
}
|
||
|
||
&__field {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 16px;
|
||
min-height: 40px;
|
||
padding: 8px 12px;
|
||
border: 1px solid #ebeef5;
|
||
border-radius: 4px;
|
||
background: #fafafa;
|
||
|
||
/* 输入行:不需要灰色容器,与上方静态信息行拉开层次 */
|
||
&--input {
|
||
align-items: center;
|
||
min-height: 0;
|
||
padding: 4px 12px 0;
|
||
border: none;
|
||
border-radius: 0;
|
||
background: transparent;
|
||
|
||
:deep(.el-input),
|
||
:deep(.el-input-number),
|
||
:deep(.el-date-editor) {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
}
|
||
|
||
/* 纯展示行(如识别到的库位名称):无容器,紧贴输入框 */
|
||
&--plain {
|
||
min-height: 0;
|
||
padding: 0 12px;
|
||
border: none;
|
||
border-radius: 0;
|
||
background: transparent;
|
||
}
|
||
}
|
||
|
||
&__field-label {
|
||
font-size: 12px;
|
||
line-height: 20px;
|
||
color: #606266;
|
||
flex-shrink: 0;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
&__field-value {
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
text-align: right;
|
||
word-break: break-all;
|
||
|
||
&.is-danger {
|
||
color: #f56c6c;
|
||
}
|
||
|
||
/* 只作参考的库内原值,弱化展示 */
|
||
&.is-muted {
|
||
font-weight: 400;
|
||
color: #909399;
|
||
}
|
||
}
|
||
|
||
&__form-tip {
|
||
margin: 8px 0 12px;
|
||
padding: 8px 12px;
|
||
border-radius: 4px;
|
||
background: #f4f4f5;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
|
||
&__foot {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
gap: 12px;
|
||
padding: 12px 16px 16px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
&__hint {
|
||
margin-right: auto;
|
||
min-width: 0;
|
||
font-size: 12px;
|
||
color: #909399;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
&__actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
|
||
:deep(.el-button) {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<style lang="scss">
|
||
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
|
||
.el-dialog.transfer-dialog,
|
||
.el-dialog.expiry-dialog {
|
||
padding: 0;
|
||
overflow: hidden;
|
||
|
||
.el-dialog__header,
|
||
.el-dialog__footer {
|
||
display: none;
|
||
}
|
||
|
||
.el-dialog__body {
|
||
padding: 0;
|
||
}
|
||
}
|
||
</style>
|