fix(frontend): resolve cross-page selection loss, add destroy-on-close to dialogs, and fix row-key collision in stocktake

This commit is contained in:
DXC
2026-04-02 18:35:11 +08:00
parent 1e2f4953b6
commit edf09508f6
8 changed files with 20 additions and 13 deletions

View File

@ -3,6 +3,7 @@
v-model="visible" v-model="visible"
title="智能扫码" title="智能扫码"
width="600px" width="600px"
destroy-on-close
:close-on-click-modal="false" :close-on-click-modal="false"
@close="handleClose" @close="handleClose"
> >

View File

@ -45,7 +45,7 @@
</el-card> </el-card>
<!-- 打印机配置弹窗 --> <!-- 打印机配置弹窗 -->
<el-dialog v-model="printerDialogVisible" title="打印机 IP 配置" width="500px"> <el-dialog v-model="printerDialogVisible" title="打印机 IP 配置" width="500px" destroy-on-close>
<el-form :model="printerForm" label-width="120px"> <el-form :model="printerForm" label-width="120px">
<el-form-item label="标签打印机 IP"> <el-form-item label="标签打印机 IP">
<el-input v-model="printerForm.label_ip" placeholder="例如 192.168.9.221" /> <el-input v-model="printerForm.label_ip" placeholder="例如 192.168.9.221" />
@ -69,7 +69,7 @@
</el-dialog> </el-dialog>
<!-- 库位管理弹窗 --> <!-- 库位管理弹窗 -->
<el-dialog v-model="warehouseDialogVisible" title="库位管理" width="700px" :close-on-click-modal="false"> <el-dialog v-model="warehouseDialogVisible" title="库位管理" width="700px" destroy-on-close :close-on-click-modal="false">
<div class="warehouse-dialog"> <div class="warehouse-dialog">
<div class="warehouse-header"> <div class="warehouse-header">
<!-- 非批量模式 --> <!-- 非批量模式 -->
@ -145,7 +145,7 @@
</el-dialog> </el-dialog>
<!-- 新增/编辑库位弹窗 --> <!-- 新增/编辑库位弹窗 -->
<el-dialog v-model="locationFormVisible" :title="locationFormTitle" width="400px"> <el-dialog v-model="locationFormVisible" :title="locationFormTitle" width="400px" destroy-on-close>
<el-form :model="locationForm" label-width="80px"> <el-form :model="locationForm" label-width="80px">
<el-form-item label="上级库位"> <el-form-item label="上级库位">
<el-input :value="locationForm.parentName" disabled /> <el-input :value="locationForm.parentName" disabled />
@ -164,7 +164,7 @@
</el-dialog> </el-dialog>
<!-- 批量生成库位弹窗 --> <!-- 批量生成库位弹窗 -->
<el-dialog v-model="batchGenerateVisible" title="批量生成库位" width="800px"> <el-dialog v-model="batchGenerateVisible" title="批量生成库位" width="800px" destroy-on-close>
<el-form :model="batchGenerateForm" label-width="100px"> <el-form :model="batchGenerateForm" label-width="100px">
<el-form-item label="父级库位"> <el-form-item label="父级库位">
<el-input :value="batchGenerateForm.parentName" disabled /> <el-input :value="batchGenerateForm.parentName" disabled />

View File

@ -194,13 +194,14 @@
:data="tableData" :data="tableData"
border border
stripe stripe
row-key="id"
:size="tableSize" :size="tableSize"
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
@sort-change="handleSortChange" @sort-change="handleSortChange"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
style="width: 100%; margin-top: 15px" style="width: 100%; margin-top: 15px"
> >
<el-table-column v-if="isBatchMode" type="selection" width="55" /> <el-table-column v-if="isBatchMode" type="selection" width="55" :reserve-selection="true" />
<el-table-column v-if="columns.id.visible" prop="id" label="ID" min-width="80" align="center" fixed="left" /> <el-table-column v-if="columns.id.visible" prop="id" label="ID" min-width="80" align="center" fixed="left" />
<el-table-column v-if="columns.companyName.visible" prop="companyName" label="所属公司" min-width="100" align="center" show-overflow-tooltip sortable="custom"> <el-table-column v-if="columns.companyName.visible" prop="companyName" label="所属公司" min-width="100" align="center" show-overflow-tooltip sortable="custom">
@ -323,6 +324,7 @@
:title="dialog.title" :title="dialog.title"
width="700px" width="700px"
append-to-body append-to-body
destroy-on-close
@close="cancel" @close="cancel"
:close-on-click-modal="!isUploading" :close-on-click-modal="!isUploading"
:close-on-press-escape="!isUploading" :close-on-press-escape="!isUploading"

View File

@ -86,7 +86,7 @@
/> />
<!-- 新增调整单弹窗 --> <!-- 新增调整单弹窗 -->
<el-dialog v-model="showDialog" title="新增盘盈盘亏调整单" width="700px" :close-on-click-modal="false"> <el-dialog v-model="showDialog" title="新增盘盈盘亏调整单" width="700px" destroy-on-close :close-on-click-modal="false">
<el-form :model="form" :rules="rules" ref="formRef" label-width="100px"> <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
<el-form-item label="选择物料" prop="stock_id"> <el-form-item label="选择物料" prop="stock_id">
<el-select <el-select
@ -128,7 +128,7 @@
</el-dialog> </el-dialog>
<!-- 物料选择弹窗 --> <!-- 物料选择弹窗 -->
<el-dialog v-model="showStockDialog" title="选择物料" width="800px"> <el-dialog v-model="showStockDialog" title="选择物料" width="800px" destroy-on-close>
<div class="filter-container" style="margin-bottom: 15px"> <div class="filter-container" style="margin-bottom: 15px">
<el-input v-model="stockKeyword" placeholder="搜索SKU/条码" style="width: 200px" @keyup.enter="fetchStocks" clearable /> <el-input v-model="stockKeyword" placeholder="搜索SKU/条码" style="width: 200px" @keyup.enter="fetchStocks" clearable />
<el-button type="primary" @click="fetchStocks">搜索</el-button> <el-button type="primary" @click="fetchStocks">搜索</el-button>
@ -152,7 +152,7 @@
</el-dialog> </el-dialog>
<!-- 盘点差异审核弹窗 --> <!-- 盘点差异审核弹窗 -->
<el-dialog v-model="showReviewDialog" title="盘点差异审核" width="1200px" :close-on-click-modal="false"> <el-dialog v-model="showReviewDialog" title="盘点差异审核" width="1200px" destroy-on-close :close-on-click-modal="false">
<div v-loading="reviewLoading"> <div v-loading="reviewLoading">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div style="margin-bottom: 16px; display: flex; gap: 12px;"> <div style="margin-bottom: 16px; display: flex; gap: 12px;">
@ -171,8 +171,8 @@
<el-button type="primary" @click="handleReviewSearch">搜索</el-button> <el-button type="primary" @click="handleReviewSearch">搜索</el-button>
</div> </div>
<el-table :data="reviewList" border stripe ref="reviewTableRef" @selection-change="handleReviewSelectionChange"> <el-table :data="reviewList" border stripe ref="reviewTableRef" row-key="id" @selection-change="handleReviewSelectionChange">
<el-table-column type="selection" width="50" /> <el-table-column type="selection" width="50" :reserve-selection="true" />
<el-table-column prop="sku" label="SKU" width="140" /> <el-table-column prop="sku" label="SKU" width="140" />
<el-table-column prop="material_name" label="物料名称" min-width="150" show-overflow-tooltip /> <el-table-column prop="material_name" label="物料名称" min-width="150" show-overflow-tooltip />
<el-table-column prop="spec_model" label="规格" width="120" show-overflow-tooltip /> <el-table-column prop="spec_model" label="规格" width="120" show-overflow-tooltip />
@ -226,7 +226,7 @@
</el-dialog> </el-dialog>
<!-- 处理调整单弹窗 --> <!-- 处理调整单弹窗 -->
<el-dialog v-model="showProcessDialog" title="处理调整单" width="500px" :close-on-click-modal="false"> <el-dialog v-model="showProcessDialog" title="处理调整单" width="500px" destroy-on-close :close-on-click-modal="false">
<el-form label-width="120px"> <el-form label-width="120px">
<el-form-item label="调整单号"> <el-form-item label="调整单号">
<el-input v-model="processForm.order_no" disabled /> <el-input v-model="processForm.order_no" disabled />

View File

@ -84,6 +84,7 @@
v-model="dialogVisible" v-model="dialogVisible"
:title="dialogTitle" :title="dialogTitle"
width="700px" width="700px"
destroy-on-close
@close="resetDialog" @close="resetDialog"
> >
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px"> <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">

View File

@ -121,6 +121,7 @@
v-model="showConfirmDialog" v-model="showConfirmDialog"
title="⚠️ 确认清除盘点数据" title="⚠️ 确认清除盘点数据"
width="400" width="400"
destroy-on-close
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
show-close show-close
@ -237,7 +238,7 @@
height="100%" height="100%"
stripe stripe
border border
row-key="id" row-key="uniqueKey"
style="width: 100%" style="width: 100%"
> >
<el-table-column prop="sku" label="SKU" width="140" show-overflow-tooltip /> <el-table-column prop="sku" label="SKU" width="140" show-overflow-tooltip />
@ -1004,6 +1005,7 @@ const fetchInventoryList = async (silent = false) => {
id: draft?.id || null, id: draft?.id || null,
stock_id: item.id, stock_id: item.id,
source_table: item.source_table, source_table: item.source_table,
uniqueKey: `${item.source_table}_${item.id}`, // ★ 绝对唯一键解决row-key冲突
sku: item.sku, sku: item.sku,
material_name: item.material_name, material_name: item.material_name,
spec_model: item.spec_model, spec_model: item.spec_model,

View File

@ -85,7 +85,7 @@
</el-card> </el-card>
<!-- 详情弹窗 --> <!-- 详情弹窗 -->
<el-dialog v-model="detailDialogVisible" title="操作详情" width="700px"> <el-dialog v-model="detailDialogVisible" title="操作详情" width="700px" destroy-on-close>
<el-descriptions :column="2" border> <el-descriptions :column="2" border>
<el-descriptions-item label="ID">{{ currentLog.id }}</el-descriptions-item> <el-descriptions-item label="ID">{{ currentLog.id }}</el-descriptions-item>
<el-descriptions-item label="操作人">{{ currentLog.username }} ({{ currentLog.display_name }})</el-descriptions-item> <el-descriptions-item label="操作人">{{ currentLog.username }} ({{ currentLog.display_name }})</el-descriptions-item>

View File

@ -59,6 +59,7 @@
v-model="dialogVisible" v-model="dialogVisible"
:title="isEdit ? '编辑员工账号' : '新增员工账号'" :title="isEdit ? '编辑员工账号' : '新增员工账号'"
width="500px" width="500px"
destroy-on-close
@close="resetForm" @close="resetForm"
> >
<el-form <el-form