Commit 50418844 authored by Administrator's avatar Administrator

更新地图,隐患设备,应急物资

parent 76f69fed
......@@ -502,6 +502,10 @@ class DevicesController extends Controller
$user_id = $request->get('uid');
$where['device.uid'] = $user_id;
}
if ($request->has('devicestatus')) {
$devicestatus = $request->get('devicestatus');
$where['device.devicestatus'] = $devicestatus;
}
$data = DB::table('device')
->join('status as s', 'device.devicepolice', '=', 's.id')
->select('device.id', 'device.uid', 'device.nd', 'device.deviceinfo', 'device.devicenum', 'device.devicecoord', 'device.devicepolice', 'device.deviceremark', 'device.devicelinkman', 's.status_name')
......
......@@ -35,10 +35,28 @@
:events="markerClickEvent(marker)"
:check="playAudio(marker.devicepolice)"
></el-amap-circle-marker>
<!-- 应急物资 -->
<el-amap-marker
v-for="(marker, index) in markersGoods"
:key="marker.id+'wz'"
:position="marker.mapcenter | rebuildUserCenter(marker.mapcenter)"
:visible="markersGoodsVisible"
:content="marker.name | rebuildGoodsContent(marker.total, marker.color)"
:vid="index"
:clickable="true"
:events="checkPermission(['manage isadmin']) ? rebuildGoodsEvent(marker) : ''"
:z-index="markerUserZIndex"
></el-amap-marker>
<!-- 右上角设备和用户切换按钮 -->
<div class="toolbar">
<el-button v-if="leftDeviceName != '全部设备' " type="primary" size="mini" round @click="allDevices">全部设备</el-button>
<el-button type="primary" size="mini" round @click="allDevices">全部设备</el-button>
<!-- <el-button v-if="checkPermission(['manage device'])" type="primary" size="mini" round @click="allDevices">全部设备</el-button> -->
<el-button type="primary" size="mini" round @click="getDangerDeviceList">隐患设备</el-button>
<el-switch
v-model="markersGoodsVisible"
active-text="应急物资"
>
</el-switch>
<el-switch
v-model="markersDeviceVisible"
active-text="设备"
......@@ -139,6 +157,11 @@ VueAMap.initAMapApiLoader({
export default {
filters: {
rebuildGoodsContent(name, count, color) {
let mcontent = '<div class="mapIcon"><span class="mapIcon_title">%name</span><span class="mapIcon_num_all" style="background-color:%color">%num</span></div>';
mcontent = mcontent.replace(/%name/, name).replace(/%num/, count).replace(/%color/, color);
return mcontent;
},
rebuildContent(company, deviceCount, alarmCount) {
let mcontent = '<div class="mapIcon"><span class="mapIcon_title">%name</span><span class="mapIcon_num_all">%num</span><span class="mapIcon_num">%alarm</span></div>';
mcontent = mcontent.replace(/%name/, company).replace(/%num/, deviceCount).replace(/%alarm/, alarmCount);
......@@ -186,6 +209,20 @@ export default {
data(){
const _this = this;
return {
markersGoodsVisible: false,
markersGoods: [{
id: 1,
mapcenter: '114.209927,38.224691',
name: '应急物资1',
total: 200,
color: '#23e610',
}, {
id: 2,
mapcenter: '114.209927,38.221291',
name: '应急物资2',
total: 20,
color: '#dd000e',
}],
audio: new Audio('/audio/alarm.wav'),
audio_play: false,
intervalId: null,
......@@ -268,6 +305,8 @@ export default {
this.leftDeviceName = '全部设备';
this.markersDevice = res.data;
this.zoom = 6;
this.markersDeviceVisible = true;
this.markerVisible = false;
});
},
getUserDevices(center) {
......@@ -292,6 +331,18 @@ export default {
},
};
},
// 应急物资
rebuildGoodsEvent(marker) {
var mapcenter = marker.mapcenter.replace(/\s*/g, '');
const that = this;
const position = mapcenter.split(',');
return {
click(e) {
that.zoom = 15;
that.center = position;
},
};
},
markerClickEvent(marker) {
const that = this;
return {
......@@ -310,6 +361,18 @@ export default {
});
this.dataRefresh(uid);
},
// 获取隐患设备
getDangerDeviceList() {
// 停止定时器
this.clearIntv();
devices({ devicestatus: 7 })
.then(res => {
this.markersDevice = res.data;
this.markersDeviceVisible = true;
this.markerVisible = false;
});
// this.dataRefresh();
},
// 获取设备详细信息
getUserDeviceInfo(id) {
deviceinfo(id)
......@@ -507,7 +570,7 @@ export default {
.toolbar{
position: fixed;
top: 120px;
right: 40px;
right: 100px;
}
.zero-user-devices{
position: fixed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment