Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
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
冯超鹏
laravelzh
Commits
203bdf7b
Commit
203bdf7b
authored
May 12, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交装维人员
parent
4df1e763
Pipeline
#48
failed with stages
Changes
5
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
472 additions
and
10 deletions
+472
-10
InstallerController.php
app/Http/Controllers/InstallerController.php
+46
-8
installer.js
resources/js/api/installer.js
+54
-0
index.vue
resources/js/views/user/index.vue
+6
-1
installer.vue
resources/js/views/user/installer.vue
+364
-1
api.php
routes/api.php
+2
-0
No files found.
app/Http/Controllers/InstallerController.php
View file @
203bdf7b
...
...
@@ -17,31 +17,65 @@ use Validator;
class
InstallerController
extends
Controller
{
//装维人员列表
public
function
installerlist
(){
return
$this
->
jsonSuccessData
(
Installer
::
where
(
'delete'
,
'='
,
'1'
)
->
get
());
public
function
installerlist
(
Request
$request
){
$pagenNum
=
(
int
)
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
(
int
)
$request
->
input
(
'limit'
);
$instllerdata
=
Installer
::
offset
(
$pagenNum
)
->
limit
(
$limit
)
->
get
();
$count
=
Installer
::
count
();
return
$this
->
jsonSuccessData
([
'instllerdata'
=>
$instllerdata
,
'count'
=>
$count
]);
}
//用户添加
public
function
addinstaller
(
Request
$request
){
$keys
=
$request
->
all
();
$validator
=
Validator
::
make
(
$request
->
all
(),
$this
->
getValidationRulesinstaller
(
false
));
if
(
$validator
->
fails
())
{
return
response
()
->
json
([
'errors'
=>
$validator
->
errors
()],
403
);
}
$type
=
new
Installer
();
return
$this
->
jsonSuccessData
(
$type
->
addinstall
(
$request
->
all
()));
foreach
(
$keys
as
$key
=>
$val
)
{
if
(
$key
==
'ispassword'
)
{
unset
(
$keys
[
$key
]);
}
}
return
$this
->
jsonSuccessData
(
$type
->
addinstall
(
$keys
));
}
// 用户搜索
public
function
seekInstaller
(
Request
$request
){
$keys
=
$request
->
all
();
$handle
=
DB
::
table
(
'installer'
);
foreach
(
$keys
as
$key
=>
$val
)
{
if
(
$key
==
'page'
)
{
unset
(
$keys
[
$key
]);
}
elseif
(
$key
==
'limit'
){
unset
(
$keys
[
$key
]);
}
}
foreach
(
$keys
as
$k
=>
$v
)
{
if
(
$v
==
'正常'
){
$v
=
1
;
}
else
if
(
$v
==
'禁用'
){
$v
=
2
;
}
$keys
[
$key
]
&&
$handle
->
where
(
$k
,
'like'
,
'%'
.
$v
.
'%'
);
}
return
$this
->
jsonSuccessData
([
'instllerdata'
=>
$handle
->
get
(),
'count'
=>
$handle
->
count
()]);
}
//更新用户操作
public
function
updateinstaller
(
Request
$request
){
$uid
=
$request
->
input
(
'
u
id'
);
//用户id
$uid
=
$request
->
input
(
'id'
);
//用户id
$data
=
$request
->
all
();
if
(
is_null
(
$uid
)){
return
$this
->
jsonErrorData
(
105
,
'用户id不能为空'
);
}
if
(
$
_POST
){
if
(
$
request
->
isMethod
(
'post'
)
){
foreach
(
$data
as
$k
=>
$v
)
{
if
(
$k
==
'
u
id'
)
{
if
(
$k
==
'id'
)
{
unset
(
$data
[
$k
]);
}
else
if
(
$k
==
'ispassword'
){
unset
(
$data
[
$k
]);
}
else
if
(
$k
==
'password'
)
{
$data
[
'password'
]
=
md5
(
md5
(
$v
)
.
$data
[
'salt'
]);
}
}
$upin
=
Installer
::
where
(
'id'
,
'='
,(
int
)
$uid
)
->
update
(
$data
);
...
...
@@ -72,10 +106,14 @@ class InstallerController extends Controller
if
(
$type
==
1
){
//物理删除
return
$this
->
jsonSuccessData
(
Installer
::
where
(
'id'
,
'='
,
$uid
)
->
delete
());
}
elseif
(
$type
==
2
){
//逻辑删除
return
$this
->
jsonSuccessData
(
Installer
::
where
(
'id'
,
'='
,
$uid
)
->
update
([
'delete'
=>
2
]));
return
$this
->
jsonSuccessData
(
Installer
::
where
(
'id'
,
'='
,
$uid
)
->
update
([
'delete'
=>
2
,
'status'
=>
2
]));
}
}
//用户回复正常
public
function
normalinstaller
(
$id
){
return
$this
->
jsonSuccessData
(
Installer
::
where
(
'id'
,
'='
,
$id
)
->
update
([
'delete'
=>
1
,
'status'
=>
1
]));
}
//验证用户提交表单
private
function
getValidationRulesinstaller
(
$isNew
=
true
){
...
...
resources/js/api/installer.js
0 → 100644
View file @
203bdf7b
import
request
from
'@/utils/request'
;
export
function
installerlist
(
limit
,
page
)
{
// 设备类型
return
request
({
url
:
'installer/installerlist?page='
+
page
+
'&limit='
+
limit
,
method
:
'get'
,
});
}
export
function
seekInstaller
(
data
)
{
// 设备类型
return
request
({
url
:
'installer/seekInstaller'
,
method
:
'post'
,
data
,
});
}
export
function
deleteInsrall
(
id
,
type
)
{
// 删除设备
return
request
({
url
:
'installer/deleteinstaller?uid='
+
id
+
'&type='
+
type
,
method
:
'get'
,
});
}
export
function
addinstaller
(
data
)
{
// 添加
return
request
({
url
:
'installer/addinstaller'
,
method
:
'post'
,
data
,
});
}
export
function
updateinstaller
(
id
)
{
// 添加
return
request
({
url
:
'installer/updateinstaller?id='
+
id
,
method
:
'get'
,
});
}
export
function
postupdateinstaller
(
data
)
{
// 添加
return
request
({
url
:
'installer/updateinstaller'
,
method
:
'post'
,
data
,
});
}
export
function
normalinstaller
(
id
)
{
// 添加
return
request
({
url
:
'installer/normalinstaller/'
+
id
,
method
:
'get'
,
});
}
resources/js/views/user/index.vue
View file @
203bdf7b
...
...
@@ -2,7 +2,7 @@
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-form
ref=
"query"
:model=
"userdata"
style=
"display: inline-block;"
>
<el-input
v-model=
"userdata.nickname"
placeholder=
"用户名称"
style=
"width: 200px;"
class=
"filter-item"
name=
"userskk
"
/>
<el-input
v-model=
"userdata.nickname"
placeholder=
"用户名称"
clearable
style=
"width: 200px;"
class=
"filter-item"
name=
"userskk"
@
input=
"changeValue
"
/>
<el-select
v-model=
"userdata.state"
placeholder=
"状态"
clearable
class=
"filter-item"
style=
"width: 130px"
@
change=
"selectOne"
>
<el-option
v-for=
"item in calendarTypeOptions"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
...
...
@@ -236,6 +236,11 @@ export default {
this
.
userdata
.
state
=
undefined
;
}
}
,
changeValue
(
event
,
item
)
{
if
(
event
===
''
)
{
this
.
userdata
.
nickname
=
undefined
;
}
}
,
// 重置
resetForm
()
{
for
(
const
key
in
this
.
upUserData
)
{
...
...
resources/js/views/user/installer.vue
View file @
203bdf7b
This diff is collapsed.
Click to expand it.
routes/api.php
View file @
203bdf7b
...
...
@@ -88,6 +88,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route
::
post
(
'installer/addinstaller'
,
'InstallerController@addinstaller'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//添加新的装维人员
Route
::
match
([
'get'
,
'post'
],
'installer/updateinstaller'
,
'InstallerController@updateinstaller'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//返回设备列表和更改设备
Route
::
get
(
'installer/deleteinstaller'
,
'InstallerController@deleteinstaller'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//删除用户
Route
::
post
(
'installer/seekInstaller'
,
'InstallerController@seekInstaller'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//用户搜索
Route
::
get
(
'installer/normalinstaller/{id}'
,
'InstallerController@normalinstaller'
);
//回复状态
});
// Fake APIs
Route
::
get
(
'/table/list'
,
function
()
{
...
...
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