Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service-admin-view
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
external
on-site-service-admin-view
Commits
49f0cbf3
Commit
49f0cbf3
authored
Jul 26, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 维修工管理
parent
b0480a3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
0 deletions
+197
-0
worker.js
src/api/worker.js
+38
-0
ServiceWorkerEdit.vue
src/views/serviceWorker/ServiceWorkerEdit.vue
+73
-0
ServiceWorkerList.vue
src/views/serviceWorker/ServiceWorkerList.vue
+86
-0
No files found.
src/api/worker.js
View file @
49f0cbf3
...
@@ -7,4 +7,42 @@ export function searchWorkers(name) {
...
@@ -7,4 +7,42 @@ export function searchWorkers(name) {
url
:
`
${
BASE_URL
}
/search`
,
url
:
`
${
BASE_URL
}
/search`
,
params
:
{
name
}
params
:
{
name
}
})
})
}
export
function
getPage
(
data
)
{
return
axios
({
url
:
`
${
BASE_URL
}
/page`
,
method
:
'post'
,
data
})
}
export
function
getDetail
(
id
)
{
return
axios
({
url
:
`
${
BASE_URL
}
/
${
id
}
`
,
method
:
'get'
})
}
export
function
save
(
data
)
{
return
axios
({
url
:
`
${
BASE_URL
}
/save`
,
method
:
'post'
,
data
})
}
export
function
update
(
data
)
{
return
axios
({
url
:
`
${
BASE_URL
}
/update`
,
method
:
'post'
,
data
})
}
export
function
deleteWorker
(
id
)
{
return
axios
({
url
:
`
${
BASE_URL
}
/delete/
${
id
}
`
,
method
:
'delete'
,
})
}
}
\ No newline at end of file
src/views/serviceWorker/ServiceWorkerEdit.vue
0 → 100644
View file @
49f0cbf3
<
template
>
<a-drawer
:width=
"500"
:visible=
"visible"
:title=
"id ? '编辑' : '新增'"
@
close=
"close"
>
<a-form
:form=
"form"
layout=
"vertical"
>
<a-form-item
label=
"姓名"
>
<a-input
v-decorator=
"['name',
{ rules: [{ required: true, message: '请输入姓名' }] }]" />
</a-form-item>
<a-form-item
label=
"手机号"
>
<a-input
v-decorator=
"['phone',
{ rules: [{ required: true, message: '请输入手机号' }] }]" />
</a-form-item>
</a-form>
<div
class=
"drawer-form-bottom-toolbar"
>
<a-button
:style=
"
{ marginRight: '8px' }" @click="close"> 取消
</a-button>
<a-button
type=
"primary"
@
click=
"submit"
>
保存
</a-button>
</div>
</a-drawer>
</
template
>
<
script
>
import
ImageUpload
from
'@/components/image-upload/ImageUpload'
import
{
save
,
getDetail
,
update
}
from
'@/api/worker'
export
default
{
name
:
'ServiceWorkerEdit'
,
components
:
{
ImageUpload
},
props
:
{
success
:
Function
},
data
()
{
return
{
form
:
this
.
$form
.
createForm
(
this
),
visible
:
false
,
id
:
null
}
},
methods
:
{
show
(
id
)
{
this
.
id
=
id
this
.
visible
=
true
if
(
this
.
id
)
{
getDetail
(
this
.
id
).
then
(({
data
})
=>
{
this
.
form
.
setFieldsValue
(
data
)
})
}
},
close
()
{
this
.
id
=
null
this
.
form
.
resetFields
()
this
.
visible
=
false
},
submit
()
{
this
.
form
.
validateFields
((
err
,
values
)
=>
{
if
(
err
)
{
return
}
const
reqData
=
{
...
values
,
id
:
this
.
id
}
const
saveRequest
=
this
.
id
?
update
:
save
saveRequest
(
reqData
).
then
(({
code
})
=>
{
if
(
code
==
200
)
{
this
.
$message
.
success
(
'保存成功'
)
this
.
close
()
this
.
success
()
}
})
})
}
}
}
</
script
>
\ No newline at end of file
src/views/serviceWorker/ServiceWorkerList.vue
0 → 100644
View file @
49f0cbf3
<
template
>
<table-template
:soul=
"this"
>
<template
#
action=
"
{ record }">
<a-space>
<a
@
click=
"edit(record.id)"
>
编辑
</a>
<a
style=
"color: red"
@
click=
"deleteRow(record.id)"
>
删除
</a>
</a-space>
</
template
>
<
template
#
free
>
<ServiceWorkerEdit
ref=
"ServiceWorkerEdit"
:success=
"reset"
/>
</
template
>
</table-template>
</template>
<
script
>
import
{
TableTemplate
,
TableScript
,
SearchType
}
from
'@/components/table'
import
{
getPage
,
deleteWorker
}
from
'@/api/worker'
import
dayjs
from
'dayjs'
import
ServiceWorkerEdit
from
'./ServiceWorkerEdit.vue'
const
columns
=
[
{
title
:
'姓名'
,
dataIndex
:
'name'
,
width
:
120
,
filter
:
{
type
:
SearchType
.
STRING
}
},
{
title
:
'手机号'
,
width
:
120
,
align
:
'center'
},
{
title
:
''
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
width
:
150
,
customRender
:
(
text
)
=>
dayjs
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'操作'
,
width
:
120
,
scopedSlots
:
{
customRender
:
'action'
},
align
:
'center'
}
]
export
default
{
name
:
'ServiceWorkerList'
,
mixins
:
[
TableScript
],
components
:
{
TableTemplate
,
ServiceWorkerEdit
},
data
()
{
return
{
columns
,
useYScroll
:
true
,
title
:
'维修工管理'
,
loadingKeys
:
[],
toolbar
:
[
{
text
:
'新增'
,
handler
:
'add'
}
]
}
},
methods
:
{
queryData
:
getPage
,
add
()
{
this
.
$refs
.
ServiceWorkerEdit
.
show
(
null
)
},
edit
(
id
)
{
this
.
$refs
.
ServiceWorkerEdit
.
show
(
id
)
},
deleteRow
(
id
)
{
const
_this
=
this
this
.
$confirm
({
title
:
'提示'
,
content
:
'是否删除'
,
onOk
()
{
deleteWorker
(
id
).
then
(({
code
})
=>
{
if
(
code
==
200
)
{
_this
.
$message
.
success
(
'删除成功'
)
_this
.
reset
()
}
})
}
})
}
}
}
</
script
>
\ No newline at end of file
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