Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web
Project
Project
Details
Activity
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
INET-TWO
web
Commits
42557b4e
Commit
42557b4e
authored
Nov 06, 2024
by
jingnan
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卷内序号行内编辑组件定义
parent
7338badf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
0 deletions
+116
-0
index.vue
...c/privateComponents/components/EditVolumeNumber/index.vue
+116
-0
No files found.
applications/dee-doc/src/privateComponents/components/EditVolumeNumber/index.vue
0 → 100644
View file @
42557b4e
/**
* @Description: 卷内序号行内编辑
* @author gjn
* @date 2024-11-05
*/
<
template
>
<div
class=
"EditVolumeNumber"
>
<el-input
v-model=
"volumeNumber"
size=
"small"
@
change=
"handleChange"
/>
</div>
</
template
>
<
script
>
import
{
post
}
from
'@/utils/http'
export
default
{
componentName
:
'卷内序号行内编辑'
,
name
:
'EditVolumeNumber'
,
components
:
{},
props
:
{
scope
:
{
type
:
Object
,
default
:
()
=>
{}
},
form
:
{
type
:
Object
,
default
:
()
=>
{}
},
value
:
{
type
:
[
String
,
Number
],
default
:
0
}
},
data
()
{
return
{
volumeNumber
:
''
}
},
computed
:
{},
watch
:
{
'form.volumeNumber'
:
{
immediate
:
true
,
handler
(
val
)
{
this
.
volumeNumber
=
val
}
}
},
created
()
{
},
methods
:
{
handleChange
()
{
if
(
!
this
.
form
.
belongingCaseFile
)
return
this
.
$utils
.
showMessageWarning
(
'请先编辑所属案件信息!'
)
this
.
$emit
(
'input'
,
this
.
volumeNumber
)
this
.
$set
(
this
.
form
,
'archiveNumber'
,
this
.
generateArchiveNumber
(
this
.
form
.
belongingCaseFile
,
this
.
volumeNumber
))
},
generateArchiveNumber
(
caseNumber
,
sequenceNumber
)
{
// 检查序号是否包含'-'且'-'后可能跟随括号或其他内容
const
hasDash
=
sequenceNumber
.
includes
(
'-'
)
const
hasBrackets
=
sequenceNumber
.
includes
(
'-('
)
let
numberPart
=
''
let
suffix
=
''
if
(
hasDash
)
{
// 如果包含'-',并且可能是'-('的形式,则特殊处理括号
if
(
hasBrackets
)
{
const
match
=
sequenceNumber
.
match
(
/^
(\d
+
)
-
\(
.*
\)
$/
)
if
(
match
)
{
numberPart
=
match
[
1
]
// 获取'-'前的数字部分
suffix
=
'-'
+
sequenceNumber
.
substring
(
numberPart
.
length
+
1
)
// 获取'-'及其后的内容,包括括号
}
else
{
const
parts
=
sequenceNumber
.
split
(
'-'
)
numberPart
=
parts
[
0
]
suffix
=
'-'
+
parts
.
slice
(
1
).
join
(
'-'
)
}
}
else
{
const
parts
=
sequenceNumber
.
split
(
'-'
)
numberPart
=
parts
[
0
]
suffix
=
'-'
+
parts
.
slice
(
1
).
join
(
'-'
)
}
}
else
{
numberPart
=
sequenceNumber
}
// 将数字部分补成3位
const
paddedNumberPart
=
numberPart
.
toString
().
padStart
(
3
,
'0'
)
// 拼接档号
const
archiveNumber
=
`
${
caseNumber
}${
paddedNumberPart
}${
suffix
}
`
return
archiveNumber
},
// 示例用法同上
changeAmount
(
val
)
{
const
params
=
{
...
this
.
form
,
volumeNumber
:
this
.
volumeNumber
,
operator
:
'MODIFY'
}
post
(
`InStorageRequestItem/inStorageRequestItem/update`
,
params
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'数量编辑成功!'
})
if
(
res
.
items
&&
res
.
items
.
inventoryJobResponses
)
{
const
allocatedAmount
=
this
.
$utils
.
sumArray
(
res
.
items
.
inventoryJobResponses
,
'allocatedAmount'
)
this
.
$set
(
this
.
scope
.
row
,
'allocatedAmount'
,
allocatedAmount
)
this
.
$bus
.
$emit
(
'changeAllocatedAmount'
,
{
index
:
this
.
scope
.
$index
,
allocatedAmount
,
inventoryJobResponses
:
res
.
items
.
inventoryJobResponses
})
}
}).
catch
((
err
)
=>
{
console
.
log
(
err
)
})
}
}
}
</
script
>
<
style
lang=
'scss'
>
</
style
>
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