Commit b77aceea authored by Administrator's avatar Administrator

地图模式-003

parent 0ff24cac
......@@ -370,10 +370,19 @@ class DevicesController extends Controller
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)
......
import request from '@/utils/request';
export function devices() {
export function devices(query) {
return request({
url: '/devices/deviceLocation',
method: 'get',
params: query,
});
}
......
......@@ -18,7 +18,7 @@
:content="marker.nickname | rebuildContent(marker.UserDaviceNum, marker.police)"
:vid="index"
:clickable="true"
:events="rebuildEvent(marker.mapcenter)"
:events="rebuildEvent(marker)"
:z-index="markerUserZIndex"
></el-amap-marker>
<el-amap-circle-marker
......@@ -121,11 +121,17 @@ export default {
return mcontent;
},
rebuildUserCenter(mapcenter) {
if (mapcenter === null) {
return '';
}
mapcenter = mapcenter.replace(/\s*/g, '');
// console.log(mapcenter.split(','));
return mapcenter.split(',');
},
deviceLocationFilter(center) {
if (center === null) {
return '';
}
center = center.replace(/\s*/g, '');
return center.split(',');
},
......@@ -214,7 +220,7 @@ export default {
console.log(res.data);
this.markers = res.data;
});
devices()
devices({})
.then(res => {
console.log(res.data);
this.markersDevice = res.data;
......@@ -232,8 +238,8 @@ export default {
console.log(device);
alert('deviceInfo');
},
rebuildEvent(mapcenter) {
mapcenter = mapcenter.replace(/\s*/g, '');
rebuildEvent(marker) {
var mapcenter = marker.mapcenter.replace(/\s*/g, '');
// console.log(mapcenter);
const that = this;
const position = mapcenter.split(',');
......@@ -243,6 +249,7 @@ export default {
that.getUserDevices(position);
that.deviceListVisible = true;
that.markerUserZIndex = 1000;
that.getUserDeviceList(marker.id);
},
};
},
......@@ -267,6 +274,14 @@ export default {
},
};
},
// 获取单个用户下的设备
getUserDeviceList(uid) {
devices({ uid: uid })
.then(res => {
console.log(res.data);
this.markersDevice = res.data;
});
},
},
};
</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