Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_vue
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
胡宝山
template_vue
Commits
201bdfe7
Commit
201bdfe7
authored
Mar 05, 2024
by
YLKCNK
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/project2024-3-5' into project2024-3-5
parents
cbe32105
ec31b355
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
266 additions
and
0 deletions
+266
-0
magnagement.js
src/api/magnagement.js
+10
-0
index.vue
src/views/equipment/warehouse/index.vue
+256
-0
No files found.
src/api/magnagement.js
View file @
201bdfe7
...
...
@@ -45,6 +45,16 @@ export function add(data) {
}
})
}
export
function
addBatch
(
data
)
{
return
request
({
url
:
'/wbwarehouse-test/add-test'
,
method
:
'post'
,
data
,
headers
:
{
'Content-Type'
:
'application/json;charset=UTF-8'
}
})
}
// 再利用
export
function
recycle
(
data
)
{
return
request
({
...
...
src/views/equipment/warehouse/index.vue
0 → 100644
View file @
201bdfe7
<
template
>
<div
class=
"app-container"
>
<div
class=
"title"
>
<span
style=
"color:#333;font-weight: 700;font-size: 16px;"
>
设备入库
</span>
</div>
<div
class=
"form"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"80px"
>
<el-row
:gutter=
"40"
style=
"padding-left: 8.6%;"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"pn:"
prop=
"pn"
>
<el-input
ref=
"input1"
v-model=
"form.pn"
placeholder=
"请输入pn"
class=
"input"
:maxlength=
"100"
@
keyup
.
enter
.
native=
"handelTab(1,$event)"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"lot:"
style=
"flex-basis: 50%;"
prop=
"lot"
>
<el-input
ref=
"input2"
v-model=
"form.lot"
placeholder=
"请输入lot"
class=
"input"
:maxlength=
"100"
@
keyup
.
enter
.
native=
"handelTab(2,$event)"
/>
</el-form-item>
</el-col>
</el-row>
<el-row
:gutter=
"40"
style=
"padding-left: 8.6%;"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"厚度:"
style=
"flex-basis: 50%;"
prop=
"phd"
>
<el-input
ref=
"input3"
v-model=
"form.phd"
placeholder=
"请输入厚度"
class=
"input"
:maxlength=
"10"
@
keyup
.
enter
.
native=
"handelTab(3,$event)"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
style=
"flex-basis: 50%;"
>
<el-button
ref=
"input4"
type=
"primary"
@
click=
"handleConfirm"
>
确认
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div
class=
"table"
>
<el-table
border
:data=
"tableData"
:gutter=
"40"
>
<el-table-column
type=
"index"
label=
"序号"
width=
"50px"
/>
<el-table-column
label=
"pn"
prop=
"businessId"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
pn
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
label=
"lot"
prop=
"lot"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
lot
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
label=
"厚度"
prop=
"phd"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
phd
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
class-name=
"small-padding fixed-width"
width=
"120px"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
style=
"color: #49cec9"
@
click=
"handleUpdate(scope.row)"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
</div>
<div
class=
"form"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rule"
label-width=
"80px"
>
<el-row
style=
"padding-left: 8.6%; padding-top: 1.5%"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"位置:"
style=
"flex-basis: 50%;"
prop=
"plocation"
>
<el-input
v-model=
"form.plocation"
placeholder=
"请输入位置"
:style=
"{ width: '400px', height: '30px' }"
:maxlength=
"100"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"寿命:"
style=
"flex-basis: 50%;"
prop=
"psm"
>
<el-input
v-model=
"form.psm"
placeholder=
"请输入寿命"
:style=
"{ width: '400px', height: '30px' }"
:maxlength=
"9"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form
label-width=
"80px"
>
<el-row
style=
"padding-left: 8.6%; padding-top: 1%"
>
<el-col
:span=
"12"
>
<el-form-item
style=
"flex-basis: 50%;"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
提交
</el-button>
<el-button
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</template>
<
script
>
import
{
addBatch
}
from
"@/api/magnagement"
;
export
default
{
data
()
{
return
{
form
:
{
pn
:
''
,
lot
:
''
,
plocation
:
''
,
phd
:
''
,
flag
:
1
,
ptype
:
1
,
pstatus
:
0
,
psm
:
undefined
},
tableData
:
[]
}
},
methods
:
{
handleConfirm
()
{
this
.
flag
=
false
const
{
pn
,
lot
,
phd
}
=
this
.
form
if
(
!
pn
&&!
lot
){
this
.
$message
.
warning
(
'pn或lot不能为空'
);
return
;
}
if
(
this
.
form
.
index
!==
undefined
){
this
.
editRow
()
}
else
{
this
.
addRow
()
}
},
addRow
(){
console
.
log
(
"添加"
)
const
{
pn
,
lot
,
phd
}
=
this
.
form
;
// 重复的下标
const
duplicateIndex
=
this
.
tableData
.
findIndex
(
item
=>
item
.
pn
===
pn
);
if
(
duplicateIndex
!==
-
1
)
{
this
.
$message
.
warning
(
`与第
${
duplicateIndex
+
1
}
条pn值重复`
);
}
else
if
(
phd
%
1
!==
0
)
{
this
.
$message
.
warning
(
'厚度要为整数'
);
}
else
{
this
.
tableData
.
push
({
pn
,
lot
,
phd
});
this
.
resetForm
();
}
},
editRow
(){
console
.
log
(
"编辑"
)
const
{
pn
,
lot
,
phd
,
index
}
=
this
.
form
;
const
duplicateIndex
=
this
.
tableData
.
findIndex
((
item
,
i
)
=>
i
!==
index
&&
item
.
pn
===
pn
);
if
(
duplicateIndex
!==
-
1
)
{
this
.
$message
.
warning
(
`与第
${
duplicateIndex
+
1
}
条pn值重复`
);
}
else
if
(
phd
%
1
!==
0
)
{
this
.
$message
.
warning
(
'厚度要为整数'
);
}
else
{
this
.
updateTableRow
(
index
,
pn
,
lot
,
phd
);
}
this
.
resetForm
();
},
updateTableRow
(
index
,
pn
,
lot
,
phd
)
{
this
.
tableData
[
index
].
pn
=
pn
;
this
.
tableData
[
index
].
lot
=
lot
;
this
.
tableData
[
index
].
phd
=
phd
;
},
resetForm
()
{
this
.
form
.
pn
=
''
;
this
.
form
.
lot
=
''
;
this
.
form
.
phd
=
''
;
this
.
form
.
index
=
undefined
;
},
handleUpdate
(
row
){
// 将点击的行数据填充到表单中
this
.
form
=
{
...
row
};
this
.
tableData
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
pn
===
row
.
pn
){
this
.
form
.
index
=
index
;
}
})
},
handleDelete
(
row
){
this
.
tableData
=
this
.
tableData
.
filter
(
item
=>
item
!==
row
)
},
submitForm
(){
if
(
!
this
.
form
.
plocation
){
this
.
$message
.
warning
(
'位置不能为空!'
);
}
if
(
this
.
tableData
.
length
===
0
){
this
.
$message
.
warning
(
'表格数据不能为空!'
);
}
this
.
tableData
.
forEach
(
item
=>
{
item
.
psm
=
this
.
form
.
psm
item
.
plocation
=
this
.
form
.
plocation
})
console
.
log
(
this
.
tableData
)
addBatch
(
this
.
tableData
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
$message
.
success
(
'添加成功'
)
this
.
tableData
=
[]
this
.
form
.
plocation
=
''
this
.
form
.
psm
=
undefined
}
})
},
resetQuery
(){
this
.
form
=
{
pn
:
''
,
lot
:
''
,
plocation
:
''
,
phd
:
''
,
flag
:
1
,
ptype
:
1
,
pstatus
:
0
,
psm
:
undefined
}
this
.
tableData
=
[]
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.app-container
{
padding
:
0
;
margin
:
0
;
.title
{
height
:
100px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.form
{
.input
{
width
:
400px
;
height
:
30px
;
}
}
.table
{
width
:
91%
;
margin-left
:
92px
;
padding-left
:
8
.6%
;
}
}
</
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