Commit b77aceea authored by Administrator's avatar Administrator

地图模式-003

parent 0ff24cac
...@@ -370,10 +370,19 @@ class DevicesController extends Controller ...@@ -370,10 +370,19 @@ class DevicesController extends Controller
return $this->jsonSuccessData(DB::table('device_type')->where('tid', '=', $id)->delete()); return $this->jsonSuccessData(DB::table('device_type')->where('tid', '=', $id)->delete());
} }
public function deviceLocation() public function deviceLocation(Request $request)
{ {
$where = [];
if($request->has('uid')) {
$user_id = $request->get('uid');
$where['uid'] = $user_id;
}
$data = DB::table('device')
->select('id','uid','nd','deviceinfo','devicenum','devicecoord','devicepolice','deviceremark','devicelinkman')
->where($where)
->get();
//返回用户安装位置 //返回用户安装位置
return $this->jsonSuccessData(DB::table('device')->select('id','uid','nd','deviceinfo','devicenum','devicecoord','devicepolice','deviceremark','devicelinkman')->get()); return $this->jsonSuccessData($data);
} }
//返回消防监测 //返回消防监测
public function control(Request $request) public function control(Request $request)
......
import request from '@/utils/request'; import request from '@/utils/request';
export function devices() { export function devices(query) {
return request({ return request({
url: '/devices/deviceLocation', url: '/devices/deviceLocation',
method: 'get', method: 'get',
params: query,
}); });
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
:content="marker.nickname | rebuildContent(marker.UserDaviceNum, marker.police)" :content="marker.nickname | rebuildContent(marker.UserDaviceNum, marker.police)"
:vid="index" :vid="index"
:clickable="true" :clickable="true"
:events="rebuildEvent(marker.mapcenter)" :events="rebuildEvent(marker)"
:z-index="markerUserZIndex" :z-index="markerUserZIndex"
></el-amap-marker> ></el-amap-marker>
<el-amap-circle-marker <el-amap-circle-marker
...@@ -121,11 +121,17 @@ export default { ...@@ -121,11 +121,17 @@ export default {
return mcontent; return mcontent;
}, },
rebuildUserCenter(mapcenter) { rebuildUserCenter(mapcenter) {
if (mapcenter === null) {
return '';
}
mapcenter = mapcenter.replace(/\s*/g, ''); mapcenter = mapcenter.replace(/\s*/g, '');
// console.log(mapcenter.split(',')); // console.log(mapcenter.split(','));
return mapcenter.split(','); return mapcenter.split(',');
}, },
deviceLocationFilter(center) { deviceLocationFilter(center) {
if (center === null) {
return '';
}
center = center.replace(/\s*/g, ''); center = center.replace(/\s*/g, '');
return center.split(','); return center.split(',');
}, },
...@@ -214,7 +220,7 @@ export default { ...@@ -214,7 +220,7 @@ export default {
console.log(res.data); console.log(res.data);
this.markers = res.data; this.markers = res.data;
}); });
devices() devices({})
.then(res => { .then(res => {
console.log(res.data); console.log(res.data);
this.markersDevice = res.data; this.markersDevice = res.data;
...@@ -232,8 +238,8 @@ export default { ...@@ -232,8 +238,8 @@ export default {
console.log(device); console.log(device);
alert('deviceInfo'); alert('deviceInfo');
}, },
rebuildEvent(mapcenter) { rebuildEvent(marker) {
mapcenter = mapcenter.replace(/\s*/g, ''); var mapcenter = marker.mapcenter.replace(/\s*/g, '');
// console.log(mapcenter); // console.log(mapcenter);
const that = this; const that = this;
const position = mapcenter.split(','); const position = mapcenter.split(',');
...@@ -243,6 +249,7 @@ export default { ...@@ -243,6 +249,7 @@ export default {
that.getUserDevices(position); that.getUserDevices(position);
that.deviceListVisible = true; that.deviceListVisible = true;
that.markerUserZIndex = 1000; that.markerUserZIndex = 1000;
that.getUserDeviceList(marker.id);
}, },
}; };
}, },
...@@ -267,6 +274,14 @@ export default { ...@@ -267,6 +274,14 @@ export default {
}, },
}; };
}, },
// 获取单个用户下的设备
getUserDeviceList(uid) {
devices({ uid: uid })
.then(res => {
console.log(res.data);
this.markersDevice = res.data;
});
},
}, },
}; };
</script> </script>
......
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