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
ce84b176
Commit
ce84b176
authored
Dec 16, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工单后台
parent
9d295b8e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
4 deletions
+87
-4
AlarmOrderController.php
app/Http/Controllers/AlarmOrderController.php
+29
-3
alarmOrder.js
resources/js/api/alarmOrder.js
+33
-0
alarms.vue
resources/js/views/history/alarms.vue
+24
-1
api.php
routes/api.php
+1
-0
No files found.
app/Http/Controllers/AlarmOrderController.php
View file @
ce84b176
...
...
@@ -61,10 +61,18 @@ class AlarmOrderController extends Controller
DB
::
beginTransaction
();
try
{
// 获取device_id
$device
=
DB
::
table
(
'device'
)
->
select
(
'id'
)
->
where
(
'devicenum'
,
$request
->
input
(
'device_num'
))
->
find
();
if
(
!
$device
)
{
return
$this
->
jsonErrorData
(
500
,
'设备编号不存在!'
);
}
$order
=
new
AlarmOrder
();
$insertId
=
$order
->
insertGetId
([
'order_num'
=>
$orderNum
,
'device_id'
=>
$
request
->
input
(
'device_id'
)
,
'device_id'
=>
$
device
[
'id'
]
,
'user_id'
=>
$request
->
input
(
'user_id'
),
'reportpolice_id'
=>
$reportpolice_id
,
'created_at'
=>
Carbon
::
now
(),
...
...
@@ -79,13 +87,13 @@ class AlarmOrderController extends Controller
DB
::
commit
();
}
catch
(
QueryException
$exception
)
{
DB
::
rollBack
();
return
$this
->
jsonErrorData
(
'工单创建失败'
);
return
$this
->
jsonErrorData
(
500
,
'工单创建失败'
);
}
if
(
$insertId
)
{
return
$this
->
jsonSuccessData
(
'已生成工单!'
);
}
else
{
return
$this
->
jsonErrorData
(
'工单创建失败'
);
return
$this
->
jsonErrorData
(
500
,
'工单创建失败'
);
}
}
...
...
@@ -156,4 +164,22 @@ class AlarmOrderController extends Controller
return
$this
->
jsonErrorData
(
500
,
'删除工单失败!'
);
}
}
/**
* 获取派单用户
*/
public
function
getUserInfo
()
{
if
(
$this
->
isadmin
())
{
$users
=
DB
::
table
(
'users'
)
->
select
(
'users.name, users.username, users.email, users.phone_number, ur.name AS role_name'
)
->
leftJoin
(
'user_roles AS ur'
,
'ur.id'
,
'='
,
'users.user_role_id'
)
->
where
(
'users.user_role_id'
,
'!='
,
0
)
->
get
()
->
toArray
();
return
$this
->
jsonSuccessData
(
$users
);
}
else
{
return
$this
->
jsonErrorData
(
500
,
'没有权限, 请联系管理员!'
);
}
}
}
resources/js/api/alarmOrder.js
0 → 100644
View file @
ce84b176
import
request
from
'@/utils/request'
;
// 列表
export
function
alarmOrderList
(
data
)
{
return
request
({
url
:
'/alarm_order'
,
method
:
'get'
,
data
:
data
,
});
}
// 新增
export
function
alarmOrderStore
(
data
)
{
return
request
({
url
:
'/alarm_order'
,
method
:
'post'
,
data
:
data
,
});
}
// 更新
export
function
alarmOrderUpdate
(
data
,
id
)
{
return
request
({
url
:
'/alarm_order/'
+
id
,
method
:
'patch'
,
data
,
});
}
// 删除
export
function
alarmOrderDestroy
(
id
)
{
return
request
({
url
:
'/alarm_order/'
+
id
,
method
:
'delete'
,
});
}
resources/js/views/history/alarms.vue
View file @
ce84b176
...
...
@@ -48,7 +48,7 @@
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
>
<
template
>
<
el
-
button
type
=
"primary"
effect
=
"dark"
>
生成工单
<
/el-button
>
<
el
-
button
type
=
"primary"
effect
=
"dark"
@
click
=
"createAlarmOrder(scope.row)"
>
生成工单
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
...
...
@@ -62,6 +62,7 @@
import
{
police
}
from
'@/api/device'
;
import
clip
from
'@/utils/clipboard'
;
import
BackToTop
from
'@/components/BackToTop'
;
import
{
alarmOrderStore
}
from
'@/api/alarmOrder'
;
export
default
{
components
:
{
BackToTop
}
,
data
()
{
...
...
@@ -77,12 +78,34 @@ export default {
'line-height'
:
'45px'
,
// Please keep consistent with height to center vertically
background
:
'#e7eaf1'
,
// The background color of the button
}
,
// 报警工单数据
alarmOrderToUserId
:
0
,
formDataOrder
:
{
device_num
:
''
,
reportpolice_id
:
0
,
policestatus
:
0
,
shutoff_status
:
0
,
user_id
:
0
,
}
,
}
;
}
,
created
()
{
this
.
police
();
// 列表
}
,
methods
:
{
// 生成工单
createAlarmOrder
(
data
)
{
this
.
formDataOrder
.
device_num
=
data
.
devicenumber
;
this
.
formDataOrder
.
reportpolice_id
=
data
.
id
;
this
.
formDataOrder
.
policestatus
=
data
.
policestatus
;
this
.
formDataOrder
.
shutoff_status
=
data
.
shutoff_status
;
this
.
formDataOrder
.
user_id
=
this
.
alarmOrderToUserId
;
alarmOrderStore
(
this
.
formDataOrder
).
then
(
response
=>
{
console
.
log
(
response
);
}
).
catch
(
err
=>
{
console
.
log
(
err
);
}
);
}
,
shutoffStatus
(
id
)
{
const
shutoff
=
[];
shutoff
[
0
]
=
'初始化'
;
...
...
routes/api.php
View file @
ce84b176
...
...
@@ -54,6 +54,7 @@ Route::group(['middleware' => 'auth:api'], function () {
Route
::
patch
(
'alarm_order/{id}'
,
'AlarmOrderController@update'
);
// 修改工单
Route
::
delete
(
'alarm_order/{id}'
,
'AlarmOrderController@destroy'
);
// 删除工单
Route
::
get
(
'alarm_order/show/{id}'
,
'AlarmOrderController@show'
);
// 工单详情
Route
::
get
(
'alarm_order/user'
,
'AlarmOrderController@getUserInfo'
);
// 获取派单人员
});
//上传图片路由
...
...
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