Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qr-consistency-vue3
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
刘怀志
qr-consistency-vue3
Commits
bb26de2c
Commit
bb26de2c
authored
Apr 11, 2025
by
祁正
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
制造工厂
parent
6cc6a034
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
20 deletions
+64
-20
factory.js
src/api/system/factory.js
+8
-0
index.vue
src/views/system/factory/index.vue
+56
-20
No files found.
src/api/system/factory.js
View file @
bb26de2c
...
...
@@ -16,3 +16,11 @@ export function insertFactory(query) {
data
:
query
,
})
}
// 编辑制造工厂
export
function
updateFactory
(
query
)
{
return
request
({
url
:
'/control/systemFactory/update'
,
method
:
'post'
,
data
:
query
,
})
}
src/views/system/factory/index.vue
View file @
bb26de2c
<
template
>
<div
style=
"padding: 30px"
>
<el-button
type=
"primary"
plain
style=
"float: right;margin: 12px 0"
@
click=
"
dialogVisible = true
"
>
新建
</el-button>
<el-button
type=
"primary"
plain
style=
"float: right;margin: 12px 0"
@
click=
"
addFactory
"
>
新建
</el-button>
<el-table
:data=
"tableList"
style=
"width: 100%;"
border
>
<el-table-column
label=
"序号"
align=
"center"
>
<template
#
default=
"scope"
>
...
...
@@ -19,27 +19,26 @@
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
type=
"text"
>
编辑
</el-button>
<el-button
@
click=
"update(scope.row)"
type=
"text"
>
编辑
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getTableList"
/>
<pagination
v-show=
"total > 0"
v-model:page=
"queryParams.pageNum"
v-model:limit=
"queryParams.pageSize"
:total=
"total"
@
pagination=
"getTableList"
/>
<!-- 新增对话框-->
<el-dialog
style=
"margin-top: 300px;width: 500px;height: auto"
v-model=
"dialogVisible"
fullscreen
title=
"新增
"
:title=
"dialogTitle
"
width=
"500"
>
<el-form
label-position=
"top"
ref=
"formRef"
:model=
"form"
label-width=
"auto"
style=
"max-width: 600px;"
>
...
...
@@ -67,7 +66,7 @@
<
script
setup
>
import
{
getList
,
insertFactory
getList
,
insertFactory
,
updateFactory
}
from
'@/api/system/factory'
import
{
ElMessage
}
from
'element-plus'
...
...
@@ -75,6 +74,8 @@ const tableList = ref([])
const
total
=
ref
(
0
)
const
dialogVisible
=
ref
(
false
)
const
formRef
=
ref
(
null
);
// 创建一个表单的引用
const
dialogTitle
=
ref
(
'新增'
)
const
tempObj
=
ref
({})
const
form
=
ref
({})
...
...
@@ -89,14 +90,32 @@ const submitForm = () => {
// 通过 formRef 访问表单的方法
formRef
.
value
.
validate
((
valid
)
=>
{
if
(
valid
)
{
insertFactory
(
form
.
value
).
then
(
res
=>
{
if
(
res
.
code
===
200
){
ElMessage
.
success
(
"新增成功"
)
dialogVisible
.
value
=
false
form
.
value
=
{}
getTableList
()
}
})
if
(
dialogTitle
===
'新增'
){
insertFactory
(
form
.
value
).
then
(
res
=>
{
if
(
res
.
data
===
1
){
ElMessage
.
success
(
"新增成功"
)
dialogVisible
.
value
=
false
form
.
value
=
{}
getTableList
()
}
else
{
ElMessage
.
error
(
"新增失败"
)
}
})
}
else
{
//编辑
updateFactory
(
form
.
value
).
then
(
res
=>
{
if
(
res
.
data
===
1
){
ElMessage
.
success
(
"修改成功"
)
dialogVisible
.
value
=
false
form
.
value
=
{}
getTableList
()
}
else
{
ElMessage
.
error
(
"修改失败"
)
}
})
}
}
else
{
return
false
;
}
...
...
@@ -108,6 +127,23 @@ function cancelDialog(){
form
.
value
=
{}
}
function
addFactory
(){
dialogVisible
.
value
=
true
dialogTitle
.
value
=
'新增'
}
function
update
(
row
){
console
.
log
(
row
)
dialogTitle
.
value
=
'编辑'
//浅拷贝
form
.
value
=
{
id
:
row
.
id
,
factoryName
:
row
.
factoryName
,
remark
:
row
.
remark
}
dialogVisible
.
value
=
true
}
function
getTableList
(){
getList
(
queryParams
.
value
).
then
((
response
)
=>
{
console
.
log
(
response
)
...
...
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