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 6f07b14d
authored
Mar 29, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
dd69f937
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
81 deletions
src/assets/scss/zoneCar.scss
src/pages/monitor/zoneCar.vue
src/utils/mapService.js
src/assets/scss/zoneCar.scss
View file @
6f07b14
...
@@ -298,4 +298,7 @@
...
@@ -298,4 +298,7 @@
height
:
16px
;
height
:
16px
;
margin-left
:
4px
;
margin-left
:
4px
;
}
}
}
.draw_area
{
margin-top
:
10px
;
}
}
\ No newline at end of file
\ No newline at end of file
src/pages/monitor/zoneCar.vue
View file @
6f07b14
...
@@ -7,11 +7,11 @@
...
@@ -7,11 +7,11 @@
class=
"map-container"
class=
"map-container"
v-loading=
"mapLoading"
v-loading=
"mapLoading"
></div>
></div>
<div
class=
"row_box_hide"
v-
if
=
"hideRowBox"
@
click=
"onShow"
>
<div
class=
"row_box_hide"
v-
show
=
"hideRowBox"
@
click=
"onShow"
>
<glsx-image
src=
"car.png"
class=
"img img_normal"
/>
<glsx-image
src=
"car.png"
class=
"img img_normal"
/>
<glsx-image
src=
"car_hover.png"
class=
"img img_hover"
/>
<glsx-image
src=
"car_hover.png"
class=
"img img_hover"
/>
</div>
</div>
<div
class=
"row_box"
v-
else
>
<div
class=
"row_box"
v-
show=
"!hideRowBox"
>
<div
class=
"hide_icon"
@
click=
"onShow"
>
<div
class=
"hide_icon"
@
click=
"onShow"
>
<glsx-image
src=
"hide.png"
class=
"img"
/>
<glsx-image
src=
"hide.png"
class=
"img"
/>
</div>
</div>
...
@@ -30,8 +30,10 @@
...
@@ -30,8 +30,10 @@
<el-form
<el-form
ref=
"form"
ref=
"form"
:model=
"form"
:model=
"form"
:rules=
"formRules"
class=
"el_form"
class=
"el_form"
label-position=
"top"
label-position=
"top"
hide-required-asterisk
>
>
<div
v-show=
"menuId == 1"
>
<div
v-show=
"menuId == 1"
>
<el-form-item
label=
"详细地址"
>
<el-form-item
label=
"详细地址"
>
...
@@ -44,7 +46,7 @@
...
@@ -44,7 +46,7 @@
</el-form-item>
</el-form-item>
</div>
</div>
<div
v-show=
"menuId == 2"
>
<div
v-show=
"menuId == 2"
>
<el-form-item
label=
"设备号"
>
<el-form-item
label=
"设备号"
prop=
"sn"
>
<div
class=
"device_label"
slot=
"label"
>
<div
class=
"device_label"
slot=
"label"
>
<span>
设备号
</span>
<span>
设备号
</span>
<!--
<el-tooltip
<!--
<el-tooltip
...
@@ -71,14 +73,18 @@
...
@@ -71,14 +73,18 @@
maxlength=
"50"
maxlength=
"50"
placeholder=
"请输入您要查询的设备号"
placeholder=
"请输入您要查询的设备号"
/>
/>
<el-button
type=
"primary"
class=
"btn"
@
click=
"getLocation"
<el-button
type=
"primary"
class=
"btn"
:disabled=
"!form.sn"
@
click=
"getLocation"
>
搜索
</el-button
>
搜索
</el-button
>
>
</div>
</div>
</el-form-item>
</el-form-item>
</div>
</div>
<el-form-item
label=
""
>
<el-form-item
label=
""
>
<div>
<div
class=
"draw_area"
>
<el-button
class=
"area_btn"
@
click=
"chooseArea"
<el-button
class=
"area_btn"
@
click=
"chooseArea"
>
划定区域
</el-button
>
划定区域
</el-button
>
>
...
@@ -120,10 +126,7 @@
...
@@ -120,10 +126,7 @@
<span>
已查询到设备共计
</span>
<span>
已查询到设备共计
</span>
<span
class=
"cred"
>
{{
deviceList
.
length
}}
</span>
<span
class=
"cred"
>
{{
deviceList
.
length
}}
</span>
<span>
条
</span>
<span>
条
</span>
<el-button
<el-button
class=
"btn"
:loading=
"dloading"
@
click=
"downloadExcel"
class=
"btn"
:loading=
"dloading"
@
click=
"downloadExcel"
>
导出
</el-button
>
导出
</el-button
>
>
</div>
</div>
...
@@ -155,20 +158,15 @@ import mapService from "@/utils/mapService.js";
...
@@ -155,20 +158,15 @@ import mapService from "@/utils/mapService.js";
import
"@/utils/mapEvent.js"
;
import
"@/utils/mapEvent.js"
;
import
AMapLoader
from
"@amap/amap-jsapi-loader"
;
import
AMapLoader
from
"@amap/amap-jsapi-loader"
;
import
{
CONSTANT
}
from
"@/constant"
;
import
{
CONSTANT
}
from
"@/constant"
;
import
CitySelect
from
"@/components/area"
;
import
{
import
{
GER_REGIONAL_SEARCH
,
GER_REGIONAL_SEARCH
,
GER_REGIONAL_EXPORT
,
GER_REGIONAL_EXPORT
,
GER_REGIONAL_LOCATION
GER_REGIONAL_LOCATION
,
}
from
"@/api/services/zooneCar"
;
}
from
"@/api/services/zooneCar"
;
// import { GET_DEVICEINFO_BYSNS } from "@/api/services/monitor";
import
EventBus
from
"@/event-bus"
;
import
EventBus
from
"@/event-bus"
;
import
{
showToast
,
deepClone
}
from
"@/utils/utils.js"
;
import
{
showToast
,
deepClone
}
from
"@/utils/utils.js"
;
import
{
Validator
}
from
"@/common/validator"
;
import
{
Validator
,
CHECK_NUMBER
}
from
"@/common/validator"
;
export
default
{
export
default
{
components
:
{
CitySelect
,
},
data
()
{
data
()
{
return
{
return
{
menus
:
[
menus
:
[
...
@@ -179,6 +177,12 @@ export default {
...
@@ -179,6 +177,12 @@ export default {
map
:
null
,
map
:
null
,
mapLoading
:
true
,
mapLoading
:
true
,
form
:
{},
form
:
{},
formRules
:
{
sn
:
[
{
required
:
true
,
message
:
"请输入设备号"
,
trigger
:
"blur"
},
{
validator
:
CHECK_NUMBER
,
trigger
:
"blur"
},
],
},
rectangle
:
null
,
rectangle
:
null
,
rectangleEditor
:
null
,
rectangleEditor
:
null
,
rectangleWidth
:
0
,
// 矩形宽度
rectangleWidth
:
0
,
// 矩形宽度
...
@@ -207,6 +211,8 @@ export default {
...
@@ -207,6 +211,8 @@ export default {
drawDone
:
false
,
drawDone
:
false
,
location
:
{},
// 设备维度查询的位置点
location
:
{},
// 设备维度查询的位置点
autoCenterMarker
:
null
,
autoCenterMarker
:
null
,
mouseTool
:
null
,
mapMass
:
null
};
};
},
},
mounted
()
{
mounted
()
{
...
@@ -222,6 +228,8 @@ export default {
...
@@ -222,6 +228,8 @@ export default {
"AMap.LabelsLayer"
,
"AMap.LabelsLayer"
,
"AMap.LabelMarker"
,
"AMap.LabelMarker"
,
"AMap.AutoComplete"
,
"AMap.AutoComplete"
,
"AMap.MassMarks"
,
"AMap.MarkerCluster"
,
]);
]);
if
(
window
.
AMap
)
{
if
(
window
.
AMap
)
{
window
.
AMap
=
null
;
window
.
AMap
=
null
;
...
@@ -251,7 +259,7 @@ export default {
...
@@ -251,7 +259,7 @@ export default {
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
window
.
location
.
reload
();
//
window.location.reload();
});
});
},
},
...
@@ -266,6 +274,11 @@ export default {
...
@@ -266,6 +274,11 @@ export default {
});
});
return
false
;
return
false
;
}
}
if
(
_this
.
mouseTool
)
{
return
false
;
}
console
.
log
(
_zoom
);
console
.
log
(
_zoom
);
if
(
_zoom
<
13
)
{
if
(
_zoom
<
13
)
{
_this
.
map
.
setZoom
(
13
);
_this
.
map
.
setZoom
(
13
);
...
@@ -287,6 +300,7 @@ export default {
...
@@ -287,6 +300,7 @@ export default {
_this
.
rectangle
=
rectangle
;
_this
.
rectangle
=
rectangle
;
_this
.
calculateWidthHeight
(
rectangle
.
getOptions
().
bounds
);
_this
.
calculateWidthHeight
(
rectangle
.
getOptions
().
bounds
);
});
});
_this
.
mouseTool
=
mouseTool
;
},
},
// 计算矩形宽度、高度
// 计算矩形宽度、高度
...
@@ -332,6 +346,7 @@ export default {
...
@@ -332,6 +346,7 @@ export default {
this
.
rectangleWidth
=
0
;
this
.
rectangleWidth
=
0
;
this
.
form
=
{};
this
.
form
=
{};
this
.
deviceList
=
[];
this
.
deviceList
=
[];
this
.
mouseTool
=
null
;
},
},
// 展开
// 展开
...
@@ -409,7 +424,7 @@ export default {
...
@@ -409,7 +424,7 @@ export default {
});
});
return
false
;
return
false
;
}
}
this
.
dloading
=
true
;
this
.
dloading
=
true
;
let
res
=
await
GER_REGIONAL_EXPORT
(
params
);
let
res
=
await
GER_REGIONAL_EXPORT
(
params
);
this
.
dloading
=
false
;
this
.
dloading
=
false
;
...
@@ -437,48 +452,58 @@ export default {
...
@@ -437,48 +452,58 @@ export default {
// 切换类型
// 切换类型
menuEvent
(
row
)
{
menuEvent
(
row
)
{
this
.
menuId
=
row
.
id
;
this
.
menuId
=
row
.
id
;
this
.
$refs
.
form
.
clearValidate
(
'sn'
)
},
},
// 设备号查车
// 设备号查车
async
getLocation
()
{
getLocation
()
{
let
_this
=
this
;
let
params
=
{};
let
params
=
{};
this
.
clearMap
();
this
.
clearMap
();
if
(
!
Validator
.
ISDECIMAL
.
test
(
this
.
form
.
sn
))
{
showToast
({
message
:
"设备号必须为纯数字"
,
});
return
false
;
}
params
.
sns
=
this
.
form
.
sn
;
params
.
sns
=
this
.
form
.
sn
;
params
.
deviceCode
=
"gps"
;
params
.
deviceCode
=
"gps"
;
let
res
=
await
GER_REGIONAL_LOCATION
(
params
);
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
let
list
=
res
.
data
||
[];
if
(
!
valid
)
{
if
(
list
.
length
<=
0
)
{
return
false
;
showToast
({
}
message
:
"暂无车辆"
,
GER_REGIONAL_LOCATION
(
params
).
then
((
res
)
=>
{
let
list
=
res
.
data
||
[];
if
(
list
.
length
<=
0
)
{
showToast
({
message
:
"暂无车辆"
,
});
return
false
;
}
let
arr
=
[];
list
.
forEach
((
item
)
=>
{
let
o
=
deepClone
(
item
||
{});
let
m
=
o
.
gpsLocation
||
{};
o
.
lng
=
m
.
elng
;
o
.
lat
=
m
.
elat
;
o
.
address
=
m
.
address
;
o
.
type
=
2
;
o
.
time
=
m
.
dateTime
;
o
.
standNo
=
item
.
standNo
||
item
.
vin
;
o
.
isSource
=
item
.
source
;
arr
.
push
(
o
);
_this
.
location
=
o
;
});
_this
.
addMarkers
(
arr
);
});
});
return
false
;
}
let
arr
=
[];
list
.
forEach
((
item
)
=>
{
let
o
=
deepClone
(
item
||
{});
let
m
=
o
.
gpsLocation
||
{};
o
.
lng
=
m
.
elng
;
o
.
lat
=
m
.
elat
;
o
.
address
=
m
.
address
;
o
.
type
=
2
;
o
.
time
=
m
.
dateTime
;
o
.
standNo
=
item
.
standNo
||
item
.
vin
;
o
.
isSource
=
item
.
source
;
arr
.
push
(
o
);
// this.autoOpenLastInfoWindow = true;
// if (this.autoOpenLastInfoWindow) {
// this.autoOpenLastInfoWindow = false;
// }
//this.addLocation(o, this.autoOpenLastInfoWindow);
this
.
location
=
o
;
});
});
this
.
addMarkers
(
arr
);
// if (!this.form.sn) {
// showToast({
// message: "请输入设备号",
// });
// return false;
// }
// if (!Validator.ISDECIMAL.test(this.form.sn)) {
// showToast({
// message: "设备号必须为纯数字",
// });
// return false;
// }
},
},
// 区域查车
// 区域查车
...
@@ -494,6 +519,10 @@ export default {
...
@@ -494,6 +519,10 @@ export default {
}
}
_this
.
deviceList
=
[];
_this
.
deviceList
=
[];
if
(
_this
.
mapMass
){
_this
.
mapMass
.
clear
()
_this
.
mapMass
=
null
;
}
_this
.
loading
=
true
;
_this
.
loading
=
true
;
let
res
=
await
GER_REGIONAL_SEARCH
(
params
);
let
res
=
await
GER_REGIONAL_SEARCH
(
params
);
...
@@ -515,49 +544,115 @@ export default {
...
@@ -515,49 +544,115 @@ export default {
EventBus
.
$emit
(
"uiMap.fence.drawDistrict"
,
areaCode
);
EventBus
.
$emit
(
"uiMap.fence.drawDistrict"
,
areaCode
);
},
},
// 添加海量点
// 添加海量点 聚合点方式
// addMarkers3(arr) {
// let _this = this;
// let markers = [];
// let icon = {
// url: require("images/icon_car.png"),
// size: new AMap.Size(24, 15),
// offset: new AMap.Pixel(4, 4),
// };
// let renderMarker = function (context) {
// console.log(context.data);
// var content = '<div style="background-color: hsla(180, 100%, 50%, 0.3); height: 18px; width: 18px; border: 1px solid hsl(180, 100%, 40%); border-radius: 12px; box-shadow: hsl(180, 100%, 50%) 0px 0px 3px;"></div>';
// //context.marker.setIcon(require("images/icon_car.png"))
// context.marker.setContent(content)
// context.marker.setSize(24,15);
// // let m = new AMap.Marker({
// // icon: require("images/icon_car.png"),
// // position: context.data[0].lnglat,
// // });
// };
// for (let i = 0, len = arr.length; i < len; i++) {
// let k = arr[i];
// k.lnglat = [k.lng, k.lat];
// markers.push(k);
// }
// let params = {
// gridSize: 60,
// renderMarker: renderMarker,
// };
// let cluster = new AMap.MarkerCluster(_this.map, markers, params);
// },
// 添加海量点 (MassMarks方式)
addMarkers
(
arr
)
{
addMarkers
(
arr
)
{
console
.
log
(
arr
);
let
_this
=
this
;
let
_this
=
this
;
let
markers
=
[];
let
markers
=
[];
let
icon
=
{
let
icon
=
{
type
:
"image"
,
type
:
"image"
,
image
:
require
(
"images/icon_car.png"
),
url
:
require
(
"images/icon_car.png"
),
size
:
[
24
,
15
],
size
:
[
24
,
15
],
anchor
:
"bottom-center"
,
anchor
:
new
AMap
.
Pixel
(
4
,
4
)
,
};
};
this
.
drawDone
=
false
;
var
layer
=
new
AMap
.
LabelsLayer
({
zooms
:
[
0
,
20
],
zIndex
:
1000
,
collision
:
false
,
});
this
.
map
.
add
(
layer
);
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
let
k
=
arr
[
i
];
let
k
=
arr
[
i
];
let
curData
=
{
k
.
lnglat
=
[
k
.
lng
,
k
.
lat
];
position
:
[
k
.
lng
,
k
.
lat
],
markers
.
push
(
k
);
icon
,
extData
:
k
,
};
let
labelMarker
=
new
AMap
.
LabelMarker
(
curData
);
labelMarker
.
on
(
"click"
,
function
(
e
)
{
console
.
log
(
labelMarker
.
getExtData
());
let
_position
=
labelMarker
.
getExtData
();
let
infoWindow
=
mapService
.
createAraeInfowindow
(
_position
);
infoWindow
.
open
(
_this
.
map
);
});
markers
.
push
(
labelMarker
);
}
}
var
mass
=
new
AMap
.
MassMarks
(
markers
,
{
layer
.
add
(
markers
);
opacity
:
0.8
,
zIndex
:
111
,
console
.
log
(
"画点结束"
,
new
Date
().
getTime
());
cursor
:
"pointer"
,
style
:
icon
,
alwaysRender
:
false
,
});
mass
.
on
(
"click"
,
function
(
e
)
{
console
.
log
(
e
);
let
infoWindow
=
mapService
.
createAraeInfowindow
(
e
.
data
);
infoWindow
.
open
(
_this
.
map
);
});
mass
.
setMap
(
_this
.
map
);
this
.
drawDone
=
true
;
this
.
drawDone
=
true
;
this
.
map
.
setFitView
();
this
.
map
.
setFitView
();
this
.
mapMass
=
mass
;
},
},
// 添加海量点 标记点方式
// addMarkers2(arr) {
// console.log(arr);
// let _this = this;
// let markers = [];
// let icon = {
// type: "image",
// image: require("images/icon_car.png"),
// size: [24, 15],
// anchor: "bottom-center",
// };
// this.drawDone = false;
// var layer = new AMap.LabelsLayer({
// zooms: [13, 20],
// zIndex: 1000,
// collision: true,
// });
// this.map.add(layer);
// for (let i = 0, len = arr.length; i < len; i++) {
// let k = arr[i];
// let curData = {
// position: [k.lng, k.lat],
// icon,
// extData: k,
// };
// let labelMarker = new AMap.LabelMarker(curData);
// labelMarker.on("click", function (e) {
// console.log(labelMarker.getExtData());
// let _position = labelMarker.getExtData();
// let infoWindow = mapService.createAraeInfowindow(_position);
// infoWindow.open(_this.map);
// });
// markers.push(labelMarker);
// }
// layer.add(markers);
// console.log("画点结束", new Date().getTime());
// //this.drawDone = true;
// //this.map.setFitView();
// },
},
},
};
};
</
script
>
</
script
>
...
...
src/utils/mapService.js
View file @
6f07b14
...
@@ -864,7 +864,7 @@ MapService.prototype = {
...
@@ -864,7 +864,7 @@ MapService.prototype = {
createAraeInfowindow
(
info
){
createAraeInfowindow
(
info
){
let
_div
=
`<h3 class="map-infowindow-title">
${
info
.
ownerName
||
'--'
}
/
${
info
.
vin
||
'--'
}
</h3>
let
_div
=
`<h3 class="map-infowindow-title">
${
info
.
ownerName
||
'--'
}
/
${
info
.
vin
||
'--'
}
</h3>
<div class="map-infowindow-ct">
<div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号:<span class="des">
${
info
.
sn
||
'--'
}
(
${
info
.
sourc
c
Str
||
'--'
}
)</span>
<p><i class="icon icon-info_device"></i> 设备号:<span class="des">
${
info
.
sn
||
'--'
}
(
${
info
.
sourc
e
Str
||
'--'
}
)</span>
<span class="battery" data-battery style="display:
${
info
.
battery
?
'block'
:
'none'
}
">
<span class="battery" data-battery style="display:
${
info
.
battery
?
'block'
:
'none'
}
">
<i class="fill"><i class="fill-percentage" data-battery-percentage style="width:
${
info
.
battery
}
%;"></i></i>
<i class="fill"><i class="fill-percentage" data-battery-percentage style="width:
${
info
.
battery
}
%;"></i></i>
<i class="icon icon-battery_enough"></i>
<i class="icon icon-battery_enough"></i>
...
...
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