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
6290bd5b
Commit
6290bd5b
authored
4 years ago
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分类
parent
84620446
Pipeline
#110
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
3 deletions
+55
-3
DevicesController.php
app/Http/Controllers/DevicesController.php
+14
-0
device.js
resources/js/api/device.js
+8
-0
categories.vue
resources/js/views/device/categories.vue
+31
-2
api.php
routes/api.php
+2
-1
No files found.
app/Http/Controllers/DevicesController.php
View file @
6290bd5b
...
...
@@ -445,6 +445,20 @@ class DevicesController extends Controller
$this
->
timeline
(
'添加了分类[分类名称'
.
$data
.
']'
);
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
insertGetId
([
'tname'
=>
$data
]));
}
/**
* 更新设备分类
* @param $id 分类ID
*/
public
function
updateClassify
(
Request
$request
)
{
$data
=
$request
->
all
();
$status
=
DB
::
table
(
'device_type'
)
->
where
(
'tid'
,
'='
,
$data
[
'tid'
])
->
update
([
'tname'
=>
$data
[
'tname'
]
]);
return
$status
?
$this
->
jsonSuccessData
(
$status
)
:
$this
->
jsonErrorData
(
202
,
'error'
);
}
public
function
delteClassify
(
$id
)
{
//删除分类
...
...
This diff is collapsed.
Click to expand it.
resources/js/api/device.js
View file @
6290bd5b
...
...
@@ -63,6 +63,14 @@ export function addClassify(data) {
method
:
'get'
,
});
}
// 更新设备分类
export
function
updateClassify
(
data
)
{
return
request
({
url
:
'/devices/updateClassify'
,
method
:
'post'
,
data
:
data
,
});
}
export
function
delteClassify
(
id
)
{
return
request
({
...
...
This diff is collapsed.
Click to expand it.
resources/js/views/device/categories.vue
View file @
6290bd5b
...
...
@@ -21,7 +21,7 @@
</el-table-column>
<el-table-column
label=
"操作"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"info"
size=
"small"
@
click=
"handle
Click(
)"
>
修改
</el-button>
<el-button
type=
"info"
size=
"small"
@
click=
"handle
Edit(scope.row.tid, scope.row.tname
)"
>
修改
</el-button>
<el-button
type=
"danger"
size=
"small"
@
click=
"delteClassify(scope.row.tid)"
>
删除
</el-button>
</
template
>
</el-table-column>
...
...
@@ -30,7 +30,7 @@
</template>
<
script
>
import
{
deviceTypeList
,
addClassify
,
delteClassify
}
from
'@/api/device'
;
import
{
deviceTypeList
,
addClassify
,
updateClassify
,
delteClassify
}
from
'@/api/device'
;
export
default
{
data
()
{
return
{
...
...
@@ -78,6 +78,35 @@ export default {
});
this
.
categoryName
=
''
;
},
// 修改分类
handleEdit
(
tid
,
tname
)
{
this
.
$prompt
(
'请输入分类名称'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
inputPattern
:
/
\S
/
,
inputErrorMessage
:
'分类名称格式不正确'
,
inputValue
:
tname
,
}).
then
(({
value
})
=>
{
updateClassify
({
'tid'
:
tid
,
'tname'
:
value
})
.
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
$message
({
type
:
'success'
,
message
:
'修改成功!'
,
});
this
.
getList
();
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}).
catch
(()
=>
{
this
.
$message
({
type
:
'info'
,
message
:
'取消输入'
,
});
});
},
delteClassify
(
id
){
this
.
$confirm
(
'此操作将永久删除该文件, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
...
...
This diff is collapsed.
Click to expand it.
routes/api.php
View file @
6290bd5b
...
...
@@ -94,7 +94,8 @@ Route::group(['middleware'=>'auth:api'],function (){
Route
::
get
(
'devices/UpPaperBasket/{id}'
,
'DevicesController@UpPaperBasket'
);
//更新废纸篓和禁用用户
Route
::
get
(
'devices/deviceBasketList'
,
'DevicesController@deviceBasketList'
);
//返回禁用设备和废纸篓设备
Route
::
get
(
'devices/addClassify/{data}'
,
'DevicesController@addClassify'
);
//添加分类
Route
::
get
(
'devices/delteClassify/{id}'
,
'DevicesController@delteClassify'
);
//删除分类
Route
::
post
(
'devices/updateClassify'
,
'DevicesController@updateClassify'
);
//删除分类
Route
::
post
(
'devices/delteClassify/{id}'
,
'DevicesController@delteClassify'
);
//删除分类
Route
::
post
(
'devices/detedevice'
,
'DevicesController@detedevice'
);
//查看历史数据
Route
::
get
(
'devices/addUserDevice'
,
'DevicesController@addUserDevice'
);
//返回正常用户
Route
::
get
(
'devices/control'
,
'DevicesController@control'
);
//返回消防监测
...
...
This diff is collapsed.
Click to expand it.
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