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
9dbb9738
Commit
9dbb9738
authored
Mar 26, 2025
by
ZhangRunSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:借出草稿
parent
c06c6cb1
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1558 additions
and
57 deletions
+1558
-57
apply.js
src/api/material/apply.js
+8
-0
return.js
src/api/material/return.js
+9
-0
add.vue
src/views/material/add.vue
+3
-2
edit.vue
src/views/material/edit.vue
+1
-24
index.vue
src/views/material/index.vue
+1
-1
add.vue
src/views/materialapply/add.vue
+8
-4
draft.vue
src/views/materialapply/draft.vue
+404
-0
draftview.vue
src/views/materialapply/draftview.vue
+220
-0
edit.vue
src/views/materialapply/edit.vue
+435
-0
index.vue
src/views/materialapply/index.vue
+12
-9
materialBorrowApproval.vue
src/views/materialapply/materialBorrowApproval.vue
+5
-3
view.vue
src/views/materialapply/view.vue
+1
-1
add.vue
src/views/materialentry/add.vue
+1
-1
edit.vue
src/views/materialentry/edit.vue
+1
-1
index.vue
src/views/materialentry/index.vue
+1
-1
add.vue
src/views/materialreturn/add.vue
+1
-1
index.vue
src/views/materialreturn/index.vue
+10
-8
returnApproval.vue
src/views/materialreturn/returnApproval.vue
+436
-0
view.vue
src/views/materialreturn/view.vue
+1
-1
No files found.
src/api/material/apply.js
View file @
9dbb9738
...
@@ -34,6 +34,14 @@ export function updateApply(data) {
...
@@ -34,6 +34,14 @@ export function updateApply(data) {
data
:
data
data
:
data
})
})
}
}
// 审核借用申请
export
function
approve
(
data
)
{
return
request
({
url
:
'/material/apply/check'
,
method
:
'put'
,
data
:
data
})
}
// 删除物品借用申请
// 删除物品借用申请
export
function
delApply
(
id
)
{
export
function
delApply
(
id
)
{
...
...
src/api/material/return.js
View file @
9dbb9738
...
@@ -35,6 +35,15 @@ export function updateReturn(data) {
...
@@ -35,6 +35,15 @@ export function updateReturn(data) {
})
})
}
}
// 修改物品归还申请
export
function
approve
(
data
)
{
return
request
({
url
:
'/material/return/check'
,
method
:
'put'
,
data
:
data
})
}
// 删除物品归还申请
// 删除物品归还申请
export
function
delReturn
(
id
)
{
export
function
delReturn
(
id
)
{
return
request
({
return
request
({
...
...
src/views/material/add.vue
View file @
9dbb9738
...
@@ -135,6 +135,7 @@ const getUserList = () => {
...
@@ -135,6 +135,7 @@ const getUserList = () => {
const
handleSubmit
=
()
=>
{
const
handleSubmit
=
()
=>
{
proxy
.
$refs
[
"formRef"
].
validate
(
valid
=>
{
proxy
.
$refs
[
"formRef"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
form
.
value
.
draft
=
"0"
addMaterial
(
form
.
value
).
then
(
response
=>
{
addMaterial
(
form
.
value
).
then
(
response
=>
{
if
(
response
.
code
===
200
){
if
(
response
.
code
===
200
){
proxy
.
$modal
.
msgSuccess
(
"新增成功"
);
proxy
.
$modal
.
msgSuccess
(
"新增成功"
);
...
@@ -157,7 +158,7 @@ const saveDraft = () => {
...
@@ -157,7 +158,7 @@ const saveDraft = () => {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
form
.
value
.
draft
=
"1"
form
.
value
.
draft
=
"1"
addMaterial
(
form
.
value
).
then
(
response
=>
{
addMaterial
(
form
.
value
).
then
(
response
=>
{
if
(
response
.
code
===
200
){
if
(
response
.
code
===
200
){
proxy
.
$modal
.
msgSuccess
(
"草稿保存成功"
);
proxy
.
$modal
.
msgSuccess
(
"草稿保存成功"
);
...
@@ -185,7 +186,7 @@ function resetForm() {
...
@@ -185,7 +186,7 @@ function resetForm() {
proxy
.
resetForm
(
"materialRef"
);
proxy
.
resetForm
(
"materialRef"
);
}
}
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialDetail'
})
proxy
.
$router
.
push
({
path
:
'/material/materialDetail'
})
...
...
src/views/material/edit.vue
View file @
9dbb9738
...
@@ -187,29 +187,6 @@ const handleSubmit = () => {
...
@@ -187,29 +187,6 @@ const handleSubmit = () => {
});
});
};
};
// 新增草稿
const
saveDraft
=
()
=>
{
proxy
.
$refs
[
"formRef"
].
validate
(
valid
=>
{
if
(
valid
)
{
proxy
.
$confirm
(
'确认提交吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
addDraft
(
form
).
then
(
response
=>
{
if
(
response
.
code
===
200
){
proxy
.
$modal
.
msgSuccess
(
"草稿保存成功"
);
proxy
.
$router
.
push
({
path
:
'/material/materialDetail'
})
}
else
{
proxy
.
$modal
.
msgError
(
response
.
msg
)
}
});
}).
catch
(()
=>
{})
}
});
}
// 表单重置
// 表单重置
function
resetForm
()
{
function
resetForm
()
{
form
.
value
=
{
form
.
value
=
{
...
@@ -230,7 +207,7 @@ function resetForm() {
...
@@ -230,7 +207,7 @@ function resetForm() {
proxy
.
resetForm
(
"materialRef"
);
proxy
.
resetForm
(
"materialRef"
);
}
}
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialDetail'
})
proxy
.
$router
.
push
({
path
:
'/material/materialDetail'
})
...
...
src/views/material/index.vue
View file @
9dbb9738
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
plain
plain
@
click=
"handleExport"
@
click=
"handleExport"
v-hasPermi=
"['psa:material:export']"
v-hasPermi=
"['psa:material:export']"
><img
src=
"../../assets/icons/common/
print
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
export2
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
</span>
</span>
...
...
src/views/materialapply/add.vue
View file @
9dbb9738
...
@@ -288,11 +288,14 @@ const handleSubmit = () => {
...
@@ -288,11 +288,14 @@ const handleSubmit = () => {
const saveDraft = () => {
const saveDraft = () => {
proxy.$refs["formRef"].validate(valid => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
if (valid) {
addDraft(form).then(response => {
form.value.draft = "1";
addApply(form.value).then(response => {
if (response.code === 200){
if (response.code === 200){
proxy.$modal.msgSuccess("草稿保存成功");
proxy.$modal.msgSuccess("草稿保存成功");
proxy.$router.push({ path: '/material/materialDetail' })
resetForm();
proxy.$router.push({ path: '/material/materialApply' })
}else {
}else {
resetForm();
proxy.$modal.msgError(response.msg)
proxy.$modal.msgError(response.msg)
}
}
});
});
...
@@ -314,12 +317,13 @@ function resetForm() {
...
@@ -314,12 +317,13 @@ function resetForm() {
unit: null,
unit: null,
maxStock: null
maxStock: null
}],
}],
remark: null
remark: null,
draft : null
};
};
proxy.resetForm("materialRef");
proxy.resetForm("materialRef");
}
}
// 返回
项目管理页面
// 返回
const reset = () => {
const reset = () => {
// 返回项目
// 返回项目
proxy.$router.push({ path: '/material/materialApply' })
proxy.$router.push({ path: '/material/materialApply' })
...
...
src/views/materialapply/draft.vue
0 → 100644
View file @
9dbb9738
<
template
>
<div
class=
"app-container"
>
<div
class=
"formSearch"
>
<el-form
:model=
"queryParams"
ref=
"queryRef"
:inline=
"true"
v-show=
"showSearch"
label-width=
"80px"
>
<el-form-item
label=
"项目组"
prop=
"projectId"
>
<el-select
v-model=
"queryParams.projectId"
placeholder=
"请选择项目"
clearable
style=
"width: 220px"
>
<el-option
v-for=
"dict in project_list"
:key=
"dict.id"
:label=
"dict.projectName"
:value=
"dict.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"申请人"
prop=
"userName"
style=
"width: 320px"
>
<el-input
v-model=
"queryParams.userName"
placeholder=
"请选择申请人"
clearable
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<el-form-item
style=
"padding-left: 30%"
>
<el-button
@
click=
"resetQuery"
class=
"el-button-defalut"
>
<template
#
icon
>
<img
src=
"../../assets/icons/common/reset.png"
height=
"25"
width=
"24"
/>
</
template
>
重置
</el-button>
<el-button
type=
"primary"
@
click=
"handleQuery"
class=
"el-button-primary"
>
<
template
#
icon
>
<img
src=
"../../assets/icons/common/search.png"
height=
"24"
width=
"24"
/>
</
template
>
查询
</el-button>
</el-form-item>
</el-form>
</div>
<div
class=
"contentTable"
>
<div
style=
"margin-bottom: 18px "
>
<span
class=
"bold-text"
style=
"border-bottom: 3px solid #0062FF;"
>
借用草稿箱
</span>
<span
style=
"padding-left: 85%"
>
<el-button
icon=
"ArrowLeft"
class=
"el-button-primary-pain"
@
click=
"resetback"
>
返回
</el-button>
</span>
</div>
<el-table
v-loading=
"loading"
:data=
"applyList"
border
style=
"width: 100%"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
label=
"项目组"
align=
"center"
prop=
"projectId"
>
<
template
v-slot:default=
"scope"
>
<span>
{{
project_list
.
find
(
item
=>
item
.
id
===
scope
.
row
.
projectId
)?.
projectName
||
'未知类型'
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"申请人"
align=
"center"
prop=
"userName"
/>
<el-table-column
label=
"申请时间"
align=
"center"
prop=
"createTime"
width=
"180"
>
未开始
</el-table-column>
<el-table-column
label=
"申请物品"
align=
"center"
prop=
"items"
>
<
template
#
default=
"scope"
>
<el-popover
placement=
"right"
:width=
"400"
trigger=
"click"
>
<template
#
reference
>
<el-button
type=
"text"
>
物品明细
</el-button>
</
template
>
<el-table
:data=
"scope.row.items"
border
style=
"width: 100%"
>
<el-table-column
label=
"物品类型"
align=
"center"
>
<
template
#
default=
"scope"
>
{{
typeMap
[
scope
.
row
.
type
]
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
label=
"物品名称"
align=
"center"
prop=
"repaymentPercentage"
>
<
template
#
default=
"scope"
>
{{
materialDetailMap
[
scope
.
row
.
material_detail
]
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
label=
"物品数量"
align=
"center"
prop=
"repaymentCondition"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
quantity
||
'-'
}}
</
template
>
</el-table-column>
</el-table>
</el-popover>
</template>
</el-table-column>
<el-table-column
label=
"审批状态"
align=
"center"
prop=
"checkStatus"
>
无
</el-table-column>
<el-table-column
label=
"申请备注"
align=
"center"
prop=
"remark"
>
<
template
#
default=
"scope"
>
<el-popover
placement=
"right"
:width=
"400"
trigger=
"click"
>
<template
#
reference
>
<el-button
type=
"text"
>
查看详情
</el-button>
</
template
>
<div
style=
"padding: 10px;"
>
<el-input
type=
"textarea"
:rows=
"5"
v-model=
"scope.row.remark"
readonly
style=
"width: 100%;"
>
</el-input>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
fixed=
"right"
min-width=
"50"
>
<
template
#
default=
"scope"
>
<el-tooltip
content=
"编辑"
placement=
"top"
>
<el-button
link
type=
"text"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['psa:material:edit']"
>
<img
src=
"../../assets/icons/common/edit.png"
height=
"32"
width=
"32"
/>
</el-button>
</el-tooltip>
<el-tooltip
content=
"详情"
placement=
"top"
>
<el-button
link
type=
"text"
@
click=
"handleView(scope.row)"
v-hasPermi=
"['system:project:view']"
>
<img
src=
"../../assets/icons/common/check.png"
height=
"32"
width=
"32"
/>
</el-button>
</el-tooltip>
<el-tooltip
content=
"删除"
placement=
"top"
>
<el-button
link
type=
"text"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['material:apply:remove']"
>
<img
src=
"../../assets/icons/common/delete.png"
height=
"32"
width=
"32"
/>
</el-button>
</el-tooltip>
</
template
>
</el-table-column>
</el-table>
<div
class=
"pagination"
>
<pagination
layout=
"prev, pager, next, sizes, jumper"
v-show=
"total > 0"
:total=
"total"
v-model:page=
"queryParams.pageNum"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</div>
</div>
</div>
</template>
<
script
setup
name=
"Apply"
>
import
{
listApply
,
getApply
,
delApply
,
addApply
,
updateApply
}
from
"@/api/material/apply"
;
import
{
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
const
{
proxy
}
=
getCurrentInstance
();
const
{
material_status
}
=
proxy
.
useDict
(
'material_status'
);
const
applyList
=
ref
([]);
const
psaMaterialApplyDetailList
=
ref
([]);
const
material_type
=
ref
([]);
const
all_material_type_detail
=
ref
([]);
const
project_list
=
ref
([]);
const
open
=
ref
(
false
);
const
loading
=
ref
(
true
);
const
showSearch
=
ref
(
true
);
const
ids
=
ref
([]);
const
single
=
ref
(
true
);
const
multiple
=
ref
(
true
);
const
total
=
ref
(
0
);
const
title
=
ref
(
""
);
const
isExpanded
=
ref
(
false
);
const
data
=
reactive
({
form
:
{
id
:
null
,
projectId
:
null
,
userId
:
null
,
userName
:
null
,
checkStatus
:
null
,
remark
:
null
,
createBy
:
null
,
createTime
:
null
,
items
:
[{
type
:
null
,
material_detail
:
null
,
quantity
:
null
}],
},
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
projectId
:
null
,
userName
:
null
,
checkStatus
:
null
,
createTime
:
null
,
draft
:
null
},
rules
:
{
}
});
const
{
queryParams
,
form
,
rules
}
=
toRefs
(
data
);
/** 查询物品借用申请列表 */
function
getList
()
{
loading
.
value
=
true
;
queryParams
.
value
.
draft
=
"1"
;
listApply
(
queryParams
.
value
).
then
(
response
=>
{
applyList
.
value
=
response
.
rows
;
total
.
value
=
response
.
total
;
loading
.
value
=
false
;
});
}
// 添加计算属性
const
typeMap
=
computed
(()
=>
{
const
map
=
{};
material_type
.
value
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
item
.
typeName
;
});
return
map
;
});
const
materialDetailMap
=
computed
(()
=>
{
const
map
=
{};
all_material_type_detail
.
value
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
item
.
materialName
;
});
return
map
;
});
const
resetback
=
()
=>
{
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialApply'
})
resetForm
()
}
// 表单重置
function
reset
()
{
form
.
value
=
{
id
:
null
,
projectId
:
null
,
userId
:
null
,
userName
:
null
,
remark
:
null
,
checkStatus
:
null
,
approvalDate
:
null
,
approvalAdvice
:
null
,
createTime
:
null
,
updateTime
:
null
,
createBy
:
null
,
updateBy
:
null
,
draft
:
null
,
delFlag
:
null
};
psaMaterialApplyDetailList
.
value
=
[];
proxy
.
resetForm
(
"applyRef"
);
}
/** 搜索按钮操作 */
function
handleQuery
()
{
queryParams
.
value
.
pageNum
=
1
;
getList
();
}
/** 重置按钮操作 */
function
resetQuery
()
{
proxy
.
resetForm
(
"queryRef"
);
handleQuery
();
}
// 多选框选中数据
function
handleSelectionChange
(
selection
)
{
ids
.
value
=
selection
.
map
(
item
=>
item
.
id
);
single
.
value
=
selection
.
length
!=
1
;
multiple
.
value
=
!
selection
.
length
;
}
/** 新增按钮操作 */
function
handleAdd
()
{
/* reset();
open.value = true;
title.value = "添加物品借用申请";*/
proxy
.
$router
.
push
({
path
:
'/materials/apply/applyadd'
});
}
/** 修改按钮操作 */
function
handleUpdate
(
row
)
{
/* reset();
const _id = row.id || ids.value
getApply(_id).then(response => {
form.value = response.data;
psaMaterialApplyDetailList.value = response.data.psaMaterialApplyDetailList;
open.value = true;
title.value = "修改物品借用申请";
});*/
const
id
=
row
.
id
proxy
.
$router
.
push
({
path
:
'/materials/apply/applyedit'
,
query
:
{
id
:
id
}
});
}
/** 查看详情操作 */
function
handleView
(
row
)
{
proxy
.
$router
.
push
({
path
:
'/materials/apply/draftview'
,
query
:
{
id
:
row
.
id
,
type
:
"2"
}
});
}
/** 删除按钮操作 */
function
handleDelete
(
row
)
{
const
_ids
=
row
.
id
||
ids
.
value
;
proxy
.
$modal
.
confirm
(
'是否确认删除物品借用申请编号为"'
+
_ids
+
'"的数据项?'
).
then
(
function
()
{
return
delApply
(
_ids
);
}).
then
(()
=>
{
getList
();
proxy
.
$modal
.
msgSuccess
(
"删除成功"
);
}).
catch
(()
=>
{});
}
/** 导出按钮操作 */
function
handleExport
()
{
proxy
.
download
(
'material/apply/export'
,
{
...
queryParams
.
value
},
`apply_
${
new
Date
().
getTime
()}
.xlsx`
)
}
/** 获取项目列表 */
function
getProjectList
(){
listProject
().
then
(
response
=>
{
project_list
.
value
=
response
.
rows
;
console
.
log
(
"project_list:"
,
project_list
.
value
)
})
}
/** 获取物品类型 */
function
getTypeList
()
{
listMaterialType
().
then
(
response
=>
{
material_type
.
value
=
response
.
data
;
});
}
/** 获取类型的物品列表 */
function
getTypeDetailList
(){
listMaterialTypeDetail
().
then
(
response
=>
{
all_material_type_detail
.
value
=
response
.
data
;
});
}
getList
();
// 在组件挂载时执行
onMounted
(()
=>
{
//获取项目列表
getProjectList
();
//获取物品类型
getTypeList
();
//获取物品信息
getTypeDetailList
();
});
</
script
>
<
style
scoped
lang=
"scss"
>
.title
{
width
:
72px
;
height
:
15px
;
font-family
:
PingFangSC-Medium
;
font-weight
:
900
;
font-size
:
18px
;
color
:
#0D162A
;
letter-spacing
:
0
;
line-height
:
15px
;
}
.bold-text
{
width
:
72px
;
height
:
15px
;
font-family
:
PingFangSC-Medium
;
font-weight
:
900
;
font-size
:
18px
;
color
:
#0D162A
;
letter-spacing
:
0
;
line-height
:
15px
;
}
// 表格的标头
:deep
(
.el-table
th
.el-table__cell
)
{
line-height
:
35px
;
//height: 56px;
background
:
#F6F8FC
!
important
;
}
/* 设置当member字段为空时的行背景色 */
:deep
.el-table
.error-row
{
--el-table-tr-bg-color
:
var
(
--
el-color-warning-light-9
);
}
.contentTable
{
position
:
relative
;
/* 父容器需要相对定位 */
min-height
:
400px
;
/* 最小高度防止内容过少时变形 */
padding-bottom
:
80px
;
/* 底部留出分页空间 */
}
.pagination
{
position
:
absolute
;
bottom
:
20px
;
/* 距离父容器底部20px */
left
:
60%
;
/* 水平居中关键步骤1 */
transform
:
translateX
(
-50%
);
/* 水平居中关键步骤2 */
margin-right
:
0
;
/* 移除旧代码中的右侧间距 */
z-index
:
1
;
/* 确保分页在表格上方 */
}
.el-alert
{
margin
:
23px
0
23px
;
}
</
style
>
src/views/materialapply/draftview.vue
0 → 100644
View file @
9dbb9738
<
template
>
<div
class=
"app-container"
>
<div
class=
"content"
style=
"position: relative"
>
<div
style=
"padding-left: 15px ;padding-top: 15px"
>
<span
class=
"bold-text"
style=
"border-bottom: 3px solid blue;"
>
借用草稿
</span>
</div>
<div
style=
"padding-top: 28px ;padding-left: 10px; "
>
<el-form
:model=
"form"
label-width=
"auto"
>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
项目名称:
</label>
</el-col>
<el-col
:span=
"2"
>
<span
class=
"label"
>
{{
project_list
.
find
(
item
=>
item
.
id
===
form
.
projectId
)?.
projectName
||
'未知类型'
}}
</span>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
申请人:
</label>
</el-col>
<el-col
:span=
"2"
>
<span
class=
"label"
>
{{
form
.
userName
}}
</span>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
申请时间:
</label>
</el-col>
<el-col
:span=
"5"
>
<span
class=
"label"
>
未开始
</span>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
审批状态:
</label>
</el-col>
<el-col
:span=
"2"
>
<template
v-for=
"(item, index) in material_status"
:key=
"index"
>
<span
class=
"label"
v-if=
"item.value === form.checkStatus"
>
无
</span>
</
template
>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
申请备注:
</label>
</el-col>
<el-col
:span=
"15"
>
<span
class=
"label"
>
{{ form.remark }}
</span>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"2"
>
<label
class=
"label-title"
>
申请物品:
</label>
</el-col>
<el-col
:span=
"20"
>
<div
v-for=
"(item, index) in form.items"
:key=
"index"
class=
"item-row"
style=
"display: flex; gap: 30px"
>
<span
style=
"flex: 1; min-width: 120px"
class=
"label"
>
物品类型:{{ material_type.find(m => m.id === item.type)?.typeName || '—' }}
</span>
<span
style=
"flex: 1; min-width: 120px"
class=
"label"
>
物品名称:{{ all_material_type_detail.find(d => d.id === item.material_detail)?.materialName || '—' }}
</span>
<span
style=
"flex: 1; min-width: 120px"
class=
"label"
>
申请数量:{{ item.quantity || 0 }}
</span>
</div>
</el-col>
</el-row>
</el-form>
<div
style=
"position: absolute;right: 52px;bottom: 42px"
>
<el-button
type=
"primary"
size=
"large"
class=
"btn-A"
@
click=
"reset"
>
返回
</el-button>
</div>
</div>
</div>
</div>
</template>
<
script
setup
>
import
{
getApply
}
from
"../../api/material/apply"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
import
{
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
const
{
proxy
}
=
getCurrentInstance
();
const
{
material_status
}
=
proxy
.
useDict
(
'material_status'
);
const
project_list
=
ref
([]);
const
all_material_type_detail
=
ref
([]);
const
material_type
=
ref
([]);
const
form
=
ref
({
id
:
null
,
projectId
:
null
,
userId
:
null
,
userName
:
null
,
checkStatus
:
null
,
remark
:
null
,
createBy
:
null
,
createTime
:
null
,
items
:
[{
type
:
null
,
material_detail
:
null
,
quantity
:
null
}],
})
// 格式化日期
/*function formatDate(date) {
if (!date) return '-';
const d = new Date(date);
return `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
}*/
// 返回
const
reset
=
()
=>
{
if
(
returnType
===
"1"
){
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialBorrowApproval'
})
}
else
if
(
returnType
===
"0"
)
{
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialApply'
})
}
else
if
(
returnType
===
"2"
)
{
proxy
.
$router
.
push
({
path
:
'/materials/apply/applydraft'
})
}
}
// 条页面来源
let
returnType
=
null
;
/** 根据ID查到的详细信息 */
const
getInfo
=
()
=>
{
returnType
=
proxy
.
$route
.
query
.
type
;
getApply
(
proxy
.
$route
.
query
.
id
).
then
(
response
=>
{
form
.
value
=
response
.
data
;
})
}
/** 获取项目列表 */
function
getProjectList
(){
listProject
().
then
(
response
=>
{
project_list
.
value
=
response
.
rows
;
console
.
log
(
"project_list:"
,
project_list
.
value
)
})
}
/** 获取物品类型 */
function
getTypeList
()
{
listMaterialType
().
then
(
response
=>
{
material_type
.
value
=
response
.
data
;
});
}
/** 获取类型的物品列表 */
function
getTypeDetailList
(){
listMaterialTypeDetail
().
then
(
response
=>
{
all_material_type_detail
.
value
=
response
.
data
;
});
}
onMounted
(()
=>
{
//根据id查询信息
getInfo
();
//获取项目列表
getProjectList
();
//获取物品类型
getTypeList
();
//获取物品信息
getTypeDetailList
();
})
</
script
>
<
style
scoped
lang=
"scss"
>
.bold-text
{
width
:
72px
;
height
:
15px
;
font-family
:
PingFangSC-Medium
;
font-weight
:
900
;
font-size
:
18px
;
color
:
#0D162A
;
letter-spacing
:
0
;
line-height
:
15px
;
}
.label-title
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
19px
;
color
:
#666666
;
letter-spacing
:
0
;
//text-align: right;
line-height
:
40px
;
}
.bordered
{
margin-left
:
110px
;
padding
:
20px
;
background
:
#FAFAFA
;
border
:
1px
solid
#C8CEDE
;
border-radius
:
2px
;
//min-height: 200px;
}
.label
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
19px
;
color
:
#4A4E54
;
letter-spacing
:
0
;
line-height
:
40px
;
}
.file-item
{
display
:
block
;
margin
:
9px
0
;
}
.file-item
.el-link
{
font-size
:
18px
;
}
.table-container
{
display
:
flex
;
justify-content
:
center
;
}
</
style
>
src/views/materialapply/edit.vue
0 → 100644
View file @
9dbb9738
<
template
>
<div
class=
"app-container"
>
<div
class=
"content"
>
<div
style=
"padding-left: 10px"
>
<span
class=
"bold-text"
style=
"border-bottom: 3px solid #0062FF;"
>
借用申请
</span>
</div>
<div
style=
"padding-top: 40px"
>
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"rules"
label-width=
"auto"
>
<el-row
:gutter=
"150"
>
<el-col
:span=
"10"
>
<el-form-item
label=
"项目组"
style=
"margin-bottom: 50px;"
prop=
"projectId"
>
<el-select
v-model=
"form.projectId"
placeholder=
"请选择项目组"
@
change=
"handleProjectChange"
>
<el-option
v-for=
"dict in project_list"
:key=
"dict.id"
:label=
"dict.projectName"
:value=
"dict.id"
style=
"width: 100%"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"申请人"
style=
"margin-bottom: 50px;"
prop=
"userId"
>
<el-select
v-model=
"form.userId"
placeholder=
"请选择申请人"
@
change=
"handleUserChange"
>
<el-option
v-for=
"dict in filteredUsers"
:key=
"dict.userId"
:label=
"dict.nickName"
:value=
"dict.userId"
style=
"width: 100%"
/>
</el-select>
</el-form-item>
<!-- 新增选择物品部分 -->
<el-form-item
label=
"申请物品"
prop=
"items"
>
<div
v-for=
"(item, index) in form.items"
:key=
"index"
class=
"item-row"
>
<el-row
style=
"width: 600px;"
>
<el-col
:span=
"6"
>
<el-select
v-model=
"item.type"
placeholder=
"选择物品类型"
@
change=
"handleTypeChange(index)"
>
<el-option
v-for=
"dict in material_type"
:key=
"dict.id"
:label=
"dict.typeName"
:value=
"dict.id"
/>
</el-select>
</el-col>
<el-col
:span=
"5"
>
<el-select
v-model=
"item.material_detail"
placeholder=
"选择物品"
@
change=
"handleMaterialChange(index)"
>
<el-option
v-for=
"dict in filteredDetails(item.type)"
:key=
"dict.id"
:label=
"dict.materialName"
:value=
"dict.id"
/>
</el-select>
</el-col>
<el-col
:span=
"5"
>
<el-form-item
:prop=
"`items.$
{index}.quantity`"
:rules="rules.quantity"
>
<el-input
type=
"number"
v-model
.
number=
"item.quantity"
placeholder=
"请输入数量"
:min=
"1"
:max=
"item.maxStock"
@
input=
"handleQuantityInput(index)"
/>
</el-form-item>
</el-col>
<el-col
:span=
"4"
>
<template
v-if=
"item.material_detail"
>
<el-input
:model-value=
"`库存为$
{item.stock}${item.unit}`"
placeholder="库存为0单位"
readonly
/>
</
template
>
<
template
v-else
>
<el-input
placeholder=
"剩余库存"
readonly
style=
"color: #999"
/>
</
template
>
</el-col>
<el-col
:span=
"1"
v-if=
"index > 0"
>
<el-link
type=
"danger"
@
click=
"removeItem(index)"
:underline=
"false"
class=
"delete-btn"
>
×
</el-link>
</el-col>
</el-row>
</div>
<el-link
type=
"primary"
@
click=
"addItem"
:underline=
"false"
class=
"add-btn"
>
+ 新增物品
</el-link>
</el-form-item>
<el-form-item
label=
"备注"
style=
"margin-bottom: 50px;"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"2"
size=
"large"
v-model=
"form.remark"
placeholder=
"请输入备注"
style=
"width: 100%; resize: both;"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item
style=
"padding-left: 80% ; padding-top: 20%"
>
<el-button
size=
"large"
@
click=
"reset"
class=
"btn-B"
>
返 回
</el-button>
<el-button
size=
"large"
type=
"primary"
@
click=
"handleSubmit"
class=
"btn-A"
>
提 交
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<
script
setup
name=
"materialAdd"
>
import
{
listUser
}
from
"../../api/system/user.js"
;
import
{
listMaterial
,
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
import
{
selectProjectUser
,
addApply
,
getApply
,
delApply
}
from
"../../api/material/apply.js"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
const
{
proxy
}
=
getCurrentInstance
();
const
project_list
=
ref
([]);
const
project_user
=
ref
([]);
const
material_stock
=
ref
([]);
const
userList
=
ref
([])
const
filteredUsers
=
ref
([]);
const
material_type
=
ref
([]);
const
all_material_type_detail
=
ref
([]);
const
formRef
=
ref
()
const
data
=
reactive
({
form
:
{
projectId
:
null
,
userId
:
null
,
userName
:
null
,
items
:
[{
type
:
null
,
material_detail
:
null
,
quantity
:
null
,
stock
:
0
,
unit
:
'单位'
,
maxStock
:
0
}],
remark
:
null
,
},
})
const
{
form
}
=
toRefs
(
data
);
// 新增方法
const
addItem
=
()
=>
{
form
.
value
.
items
.
push
({
type
:
null
,
material_detail
:
null
,
quantity
:
null
})
}
const
removeItem
=
(
index
)
=>
{
form
.
value
.
items
.
splice
(
index
,
1
)
}
const
rules
=
{
projectId
:
[
{
required
:
true
,
message
:
'项目组不能为空'
,
trigger
:
'blur'
}
],
materialName
:
[
{
required
:
true
,
message
:
'物品名称不能为空'
,
trigger
:
'blur'
}
],
items
:
[
{
required
:
true
,
message
:
'申请物品不能为空'
,
trigger
:
'blur'
}
],
quantity
:
[
{
validator
:
(
rule
,
value
,
callback
)
=>
{
const
currentItem
=
form
.
value
.
items
[
rule
.
field
.
split
(
'.'
)[
1
]];
const
stockItem
=
material_stock
.
value
.
find
(
item
=>
item
.
itemId
===
currentItem
.
material_detail
);
// 库存为0校验
if
(
stockItem
?.
stock
===
0
)
{
callback
(
new
Error
(
'库存为零,无法申请'
));
return
;
}
// 数量超限校验
if
(
value
>
(
stockItem
?.
stock
||
0
))
{
callback
(
new
Error
(
`库存不足,当前可用
${
stockItem
?.
stock
}
$
{
stockItem
?.
unit
}
`));
} else {
callback();
}
},
trigger: ['blur', 'change']
}
]
}
// 方法:根据类型ID过滤物品详情
const filteredDetails = (typeId) => {
if (!typeId) return [];
return all_material_type_detail.value.filter(item => item.typeId === typeId);
};
// 处理类型选择变化事件
const handleTypeChange = (index) => {
console.log("执行了2")
form.value.items[index].material_detail = null;
};
//给userName赋值
const handleUserChange = (userId) => {
const selectedUser = filteredUsers.value.find(user => user.userId === userId);
console.log("selectedUser:",selectedUser)
if (selectedUser) {
form.value.userName = selectedUser.nickName; // 赋值nickName
}
};
// 获取用户列表
const getUserList = () => {
listUser().then(response => {
console.log("response:",response)
userList.value = response.rows
})
console.log("userList:",userList)
}
// 数量输入处理
const handleQuantityInput = (index) => {
const item = form.value.items[index];
item.quantity = Math.max(1, Math.min(item.quantity, item.maxStock));
// 立即触发校验更新
proxy.$refs.formRef.validateField(`
items
.
$
{
index
}.
quantity
`);
};
// 提交表单
const handleSubmit = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
delApply(form.value.id);
form.value.draft = "0";
addApply(form.value).then(response=>{
if (response.code === 200){
proxy.$modal.msgSuccess("新增成功");
resetForm()
proxy.$router.push({ path: '/material/materialApply' })
}else {
proxy.$modal.msgError("请检查表单中的错误提示");
proxy.$modal.msgError(response.msg)
}
})
}
});
}
// 表单重置
function resetForm() {
form.value = {
projectId: null,
userId: null,
userName: null,
items: [{
type: null,
material_detail: null,
quantity: null,
stock: null,
unit: null,
maxStock: null
}],
remark: null,
draft : null
};
proxy.resetForm("materialRef");
}
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/materials/apply/applydraft' });
resetForm()
}
/** 获取物品类型 */
function getTypeList() {
listMaterialType().then(response => {
material_type.value = response.data;
});
}
/** 获取类型的物品列表 */
function getTypeDetailList(){
listMaterialTypeDetail().then(response => {
all_material_type_detail.value = response.data;
});
}
/** 选择物品后展示库存 */
const handleMaterialChange = (index) => {
const selectedId = form.value.items[index].material_detail;
const stockItem = material_stock.value.find(item => item.itemId === selectedId);
if (stockItem) {
form.value.items[index].stock = stockItem.stock;
form.value.items[index].unit = stockItem.unit;
form.value.items[index].maxStock = stockItem.stock;
} else {
form.value.items[index].stock = 0;
form.value.items[index].unit = '单位';
form.value.items[index].maxStock = 0;
}
form.value.items[index].quantity = 1;
};
/** 获取项目列表 */
function getProjectList(){
listProject().then(response =>{
project_list.value = response.rows;
console.log("project_list:",project_list.value)
})
}
/** 处理项目变化 */
const handleProjectChange = (selectedProjectId) => {
form.value.userId = null; // 清空已选用户
if (!selectedProjectId) {
filteredUsers.value = [];
return;
}
// 获取该项目关联的所有userId
const userIds = project_user.value
.filter(pu => pu.projectId === selectedProjectId)
.map(pu => pu.userId);
// 过滤出对应的用户
filteredUsers.value = userList.value.filter(user => userIds.includes(user.userId));
};
/** 获取用户与项目关系 */
function getProjectUser(){
selectProjectUser().then(response =>{
project_user.value = response.data;
console.log("selectProjectUser.response",response)
})
}
/** 获取物品库存 */
function getMaterialStock(){
listMaterial().then(response => {
material_stock.value = response.rows.map(item => ({
itemId: item.itemId,
stock: item.stock,
unit: item.unit
}));
console.log("material_stock.value:",material_stock.value)
return getDetail();
});
}
/** 获取回显信息 */
function getDetail(){
const id = proxy.$route.query.id;
getApply(id).then(response => {
const data = response.data;
// 确保每个物品都有 stock、unit、maxStock 等默认值(如有需要)
data.items = data.items.map(item => ({
...item,
stock: item.stock || 0,
unit: item.unit || '单位',
maxStock: item.stock || 0
}));
form.value = data;
})
}
// 在组件挂载时执行
onMounted(() => {
//获取项目列表
getProjectList();
//获取项目与成员多对多关系
getProjectUser();
//获取用户列表
getUserList();
//获取物品类型
getTypeList();
//获取物品信息
getTypeDetailList();
//获取物品库存
getMaterialStock();
});
</
script
>
<
style
scoped
lang=
"scss"
>
.item-row
{
margin-bottom
:
20px
;
}
.bold-text
{
width
:
72px
;
height
:
15px
;
font-family
:
PingFangSC-Medium
;
font-weight
:
900
;
font-size
:
18px
;
color
:
#0D162A
;
letter-spacing
:
0
;
line-height
:
15px
;
}
</
style
>
src/views/materialapply/index.vue
View file @
9dbb9738
...
@@ -78,22 +78,23 @@
...
@@ -78,22 +78,23 @@
@
click=
"handleAdd"
@
click=
"handleAdd"
v-hasPermi=
"['material:apply:add']"
v-hasPermi=
"['material:apply:add']"
>
借用申请
</el-button>
>
借用申请
</el-button>
<el-tooltip
content=
"
导出
"
placement=
"top"
>
<el-tooltip
content=
"
草稿箱
"
placement=
"top"
>
<el-button
<el-button
type=
"text"
type=
"text"
plain
plain
@
click=
"
handleExpor
t"
@
click=
"
draf
t"
v-hasPermi=
"['material:apply:
expor
t']"
v-hasPermi=
"['material:apply:
draf
t']"
><img
src=
"../../assets/icons/common/
daochu
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
rightone
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
<el-tooltip
content=
"草稿箱"
placement=
"top"
>
<el-tooltip
content=
"导出"
placement=
"top"
>
<el-button
<el-button
type=
"text"
type=
"text"
plain
plain
@
click=
"
draf
t"
@
click=
"
handleExpor
t"
v-hasPermi=
"['material:apply:
draf
t']"
v-hasPermi=
"['material:apply:
expor
t']"
><img
src=
"../../assets/icons/common/
rightone
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
export2
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
</span>
</span>
...
@@ -331,7 +332,9 @@ function handleAdd() {
...
@@ -331,7 +332,9 @@ function handleAdd() {
title.value = "添加物品借用申请";*/
title.value = "添加物品借用申请";*/
proxy
.
$router
.
push
({
path
:
'/materials/apply/applyadd'
}
);
proxy
.
$router
.
push
({
path
:
'/materials/apply/applyadd'
}
);
}
}
function
draft
()
{
proxy
.
$router
.
push
({
path
:
'/materials/apply/applydraft'
}
);
}
/** 修改按钮操作 */
/** 修改按钮操作 */
function
handleUpdate
(
row
)
{
function
handleUpdate
(
row
)
{
reset
();
reset
();
...
...
src/views/materialapply/materialBorrowApproval.vue
View file @
9dbb9738
...
@@ -213,7 +213,7 @@
...
@@ -213,7 +213,7 @@
<
/template
>
<
/template
>
<
script
setup
>
<
script
setup
>
import
{
listApply
}
from
"@/api/material/apply
"
;
import
{
listApply
,
approve
}
from
"../../api/material/apply.js
"
;
import
{
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
import
{
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
...
@@ -346,7 +346,8 @@ function handleApprove(row) {
...
@@ -346,7 +346,8 @@ function handleApprove(row) {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}
).
then
(()
=>
{
}
).
then
(()
=>
{
approve
(
row
.
id
).
then
(
response
=>
{
row
.
checkStatus
=
"1"
approve
(
row
).
then
(
response
=>
{
proxy
.
$message
({
proxy
.
$message
({
message
:
'通过成功'
,
message
:
'通过成功'
,
type
:
'success'
type
:
'success'
...
@@ -363,7 +364,8 @@ function handleReject(row) {
...
@@ -363,7 +364,8 @@ function handleReject(row) {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}
).
then
(()
=>
{
}
).
then
(()
=>
{
reject
(
row
.
id
).
then
(
response
=>
{
row
.
checkStatus
=
"2"
approve
(
row
).
then
(
response
=>
{
proxy
.
$message
({
proxy
.
$message
({
message
:
'驳回成功'
,
message
:
'驳回成功'
,
type
:
'success'
type
:
'success'
...
...
src/views/materialapply/view.vue
View file @
9dbb9738
...
@@ -114,7 +114,7 @@ const form = ref({
...
@@ -114,7 +114,7 @@ const form = ref({
return `${d.getFullYear()
}
/${String(d.getMonth() + 1).padStart(2, '0')
}
/${String(d.getDate()).padStart(2, '0')
}
`;
return `${d.getFullYear()
}
/${String(d.getMonth() + 1).padStart(2, '0')
}
/${String(d.getDate()).padStart(2, '0')
}
`;
}
*/
}
*/
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
if
(
returnType
===
"1"
){
if
(
returnType
===
"1"
){
// 返回项目
// 返回项目
...
...
src/views/materialentry/add.vue
View file @
9dbb9738
...
@@ -194,7 +194,7 @@ function resetForm() {
...
@@ -194,7 +194,7 @@ function resetForm() {
proxy
.
resetForm
(
"materialRef"
);
proxy
.
resetForm
(
"materialRef"
);
}
}
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialEntry'
})
proxy
.
$router
.
push
({
path
:
'/material/materialEntry'
})
...
...
src/views/materialentry/edit.vue
View file @
9dbb9738
...
@@ -202,7 +202,7 @@ function resetForm() {
...
@@ -202,7 +202,7 @@ function resetForm() {
proxy
.
resetForm
(
"materialRef"
);
proxy
.
resetForm
(
"materialRef"
);
}
}
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/materials/entry/entrydraft'
});
proxy
.
$router
.
push
({
path
:
'/materials/entry/entrydraft'
});
...
...
src/views/materialentry/index.vue
View file @
9dbb9738
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
plain
plain
@
click=
"handleExport"
@
click=
"handleExport"
v-hasPermi=
"['psa:entry:export']"
v-hasPermi=
"['psa:entry:export']"
><img
src=
"../../assets/icons/common/
print
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
export2
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
</span>
</span>
...
...
src/views/materialreturn/add.vue
View file @
9dbb9738
...
@@ -290,7 +290,7 @@ function resetForm() {
...
@@ -290,7 +290,7 @@ function resetForm() {
proxy
.
resetForm
(
"materialRef"
);
proxy
.
resetForm
(
"materialRef"
);
}
}
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialReturn'
})
proxy
.
$router
.
push
({
path
:
'/material/materialReturn'
})
...
...
src/views/materialreturn/index.vue
View file @
9dbb9738
...
@@ -58,22 +58,24 @@
...
@@ -58,22 +58,24 @@
@
click=
"handleAdd"
@
click=
"handleAdd"
v-hasPermi=
"['material:return:add']"
v-hasPermi=
"['material:return:add']"
>
归还申请
</el-button>
>
归还申请
</el-button>
<el-tooltip
content=
"导出"
placement=
"top"
>
<el-tooltip
content=
"草稿箱"
placement=
"top"
>
<el-button
<el-button
type=
"text"
type=
"text"
plain
plain
@
click=
"
handleExpor
t"
@
click=
"
draf
t"
v-hasPermi=
"['material:apply:
expor
t']"
v-hasPermi=
"['material:apply:
draf
t']"
><img
src=
"../../assets/icons/common/
daochu
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
rightone
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
<el-tooltip
content=
"草稿箱"
placement=
"top"
>
<el-tooltip
content=
"导出"
placement=
"top"
>
<el-button
<el-button
type=
"text"
type=
"text"
plain
plain
@
click=
"
draf
t"
@
click=
"
handleExpor
t"
v-hasPermi=
"['material:apply:
draf
t']"
v-hasPermi=
"['material:apply:
expor
t']"
><img
src=
"../../assets/icons/common/
rightone
.png"
height=
"38"
width=
"38"
/>
><img
src=
"../../assets/icons/common/
export2
.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-button>
</el-tooltip>
</el-tooltip>
</span>
</span>
...
...
src/views/materialreturn/returnApproval.vue
0 → 100644
View file @
9dbb9738
<
template
>
<div
class=
"app-container"
>
<div
class=
"formSearch"
>
<el-form
:model=
"queryParams"
ref=
"queryRef"
:inline=
"true"
v-show=
"showSearch"
label-width=
"80px"
>
<el-row
:gutter=
"25"
>
<el-col
:span=
"6"
>
<el-form-item
label=
"项目组"
prop=
"projectId"
>
<el-select
v-model=
"queryParams.projectId"
placeholder=
"请选择项目"
clearable
style=
"width: 220px"
>
<el-option
v-for=
"dict in project_list"
:key=
"dict.id"
:label=
"dict.projectName"
:value=
"dict.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-form-item
label=
"申请人"
prop=
"userName"
width=
"220px"
>
<el-input
v-model=
"queryParams.userName"
placeholder=
"请选择申请人"
clearable
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-form-item
label=
"状态"
prop=
"checkStatus"
>
<el-select
v-model=
"queryParams.checkStatus"
placeholder=
"请选择审核状态"
clearable
style=
"width: 220px;"
>
<el-option
v-for=
"dict in material_status"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-form-item
style=
"margin-left: 30px"
>
<el-button
@
click=
"resetQuery"
class=
"el-button-defalut"
>
<template
#
icon
>
<img
src=
"../../assets/icons/common/reset.png"
height=
"25"
width=
"24"
/>
</
template
>
重置
</el-button>
<el-button
type=
"primary"
@
click=
"handleQuery"
class=
"el-button-primary"
>
<
template
#
icon
>
<img
src=
"../../assets/icons/common/search.png"
height=
"24"
width=
"24"
/>
</
template
>
查询
</el-button>
<el-button
size=
"large"
icon=
"ArrowDown"
link
type=
"primary"
v-show=
"!isExpanded"
@
click=
"toggleSearch"
>
展开
</el-button>
<el-button
size=
"large"
type=
"primary"
link
icon=
"ArrowUp"
v-show=
"isExpanded"
@
click=
"toggleSearch"
>
收起
</el-button>
</el-form-item>
</el-col>
</el-row>
<!-- 可折叠的查询条件 -->
<transition>
<div
v-if=
"isExpanded"
>
<el-row
:gutter=
"25"
>
<el-col
:span=
"6"
>
<el-form-item
label=
"申请时间"
prop=
"createTime"
>
<el-date-picker
clearable
v-model=
"queryParams.createTime"
type=
"date"
value-format=
"YYYY-MM-DD"
placeholder=
"请选择申请时间"
style=
"width: 220px"
size=
"large"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</div>
</transition>
</el-form>
</div>
<div
class=
"contentTable"
>
<div
class=
"title"
>
<div
class=
"contentBt"
>
<span
class=
"bold-text"
>
借用审批
</span>
<div>
<el-tooltip
content=
"导出"
placement=
"top"
>
<el-button
type=
"primary"
link
plain
@
click=
"handleExport"
v-hasPermi=
"['material:apply:export']"
><img
src=
"../../assets/icons/common/export2.png"
height=
"38"
width=
"38"
/>
</el-button>
</el-tooltip>
</div>
</div>
</div>
<el-table
v-loading=
"loading"
:data=
"applyList"
border
style=
"width: 100%"
>
<el-table-column
label=
"项目组"
align=
"center"
prop=
"projectId"
>
<
template
v-slot:default=
"scope"
>
<span>
{{
project_list
.
find
(
item
=>
item
.
id
===
scope
.
row
.
projectId
)?.
projectName
||
'未知类型'
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"申请人"
align=
"center"
prop=
"userName"
/>
<el-table-column
label=
"申请时间"
align=
"center"
prop=
"createTime"
>
<
template
#
default=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
,
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"申请物品"
align
=
"center"
prop
=
"items"
>
<
template
#
default
=
"scope"
>
<
el
-
popover
placement
=
"right"
:
width
=
"400"
trigger
=
"click"
>
<
template
#
reference
>
<
el
-
button
type
=
"primary"
link
>
物品明细
<
/el-button
>
<
/template
>
<
el
-
table
:
data
=
"scope.row.items"
border
style
=
"width: 100%"
>
<!--
项目回款笔数
-->
<
el
-
table
-
column
label
=
"物品类型"
align
=
"center"
>
<
template
#
default
=
"scope"
>
{{
typeMap
[
scope
.
row
.
type
]
||
'-'
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"物品名称"
align
=
"center"
prop
=
"repaymentPercentage"
>
<
template
#
default
=
"scope"
>
{{
materialDetailMap
[
scope
.
row
.
material_detail
]
||
'-'
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"物品数量"
align
=
"center"
prop
=
"repaymentCondition"
show
-
overflow
-
tooltip
>
<
template
#
default
=
"scope"
>
{{
scope
.
row
.
quantity
||
'-'
}}
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
/el-popover
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"审批状态"
align
=
"center"
prop
=
"checkStatus"
>
<
template
#
default
=
"scope"
>
<
dict
-
tag
:
options
=
"material_status"
:
value
=
"scope.row.checkStatus"
/>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"申请备注"
align
=
"center"
prop
=
"remark"
>
<
template
#
default
=
"scope"
>
<
el
-
popover
placement
=
"right"
:
width
=
"400"
trigger
=
"click"
>
<
template
#
reference
>
<
el
-
button
type
=
"primary"
link
>
查看详情
<
/el-button
>
<
/template
>
<
div
style
=
"padding: 10px;"
>
<
el
-
input
type
=
"textarea"
:
rows
=
"5"
v
-
model
=
"scope.row.remark"
readonly
style
=
"width: 100%;"
>
<
/el-input
>
<
/div
>
<
/el-popover
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"详情"
align
=
"center"
width
=
"80"
>
<
template
#
default
=
"scope"
>
<
el
-
tooltip
content
=
"详情"
placement
=
"top"
>
<
el
-
button
link
@
click
=
"handleView(scope.row)"
>
<
img
src
=
"../../assets/icons/common/check.png"
height
=
"32"
width
=
"32"
/>
<
/el-button
>
<
/el-tooltip
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
fixed
=
"right"
width
=
"130"
>
<
template
#
default
=
"scope"
>
<
el
-
button
type
=
"primary"
link
@
click
=
"handleApprove(scope.row)"
>
通过
<
/el-button
>
<
el
-
button
type
=
"danger"
link
@
click
=
"handleReject(scope.row)"
>
驳回
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
div
class
=
"pagination"
>
<
pagination
layout
=
"prev, pager, next, sizes, jumper"
v
-
show
=
"total > 0"
:
total
=
"total"
v
-
model
:
page
=
"queryParams.pageNum"
v
-
model
:
limit
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<
/div
>
<
/div
>
<
/div
>
<
/template
>
<
script
setup
>
import
{
listReturn
,
approve
}
from
"../../api/material/return.js"
;
import
{
listMaterialType
,
listMaterialTypeDetail
}
from
"../../api/material/material.js"
;
import
{
listProject
}
from
"../../api/project/project.js"
;
const
queryRef
=
ref
(
null
);
const
{
proxy
}
=
getCurrentInstance
();
const
{
material_status
}
=
proxy
.
useDict
(
'material_status'
);
const
applyList
=
ref
([]);
const
material_type
=
ref
([]);
const
all_material_type_detail
=
ref
([]);
const
project_list
=
ref
([]);
const
open
=
ref
(
false
);
const
loading
=
ref
(
true
);
const
showSearch
=
ref
(
true
);
const
ids
=
ref
([]);
const
single
=
ref
(
true
);
const
multiple
=
ref
(
true
);
const
total
=
ref
(
0
);
const
title
=
ref
(
""
);
const
isExpanded
=
ref
(
false
);
const
data
=
reactive
({
form
:
{
id
:
null
,
projectId
:
null
,
userId
:
null
,
userName
:
null
,
checkStatus
:
null
,
remark
:
null
,
createBy
:
null
,
createTime
:
null
,
items
:
[{
type
:
null
,
material_detail
:
null
,
quantity
:
null
}
],
}
,
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
projectId
:
null
,
userName
:
null
,
checkStatus
:
null
,
createTime
:
null
,
}
,
rules
:
{
}
}
);
const
{
queryParams
,
form
,
rules
}
=
toRefs
(
data
);
/** 切换展开/折叠 */
const
toggleSearch
=
()
=>
{
isExpanded
.
value
=
!
isExpanded
.
value
;
}
/** 查询物品借用申请列表 */
function
getList
()
{
loading
.
value
=
true
;
listReturn
(
queryParams
.
value
).
then
(
response
=>
{
applyList
.
value
=
response
.
rows
;
total
.
value
=
response
.
total
;
loading
.
value
=
false
;
}
);
}
// 添加计算属性
const
typeMap
=
computed
(()
=>
{
const
map
=
{
}
;
material_type
.
value
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
item
.
typeName
;
}
);
return
map
;
}
);
const
materialDetailMap
=
computed
(()
=>
{
const
map
=
{
}
;
all_material_type_detail
.
value
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
item
.
materialName
;
}
);
return
map
;
}
);
/** 搜索按钮操作 */
function
handleQuery
()
{
queryParams
.
value
.
pageNum
=
1
;
getList
();
}
/** 重置按钮操作 */
function
resetQuery
()
{
proxy
.
resetForm
(
"queryRef"
);
handleQuery
();
}
/** 查看详情操作 */
function
handleView
(
row
)
{
proxy
.
$router
.
push
({
path
:
'/materials/apply/applyview'
,
query
:
{
id
:
row
.
id
,
type
:
"1"
}}
);
}
/** 导出按钮操作 */
function
handleExport
()
{
proxy
.
download
(
'material/apply/export'
,
{
...
queryParams
.
value
}
,
`apply_${new Date().getTime()
}
.xlsx`
)
}
/** 获取项目列表 */
function
getProjectList
()
{
listProject
().
then
(
response
=>
{
project_list
.
value
=
response
.
rows
;
}
)
}
/** 获取物品类型 */
function
getTypeList
()
{
listMaterialType
().
then
(
response
=>
{
material_type
.
value
=
response
.
data
;
}
);
}
/** 获取类型的物品列表 */
function
getTypeDetailList
()
{
listMaterialTypeDetail
().
then
(
response
=>
{
all_material_type_detail
.
value
=
response
.
data
;
}
);
}
// 审批通过
function
handleApprove
(
row
)
{
proxy
.
$confirm
(
'确认通过该申请吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}
).
then
(()
=>
{
row
.
checkStatus
=
"1"
approve
(
row
).
then
(
response
=>
{
proxy
.
$message
({
message
:
'通过成功'
,
type
:
'success'
}
);
getList
();
}
);
}
);
}
// 审批驳回
function
handleReject
(
row
)
{
proxy
.
$confirm
(
'确认驳回该申请吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}
).
then
(()
=>
{
row
.
checkStatus
=
"2"
approve
(
row
).
then
(
response
=>
{
proxy
.
$message
({
message
:
'驳回成功'
,
type
:
'success'
}
);
getList
();
}
);
}
);
}
getList
();
//获取项目列表
getProjectList
();
//获取物品类型
getTypeList
();
//获取物品信息
getTypeDetailList
();
<
/script
>
<
style
scoped
lang
=
"scss"
>
.
bold
-
text
{
font
-
family
:
PingFangSC
-
Medium
;
font
-
weight
:
900
;
font
-
size
:
19
px
;
color
:
#
0
D162A
;
border
-
bottom
:
4
px
solid
#
0062
FF
;
}
.
title
{
padding
-
left
:
8
px
;
margin
-
bottom
:
25
px
;
position
:
relative
;
}
.
contentBt
{
display
:
flex
;
align
-
items
:
center
;
justify
-
content
:
space
-
between
;
}
// 表格的标头
:
deep
(.
el
-
table
th
.
el
-
table__cell
)
{
line
-
height
:
35
px
;
//height: 56px;
background
:
#
F6F8FC
!
important
;
}
/* 设置当member字段为空时的行背景色 */
:
deep
.
el
-
table
.
error
-
row
{
--
el
-
table
-
tr
-
bg
-
color
:
var
(
--
el
-
color
-
warning
-
light
-
9
);
}
.
contentTable
{
position
:
relative
;
/* 父容器需要相对定位 */
min
-
height
:
400
px
;
/* 最小高度防止内容过少时变形 */
padding
-
bottom
:
80
px
;
/* 底部留出分页空间 */
}
.
pagination
{
position
:
absolute
;
bottom
:
20
px
;
/* 距离父容器底部20px */
left
:
60
%
;
/* 水平居中关键步骤1 */
transform
:
translateX
(
-
50
%
);
/* 水平居中关键步骤2 */
margin
-
right
:
0
;
/* 移除旧代码中的右侧间距 */
z
-
index
:
1
;
/* 确保分页在表格上方 */
}
<
/style
>
src/views/materialreturn/view.vue
View file @
9dbb9738
...
@@ -114,7 +114,7 @@ const form = ref({
...
@@ -114,7 +114,7 @@ const form = ref({
return `${d.getFullYear()
}
/${String(d.getMonth() + 1).padStart(2, '0')
}
/${String(d.getDate()).padStart(2, '0')
}
`;
return `${d.getFullYear()
}
/${String(d.getMonth() + 1).padStart(2, '0')
}
/${String(d.getDate()).padStart(2, '0')
}
`;
}
*/
}
*/
// 返回
项目管理页面
// 返回
const
reset
=
()
=>
{
const
reset
=
()
=>
{
// 返回项目
// 返回项目
proxy
.
$router
.
push
({
path
:
'/material/materialReturn'
}
)
proxy
.
$router
.
push
({
path
:
'/material/materialReturn'
}
)
...
...
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