Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jilinzhongdianrenqun-web
概览
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
吴超
jilinzhongdianrenqun-web
Commits
a0e2485f
Commit
a0e2485f
authored
Dec 30, 2025
by
zhangtw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
申领表单校验,审批人选择调整
parent
99f5450d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
223 行增加
和
23 行删除
+223
-23
src/api/key-dm-inbound.js
+9
-0
src/view/key-person/key_dm_inventory/inbound.vue
+116
-4
src/view/key-person/key_dm_inventory/index.vue
+98
-19
没有找到文件。
src/api/key-dm-inbound.js
View file @
a0e2485f
...
...
@@ -80,3 +80,12 @@ export const getPendingReturnById = (param) => {
data
:
param
})
}
// 导入物料(Excel)
export
const
importInbound
=
(
formData
)
=>
{
return
axios
.
request
({
url
:
'/api/ac/jilinsscgsdp/keyDmInbound/importInbound'
,
method
:
'post'
,
data
:
formData
})
}
src/view/key-person/key_dm_inventory/inbound.vue
View file @
a0e2485f
...
...
@@ -65,6 +65,7 @@
<Button
type=
"primary"
class=
"mr10"
@
click=
"handleSearch('inbound')"
>
搜索
</Button>
<Button
type=
"primary"
class=
"mr10"
@
click=
"handleReset('inbound')"
>
重置
</Button>
<Button
type=
"primary"
class=
"mr10"
@
click=
"openInboundModal"
>
新增入库
</Button>
<Button
type=
"primary"
class=
"mr10"
v-if=
"showImport()"
@
click=
"importShow = true"
>
导入
</Button>
</Col>
</Row>
</div>
...
...
@@ -149,7 +150,7 @@
<!-- 入库弹窗 -->
<Modal
v-model=
"inboundModal.visible"
:title=
"inboundModal.isEdit ? '修改入库' : '新增入库'"
width=
"800"
>
<Form
:model=
"inboundModal.form"
:label-width=
"120"
ref=
"inboundForm"
>
<Form
:model=
"inboundModal.form"
:
rules=
"inboundRules"
:
label-width=
"120"
ref=
"inboundForm"
>
<FormItem
label=
"入库单号"
>
<Input
v-model=
"inboundModal.form.inbound_no"
/>
</FormItem>
...
...
@@ -209,11 +210,37 @@
<Row
:gutter=
"16"
><Col
span=
"12"
><p><strong>
单号:
</strong>
{{ detailModal.data.inbound_no || detailModal.data.application_no }}
</p></Col></Row>
<Row
class=
"mt8"
><Col
span=
"24"
><h4>
明细
</h4></Col></Row>
<Table
:data=
"detailModal.details"
:columns=
"detailDetailColumns"
size=
"small"
border
/>
<Row
class=
"mt8"
><Col
span=
"24"
><h4>
操作日志
</h4></Col></Row>
<Table
:data=
"detailModal.logs"
:columns=
"detailLogsColumns"
size=
"small"
border
/>
<
!-- <
Row class="mt8"><Col span="24"><h4>操作日志</h4></Col></Row>
<Table :data="detailModal.logs" :columns="detailLogsColumns" size="small" border />
-->
</div>
<div
slot=
"footer"
><Button
type=
"primary"
@
click=
"detailModal.visible=false"
>
关闭
</Button></div>
</Modal>
<!-- 导入物料弹窗 -->
<Modal
v-model=
"importShow"
title=
"入库导入"
width=
"360"
>
<Row
type=
"flex"
justify=
"center"
align=
"middle"
>
<Col
span=
"10"
>
<div
style=
"text-align: center;"
>
<Upload
action=
"#"
:show-upload-list=
"false"
:before-upload=
"handleBeforeUpload"
:format=
"['xls','xlsx']"
accept=
".xls,.xlsx"
:max-size=
"4096"
>
<Button
icon=
"ios-cloud-upload-outline"
type=
"primary"
:loading=
"impBtnDisabled"
>
导入
</Button>
</Upload>
</div>
</Col>
<Col
span=
"12"
>
<div
style=
"text-align: center;"
>
<Button
type=
"primary"
@
click=
"tplDownload"
style=
"margin-right: 10px;"
>
下载模板
</Button>
</div>
</Col>
</Row>
<div
slot=
"footer"
>
<Button
size=
"large"
type=
"text"
@
click=
"importShow = false"
>
关闭
</Button>
</div>
</Modal>
</div>
</template>
...
...
@@ -227,7 +254,8 @@ import {
processReturn
,
getInventoryList
,
getInboundById
,
getPendingReturnById
getPendingReturnById
,
importInbound
}
from
'@/api/key-dm-inbound'
import
MaterialSelector
from
'@/view/key-person/key_dm_conf/materialSelector.vue'
import
{
normalizeVisitTimeValue
}
from
'@/view/key-person/key_dm_conf/dates.js'
...
...
@@ -237,6 +265,8 @@ export default {
components
:
{
MaterialSelector
},
data
()
{
return
{
importShow
:
false
,
impBtnDisabled
:
false
,
// 时间范围数组
inboundDateRange
:
null
,
// 入库状态映射字典
...
...
@@ -459,6 +489,88 @@ export default {
watch
:
{},
created
()
{
this
.
fetchList
(
'inbound'
)
},
methods
:
{
showImport
()
{
// 简单权限控制:可根据需要替换
const
info
=
this
.
$store
.
state
.
user
.
otherUserInfo
||
{}
const
areaId
=
info
.
area_id
||
''
if
(
areaId
&&
areaId
.
startsWith
(
'2201'
))
return
true
return
false
},
async
tplDownload
()
{
// 下载入库导入模板
try
{
const
response
=
await
axios
.
post
(
'/api/ac/jilinsscgsdp/keyDmInbound/templateDownload'
,
{},
{
responseType
:
'blob'
}
)
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
response
.
data
]))
// 创建隐藏的a标签并设置属性
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
url
link
.
download
=
'入库导入模板.xlsx'
// 自定义下载文件名和扩展名
link
.
style
.
display
=
'none'
document
.
body
.
appendChild
(
link
)
// 触发点击下载
link
.
click
()
// 清理
document
.
body
.
removeChild
(
link
)
window
.
URL
.
revokeObjectURL
(
url
)
}
catch
(
error
)
{
console
.
error
(
'下载失败:'
,
error
)
// 可以在这里添加错误提示
}
},
handleBeforeUpload
(
file
)
{
const
fileExt
=
file
.
name
.
split
(
'.'
).
pop
().
toLocaleLowerCase
()
if
(
fileExt
===
'xlsx'
||
fileExt
===
'xls'
)
{
this
.
readFile
(
file
)
}
else
{
this
.
$Notice
.
warning
({
title
:
'文件类型错误'
,
desc
:
'文件:'
+
file
.
name
+
'不是EXCEL文件,请选择后缀为.xlsx或者.xls的EXCEL文件。'
})
}
return
false
},
async
readFile
(
file
)
{
this
.
impBtnDisabled
=
true
const
formdata
=
new
FormData
()
formdata
.
append
(
'file'
,
file
)
formdata
.
append
(
'fileName'
,
file
.
name
)
const
ret
=
await
importInbound
(
formdata
)
if
(
ret
&&
ret
.
data
)
{
this
.
importShow
=
false
this
.
impBtnDisabled
=
false
const
mobj
=
ret
.
data
.
data
||
{}
let
msg
=
'添加'
+
(
mobj
.
insert
||
0
)
+
'条, 更新'
+
(
mobj
.
update
||
0
)
+
'条'
if
(
mobj
.
error
)
{
msg
+=
', 缺少关键信息未能导入'
+
mobj
.
error
+
'条'
}
if
(
mobj
.
errInfo
&&
mobj
.
errInfo
!==
''
)
{
msg
+=
', 以下记录导入失败:'
+
mobj
.
errInfo
}
if
(
ret
.
data
.
errmsg
&&
ret
.
data
.
errmsg
!==
'success'
)
{
msg
+=
ret
.
data
.
errmsg
}
if
((
mobj
.
insert
||
0
)
+
(
mobj
.
update
||
0
)
>
0
)
{
this
.
fetchList
(
'inbound'
)
}
this
.
$Notice
.
success
({
title
:
'导入完成!'
,
desc
:
msg
})
}
else
{
this
.
impBtnDisabled
=
false
this
.
$Notice
.
warning
({
title
:
'未导入数据!'
,
desc
:
ret
&&
ret
.
data
&&
ret
.
data
.
errmsg
})
}
},
// 获取当天日期,格式为 yyyy-MM-dd
getTodayDate
()
{
const
today
=
new
Date
()
...
...
src/view/key-person/key_dm_inventory/index.vue
View file @
a0e2485f
...
...
@@ -66,7 +66,9 @@
<template
slot=
"action"
slot-scope=
"
{ row }">
<Button
size=
"small"
@
click=
"openDetail(row)"
class=
"mr5"
>
详细
</Button>
<Button
size=
"small"
type=
"primary"
class=
"mr5"
@
click=
"openEdit(row)"
v-if=
"canEdit(row)"
>
修改
</Button>
<Button
size=
"small"
type=
"success"
class=
"mr5"
@
click=
"submit(row)"
v-if=
"canSubmit(row)"
>
提交
</Button>
<Poptip
confirm
title=
"提交后将进入审批流程"
transfer
@
on-ok=
"submit(row)"
v-if=
"canSubmit(row)"
class=
"mr5"
>
<Button
size=
"small"
type=
"success"
>
提交
</Button>
</Poptip>
<Poptip
confirm
title=
"确认撤回?"
transfer
@
on-ok=
"revoke(row)"
v-if=
"canRevoke(row)"
class=
"mr5"
>
<Button
size=
"small"
type=
"warning"
>
撤回
</Button>
</Poptip>
...
...
@@ -157,16 +159,32 @@
<!-- 申请弹窗 -->
<Modal
v-model=
"applyModal.visible"
:title=
"applyModal.isEdit ? '修改领用申请' : '新增领用申请'"
width=
"800"
>
<Form
:model=
"applyModal.form"
:label-width=
"120"
ref=
"applyForm"
>
<FormItem
label=
"申请人"
>
<Form
:model=
"applyModal.form"
:
rules=
"applyRules"
:
label-width=
"120"
ref=
"applyForm"
>
<
!-- <
FormItem label="申请人">
<Input v-model="applyModal.form.applicant_name" disabled />
</FormItem>
<FormItem label="部门">
<Input v-model="applyModal.form.department_name" disabled />
</FormItem>
<FormItem
label=
"领用用途"
>
</FormItem>
-->
<FormItem
label=
"领用用途"
prop=
"borrow_purpose"
>
<Input
v-model=
"applyModal.form.borrow_purpose"
/>
</FormItem>
<FormItem
label=
"审批人:"
prop=
"approver_id"
>
<Select
v-model=
"applyModal.form.approver_id"
placeholder=
"请选择审批人"
class=
"form-input"
filterable
>
<Option
v-for=
"item in approverModal.approverList"
:key=
"item.id"
:value=
"item.id"
>
{{ item.name }} {{ item.leader === 1 ? '-leader' : '' }}
</Option>
</Select>
</FormItem>
<FormItem
label=
"预计归还日期"
>
<DatePicker
v-model=
"applyModal.form.expected_return_date"
...
...
@@ -226,7 +244,7 @@
</div>
<div
slot=
"footer"
><Button
type=
"primary"
@
click=
"detailModal.visible=false"
>
关闭
</Button></div>
</Modal>
<Modal
v-model=
"approverModal.visible"
title=
"选择审批人"
width=
"500"
>
<
!-- <
Modal v-model="approverModal.visible" title="选择审批人" width="500">
<Form :model="approverModal.form" :label-width="80">
<FormItem label="审批人:" required>
<Select
...
...
@@ -256,7 +274,7 @@
确认提交
</Button>
</div>
</Modal>
</Modal>
-->
</div>
</template>
...
...
@@ -281,6 +299,15 @@ export default {
components
:
{
MaterialSelector
},
data
()
{
return
{
// 表单验证规则
applyRules
:
{
borrow_purpose
:
[
{
required
:
true
,
message
:
'请填写申领用途'
,
trigger
:
'blur'
}
],
approver_id
:
[
{
required
:
true
,
message
:
'请选择审批人'
,
trigger
:
'change'
}
]
},
approverModal
:
{
visible
:
false
,
submitting
:
false
,
...
...
@@ -659,10 +686,28 @@ export default {
openApplyModal
()
{
this
.
applyModal
.
isEdit
=
false
this
.
applyModal
.
form
=
{
applicant_id
:
''
,
applicant_name
:
''
,
department_id
:
''
,
department_name
:
''
,
borrow_purpose
:
''
,
expected_return_date
:
this
.
getTodayDate
(),
approval_status
:
0
}
this
.
applyModal
.
form
=
{
applicant_id
:
''
,
applicant_name
:
''
,
department_id
:
''
,
department_name
:
''
,
borrow_purpose
:
''
,
expected_return_date
:
''
,
approval_status
:
0
,
approver_id
:
''
// 确保包含审批人字段
}
// 如果有默认审批人,可以设置
if
(
this
.
approverModal
.
approverList
.
length
>
0
)
{
const
leaderItem
=
this
.
approverModal
.
approverList
.
find
(
item
=>
item
.
leader
===
1
)
this
.
applyModal
.
form
.
approver_id
=
leaderItem
?
leaderItem
.
id
:
this
.
approverModal
.
approverList
[
0
].
id
}
this
.
applyModal
.
details
=
[]
this
.
applyModal
.
visible
=
true
this
.
exitEditMode
()
// 重置验证状态(如果有的话)
if
(
this
.
$refs
.
applyForm
)
{
this
.
$refs
.
applyForm
.
resetFields
()
}
},
openEdit
(
row
)
{
console
.
log
(
row
)
...
...
@@ -672,9 +717,13 @@ export default {
if
(
this
.
applyModal
.
form
.
expected_return_date
)
{
this
.
applyModal
.
form
.
expected_return_date
=
this
.
formatDate
(
this
.
applyModal
.
form
.
expected_return_date
)
}
else
{
// 空值兜底
this
.
applyModal
.
form
.
expected_return_date
=
this
.
getTodayDate
()
}
// 如果表单中没有 approver_id,设置默认值
if
(
!
this
.
applyModal
.
form
.
approver_id
&&
this
.
approverModal
.
approverList
.
length
>
0
)
{
const
leaderItem
=
this
.
approverModal
.
approverList
.
find
(
item
=>
item
.
leader
===
1
)
this
.
applyModal
.
form
.
approver_id
=
leaderItem
?
leaderItem
.
id
:
this
.
approverModal
.
approverList
[
0
].
id
}
// load details from backend when open (simplified)
getBorrowById
({
id
:
row
.
id
}).
then
(
ret
=>
{
if
(
ret
.
data
&&
ret
.
data
.
errcode
===
0
)
{
...
...
@@ -721,12 +770,45 @@ export default {
this
.
applySelectedDetails
=
[]
},
saveApplication
()
{
// 先退出编辑模式
this
.
exitEditMode
()
this
.
applyModal
.
saving
=
true
const
payload
=
Object
.
assign
({},
this
.
applyModal
.
form
,
{
details
:
this
.
applyModal
.
details
})
saveBorrowApplication
(
payload
).
then
(
ret
=>
{
if
(
ret
.
data
&&
ret
.
data
.
errcode
===
0
)
{
this
.
$Message
.
success
(
'保存成功'
);
this
.
applyModal
.
visible
=
false
;
this
.
fetchList
(
'apply'
)
}
else
this
.
$Notice
.
error
({
title
:
'保存失败'
,
desc
:
ret
.
data
&&
ret
.
data
.
errmsg
})
}).
finally
(()
=>
{
this
.
applyModal
.
saving
=
false
})
// 表单验证
this
.
$refs
.
applyForm
.
validate
((
valid
)
=>
{
if
(
!
valid
)
{
this
.
$Message
.
error
(
'请填写完整表单信息'
)
return
}
// 验证明细
if
(
this
.
applyModal
.
details
===
null
||
this
.
applyModal
.
details
.
length
<
1
)
{
this
.
$Message
.
error
(
'请至少申领一条用品'
)
return
}
// 验证申请数量
const
invalidDetails
=
this
.
applyModal
.
details
.
filter
(
d
=>
!
d
.
apply_quantity
||
d
.
apply_quantity
<=
0
)
if
(
invalidDetails
.
length
>
0
)
{
this
.
$Message
.
error
(
'请填写正确的申请数量'
)
return
}
this
.
applyModal
.
saving
=
true
const
payload
=
Object
.
assign
({},
this
.
applyModal
.
form
,
{
details
:
this
.
applyModal
.
details
,
// 确保提交时带上审批人ID
approver_id
:
this
.
approverModal
.
form
.
approver_id
})
saveBorrowApplication
(
payload
).
then
(
ret
=>
{
if
(
ret
.
data
&&
ret
.
data
.
errcode
===
0
)
{
this
.
$Message
.
success
(
'保存成功'
)
this
.
applyModal
.
visible
=
false
this
.
fetchList
(
'apply'
)
}
else
{
this
.
$Notice
.
error
({
title
:
'保存失败'
,
desc
:
ret
.
data
&&
ret
.
data
.
errmsg
})
}
}).
finally
(()
=>
{
this
.
applyModal
.
saving
=
false
})
})
},
canEdit
(
row
)
{
const
userId
=
this
.
$store
.
state
.
user
.
userId
...
...
@@ -748,15 +830,12 @@ export default {
// 获取审批人列表
this
.
fetchApproverList
()
// 打开审批人选择弹窗
this
.
approverModal
.
visible
=
true
// this.approverModal.visible = true
this
.
confirmSubmitWithApprover
()
},
// 新增:确认选择审批人后提交
confirmSubmitWithApprover
()
{
const
approverId
=
this
.
approverModal
.
form
.
approver_id
if
(
!
approverId
)
{
this
.
$Message
.
warning
(
'请选择审批人'
)
return
}
this
.
approverModal
.
submitting
=
true
// 调用提交接口,携带审批人ID(需后端接口支持)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论