Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lbs-gpsbd-web
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
yangkaiyi
lbs-gpsbd-web
Commits
889ff121
Commit
889ff121
authored
May 30, 2021
by
yangkaiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
存档
parent
7eb1fa4a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
362 additions
and
112 deletions
+362
-112
util.js
src/utils/util.js
+6
-6
websocket.js
src/utils/websocket.js
+40
-1
Menu.vue
src/views/map/components/menu/Menu.vue
+227
-30
Message.vue
src/views/map/components/tools/Message.vue
+4
-4
devices.vue
src/views/system/devices.vue
+75
-61
user.js
src/vuex/modules/user.js
+8
-8
mutations.js
src/vuex/mutations.js
+2
-2
No files found.
src/utils/util.js
View file @
889ff121
...
...
@@ -123,12 +123,12 @@ export default {
]
+
"]"
:
""
),
messages
[
store
.
state
.
common
.
system
.
lang
].
map
.
popupMileage
+
":"
+
(
attributes
.
todaytrip
?
attributes
.
todaytrip
:
0
)
+
"/"
+
(
attributes
.
trip
?
attributes
.
trip
:
0
)
+
" km"
,
//
messages[store.state.common.system.lang].map.popupMileage +
//
":" +
//
(attributes.todaytrip ? attributes.todaytrip : 0) +
//
"/" +
//
(attributes.trip ? attributes.trip : 0) +
//
" km",
messages
[
store
.
state
.
common
.
system
.
lang
].
common
.
time
+
":"
+
this
.
dateFormat
(
device
.
position
.
time
,
"YYYY-MM-DD HH:mm:ss"
),
...
...
src/utils/websocket.js
View file @
889ff121
import
{
Message
}
from
"element-ui"
;
import
{
Message
,
Notification
}
from
"element-ui"
;
import
util
from
"./util"
;
let
token
=
""
;
if
(
localStorage
.
user
)
{
...
...
@@ -31,18 +32,56 @@ const ws = {
}
};
this
.
websocket
.
onmessage
=
function
(
evt
)
{
console
.
log
(
"evt"
,
JSON
.
parse
(
evt
.
data
));
if
(
evt
.
data
)
{
let
socketMsg
=
JSON
.
parse
(
evt
.
data
);
if
(
socketMsg
.
positions
)
{
self
.
$store
.
dispatch
(
"updateDevicePosition"
,
socketMsg
.
positions
);
}
else
if
(
socketMsg
.
devices
)
{
self
.
$store
.
dispatch
(
"updateDeviceStatus"
,
socketMsg
.
devices
);
const
name
=
self
.
$store
.
state
.
user
.
devices
.
list
[
self
.
$store
.
state
.
user
.
devices
.
index
[
socketMsg
.
devices
[
0
].
deviceId
]
].
name
;
let
type
;
try
{
type
=
JSON
.
parse
(
socketMsg
.
devices
[
0
].
attributes
).
alarm
;
}
catch
(
e
)
{
type
=
socketMsg
.
devices
[
0
].
attributes
.
alarm
;
}
const
txt
=
{
sos
:
"求救报警"
,
idle
:
"静默报警"
,
vibration
:
"vibration"
,
powerOff
:
"断电,请及时查看"
,
powerCut
:
"断电,请及时查看"
,
lowBattery
:
"低电报警"
,
removing
:
"拆除报警"
,
fault
:
"fault"
,
};
Notification
({
title
:
`
${
name
}
${
txt
[
type
]}
`
,
message
:
util
.
dateFormat
(
socketMsg
.
devices
[
0
].
time
,
"YYYY-MM-DD HH:mm:ss"
),
duration
:
0
,
type
:
"warning"
,
});
}
else
if
(
socketMsg
.
commands
)
{
self
.
$store
.
dispatch
(
"responseCommand"
,
socketMsg
.
commands
);
}
}
};
this
.
websocket
.
onerror
=
function
(
evt
)
{};
// test代码
// let str = {
// data:
// '{"devices":[{"attributes":"{\\"alarm\\":\\"powerCut\\"}","deviceId":45,"id":45,"status":9,"time":1621495646355}]}',
// };
// this.websocket.onmessage(str);
},
reconnection
:
function
(
val
)
{
ws
.
connection
=
false
;
...
...
src/views/map/components/menu/Menu.vue
View file @
889ff121
This diff is collapsed.
Click to expand it.
src/views/map/components/tools/Message.vue
View file @
889ff121
...
...
@@ -8,8 +8,8 @@
>
<el-option
:key=
"-1"
label=
"全部"
:value=
"-1"
/>
<el-option
v-for=
"
item
in $store.state.user.devices.list"
:key=
"i
tem.id
"
v-for=
"
(item, i)
in $store.state.user.devices.list"
:key=
"i"
:label=
"item.name"
:value=
"item.id"
>
...
...
@@ -18,8 +18,8 @@
<el-select
size=
"mini"
v-model=
"typeId"
placeholder=
"请类型"
@
change=
"init"
>
<el-option
label=
"全部"
:value=
"-1"
/>
<el-option
v-for=
"
item
in eventTypes"
:key=
"i
tem.id
"
v-for=
"
(item, i)
in eventTypes"
:key=
"i"
:label=
"item.name"
:value=
"item.id"
>
...
...
src/views/system/devices.vue
View file @
889ff121
...
...
@@ -155,71 +155,80 @@
:devices=
"selectDevices"
@
visible=
"closeDialog"
></TransferDevice>
<!--
编辑
-->
<!--
新增、编辑弹窗
-->
<el-dialog
:title=
"`${isEdit ? '编辑' : '添加'}重要有害植物`"
:visible
.
sync=
"editDialogVisible"
width=
"
4
0%"
width=
"
5
0%"
>
<el-form
:model=
"editForm"
ref=
"editFormRef"
label-width=
"100px"
class=
"demo-ruleForm"
>
<!-- 新增、编辑弹窗 -->
<el-form-item
label=
"名称"
prop=
"name"
:rules=
"[
{
required: true,
message: '请输入有害植物名称',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model=
"editForm.name"
auto-complete=
"off"
:disabled=
"isEdit"
></el-input>
</el-form-item>
<el-form-item
label=
"IMEI"
prop=
"imei"
:rules=
"[
{
required: true,
message: '请输入IMEI',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model=
"editForm.imei"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"报关号"
prop=
"clearanceID"
>
<el-input
v-model=
"editForm.clearanceID"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"来源国"
prop=
"countryOfOrigin"
>
<el-input
v-model=
"editForm.countryOfOrigin"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"携带有害生物"
prop=
"carryPestName"
>
<el-input
v-model=
"editForm.carryPestName"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remarks"
>
<el-input
v-model=
"editForm.remarks"
></el-input>
</el-form-item>
</el-form>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-form
:model=
"editForm"
ref=
"editFormRef"
label-width=
"100px"
class=
"demo-ruleForm"
>
<el-form-item
label=
"名称"
prop=
"name"
:rules=
"[
{
required: true,
message: '请输入有害植物名称',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model=
"editForm.name"
auto-complete=
"off"
:disabled=
"isEdit"
></el-input>
</el-form-item>
<el-form-item
label=
"IMEI"
prop=
"imei"
:rules=
"[
{
required: true,
message: '请输入IMEI',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model=
"editForm.imei"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"报关号"
prop=
"clearanceID"
>
<el-input
v-model=
"editForm.clearanceID"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"来源国"
prop=
"countryOfOrigin"
>
<el-input
v-model=
"editForm.countryOfOrigin"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"携带有害生物"
prop=
"carryPestName"
>
<el-input
v-model=
"editForm.carryPestName"
auto-complete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remarks"
>
<el-input
v-model=
"editForm.remarks"
></el-input>
</el-form-item>
</el-form>
</el-col>
<el-col
:span=
"12"
>
<GroupTree
@
handleNodeClick=
"handleNodeClick"
:currentKey=
"editForm.groupId"
></GroupTree>
</el-col>
</el-row>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"editDialogVisible = false"
>
取 消
</el-button>
...
...
@@ -234,6 +243,7 @@ import moment from "moment";
import
util
from
"@/utils/util"
;
import
InDevice
from
"./components/InDevice"
;
import
TransferDevice
from
"./components/TransferDevice"
;
import
GroupTree
from
"../map/components/menu/GroupTree"
;
import
{
getAllDevices
,
getDevices
,
...
...
@@ -307,6 +317,9 @@ export default {
this
.
data
=
data
;
});
},
handleNodeClick
(
node
)
{
this
.
editForm
.
groupId
=
node
.
id
;
},
// 弹窗提交
handlerSubmit
()
{
this
.
$refs
[
"editFormRef"
].
validate
((
valid
)
=>
{
...
...
@@ -478,6 +491,7 @@ export default {
components
:
{
InDevice
,
TransferDevice
,
GroupTree
,
},
};
</
script
>
...
...
src/vuex/modules/user.js
View file @
889ff121
...
...
@@ -77,12 +77,12 @@ export const moduleUser = {
enable
:
false
,
},
status
:
{
0
:
"eventOffline"
,
1
:
"eventOnline"
,
2
:
"eventFenceEnter"
,
3
:
"eventFenceExit"
,
4
:
"eventOverSpeed"
,
9
:
"eventAlarm"
,
0
:
"eventOffline"
,
//上线
1
:
"eventOnline"
,
//下线
2
:
"eventFenceEnter"
,
//进围栏
3
:
"eventFenceExit"
,
//出围栏
4
:
"eventOverSpeed"
,
//超速
9
:
"eventAlarm"
,
//重要有害植物报警
},
//事件状态字典
alarms
:
{
sos
:
"求救报警"
,
...
...
@@ -185,8 +185,8 @@ export const moduleUser = {
userConfig
:
{
events
:
{
0
:
false
,
1
:
tru
e
,
2
:
tru
e
,
1
:
fals
e
,
2
:
fals
e
,
3
:
true
,
4
:
true
,
5
:
false
,
...
...
src/vuex/mutations.js
View file @
889ff121
...
...
@@ -120,6 +120,7 @@ export default {
);
}
if
(
state
.
user
.
userConfig
.
events
[
devstatus
.
status
])
{
// TODO:需不需要提示?devstatus.status是配置什么
Notification
({
title
:
state
.
user
.
devices
.
list
[
index
].
name
+
...
...
@@ -129,8 +130,7 @@ export default {
],
message
:
util
.
dateFormat
(
devstatus
.
time
,
"YYYY-MM-DD HH:mm:ss"
),
type
:
devstatus
.
status
==
1
?
"success"
:
"warning"
,
duration
:
60000
,
offset
:
60
,
duration
:
0
,
});
state
.
user
.
playAlarmSound
=
true
;
}
...
...
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