Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
oEshield
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6ce922e1
authored
Feb 24, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
89a36cfb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
533 additions
and
489 deletions
src/pages/monitor/monitor.vue
src/pages/monitor/monitor.vue
View file @
6ce922e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<map-controll
isShowFullsize=
"true"
></map-controll>
<map-controll
isShowFullsize=
"true"
></map-controll>
<div
class=
"controll-wrap"
>
<div
class=
"controll-wrap"
>
<div
class=
"menu-search"
>
<div
class=
"menu-search"
>
<el-autocomplete
<!--
<el-autocomplete
ref=
"autocomplete"
ref=
"autocomplete"
size=
"small"
size=
"small"
:popper-class=
"'search_auto'+(autocompleteHide?' search_auto_hide':'')"
:popper-class=
"'search_auto'+(autocompleteHide?' search_auto_hide':'')"
...
@@ -18,17 +18,17 @@
...
@@ -18,17 +18,17 @@
:fetch-suggestions=
"querySearch"
:fetch-suggestions=
"querySearch"
:trigger-on-focus=
"false"
:trigger-on-focus=
"false"
:placeholder=
"'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
:placeholder=
"'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@
select=
"handleSelect"
>
@
select=
"handleSelect"
>
-->
<!--
<el-input
placeholder=
"请输入对应条件值"
v-model
.
trim=
"searchText"
size=
"small"
class=
"input-with-select"
@
keyup
.
enter
.
native=
'searchSubmit'
>
--
>
<el-input
placeholder=
"请输入对应条件值"
v-model
.
trim=
"searchText"
size=
"small"
class=
"input-with-select"
@
keyup
.
enter
.
native=
'searchSubmit'
>
<el-select
v-model=
"searchType"
slot=
"prepend"
placeholder=
"请选择"
size=
"small"
>
<el-select
v-model=
"searchType"
slot=
"prepend"
placeholder=
"请选择"
size=
"small"
>
<el-option
label=
"设备号"
value=
"1"
></el-option>
<el-option
label=
"设备号"
value=
"1"
></el-option>
<el-option
label=
"车架号"
value=
"2"
></el-option>
<el-option
label=
"车架号"
value=
"2"
></el-option>
<el-option
label=
"姓名"
value=
"3"
></el-option>
<el-option
label=
"姓名"
value=
"3"
></el-option>
<!--
<el-option
label=
"工单号"
value=
"4"
></el-option>
-->
<!--
<el-option
label=
"工单号"
value=
"4"
></el-option>
-->
</el-select>
</el-select>
<el-button
icon=
"el-icon-search"
size=
"mini"
slot=
"append"
:loading=
"isSearching"
@
click=
"searchSubmit"
>
<el-button
icon=
"el-icon-search"
size=
"mini"
slot=
"append"
:loading=
"isSearching"
@
click=
"searchSubmit"
>
</el-button>
</el-button>
<template
slot-scope=
"
{ item }">
<!--
<template
slot-scope=
"
{ item }">
<div
style=
"margin: 0 -20px; font-size: 12px; "
class=
"auto_item"
>
<div
style=
"margin: 0 -20px; font-size: 12px; "
class=
"auto_item"
>
<template
v-if=
"item.tip"
>
<template
v-if=
"item.tip"
>
{{
item
.
tip
}}
{{
item
.
tip
}}
...
@@ -39,9 +39,9 @@
...
@@ -39,9 +39,9 @@
</
template
>
</
template
>
</div>
</div>
</template>
</template>
-->
</el-autocomplete
>
<!-- </el-autocomplete> --
>
<!-- </el-input> --
>
</el-input
>
</div>
</div>
<el-row
type=
"flex"
class=
"filter-entrance"
justify=
"space-between"
>
<el-row
type=
"flex"
class=
"filter-entrance"
justify=
"space-between"
>
<!-- <el-button type="text" @click="importDialogHidden=false;listDialogHidden=true;resultDialogHidden=true;">导入查询</el-button> -->
<!-- <el-button type="text" @click="importDialogHidden=false;listDialogHidden=true;resultDialogHidden=true;">导入查询</el-button> -->
...
@@ -57,19 +57,9 @@
...
@@ -57,19 +57,9 @@
<div
class=
"filter-dialog-body"
>
<div
class=
"filter-dialog-body"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
:inline=
"false"
size=
"mini"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
:inline=
"false"
size=
"mini"
>
<el-form-item
label=
""
prop=
"filename"
>
<el-form-item
label=
""
prop=
"filename"
>
<el-upload
ref=
"upload"
class=
"upload-wrap"
<el-upload
ref=
"upload"
class=
"upload-wrap"
action=
"vehicle/importSerchDevice"
:on-change=
"changeFile"
:before-upload=
"beforeUpload"
:multiple=
"false"
:show-file-list=
"false"
:on-success=
"successUpload"
:on-error=
"errorUpload"
:data=
"uploadData"
accept=
".xlsx"
:auto-upload=
"false"
>
action=
"vehicle/importSerchDevice"
<el-input
v-model=
"form.filename"
placeholder=
"未选取任何文件"
class=
"input-with-select"
size=
"small"
>
:on-change=
"changeFile"
<el-select
v-model=
"form.uploadType"
slot=
"prepend"
placeholder=
"请选择"
size=
"small"
>
:before-upload=
"beforeUpload"
:multiple=
"false"
:show-file-list=
"false"
:on-success=
"successUpload"
:on-error=
"errorUpload"
:data=
"uploadData"
accept=
".xlsx"
:auto-upload=
"false"
>
<el-input
v-model=
"form.filename"
placeholder=
"未选取任何文件"
class=
"input-with-select"
size=
"small"
>
<el-select
v-model=
"form.uploadType"
slot=
"prepend"
placeholder=
"请选择"
size=
"small"
>
<el-option
label=
"设备号"
value=
"1"
></el-option>
<el-option
label=
"设备号"
value=
"1"
></el-option>
<el-option
label=
"车架号"
value=
"2"
></el-option>
<el-option
label=
"车架号"
value=
"2"
></el-option>
<el-option
label=
"姓名"
value=
"3"
></el-option>
<el-option
label=
"姓名"
value=
"3"
></el-option>
...
@@ -96,14 +86,11 @@
...
@@ -96,14 +86,11 @@
<el-option
label=
"有线"
value=
"1"
></el-option>
<el-option
label=
"有线"
value=
"1"
></el-option>
<el-option
label=
"无线"
value=
"0"
></el-option>
<el-option
label=
"无线"
value=
"0"
></el-option>
</el-select>
</el-select>
<!-- <el-button type="primary" plain size="small" @click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button> --
>
<el-button
type=
"primary"
plain
size=
"small"
@
click=
"removeMonitorByGroup(monitorList.itemArr)"
>
批量删除
</el-button
>
</el-row>
</el-row>
<ul
class=
"monitor-list"
style=
"max-height:calc(100vh - 380px);"
>
<ul
class=
"monitor-list"
style=
"max-height:calc(100vh - 380px);"
>
<li
class=
"monitor-list-item"
<
template
v-for=
"(sn, key) in monitorList.itemArr"
>
v-for=
"(sn, key) in monitorList.itemArr"
<li
class=
"monitor-list-item"
:key=
"sn"
@
click=
"openMapInfoWindow(sn, monitorList[sn].source)"
v-if=
"key!=='count' && monitorList[sn]&&(monitorList[sn].source==monitorFilterType||monitorFilterType=='')"
>
:key=
"sn"
@
click=
"openMapInfoWindow(sn, monitorList[sn].source)"
v-show=
"key!=='count' && (monitorList[sn].source==monitorFilterType||monitorFilterType=='')"
>
<span
class=
"device-icon"
:class=
"monitorList[sn].online?'':'offline'"
v-show=
"monitorList[sn].online !== undefined"
></span>
<span
class=
"device-icon"
:class=
"monitorList[sn].online?'':'offline'"
v-show=
"monitorList[sn].online !== undefined"
></span>
<div
class=
"user-info"
>
<div
class=
"user-info"
>
<p>
<p>
...
@@ -113,8 +100,9 @@
...
@@ -113,8 +100,9 @@
<p>
车架号:
{{
monitorList
[
sn
].
standNo
}}
</p>
<p>
车架号:
{{
monitorList
[
sn
].
standNo
}}
</p>
</div>
</div>
<span
class=
"none_tip"
v-show=
"!monitorList[sn].isHasPosition"
>
无定位信息
</span>
<span
class=
"none_tip"
v-show=
"!monitorList[sn].isHasPosition"
>
无定位信息
</span>
<!-- <el-button type="text" @click.stop="removeMonitor(monitorList[sn], true)"><i class="fa fa-trash"></i></el-button> --
>
<el-button
type=
"text"
@
click
.
stop=
"removeMonitor(monitorList[sn], true)"
><i
class=
"fa fa-trash"
></i></el-button
>
</li>
</li>
</
template
>
</ul>
</ul>
</div>
</div>
<div
class=
"filter-dialog-footer"
>
<div
class=
"filter-dialog-footer"
>
...
@@ -157,20 +145,7 @@
...
@@ -157,20 +145,7 @@
</div>
</div>
<div
class=
"filter-dialog-body"
>
<div
class=
"filter-dialog-body"
>
<div
class=
"monitor-list"
>
<div
class=
"monitor-list"
>
<el-tree
<el-tree
ref=
"tree"
:data=
"treeData"
:props=
"treeProps"
lazy
:load=
"loadNode"
show-checkbox
node-key=
"id"
:render-content=
"renderTreeContent"
:default-expanded-keys=
"expandedKeys"
:default-checked-keys=
"checkedKeys"
@
check=
"handleCheck"
v-loading=
"treeLoading"
@
check-change=
"handleCheckChange"
>
ref=
"tree"
:data=
"treeData"
:props=
"treeProps"
lazy
:load=
"loadNode"
show-checkbox
node-key=
"id"
:render-content=
"renderTreeContent"
:default-expanded-keys=
"expandedKeys"
:default-checked-keys=
"checkedKeys"
@
check=
"handleCheck"
v-loading=
"treeLoading"
@
check-change=
"handleCheckChange"
>
</el-tree>
</el-tree>
</div>
</div>
...
@@ -183,68 +158,68 @@
...
@@ -183,68 +158,68 @@
</v-full-layout>
</v-full-layout>
</template>
</template>
<
script
>
<
script
>
import
'../../assets/spritesmith-generated/sprite.css'
import
"../../assets/spritesmith-generated/sprite.css"
;
import
store
from
'../../vuex/store.js'
import
store
from
"../../vuex/store.js"
;
import
remoteLoad
from
'utils/remoteLoad.js'
import
remoteLoad
from
"utils/remoteLoad.js"
;
import
mapService
from
'utils/mapService.js'
import
mapService
from
"utils/mapService.js"
;
import
'utils/mapEvent.js'
import
"utils/mapEvent.js"
;
import
EventBus
from
'../../event-bus'
import
EventBus
from
"../../event-bus"
;
import
{
services
}
from
'../../api'
import
{
services
}
from
"../../api"
;
import
mock
from
'../../mock'
import
mock
from
"../../mock"
;
const
MONITOR_SERVICE
=
services
.
monitor
;
const
MONITOR_SERVICE
=
services
.
monitor
;
import
{
CONSTANT
}
from
'../../constant'
import
{
CONSTANT
}
from
"../../constant"
;
import
MapControll
from
'./MapControll.vue'
import
MapControll
from
"./MapControll.vue"
;
import
{
exportExcel
}
from
'utils'
import
{
exportExcel
}
from
"utils"
;
export
default
{
export
default
{
data
()
{
data
()
{
let
checkFilename
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkFilename
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
filename
===
''
)
{
if
(
this
.
form
.
filename
===
""
)
{
cb
(
''
)
cb
(
""
);
}
}
cb
()
cb
();
}
};
return
{
return
{
AMap
:
null
,
AMap
:
null
,
mapObj
:
null
,
mapObj
:
null
,
mapLoading
:
false
,
mapLoading
:
false
,
isInitMap
:
false
,
isInitMap
:
false
,
flag
:
false
,
flag
:
false
,
searchText
:
''
,
//65MA08605HG349105 75108160001 1510112899
searchText
:
""
,
//65MA08605HG349105 75108160001 1510112899
searchType
:
'2'
,
searchType
:
"2"
,
isSearching
:
false
,
isSearching
:
false
,
monitorFilterType
:
''
,
monitorFilterType
:
""
,
resultFilterType
:
''
,
resultFilterType
:
""
,
importDialogHidden
:
true
,
importDialogHidden
:
true
,
listDialogHidden
:
true
,
listDialogHidden
:
true
,
resultDialogHidden
:
true
,
resultDialogHidden
:
true
,
resultList
:
[],
resultList
:
[],
monitorList
:
{
monitorList
:
{
count
:
0
,
count
:
0
,
itemArr
:
[]
itemArr
:
[],
},
},
importing
:
false
,
importing
:
false
,
form
:
{
form
:
{
uploadType
:
'1'
,
uploadType
:
"1"
,
filename
:
''
,
filename
:
""
,
},
},
rules
:
{
rules
:
{
//filename: [{validator: checkFilename, trigger: 'change'}],
//filename: [{validator: checkFilename, trigger: 'change'}],
},
},
uploadData
:
{},
uploadData
:
{},
remainSearchSnStr
:
''
,
remainSearchSnStr
:
""
,
refreshCount
:
1
,
refreshCount
:
1
,
resetRefreshCount
:
false
,
resetRefreshCount
:
false
,
autoOpenLastInfoWindow
:
false
,
autoOpenLastInfoWindow
:
false
,
treeHidden
:
false
,
treeHidden
:
false
,
treeProps
:
{
treeProps
:
{
label
:
'label'
,
label
:
"label"
,
children
:
'children'
,
children
:
"children"
,
isLeaf
:
'leaf'
,
isLeaf
:
"leaf"
,
[
'node-key'
]:
'id'
[
"node-key"
]:
"id"
,
},
},
treeData
:
[],
treeData
:
[],
expandedKeys
:
[],
expandedKeys
:
[],
...
@@ -252,237 +227,238 @@
...
@@ -252,237 +227,238 @@
checkedKeys
:
[],
checkedKeys
:
[],
autocompleteHide
:
true
,
autocompleteHide
:
true
,
treeLoading
:
true
,
treeLoading
:
true
,
}
};
},
},
computed
:
{
computed
:
{
'uploadDisabled'
()
{
uploadDisabled
()
{
return
this
.
form
.
filename
===
''
return
this
.
form
.
filename
===
""
;
},
},
getMonitorListVisibleCount
()
{
getMonitorListVisibleCount
()
{
if
(
this
.
monitorFilterType
===
''
)
{
if
(
this
.
monitorFilterType
===
""
)
{
return
this
.
monitorList
.
count
return
this
.
monitorList
.
count
;
}
else
{
}
else
{
let
count
=
0
;
let
count
=
0
;
for
(
let
key
in
this
.
monitorList
)
{
for
(
let
key
in
this
.
monitorList
)
{
if
(
key
!==
'count'
||
key
!==
'itemArr'
)
{
if
(
key
!==
"count"
||
key
!==
"itemArr"
)
{
if
(
this
.
monitorList
[
key
].
source
==
this
.
monitorFilterType
)
{
if
(
this
.
monitorList
[
key
].
source
==
this
.
monitorFilterType
)
{
count
++
;
count
++
;
}
}
}
}
}
}
return
count
;
return
count
;
}
}
},
}
},
},
watch
:
{
watch
:
{
'monitorFilterType'
(
newVal
)
{
monitorFilterType
(
newVal
)
{
EventBus
.
$emit
(
'uiMap.monitor.changeSourceType'
,
newVal
);
EventBus
.
$emit
(
"uiMap.monitor.changeSourceType"
,
newVal
);
},
},
searchType
()
{
searchType
()
{
if
(
this
.
searchText
)
{
if
(
this
.
searchText
)
{
this
.
searchSubmit
()
this
.
searchSubmit
();
}
}
}
},
},
},
methods
:
{
methods
:
{
renderTreeContent
(
h
,
{
node
,
data
,
store
})
{
renderTreeContent
(
h
,
{
node
,
data
,
store
})
{
if
(
data
.
leaf
)
{
if
(
data
.
leaf
)
{
return
h
(
'div'
,
{
class
:
'custom-tree-node'
},
[
return
h
(
"div"
,
{
class
:
"custom-tree-node"
},
[
h
(
'div'
,
{
h
(
"div"
,
{
domProps
:
{
domProps
:
{
innerHTML
:
'姓名:'
+
node
.
data
.
label1
||
'--'
innerHTML
:
"姓名:"
+
node
.
data
.
label1
||
"--"
,
}
},
}),
}),
h
(
'div'
,
{
h
(
"div"
,
{
domProps
:
{
domProps
:
{
innerHTML
:
'设备号:'
+
node
.
data
.
label
innerHTML
:
"设备号:"
+
node
.
data
.
label
,
}
},
}),
}),
h
(
'div'
,
{
h
(
"div"
,
{
domProps
:
{
domProps
:
{
innerHTML
:
'车架号:'
+
node
.
data
.
label2
innerHTML
:
"车架号:"
+
node
.
data
.
label2
,
}
},
})
}),
])
]);
}
}
return
h
(
'span'
,
{
return
h
(
"span"
,
{
domProps
:
{
domProps
:
{
innerHTML
:
node
.
data
.
label
innerHTML
:
node
.
data
.
label
,
}
},
})
});
},
},
getTreeData
()
{
getTreeData
()
{
MONITOR_SERVICE
.
getVehicleTree
().
then
(({
data
})
=>
{
MONITOR_SERVICE
.
getVehicleTree
().
then
(({
data
})
=>
{
this
.
treeLoading
=
false
this
.
treeLoading
=
false
;
this
.
treeData
=
data
this
.
treeData
=
data
;
})
});
},
},
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
//console.log(data, checked, indeterminate);
//console.log(data, checked, indeterminate);
if
(
checked
)
{
if
(
checked
)
{
//console.log(this.$refs.tree.getNode(data))
//console.log(this.$refs.tree.getNode(data))
let
node
=
this
.
$refs
.
tree
.
getNode
(
data
)
let
node
=
this
.
$refs
.
tree
.
getNode
(
data
);
console
.
log
(
indeterminate
)
console
.
log
(
indeterminate
);
//this.getAllChild(node)
//this.getAllChild(node)
//this.$refs.tree.store.defaultExpandAll = true
//this.$refs.tree.store.defaultExpandAll = true
//this.$refs.tree.setCheckedKeys(['u8121'])
//this.$refs.tree.setCheckedKeys(['u8121'])
}
}
this
.
isTreeChecked
=
checked
this
.
isTreeChecked
=
checked
;
this
.
expandedKeys
=
[]
this
.
expandedKeys
=
[];
},
},
handleCheck
(
data
,
node
)
{
handleCheck
(
data
,
node
)
{
console
.
log
(
'node'
,
data
)
console
.
log
(
"node"
,
data
);
if
(
data
.
leaf
)
{
if
(
data
.
leaf
)
{
const
item
=
{
const
item
=
{
sn
:
data
.
label
,
sn
:
data
.
label
,
name
:
data
.
label1
,
name
:
data
.
label1
,
standNo
:
data
.
label2
,
standNo
:
data
.
label2
,
online
:
data
.
online
,
online
:
data
.
online
,
id
:
data
.
id
,
id
:
data
.
id
,
source
:
data
.
source
===
'有线'
?
'1'
:
'0'
,
source
:
data
.
source
===
"有线"
?
"1"
:
"0"
,
sourceType
:
data
.
source
sourceType
:
data
.
source
,
}
};
if
(
this
.
isTreeChecked
)
{
if
(
this
.
isTreeChecked
)
{
this
.
addMonitor
(
item
)
this
.
addMonitor
(
item
);
}
else
{
}
else
{
this
.
removeMonitor
(
item
)
this
.
removeMonitor
(
item
);
}
}
}
else
{
}
else
{
if
(
this
.
isTreeChecked
)
{
if
(
this
.
isTreeChecked
)
{
this
.
$confirm
(
'当所选分组包含车辆过多时,请尝试分多次查询,以防等待时间过久。'
,
'提示'
,
{
this
.
$confirm
(
confirmButtonText
:
'确定'
,
"当所选分组包含车辆过多时,请尝试分多次查询,以防等待时间过久。"
,
cancelButtonText
:
'取消'
,
"提示"
,
type
:
'warning'
{
}).
then
(()
=>
{
confirmButtonText
:
"确定"
,
this
.
checkFlow
(
data
,
node
)
cancelButtonText
:
"取消"
,
})
type
:
"warning"
,
}
else
{
}
this
.
checkFlow
(
data
,
node
)
).
then
(()
=>
{
this
.
checkFlow
(
data
,
node
);
});
}
else
{
this
.
checkFlow
(
data
,
node
);
}
}
}
}
},
},
checkFlow
(
data
,
node
)
{
checkFlow
(
data
,
node
)
{
let
action
=
MONITOR_SERVICE
.
getVehicleTreeUserIds
let
action
=
MONITOR_SERVICE
.
getVehicleTreeUserIds
;
let
params
=
{
oId
:
data
.
id
}
let
params
=
{
oId
:
data
.
id
};
if
(
data
.
origin
.
type
===
'u'
)
{
if
(
data
.
origin
.
type
===
"u"
)
{
action
=
MONITOR_SERVICE
.
getVehicleTreeUserList
action
=
MONITOR_SERVICE
.
getVehicleTreeUserList
;
params
=
{
uId
:
data
.
id
}
params
=
{
uId
:
data
.
id
};
}
}
this
.
treeLoading
=
true
this
.
treeLoading
=
true
;
action
(
params
).
then
((
res
)
=>
{
action
(
params
).
then
((
res
)
=>
{
this
.
treeLoading
=
false
this
.
treeLoading
=
false
;
let
items
=
[]
let
items
=
[];
if
(
!
res
.
tips
)
{
if
(
!
res
.
tips
)
{
items
=
res
.
data
.
map
((
item
)
=>
{
items
=
res
.
data
.
map
((
item
)
=>
{
return
{
return
{
sn
:
item
.
label
,
sn
:
item
.
label
,
name
:
item
.
label1
,
name
:
item
.
label1
,
standNo
:
item
.
label2
,
standNo
:
item
.
label2
,
online
:
item
.
online
,
online
:
item
.
online
,
id
:
item
.
id
,
id
:
item
.
id
,
source
:
item
.
source
===
'有线'
?
'1'
:
'0'
,
source
:
item
.
source
===
"有线"
?
"1"
:
"0"
,
sourceType
:
item
.
source
sourceType
:
item
.
source
,
}
};
})
});
}
else
{
}
else
{
if
(
this
.
isTreeChecked
)
{
if
(
this
.
isTreeChecked
)
{
this
.
$message
({
this
.
$message
({
type
:
'info'
,
type
:
"info"
,
message
:
res
.
tips
message
:
res
.
tips
,
});
});
this
.
$refs
.
tree
.
setChecked
(
data
,
false
)
this
.
$refs
.
tree
.
setChecked
(
data
,
false
);
if
(
data
.
children
!==
undefined
)
{
if
(
data
.
children
!==
undefined
)
{
data
.
children
.
forEach
((
item
,
i
)
=>
{
data
.
children
.
forEach
((
item
,
i
)
=>
{
this
.
$refs
.
tree
.
setChecked
(
item
,
false
,
true
)
this
.
$refs
.
tree
.
setChecked
(
item
,
false
,
true
);
})
});
}
}
}
}
}
}
if
(
items
.
length
)
{
if
(
items
.
length
)
{
if
(
this
.
isTreeChecked
)
{
if
(
this
.
isTreeChecked
)
{
this
.
addMonitorByGroup
(
items
)
this
.
addMonitorByGroup
(
items
);
}
else
{
}
else
{
this
.
removeMonitorByGroup
(
items
)
this
.
removeMonitorByGroup
(
items
);
}
}
}
}
});
})
},
},
getAllChild
(
node
)
{
getAllChild
(
node
)
{
if
(
node
.
childNodes
.
length
===
0
&&
!
node
.
data
.
test
)
{
if
(
node
.
childNodes
.
length
===
0
&&
!
node
.
data
.
test
)
{
let
nodeData
=
node
.
data
let
nodeData
=
node
.
data
;
let
origin
=
nodeData
.
origin
let
origin
=
nodeData
.
origin
;
if
(
nodeData
.
children
)
{
if
(
nodeData
.
children
)
{
if
(
nodeData
.
children
.
length
)
{
if
(
nodeData
.
children
.
length
)
{
nodeData
.
children
.
forEach
((
item
)
=>
{
nodeData
.
children
.
forEach
((
item
)
=>
{
this
.
$refs
.
tree
.
append
(
item
,
node
)
this
.
$refs
.
tree
.
append
(
item
,
node
);
let
childNode
=
this
.
$refs
.
tree
.
getNode
(
item
)
let
childNode
=
this
.
$refs
.
tree
.
getNode
(
item
);
this
.
getAllChild
(
childNode
)
this
.
getAllChild
(
childNode
);
})
});
node
.
data
.
test
=
true
node
.
data
.
test
=
true
;
}
else
{
}
else
{
if
(
origin
.
type
===
'u'
)
{
if
(
origin
.
type
===
"u"
)
{
console
.
log
(
'u'
)
console
.
log
(
"u"
);
MONITOR_SERVICE
.
getVehicleTreeUserList
({
uId
:
nodeData
.
id
}).
then
(({
data
})
=>
{
MONITOR_SERVICE
.
getVehicleTreeUserList
({
uId
:
nodeData
.
id
}).
then
(
if
(
data
.
length
)
{
({
data
})
=>
{
data
.
map
((
item
)
=>
{
if
(
data
.
length
)
{
item
.
leaf
=
true
data
.
map
((
item
)
=>
{
this
.
$refs
.
tree
.
append
(
item
,
node
)
item
.
leaf
=
true
;
})
this
.
$refs
.
tree
.
append
(
item
,
node
);
});
}
}
}
})
);
node
.
data
.
test
=
true
node
.
data
.
test
=
true
;
}
}
}
}
}
}
}
}
},
},
loadNode
(
node
,
resolve
)
{
console
.
log
(
node
);
loadNode
(
node
,
resolve
)
{
const
nodeData
=
node
.
data
console
.
log
(
node
);
const
origin
=
nodeData
.
origin
const
nodeData
=
node
.
data
;
if
(
nodeData
.
children
){
const
origin
=
nodeData
.
origin
;
if
(
nodeData
.
children
.
length
)
{
if
(
nodeData
.
children
)
{
return
resolve
(
nodeData
.
children
)
if
(
nodeData
.
children
.
length
)
{
}
else
{
return
resolve
(
nodeData
.
children
);
if
(
origin
.
type
===
'u'
)
{
}
else
{
console
.
log
(
'u'
)
if
(
origin
.
type
===
"u"
)
{
MONITOR_SERVICE
.
getVehicleTreeUserList
({
uId
:
nodeData
.
id
}).
then
(({
data
})
=>
{
console
.
log
(
"u"
);
if
(
data
.
length
)
{
MONITOR_SERVICE
.
getVehicleTreeUserList
({
uId
:
nodeData
.
id
}).
then
(
data
.
map
((
item
)
=>
{
({
data
})
=>
{
item
.
leaf
=
true
if
(
data
.
length
)
{
})
data
.
map
((
item
)
=>
{
return
resolve
(
data
)
item
.
leaf
=
true
;
});
return
resolve
(
data
);
}
}
return
resolve
([])
return
resolve
([]);
})
}
);
return
;
return
;
}
}
}
}
}
}
return
resolve
([])
return
resolve
([]);
if
(
node
.
level
===
0
)
{
if
(
node
.
level
===
0
)
{
return
resolve
([{
name
:
'region1'
},
{
name
:
'region2'
}]);
return
resolve
([{
name
:
"region1"
},
{
name
:
"region2"
}]);
}
}
if
(
node
.
level
>
3
)
return
resolve
([]);
if
(
node
.
level
>
3
)
return
resolve
([]);
var
hasChild
;
var
hasChild
;
if
(
node
.
data
.
name
===
'region1'
)
{
if
(
node
.
data
.
name
===
"region1"
)
{
hasChild
=
true
;
hasChild
=
true
;
}
else
if
(
node
.
data
.
name
===
'region2'
)
{
}
else
if
(
node
.
data
.
name
===
"region2"
)
{
hasChild
=
false
;
hasChild
=
false
;
}
else
{
}
else
{
hasChild
=
Math
.
random
()
>
0.5
;
hasChild
=
Math
.
random
()
>
0.5
;
...
@@ -491,11 +467,14 @@
...
@@ -491,11 +467,14 @@
setTimeout
(()
=>
{
setTimeout
(()
=>
{
var
data
;
var
data
;
if
(
hasChild
)
{
if
(
hasChild
)
{
data
=
[{
data
=
[
name
:
'zone'
+
this
.
count
++
{
},
{
name
:
"zone"
+
this
.
count
++
,
name
:
'zone'
+
this
.
count
++
},
}];
{
name
:
"zone"
+
this
.
count
++
,
},
];
}
else
{
}
else
{
data
=
[];
data
=
[];
}
}
...
@@ -503,93 +482,100 @@
...
@@ -503,93 +482,100 @@
resolve
(
data
);
resolve
(
data
);
},
500
);
},
500
);
},
},
initMap
(){
initMap
()
{
let
check
=
()
=>
{
let
check
=
()
=>
{
this
.
checkLoadedTimeoutId
&&
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
this
.
checkLoadedTimeoutId
&&
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
return
setTimeout
(()
=>
{
return
setTimeout
(()
=>
{
if
(
'AMap'
in
window
&&
typeof
AMap
.
Map
==
'function'
&&
!
this
.
mapObj
){
if
(
"AMap"
in
window
&&
typeof
AMap
.
Map
==
"function"
&&
!
this
.
mapObj
)
{
window
.
AMap
=
AMap
;
window
.
AMap
=
AMap
;
this
.
mapObj
=
mapService
.
init
(
'map'
);
this
.
mapObj
=
mapService
.
init
(
"map"
);
//this.bindEvent();
//this.bindEvent();
this
.
isInitMap
=
true
;
this
.
isInitMap
=
true
;
if
(
this
.
$route
.
query
.
snArr
)
{
if
(
this
.
$route
.
query
.
snArr
)
{
let
routeQuery
=
JSON
.
parse
(
this
.
$route
.
query
.
snArr
);
let
routeQuery
=
JSON
.
parse
(
this
.
$route
.
query
.
snArr
);
if
(
routeQuery
.
length
>
0
)
{
if
(
routeQuery
.
length
>
0
)
{
/* this.addMonitor(routeQuery[0]);
/* this.addMonitor(routeQuery[0]);
this.autoOpenLastInfoWindow = true; */
this.autoOpenLastInfoWindow = true; */
routeQuery
.
forEach
((
item
)
=>
{
routeQuery
.
forEach
((
item
)
=>
{
this
.
addMonitor
(
item
);
this
.
addMonitor
(
item
);
});
})
this
.
autoOpenLastInfoWindow
=
true
;
this
.
autoOpenLastInfoWindow
=
true
;
this
.
listDialogHidden
=
false
this
.
listDialogHidden
=
false
;
}
}
}
}
if
(
this
.
$route
.
query
.
vin
)
{
if
(
this
.
$route
.
query
.
vin
)
{
MONITOR_SERVICE
.
getVehicleTree
({
MONITOR_SERVICE
.
getVehicleTree
({
termType
:
2
,
termType
:
2
,
term
:
this
.
$route
.
query
.
vin
,
term
:
this
.
$route
.
query
.
vin
,
returnTrees
:
true
returnTrees
:
true
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
const
items
=
res
.
data
const
items
=
res
.
data
;
this
.
expandTreeItems
(
items
)
this
.
expandTreeItems
(
items
);
})
});
this
.
treeHidden
=
true
this
.
treeHidden
=
true
;
}
}
else
{
this
.
checkLoadedTimeoutId
=
check
()
}
}
},
100
)
}
else
{
this
.
checkLoadedTimeoutId
=
check
();
}
}
},
100
);
};
this
.
checkLoadedTimeoutId
=
check
();
this
.
checkLoadedTimeoutId
=
check
();
},
},
keyupSubmit
(){
keyupSubmit
()
{
document
.
onkeydown
=
e
=>
{
document
.
onkeydown
=
(
e
)
=>
{
let
_key
=
window
.
event
.
keyCode
;
let
_key
=
window
.
event
.
keyCode
;
if
(
_key
===
13
){
if
(
_key
===
13
)
{
this
.
searchSubmit
()
this
.
searchSubmit
();
}
}
}
};
},
},
searchSubmit
()
{
searchSubmit
()
{
/* this.addMonitor({
/* this.addMonitor({
sn: '75108160001'
sn: '75108160001'
})
})
return */
return */
//if(!this.searchText) return;
//if(!this.searchText) return;
switch
(
this
.
searchType
)
{
switch
(
this
.
searchType
)
{
case
'1'
:
case
"1"
:
case
'2'
:
case
"2"
:
case
'4'
:
case
"4"
:
let
relObj
=
{
let
relObj
=
{
'1'
:
'设备号'
,
1
:
"设备号"
,
'2'
:
'车架号'
,
2
:
"车架号"
,
'4'
:
'工单号'
4
:
"工单号"
,
}
};
if
(
this
.
searchText
.
length
<
6
)
{
if
(
this
.
searchText
.
length
<
6
)
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
`请输入至少6位的
${
relObj
[
this
.
searchType
]}
`
message
:
`请输入至少6位的
${
relObj
[
this
.
searchType
]}
`
,
});
});
return
;
return
;
}
}
break
;
break
;
case
'3'
:
case
"3"
:
if
(
this
.
searchText
.
length
<
2
)
{
if
(
this
.
searchText
.
length
<
2
)
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
'请输入至少2位的姓名'
message
:
"请输入至少2位的姓名"
,
});
});
return
;
return
;
}
}
break
;
break
;
}
}
this
.
isSearching
=
true
;
this
.
isSearching
=
true
;
this
.
$refs
.
autocomplete
.
activated
=
true
// this.$refs.autocomplete.activated = true
this
.
$refs
.
autocomplete
.
getData
(
this
.
searchText
)
// this.$refs.autocomplete.getData(this.searchText)
this
.
querySearch
();
/* MONITOR_SERVICE.getVehicleDeviceList({
/* MONITOR_SERVICE.getVehicleDeviceList({
term: this.searchText,
term: this.searchText,
type: this.searchType
type: this.searchType
...
@@ -616,120 +602,133 @@
...
@@ -616,120 +602,133 @@
}
}
}); */
}); */
},
},
querySearch
(
queryString
,
cb
)
{
querySearch
()
{
this
.
autocompleteHide
=
true
let
_this
=
this
;
if
(
this
.
isSearching
)
{
//this.autocompleteHide = true
if
(
this
.
isSearching
)
{
MONITOR_SERVICE
.
getVehicleTree
({
MONITOR_SERVICE
.
getVehicleTree
({
termType
:
this
.
searchType
,
termType
:
this
.
searchType
,
term
:
this
.
searchText
,
term
:
this
.
searchText
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
this
.
isSearching
=
false
;
this
.
isSearching
=
false
;
cb
(
res
.
data
)
console
.
log
(
res
);
if
(
!
res
.
data
.
length
)
{
let
list
=
res
.
data
||
[];
cb
([{
if
(
!
list
||
list
.
length
<=
0
)
{
tip
:
'无数据'
return
false
;
}])
}
this
.
autocompleteHide
=
false
})
}
}
for
(
var
i
=
0
,
len
=
list
.
length
;
i
<
len
;
i
++
)
{
_this
.
handleSelect
(
list
[
i
]);
}
//cb(res.data)
// if(!res.data.length) {
// cb([{
// tip: '无数据'
// }])
// }
//this.autocompleteHide = false
});
}
},
},
// 查询树node
handleSelect
(
item
)
{
handleSelect
(
item
)
{
if
(
!
item
.
tip
)
{
if
(
!
item
.
tip
)
{
MONITOR_SERVICE
.
getVehicleTree
({
MONITOR_SERVICE
.
getVehicleTree
({
termType
:
1
,
termType
:
1
,
term
:
item
.
label
,
term
:
item
.
label
,
returnTrees
:
true
returnTrees
:
true
,
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
const
items
=
res
.
data
const
items
=
res
.
data
;
this
.
expandTreeItems
(
items
)
this
.
expandTreeItems
(
items
);
})
});
}
}
},
},
expandTreeItems
(
arr
,
isDevice
)
{
arr
.
forEach
((
item
)
=>
{
if
(
isDevice
)
{
// 展开树节点
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
item
.
id
))
expandTreeItems
(
arr
,
isDevice
)
{
arr
.
forEach
((
item
)
=>
{
if
(
isDevice
)
{
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
item
.
id
)
);
this
.
addMonitor
({
this
.
addMonitor
({
sn
:
item
.
label
,
sn
:
item
.
label
,
name
:
item
.
label1
,
name
:
item
.
label1
,
standNo
:
item
.
label2
,
standNo
:
item
.
label2
,
online
:
item
.
online
,
online
:
item
.
online
,
id
:
item
.
id
,
id
:
item
.
id
,
source
:
item
.
source
===
'有线'
?
'1'
:
'0'
,
source
:
item
.
source
===
"有线"
?
"1"
:
"0"
,
sourceType
:
item
.
source
sourceType
:
item
.
source
,
})
});
}
else
{
}
else
{
this
.
expandedKeys
.
push
(
item
.
id
)
this
.
expandedKeys
.
push
(
item
.
id
);
}
if
(
item
.
children
&&
item
.
children
.
length
)
{
this
.
expandTreeItems
(
item
.
children
,
item
.
origin
.
type
===
'u'
?
true
:
false
)
}
}
if
(
item
.
children
&&
item
.
children
.
length
)
{
this
.
expandTreeItems
(
/* else{
item
.
children
,
if() {
item
.
origin
.
type
===
"u"
?
true
:
false
this.checkedKeys.push(item.id)
);
}
}
} */
});
})
},
hasSameStandNo
(
arr
){
let
isSame
=
true
;
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
-
2
;
i
++
){
if
(
arr
[
i
].
standNo
!==
arr
[
i
+
1
].
standNo
){
isSame
=
false
;
break
;
}
}
return
isSame
},
},
// hasSameStandNo(arr){
// let isSame = true;
// for(let i=0,len=arr.length; i<len-2; i++){
// if(arr[i].standNo !== arr[i+1].standNo){
// isSame = false;
// break;
// }
// }
// return isSame
// },
/*searchSubmit(){
/*searchSubmit(){
console.log(mock.getMonitorDataByGroup)
console.log(mock.getMonitorDataByGroup)
EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup)
EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup)
},*/
},*/
successUpload
(
res
){
this
.
importing
=
false
;
if
(
typeof
res
===
'object'
){
if
(
res
.
returnCode
==
0
){
// 导入成功
successUpload
(
res
)
{
this
.
importing
=
false
;
if
(
typeof
res
===
"object"
)
{
if
(
res
.
returnCode
==
0
)
{
const
data
=
res
.
data
;
const
data
=
res
.
data
;
this
.
resultList
=
data
;
this
.
resultList
=
data
;
this
.
resultDialogHidden
=
false
;
this
.
resultDialogHidden
=
false
;
this
.
importDialogHidden
=
true
;
this
.
importDialogHidden
=
true
;
setTimeout
(()
=>
this
.
form
.
filename
=
''
,
0
);
setTimeout
(()
=>
(
this
.
form
.
filename
=
""
)
,
0
);
//this.$refs.upload.clearFiles();
//this.$refs.upload.clearFiles();
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
res
.
message
message
:
res
.
message
,
});
});
setTimeout
(()
=>
this
.
form
.
filename
=
''
,
0
);
setTimeout
(()
=>
(
this
.
form
.
filename
=
""
),
0
);
}
}
}
else
{
}
else
{
window
.
location
.
href
=
'../ots/login'
;
window
.
location
.
href
=
"../ots/login"
;
}
}
},
},
// 开始上传
submitUpload
()
{
submitUpload
()
{
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
uploadData
.
type
=
this
.
form
.
uploadType
this
.
uploadData
.
type
=
this
.
form
.
uploadType
;
this
.
$refs
.
upload
.
submit
();
this
.
$refs
.
upload
.
submit
();
}
}
})
});
},
},
// 监听文件上传改变
changeFile
(
file
,
filelist
)
{
changeFile
(
file
,
filelist
)
{
this
.
form
.
filename
=
file
.
name
;
this
.
form
.
filename
=
file
.
name
;
},
},
beforeUpload
(
file
){
// 文件上传前的钩子
beforeUpload
(
file
)
{
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
this.$message({
this.$message({
type: 'info',
type: 'info',
...
@@ -737,51 +736,55 @@
...
@@ -737,51 +736,55 @@
});
});
return false
return false
}*/
}*/
if
(
file
.
name
==
this
.
form
.
filename
)
{
if
(
file
.
name
==
this
.
form
.
filename
)
{
this
.
importing
=
true
;
this
.
importing
=
true
;
return
true
return
true
;
}
}
return
false
return
false
;
},
},
addMonitor
(
item
){
if
(
this
.
monitorList
.
count
===
100
){
// 添加监控
addMonitor
(
item
)
{
if
(
this
.
monitorList
.
count
===
100
)
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
'监控设备数最大100台,无法添加'
message
:
"监控设备数最大100台,无法添加"
,
});
});
}
else
{
}
else
{
if
(
this
.
monitorList
[
item
.
sn
])
{
if
(
this
.
monitorList
[
item
.
sn
])
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
'该列表中有设备正在监控中,请勿重复监控'
message
:
"该列表中有设备正在监控中,请勿重复监控"
,
});
});
}
else
{
}
else
{
this
.
resetRefreshCount
=
true
;
this
.
resetRefreshCount
=
true
;
this
.
monitorList
.
count
++
;
this
.
monitorList
.
count
++
;
item
.
eLocateType
=
'gpsLocation'
item
.
eLocateType
=
"gpsLocation"
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
.
itemArr
.
unshift
(
item
.
sn
)
this
.
monitorList
.
itemArr
.
unshift
(
item
.
sn
);
this
.
getPositionData
();
this
.
getPositionData
();
}
}
}
}
},
},
standNoMonitor
(
item
){
//
standNoMonitor(item){
this
.
resetRefreshCount
=
true
;
//
this.resetRefreshCount = true;
this
.
monitorList
.
count
++
;
//
this.monitorList.count++;
for
(
let
i
in
item
)
{
//
for (let i in item) {
this
.
monitorList
[
item
.
sn
]
=
item
[
i
].
sn
;
//
this.monitorList[item.sn] = item[i].sn;
}
//
}
this
.
getPositionData
();
// this.getPositionData();
},
// },
addMonitorByGroup
(
items
){
if
(
this
.
resultList
.
length
>
100
-
this
.
monitorList
.
count
){
// 批量监控
addMonitorByGroup
(
items
)
{
if
(
this
.
resultList
.
length
>
100
-
this
.
monitorList
.
count
)
{
this
.
$message
({
this
.
$message
({
type
:
'error'
,
type
:
"error"
,
message
:
'监控设备数最大100台,无法添加'
message
:
"监控设备数最大100台,无法添加"
,
});
});
}
else
{
}
else
{
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
if(findExistItem){
if(findExistItem){
this.$message({
this.$message({
...
@@ -797,119 +800,163 @@
...
@@ -797,119 +800,163 @@
});
});
this.getPositionData(this.resultList)
this.getPositionData(this.resultList)
} */
} */
let
filterList
=
items
.
filter
((
item
)
=>
{
let
filterList
=
items
.
filter
((
item
)
=>
{
return
!
this
.
monitorList
[
item
.
sn
]
return
!
this
.
monitorList
[
item
.
sn
];
});
});
filterList
.
forEach
((
item
)
=>
{
filterList
.
forEach
((
item
)
=>
{
item
.
eLocateType
=
'gpsLocation'
item
.
eLocateType
=
"gpsLocation"
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
.
count
++
;
this
.
monitorList
.
count
++
;
this
.
monitorList
.
itemArr
.
unshift
(
item
.
sn
)
this
.
monitorList
.
itemArr
.
unshift
(
item
.
sn
);
});
});
this
.
getPositionData
()
this
.
getPositionData
();
}
}
},
},
removeMonitor
(
item
,
ifUpdateTreeKeys
){
delete
this
.
monitorList
[
item
.
sn
];
// 单个删除监控列表
this
.
monitorList
.
itemArr
.
splice
(
this
.
monitorList
.
itemArr
.
indexOf
(
item
.
sn
),
1
)
removeMonitor
(
item
,
ifUpdateTreeKeys
)
{
this
.
monitorList
=
Object
.
assign
({},
this
.
monitorList
);
let
obj
=
this
.
monitorList
;
let
list
=
obj
.
itemArr
;
if
(
obj
[
item
.
sn
])
{
delete
obj
[
item
.
sn
];
}
this
.
monitorList
.
itemArr
=
list
.
filter
((
k
)
=>
k
!=
item
.
sn
);
//this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
this
.
monitorList
=
Object
.
assign
({},
obj
);
this
.
monitorList
.
count
--
;
this
.
monitorList
.
count
--
;
EventBus
.
$emit
(
'uiMap.monitor.destroy'
,
`
${
item
.
sn
}
:
${
item
.
source
}
`
);
EventBus
.
$emit
(
if
(
ifUpdateTreeKeys
)
{
"uiMap.monitor.destroy"
,
console
.
log
(
item
)
`
${
item
.
sn
||
item
}
:
${
item
.
source
||
item
}
`
let
checkedKeys
=
this
.
$refs
.
tree
.
getCheckedKeys
()
);
let
arr
=
checkedKeys
.
filter
((
id
)
=>
id
!==
item
.
id
)
console
.
log
(
this
.
monitorList
);
console
.
log
(
arr
)
if
(
ifUpdateTreeKeys
)
{
this
.
$refs
.
tree
.
setCheckedKeys
(
arr
)
console
.
log
(
item
);
let
checkedKeys
=
this
.
$refs
.
tree
.
getCheckedKeys
();
let
arr
=
checkedKeys
.
filter
((
id
)
=>
id
!==
item
.
id
);
console
.
log
(
arr
);
this
.
$refs
.
tree
.
setCheckedKeys
(
arr
);
}
}
},
},
removeMonitorByGroup
(
arr
){
arr
.
forEach
((
item
)
=>
{
// 批量删除 监控列表
if
(
this
.
monitorList
[
item
.
sn
])
{
removeMonitorByGroup
(
arr
)
{
this
.
removeMonitor
(
item
)
let
_this
=
this
;
}
console
.
log
(
this
.
monitorList
);
})
let
o
=
this
.
monitorList
;
arr
.
forEach
((
item
)
=>
{
let
n
=
o
[
item
];
if
(
n
)
{
_this
.
removeMonitor
(
n
);
}
// if(this.monitorList[item.sn||item]) {
// this.removeMonitor(item)
// }
});
},
},
getPositionData
(
arr
)
{
getPositionData
(
arr
)
{
/* let _this = this;
/* let _this = this;
arr = arr.filter((item)=>this.monitorList[item.sn]); */
arr = arr.filter((item)=>this.monitorList[item.sn]); */
let
snStr
=
this
.
monitorList
.
itemArr
.
join
(
','
);
//arr.map((item)=>item.sn).join(',');
let
snStr
=
this
.
monitorList
.
itemArr
.
join
(
","
);
//arr.map((item)=>item.sn).join(',');
if
(
!
snStr
)
return
;
if
(
!
snStr
)
return
;
if
(
this
.
resetRefreshCount
||
this
.
remainSearchSnStr
!=
snStr
)
{
if
(
this
.
resetRefreshCount
||
this
.
remainSearchSnStr
!=
snStr
)
{
this
.
refreshCount
=
1
;
this
.
refreshCount
=
1
;
}
else
{
}
else
{
this
.
refreshCount
++
;
this
.
refreshCount
++
;
}
}
this
.
resetRefreshCount
=
false
;
this
.
resetRefreshCount
=
false
;
this
.
remainSearchSnStr
=
snStr
;
this
.
remainSearchSnStr
=
snStr
;
MONITOR_SERVICE
.
getDevicesLocation
({
MONITOR_SERVICE
.
getDevicesLocation
({
sns
:
snStr
,
sns
:
snStr
,
deviceCode
:
'gps'
,
deviceCode
:
"gps"
,
//refreshCount: this.refreshCount
//refreshCount: this.refreshCount
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
//this.monitorList['1570222001'].isOnLine = true;
//this.monitorList['1570222001'].isOnLine = true;
const
data
=
res
.
data
;
const
data
=
res
.
data
;
if
(
data
.
length
)
{
if
(
data
.
length
)
{
data
.
forEach
((
item
)
=>
{
data
.
forEach
((
item
)
=>
{
let
relItem
=
this
.
monitorList
[
item
.
sn
];
let
relItem
=
this
.
monitorList
[
item
.
sn
];
if
(
relItem
)
{
if
(
relItem
)
{
relItem
.
isOnLine
=
item
.
status
===
2
?
false
:
true
;
relItem
.
isOnLine
=
item
.
status
===
2
?
false
:
true
;
relItem
.
isHasPosition
=
true
;
relItem
.
isHasPosition
=
true
;
item
.
name
=
relItem
.
name
;
item
.
name
=
relItem
.
name
;
item
.
standNo
=
relItem
.
standNo
;
item
.
standNo
=
relItem
.
standNo
;
}
}
item
.
eLocateType
=
relItem
.
eLocateType
item
.
eLocateType
=
relItem
.
eLocateType
;
item
=
this
.
filterGpsBase
(
item
)
item
=
this
.
filterGpsBase
(
item
);
item
.
isSource
=
relItem
.
source
item
.
isSource
=
relItem
.
source
;
});
});
this
.
monitorList
=
Object
.
assign
({},
this
.
monitorList
);
this
.
monitorList
=
Object
.
assign
({},
this
.
monitorList
);
let
drawData
=
data
.
filter
((
item
)
=>
(
this
.
monitorList
.
itemArr
.
indexOf
(
item
.
sn
)
>-
1
)
&&
item
.
eLocateType
)
let
drawData
=
data
.
filter
(
(
item
)
=>
this
.
monitorList
.
itemArr
.
indexOf
(
item
.
sn
)
>
-
1
&&
item
.
eLocateType
);
this
.
monitorList
.
count
&&
EventBus
.
$emit
(
'uiMap.monitor.draw'
,
drawData
,
this
.
autoOpenLastInfoWindow
);
this
.
monitorList
.
count
&&
if
(
this
.
autoOpenLastInfoWindow
){
EventBus
.
$emit
(
"uiMap.monitor.draw"
,
drawData
,
this
.
autoOpenLastInfoWindow
);
if
(
this
.
autoOpenLastInfoWindow
)
{
this
.
autoOpenLastInfoWindow
=
false
;
this
.
autoOpenLastInfoWindow
=
false
;
}
}
this
.
isSearching
=
false
;
this
.
isSearching
=
false
;
}
else
{
}
else
{
this
.
drawDoneCb
();
this
.
drawDoneCb
();
}
}
}
}
});
});
},
},
filterGpsBase
(
item
)
{
filterGpsBase
(
item
)
{
//item.bsLocation = {}
//item.bsLocation = {}
console
.
log
(
item
)
console
.
log
(
item
);
let
gpsLocation
=
item
.
gpsLocation
let
gpsLocation
=
item
.
gpsLocation
;
let
bsLocation
=
item
.
bsLocation
let
bsLocation
=
item
.
bsLocation
;
/* 如果基站,gps其中一个没数据,自动切换到另一个,如果都没有eLocateType为null */
/* 如果基站,gps其中一个没数据,自动切换到另一个,如果都没有eLocateType为null */
if
(
item
.
eLocateType
===
'gpsLocation'
&&
(
!
gpsLocation
||
!
gpsLocation
.
elng
||
!
gpsLocation
.
elat
)){
if
(
if
(
bsLocation
&&
bsLocation
.
elng
&&
bsLocation
.
elat
){
item
.
eLocateType
===
"gpsLocation"
&&
item
.
eLocateType
=
'bsLocation'
(
!
gpsLocation
||
!
gpsLocation
.
elng
||
!
gpsLocation
.
elat
)
}
else
{
)
{
item
.
eLocateType
=
null
if
(
bsLocation
&&
bsLocation
.
elng
&&
bsLocation
.
elat
)
{
}
item
.
eLocateType
=
"bsLocation"
;
}
else
if
(
item
.
eLocateType
===
'bsLocation'
&&
(
!
bsLocation
||
!
bsLocation
.
elng
||
!
bsLocation
.
elat
)){
}
else
{
if
(
gpsLocation
&&
gpsLocation
.
elng
&&
gpsLocation
.
elat
){
item
.
eLocateType
=
null
;
item
.
eLocateType
=
'gpsLocation'
}
}
else
{
}
else
if
(
item
.
eLocateType
=
null
item
.
eLocateType
===
"bsLocation"
&&
(
!
bsLocation
||
!
bsLocation
.
elng
||
!
bsLocation
.
elat
)
)
{
if
(
gpsLocation
&&
gpsLocation
.
elng
&&
gpsLocation
.
elat
)
{
item
.
eLocateType
=
"gpsLocation"
;
}
else
{
item
.
eLocateType
=
null
;
}
}
}
}
if
(
item
.
eLocateType
===
'gpsLocation'
&&
(
!
bsLocation
||
!
bsLocation
.
elng
||
!
bsLocation
.
elat
)){
if
(
item
.
eLocateSingle
=
true
item
.
eLocateType
===
"gpsLocation"
&&
}
else
if
(
item
.
eLocateType
===
'bsLocation'
&&
(
!
gpsLocation
||
!
gpsLocation
.
elng
||
!
gpsLocation
.
elat
)){
(
!
bsLocation
||
!
bsLocation
.
elng
||
!
bsLocation
.
elat
)
item
.
eLocateSingle
=
true
)
{
item
.
eLocateSingle
=
true
;
}
else
if
(
item
.
eLocateType
===
"bsLocation"
&&
(
!
gpsLocation
||
!
gpsLocation
.
elng
||
!
gpsLocation
.
elat
)
)
{
item
.
eLocateSingle
=
true
;
}
}
if
(
!
item
.
eLocateSingle
){
if
(
!
item
.
eLocateSingle
)
{
if
(
moment
(
gpsLocation
.
dateTime
).
format
(
'x'
)
>=
moment
(
bsLocation
.
dateTime
).
format
(
'x'
)){
if
(
item
.
eLocateType
=
'gpsLocation'
moment
(
gpsLocation
.
dateTime
).
format
(
"x"
)
>=
}
else
{
moment
(
bsLocation
.
dateTime
).
format
(
"x"
)
item
.
eLocateType
=
'bsLocation'
)
{
item
.
eLocateType
=
"gpsLocation"
;
}
else
{
item
.
eLocateType
=
"bsLocation"
;
}
}
// if(moment(gpsLocation.dateTime).isAfter(moment(bsLocation.dateTime))){
// if(moment(gpsLocation.dateTime).isAfter(moment(bsLocation.dateTime))){
// item.eLocateType = 'gpsLocation'
// item.eLocateType = 'gpsLocation'
...
@@ -918,14 +965,14 @@
...
@@ -918,14 +965,14 @@
// }
// }
}
}
return
item
return
item
;
},
},
errorUpload
(
err
)
{
errorUpload
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
);
//window.location.href = '../ots/login';
//window.location.href = '../ots/login';
},
},
drawDoneCb
()
{
drawDoneCb
()
{
console
.
log
(
'drawDoneCb'
)
console
.
log
(
"drawDoneCb"
);
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
/* let arr = [];
/* let arr = [];
for(let key in this.monitorList){
for(let key in this.monitorList){
...
@@ -934,72 +981,69 @@
...
@@ -934,72 +981,69 @@
}
}
} */
} */
this
.
_drawTimeoutId
=
setTimeout
(()
=>
{
this
.
_drawTimeoutId
=
setTimeout
(()
=>
{
this
.
getPositionData
()
this
.
getPositionData
();
},
10
*
1000
)
},
10
*
1000
);
},
},
terminate
()
{
terminate
()
{
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
},
},
openMapInfoWindow
(
sn
,
source
)
{
openMapInfoWindow
(
sn
,
source
)
{
EventBus
.
$emit
(
'uiMap.monitor.openInfoWindow'
,
`
${
sn
}
:
${
source
}
`
)
EventBus
.
$emit
(
"uiMap.monitor.openInfoWindow"
,
`
${
sn
}
:
${
source
}
`
);
},
},
downloadTpl
()
{
downloadTpl
()
{
exportExcel
(
'vehicle/downLoadImportSearchModel'
)
exportExcel
(
"vehicle/downLoadImportSearchModel"
);
},
},
changeELocate
(
item
)
{
changeELocate
(
item
)
{
this
.
monitorList
[
item
.
sn
].
eLocateType
=
item
.
eLocateType
this
.
monitorList
[
item
.
sn
].
eLocateType
=
item
.
eLocateType
;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
}
},
},
created
()
{
},
created
()
{
if
(
window
.
AMap
)
{
if
(
window
.
AMap
)
{
this
.
initMap
();
this
.
initMap
();
}
else
{
}
else
{
remoteLoad
(
`
${
CONSTANT
.
AMAP_URL
}
`
).
then
(()
=>
{
remoteLoad
(
`
${
CONSTANT
.
AMAP_URL
}
`
).
then
(()
=>
{
remoteLoad
(
`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`
).
then
(()
=>
{
remoteLoad
(
`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`
).
then
(
()
=>
{
this
.
initMap
();
this
.
initMap
();
})
}
})
);
});
}
}
this
.
keyupSubmit
();
this
.
keyupSubmit
();
EventBus
.
$on
(
'uiMap.monitor.drawDone'
,
this
.
drawDoneCb
);
EventBus
.
$on
(
"uiMap.monitor.drawDone"
,
this
.
drawDoneCb
);
EventBus
.
$on
(
'uiMap.monitor.changeELocate'
,
this
.
changeELocate
);
EventBus
.
$on
(
"uiMap.monitor.changeELocate"
,
this
.
changeELocate
);
EventBus
.
$on
(
'uiMap.monitor.terminate'
,
this
.
terminate
);
EventBus
.
$on
(
"uiMap.monitor.terminate"
,
this
.
terminate
);
this
.
getTreeData
()
this
.
getTreeData
();
},
},
beforeDestroy
()
{
beforeDestroy
()
{
EventBus
.
$emit
(
'uiMap.monitor.destroy'
);
EventBus
.
$emit
(
"uiMap.monitor.destroy"
);
EventBus
.
$off
(
'uiMap.monitor.drawDone'
,
this
.
drawDoneCb
);
EventBus
.
$off
(
"uiMap.monitor.drawDone"
,
this
.
drawDoneCb
);
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
this
.
_drawTimeoutId
&&
window
.
clearTimeout
(
this
.
_drawTimeoutId
);
this
.
checkLoadedTimeoutId
&&
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
this
.
checkLoadedTimeoutId
&&
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
},
},
components
:
{
components
:
{
MapControll
MapControll
,
}
},
}
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
/*样式写在 scss/monitor.scss*/
/*样式写在 scss/monitor.scss*/
.none_tip
{
.none_tip
{
align-self
:
center
;
align-self
:
center
;
font-size
:
12px
;
font-size
:
12px
;
color
:
red
;
color
:
red
;
padding
:
0
5px
;
padding
:
0
5px
;
}
}
</
style
>
</
style
>
<
style
>
<
style
>
.el-tree-node__content
{
.el-tree-node__content
{
height
:
auto
;
height
:
auto
;
padding
:
2px
;
padding
:
2px
;
}
}
.custom-tree-node
{
.custom-tree-node
{
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -1007,31 +1051,31 @@
...
@@ -1007,31 +1051,31 @@
font-size
:
12px
;
font-size
:
12px
;
padding-right
:
8px
;
padding-right
:
8px
;
line-height
:
26px
;
line-height
:
26px
;
}
}
.map-wrap
.el-tree-node
>
.el-tree-node__children
{
.map-wrap
.el-tree-node
>
.el-tree-node__children
{
overflow
:
visible
;
overflow
:
visible
;
}
}
.search_auto
{
.search_auto
{
font-size
:
12px
;
font-size
:
12px
;
}
}
.search_auto_hide
{
.search_auto_hide
{
display
:
none
;
display
:
none
;
}
}
.search_auto
.el-autocomplete-suggestion
li
{
.search_auto
.el-autocomplete-suggestion
li
{
padding
:
0
;
padding
:
0
;
}
}
.search_auto
.el-autocomplete-suggestion
li
div
{
.search_auto
.el-autocomplete-suggestion
li
div
{
line-height
:
20px
;
line-height
:
20px
;
}
}
.el-autocomplete-suggestion
li
{
.el-autocomplete-suggestion
li
{
border-bottom
:
1px
solid
#eee
;
border-bottom
:
1px
solid
#eee
;
padding-bottom
:
4px
;
padding-bottom
:
4px
;
}
}
.el-autocomplete-suggestion
li
:last-child
{
.el-autocomplete-suggestion
li
:last-child
{
border-bottom
:
none
;
border-bottom
:
none
;
}
}
.full-width
.main-wrap.full-width
{
.full-width
.main-wrap.full-width
{
left
:
0
;
left
:
0
;
width
:
100%
;
width
:
100%
;
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment