Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psa-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高滢
psa-web
Commits
3a01986e
Commit
3a01986e
authored
Mar 03, 2025
by
方建宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物品归还-选择归还物品获取数据
parent
47522ed5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
6 deletions
+68
-6
materialReturn.vue
src/views/material/materialReturn.vue
+68
-6
No files found.
src/views/material/materialReturn.vue
View file @
3a01986e
...
@@ -122,14 +122,18 @@
...
@@ -122,14 +122,18 @@
<div
style=
"display: flex; justify-content: flex-end;"
>
<div
style=
"display: flex; justify-content: flex-end;"
>
<el-input
v-model=
"searchQuery"
placeholder=
"搜索数据"
style=
"margin-bottom: 10px;width: 200px;"
></el-input>
<el-input
v-model=
"searchQuery"
placeholder=
"搜索数据"
style=
"margin-bottom: 10px;width: 200px;"
></el-input>
</div>
</div>
<el-table
:data=
"filteredItems"
border
style=
"width: 100%"
>
<el-table
:data=
"filteredItems"
border
style=
"width: 100%"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
></el-table-column>
<el-table-column
type=
"selection"
width=
"55"
></el-table-column>
<el-table-column
prop=
"applicant"
label=
"申请人"
width=
"150"
></el-table-column>
<el-table-column
prop=
"applicant"
label=
"申请人"
width=
"150"
></el-table-column>
<el-table-column
prop=
"itemName"
label=
"物品名称"
width=
"150"
></el-table-column>
<el-table-column
prop=
"itemName"
label=
"物品名称"
width=
"150"
></el-table-column>
<el-table-column
prop=
"itemType"
label=
"物品类型"
width=
"150"
></el-table-column>
<el-table-column
prop=
"itemType"
label=
"物品类型"
width=
"150"
></el-table-column>
<el-table-column
prop=
"itemUnit"
label=
"单位"
width=
"1
5
0"
></el-table-column>
<el-table-column
prop=
"itemUnit"
label=
"单位"
width=
"1
3
0"
></el-table-column>
<el-table-column
prop=
"
q
uantity"
label=
"待归还数量"
width=
"150"
></el-table-column>
<el-table-column
prop=
"
applyQ
uantity"
label=
"待归还数量"
width=
"150"
></el-table-column>
</el-table>
</el-table>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"onCloseSelectDialog"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmSelection"
>
确定
</el-button>
</div>
</el-dialog>
</el-dialog>
</div>
</div>
</template>
</template>
...
@@ -156,8 +160,9 @@ export default {
...
@@ -156,8 +160,9 @@ export default {
editingId
:
null
,
// 用于存储正在编辑的归还ID
editingId
:
null
,
// 用于存储正在编辑的归还ID
showItemSelectDialog
:
false
,
showItemSelectDialog
:
false
,
searchQuery
:
''
,
searchQuery
:
''
,
itemsList
:
[],
itemsList
:
[],
// 存储领用申请数据
selectedRowIndex
:
-
1
,
selectedRowIndex
:
-
1
,
selectedItems
:
[],
// 用于存储选中的数据
rules
:
{
rules
:
{
returnDate
:
[
returnDate
:
[
{
required
:
true
,
message
:
'请选择归还日期'
,
trigger
:
'change'
}
{
required
:
true
,
message
:
'请选择归还日期'
,
trigger
:
'change'
}
...
@@ -264,8 +269,62 @@ export default {
...
@@ -264,8 +269,62 @@ export default {
},
},
openItemSelectDialog
(
index
)
{
openItemSelectDialog
(
index
)
{
this
.
selectedRowIndex
=
index
;
this
.
selectedRowIndex
=
index
;
// 去掉 fetchItems 调用
// 调用 listApply 接口获取领用申请数据
this
.
fetchItems
();
this
.
showItemSelectDialog
=
true
;
this
.
showItemSelectDialog
=
true
;
},
fetchItems
()
{
listApply
().
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
// 解析 items 字段
this
.
itemsList
=
response
.
rows
.
flatMap
(
row
=>
{
try
{
const
items
=
JSON
.
parse
(
row
.
items
);
return
items
.
map
(
item
=>
({
applicant
:
row
.
applicant
,
itemName
:
item
.
itemName
,
itemType
:
item
.
itemType
,
itemUnit
:
item
.
unit
,
applyQuantity
:
item
.
applyQuantity
// 假设 applyRemaining 是待归还数量
}));
}
catch
(
error
)
{
console
.
error
(
'解析 items 字段失败:'
,
error
);
return
[];
}
});
}
else
{
this
.
$message
.
error
(
'获取领用申请数据失败: '
+
response
.
msg
);
}
}).
catch
(
error
=>
{
this
.
$message
.
error
(
'获取领用申请数据失败: '
+
error
.
message
);
});
},
handleSelectionChange
(
selection
)
{
this
.
selectedItems
=
selection
;
},
onCloseSelectDialog
()
{
this
.
showItemSelectDialog
=
false
;
},
confirmSelection
()
{
if
(
this
.
selectedItems
.
length
===
0
)
{
this
.
$message
.
warning
(
'请选择要添加的数据'
);
return
;
}
// 将选中的数据填充到主页面的表格中
this
.
selectedItems
.
forEach
(
selectedItem
=>
{
this
.
form
.
items
[
this
.
selectedRowIndex
]
=
{
item
:
''
,
itemType
:
selectedItem
.
itemType
,
itemName
:
selectedItem
.
itemName
,
unit
:
selectedItem
.
itemUnit
,
pendingReturn
:
selectedItem
.
applyQuantity
,
returnQuantity
:
0
,
remainingReturn
:
selectedItem
.
applyQuantity
};
});
this
.
onCloseSelectDialog
();
}
}
},
},
created
()
{
created
()
{
...
@@ -275,6 +334,9 @@ export default {
...
@@ -275,6 +334,9 @@ export default {
this
.
form
=
JSON
.
parse
(
draft
);
this
.
form
=
JSON
.
parse
(
draft
);
this
.
$message
.
info
(
'已加载草稿'
);
this
.
$message
.
info
(
'已加载草稿'
);
}
}
// 调用 listApply 接口获取领用申请数据
this
.
fetchItems
();
},
},
watch
:
{
watch
:
{
'form.items'
:
{
'form.items'
:
{
...
@@ -292,7 +354,7 @@ export default {
...
@@ -292,7 +354,7 @@ export default {
item
.
applicant
.
includes
(
this
.
searchQuery
)
||
item
.
applicant
.
includes
(
this
.
searchQuery
)
||
item
.
itemName
.
includes
(
this
.
searchQuery
)
||
item
.
itemName
.
includes
(
this
.
searchQuery
)
||
item
.
itemType
.
includes
(
this
.
searchQuery
)
||
item
.
itemType
.
includes
(
this
.
searchQuery
)
||
item
.
u
nit
.
includes
(
this
.
searchQuery
)
item
.
itemU
nit
.
includes
(
this
.
searchQuery
)
);
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment