Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mini-wms
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
周海峰
mini-wms
Commits
e1ae0b7c
Commit
e1ae0b7c
authored
Dec 12, 2025
by
yubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修bug
parent
bb7e8f6e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
26 行删除
+37
-26
ruoyi-admin-vue/src/views/inventory/locations/index.vue
+37
-26
没有找到文件。
ruoyi-admin-vue/src/views/inventory/locations/index.vue
View file @
e1ae0b7c
...
@@ -528,10 +528,11 @@
...
@@ -528,10 +528,11 @@
readonly
readonly
style=
"width: 100%;"
style=
"width: 100%;"
/>
/>
<!-- 修复:点击事件改为初始化方法 -->
<el-button
<el-button
type=
"primary"
type=
"primary"
size=
"small"
size=
"small"
@
click
.
stop=
"
showMaterialSelect = true
"
@
click
.
stop=
"
initMaterialSelector
"
style=
"align-self: flex-end;"
style=
"align-self: flex-end;"
>
选择物料
</el-button>
>
选择物料
</el-button>
</div>
</div>
...
@@ -744,6 +745,29 @@ export default {
...
@@ -744,6 +745,29 @@ export default {
this
.
initMaterialCodeToNameMap
()
this
.
initMaterialCodeToNameMap
()
},
},
methods
:
{
methods
:
{
// ========== 新增:初始化物料选择器(核心修复数据残留) ==========
initMaterialSelector
()
{
console
.
log
(
'【初始化物料选择器】清空残留数据'
)
// 1. 清空临时选择数据(区分新增/修改)
this
.
tempSelectedMaterials
=
{
materialCodes
:
this
.
form
.
id
?
(
this
.
form
.
materialCodes
?
this
.
form
.
materialCodes
.
split
(
','
).
filter
(
u
=>
u
.
trim
())
:
[])
:
[],
names
:
this
.
form
.
id
?
(
this
.
form
.
materialNames
?
this
.
form
.
materialNames
.
split
(
','
).
filter
(
n
=>
n
.
trim
())
:
[])
:
[],
categoryIds
:
this
.
form
.
id
?
(
this
.
form
.
allowedCategoryIds
?
this
.
form
.
allowedCategoryIds
.
split
(
','
).
filter
(
c
=>
c
.
trim
())
:
[])
:
[]
}
// 2. 延迟打开弹窗,确保数据先清空
this
.
$nextTick
(()
=>
{
this
.
showMaterialSelect
=
true
// 3. 兼容子组件清空选中状态(如果有该方法)
if
(
this
.
$refs
.
materialsSeletor
&&
this
.
$refs
.
materialsSeletor
.
clearSelection
)
{
this
.
$refs
.
materialsSeletor
.
clearSelection
()
// 修改模式下重新设置选中值
if
(
this
.
form
.
id
)
{
this
.
$refs
.
materialsSeletor
.
setSelection
(
this
.
tempSelectedMaterials
.
materialCodes
)
}
}
})
},
// 清空查询仓库
// 清空查询仓库
clearQueryWarehouse
()
{
clearQueryWarehouse
()
{
console
.
log
(
'【清空查询仓库】执行清空操作'
)
console
.
log
(
'【清空查询仓库】执行清空操作'
)
...
@@ -934,7 +958,7 @@ export default {
...
@@ -934,7 +958,7 @@ export default {
this
.
title
=
"添加库位"
this
.
title
=
"添加库位"
},
},
// 修改库位
- 核心优化:适配数组格式的物料/分类数据
// 修改库位
async
handleUpdate
(
row
)
{
async
handleUpdate
(
row
)
{
console
.
log
(
'【修改库位】触发修改操作,传入的行数据:'
,
row
)
console
.
log
(
'【修改库位】触发修改操作,传入的行数据:'
,
row
)
this
.
reset
()
this
.
reset
()
...
@@ -965,16 +989,6 @@ export default {
...
@@ -965,16 +989,6 @@ export default {
await
this
.
initMaterialCodeToNameMap
()
await
this
.
initMaterialCodeToNameMap
()
// ========== 核心修改:处理数组格式的物料/分类数据 ==========
console
.
log
(
'【修改库位】开始处理物料数据,原始数据:'
,
{
materialIds
:
rowData
.
materialIds
,
materialCodes
:
rowData
.
materialCodes
,
names
:
rowData
.
names
,
materialNames
:
rowData
.
materialNames
,
categoryIds
:
rowData
.
categoryIds
,
allowedCategoryIds
:
rowData
.
allowedCategoryIds
})
// 处理物料编码和名称(支持数组或字符串格式)
// 处理物料编码和名称(支持数组或字符串格式)
let
materialCodes
=
[]
let
materialCodes
=
[]
let
materialNames
=
[]
let
materialNames
=
[]
...
@@ -982,10 +996,9 @@ export default {
...
@@ -982,10 +996,9 @@ export default {
// 优先从materialIds数组读取
// 优先从materialIds数组读取
if
(
Array
.
isArray
(
rowData
.
materialIds
)
&&
rowData
.
materialIds
.
length
)
{
if
(
Array
.
isArray
(
rowData
.
materialIds
)
&&
rowData
.
materialIds
.
length
)
{
materialCodes
=
rowData
.
materialIds
materialCodes
=
rowData
.
materialIds
.
filter
(
code
=>
code
&&
code
.
trim
())
// 过滤null/空值
.
filter
(
code
=>
code
&&
code
.
trim
())
.
map
(
code
=>
code
.
trim
().
toUpperCase
())
.
map
(
code
=>
code
.
trim
().
toUpperCase
())
.
filter
((
code
,
index
,
self
)
=>
self
.
indexOf
(
code
)
===
index
)
// 去重
.
filter
((
code
,
index
,
self
)
=>
self
.
indexOf
(
code
)
===
index
)
console
.
log
(
'【修改库位】从materialIds数组读取物料编码:'
,
materialCodes
)
}
}
// 兼容字符串格式
// 兼容字符串格式
else
if
(
rowData
.
materialCodes
)
{
else
if
(
rowData
.
materialCodes
)
{
...
@@ -993,43 +1006,37 @@ export default {
...
@@ -993,43 +1006,37 @@ export default {
.
filter
(
code
=>
code
&&
code
.
trim
())
.
filter
(
code
=>
code
&&
code
.
trim
())
.
map
(
code
=>
code
.
trim
().
toUpperCase
())
.
map
(
code
=>
code
.
trim
().
toUpperCase
())
.
filter
((
code
,
index
,
self
)
=>
self
.
indexOf
(
code
)
===
index
)
.
filter
((
code
,
index
,
self
)
=>
self
.
indexOf
(
code
)
===
index
)
console
.
log
(
'【修改库位】从materialCodes字符串读取物料编码:'
,
materialCodes
)
}
}
// 处理物料名称
(支持数组或字符串格式)
// 处理物料名称
if
(
Array
.
isArray
(
rowData
.
names
)
&&
rowData
.
names
.
length
)
{
if
(
Array
.
isArray
(
rowData
.
names
)
&&
rowData
.
names
.
length
)
{
materialNames
=
rowData
.
names
materialNames
=
rowData
.
names
.
filter
(
name
=>
name
&&
name
.
trim
())
.
filter
(
name
=>
name
&&
name
.
trim
())
.
filter
((
name
,
index
,
self
)
=>
self
.
indexOf
(
name
)
===
index
)
.
filter
((
name
,
index
,
self
)
=>
self
.
indexOf
(
name
)
===
index
)
console
.
log
(
'【修改库位】从names数组读取物料名称:'
,
materialNames
)
}
}
else
if
(
rowData
.
materialNames
)
{
else
if
(
rowData
.
materialNames
)
{
materialNames
=
rowData
.
materialNames
.
split
(
','
)
materialNames
=
rowData
.
materialNames
.
split
(
','
)
.
filter
(
name
=>
name
&&
name
.
trim
())
.
filter
(
name
=>
name
&&
name
.
trim
())
.
filter
((
name
,
index
,
self
)
=>
self
.
indexOf
(
name
)
===
index
)
.
filter
((
name
,
index
,
self
)
=>
self
.
indexOf
(
name
)
===
index
)
console
.
log
(
'【修改库位】从materialNames字符串读取物料名称:'
,
materialNames
)
}
}
// 兜底:通过物料编码映射名称
// 兜底:通过物料编码映射名称
else
if
(
materialCodes
.
length
)
{
else
if
(
materialCodes
.
length
)
{
materialNames
=
materialCodes
.
map
(
code
=>
{
materialNames
=
materialCodes
.
map
(
code
=>
{
return
this
.
materialCodeToNameMap
[
code
]
||
`【未匹配】
${
code
}
`
return
this
.
materialCodeToNameMap
[
code
]
||
`【未匹配】
${
code
}
`
})
})
console
.
log
(
'【修改库位】通过物料编码映射名称:'
,
materialNames
)
}
}
// 处理分类ID
(支持数组或字符串格式)
// 处理分类ID
let
categoryIds
=
[]
let
categoryIds
=
[]
if
(
Array
.
isArray
(
rowData
.
categoryIds
)
&&
rowData
.
categoryIds
.
length
)
{
if
(
Array
.
isArray
(
rowData
.
categoryIds
)
&&
rowData
.
categoryIds
.
length
)
{
categoryIds
=
rowData
.
categoryIds
categoryIds
=
rowData
.
categoryIds
.
filter
(
id
=>
id
&&
id
.
trim
())
.
filter
(
id
=>
id
&&
id
.
trim
())
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
console
.
log
(
'【修改库位】从categoryIds数组读取分类ID:'
,
categoryIds
)
}
}
else
if
(
rowData
.
allowedCategoryIds
)
{
else
if
(
rowData
.
allowedCategoryIds
)
{
categoryIds
=
rowData
.
allowedCategoryIds
.
split
(
','
)
categoryIds
=
rowData
.
allowedCategoryIds
.
split
(
','
)
.
filter
(
id
=>
id
&&
id
.
trim
())
.
filter
(
id
=>
id
&&
id
.
trim
())
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
console
.
log
(
'【修改库位】从allowedCategoryIds字符串读取分类ID:'
,
categoryIds
)
}
}
// 更新表单数据
// 更新表单数据
...
@@ -1154,7 +1161,7 @@ export default {
...
@@ -1154,7 +1161,7 @@ export default {
this
.
download
(
'inventory/locations/export'
,
exportParams
,
`locations_
${
new
Date
().
getTime
()}
.xlsx`
)
this
.
download
(
'inventory/locations/export'
,
exportParams
,
`locations_
${
new
Date
().
getTime
()}
.xlsx`
)
},
},
// 物料选择变化
- 优化数据处理
// 物料选择变化
handleMaterialSelectionChange
(
selectedData
)
{
handleMaterialSelectionChange
(
selectedData
)
{
console
.
log
(
'【物料选择变化】接收到的选择数据:'
,
selectedData
)
console
.
log
(
'【物料选择变化】接收到的选择数据:'
,
selectedData
)
...
@@ -1175,7 +1182,7 @@ export default {
...
@@ -1175,7 +1182,7 @@ export default {
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
.
filter
((
id
,
index
,
self
)
=>
self
.
indexOf
(
id
)
===
index
)
this
.
tempSelectedMaterials
=
{
this
.
tempSelectedMaterials
=
{
materialCodes
,
// 保持变量名不变(后续逻辑依赖)
materialCodes
,
names
,
names
,
categoryIds
categoryIds
}
}
...
@@ -1196,7 +1203,7 @@ export default {
...
@@ -1196,7 +1203,7 @@ export default {
console
.
log
(
'【取消物料选择】恢复后的临时选择数据:'
,
this
.
tempSelectedMaterials
)
console
.
log
(
'【取消物料选择】恢复后的临时选择数据:'
,
this
.
tempSelectedMaterials
)
},
},
// 确认物料选择
- 优化数据格式化
// 确认物料选择
confirmMaterialSelection
()
{
confirmMaterialSelection
()
{
console
.
log
(
'【确认物料选择】当前临时选择数据:'
,
this
.
tempSelectedMaterials
)
console
.
log
(
'【确认物料选择】当前临时选择数据:'
,
this
.
tempSelectedMaterials
)
...
@@ -1279,6 +1286,10 @@ export default {
...
@@ -1279,6 +1286,10 @@ export default {
names
:
[],
names
:
[],
categoryIds
:
[]
categoryIds
:
[]
}
}
// 修复:清空物料选择器残留
if
(
this
.
$refs
.
materialsSeletor
&&
this
.
$refs
.
materialsSeletor
.
clearSelection
)
{
this
.
$refs
.
materialsSeletor
.
clearSelection
()
}
if
(
this
.
$refs
.
form
)
{
if
(
this
.
$refs
.
form
)
{
this
.
$refs
.
form
.
resetFields
()
this
.
$refs
.
form
.
resetFields
()
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论