This commit is contained in:
tx 2024-08-16 18:05:45 +08:00
parent 5bd18b982a
commit 21081b8618
6 changed files with 62 additions and 26 deletions

View File

@ -5,8 +5,8 @@ VUE_APP_TITLE = 共享电动车管理系统
ENV = 'development' ENV = 'development'
# 共享电动车管理系统/开发环境 # 共享电动车管理系统/开发环境
# VUE_APP_BASE_API = 'https://dche.ccttiot.com/prod-api' VUE_APP_BASE_API = 'https://dche.ccttiot.com/prod-api'
VUE_APP_BASE_API = 'http://192.168.2.75:8088' # VUE_APP_BASE_API = 'http://192.168.2.75:8088'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -139,4 +139,11 @@ export function getDeviceBySn(sn){
method: 'get' method: 'get'
}) })
} }
// 根据运营区id查询设备
export function getDeviceLists(areaId){
return request({
url: '/app/allVehicleByArea?areaId='+areaId,
method: 'get'
})
}

View File

@ -13,6 +13,7 @@ import { debounce } from '@/utils'
import AreaTextSelect from '@/components/AreaTextSelect/index.vue' import AreaTextSelect from '@/components/AreaTextSelect/index.vue'
import { getArea } from '@/api/system/area' import { getArea } from '@/api/system/area'
import { listParking } from '@/api/system/parking' import { listParking } from '@/api/system/parking'
import { getDeviceBySn } from '@/api/system/device'
export default { export default {
name: "LocationMap", name: "LocationMap",
components: { AreaTextSelect }, components: { AreaTextSelect },
@ -45,10 +46,7 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
areaId: {
type: Number,
default: ''
},
}, },
data() { data() {
return { return {
@ -68,11 +66,18 @@ export default {
noParkingList:[], noParkingList:[],
noridingList:[], noridingList:[],
labels: [], labels: [],
areaId:''
} }
}, },
mounted() { mounted() {
// this.initAMap(); // this.initAMap();
this.getAreas(this.areaId) // this.getAreas(this.areaId)
getDeviceBySn(this.deviceSn).then(response => {
this.areaId=response.data.areaId
console.log(response,'responseresponse');
this.getAreas(this.areaId)
});
}, },
beforeDestroy() { beforeDestroy() {
console.log("轨迹=====组件将被销毁"); console.log("轨迹=====组件将被销毁");

View File

@ -37,6 +37,7 @@
placeholder="请选择运营商" placeholder="请选择运营商"
/> />
</el-form-item> </el-form-item>
<!-- <div class="text" style="color:red;">该运营商没设置收费方式将无法保存数据请返回运营管理设置收费方式</div> -->
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item

View File

@ -28,8 +28,8 @@
</router-link> </router-link>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="editArea2" <!-- <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="editArea2"
v-hasPermi="['system:area:edit']">修改</el-button> v-hasPermi="['system:area:edit']">修改</el-button> -->
<!-- <el-button <!-- <el-button
type="success" type="success"
plain plain

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="container"> <div class="container">
<div id="container" @click="handleInfoWindowClick"></div> <div id="container" @click="handleInfoWindowClick" v-if="showmap"></div>
<div class="tips"> <div class="tips">
<div class="tip-item"> <div class="tip-item">
<img :src="icons.blue" alt="蓝色"> <img :src="icons.blue" alt="蓝色">
@ -102,7 +102,7 @@
<script> <script>
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import globalConfig from "@/utils/config/globalConfig"; import globalConfig from "@/utils/config/globalConfig";
import { getDevice, listDevice } from '@/api/system/device' import { getDevice, listDevice,getDeviceLists} from '@/api/system/device'
import { listArea, optionselect as getAreaOptionselect } from '@/api/system/area' import { listArea, optionselect as getAreaOptionselect } from '@/api/system/area'
import { listParking } from '@/api/system/parking' import { listParking } from '@/api/system/parking'
import LocationMap from '@/components/Map/location/LocationMap' import LocationMap from '@/components/Map/location/LocationMap'
@ -166,7 +166,7 @@ export default {
open2: false, open2: false,
// //
form: {}, form: {},
areaId: null, areaId: 14,
areaOptions: [], areaOptions: [],
infoWindow: null, infoWindow: null,
// //
@ -175,7 +175,8 @@ export default {
parkingList: [], parkingList: [],
noParkingList: [], noParkingList: [],
noridingList: [], noridingList: [],
type: null type: null,
showmap:true,
} }
}, },
mounted() { mounted() {
@ -188,10 +189,25 @@ export default {
this.map?.destroy(); this.map?.destroy();
}, },
methods: { methods: {
handleAreaChange(newAreaId) { async handleAreaChange(newAreaId) {
console.log('newAreaId:', newAreaId); console.log('newAreaId:', newAreaId);
this.areaId = newAreaId;
this.getAreaList(this.areaId); // areaId
this.areaId = newAreaId;
this.onDeviceList = [];
this.parkingList = [];
this.noParkingList = [];
this.noridingList = [];
this.deviceList=[]
//
// if (this.map) {
// this.map.destroy();
// this.map = null;
// }
this.showmap=false
//
await this.getAreaList(this.areaId);
}, },
getAreaOptions() { getAreaOptions() {
getAreaOptionselect().then(response => { getAreaOptionselect().then(response => {
@ -257,10 +273,10 @@ export default {
if (this.areaList.length > 0) { // if (this.areaList.length > 0) { //
const firstArea = this.areaList[0]; // const firstArea = this.areaList[0]; //
this.area = firstArea; this.area = firstArea;
console.log('第一个区域的信息:', firstArea); // console.log(':', firstArea);
this.lon = firstArea.longitude; this.lon = firstArea.longitude;
this.lat = firstArea.latitude; this.lat = firstArea.latitude;
console.log("area=============" + JSON.stringify(this.area)) // console.log("area=============" + JSON.stringify(this.area))
listParking({ areaId: this.area.areaId }).then(response => { listParking({ areaId: this.area.areaId }).then(response => {
let list = response.rows; let list = response.rows;
list.forEach(item => { list.forEach(item => {
@ -272,10 +288,14 @@ export default {
this.noridingList.push(item); this.noridingList.push(item);
} }
}); });
console.log("parkingList=============" + JSON.stringify(this.parkingList)); // console.log("parkingList=============" + JSON.stringify(this.parkingList));
console.log("noParkingList=============" + JSON.stringify(this.noParkingList)); // console.log("noParkingList=============" + JSON.stringify(this.noParkingList));
console.log("noriding=============" + JSON.stringify(this.noridingList)); // console.log("noriding=============" + JSON.stringify(this.noridingList));
this.initAMap(); setTimeout(() => {
this.showmap=true
this.initAMap();
}, 300);
}); });
} else { } else {
console.log('区域列表为空'); console.log('区域列表为空');
@ -308,6 +328,7 @@ export default {
this.map.setFitView(null, false, [150, 60, 100, 60]); this.map.setFitView(null, false, [150, 60, 100, 60]);
}, },
initAMap() { initAMap() {
AMapLoader.load({ AMapLoader.load({
key: globalConfig.aMap.key, // WebKey load key: globalConfig.aMap.key, // WebKey load
version: "2.0", // JSAPI 1.4.15 version: "2.0", // JSAPI 1.4.15
@ -366,6 +387,7 @@ export default {
// //
if (this.cluster) { if (this.cluster) {
console.log('加载了');
try { try {
this.cluster.setData(points); this.cluster.setData(points);
} catch (error) { } catch (error) {
@ -583,8 +605,9 @@ export default {
}, },
deviceMarker(areaId) { deviceMarker(areaId) {
this.data = []; this.data = [];
listDevice({ pageNum: 1, pageSize: 999, areaId: areaId }).then(response => { console.log(areaId,'areaIdareaId');
this.deviceList = response.rows; getDeviceLists(areaId).then(response => {
this.deviceList = response.data;
this.deviceList.forEach(device => { this.deviceList.forEach(device => {
// //
if (device.longitude !== null && device.latitude !== null && if (device.longitude !== null && device.latitude !== null &&
@ -597,7 +620,7 @@ export default {
vehicleNum: device.vehicleNum, vehicleNum: device.vehicleNum,
deviceId: device.deviceId deviceId: device.deviceId
}); });
// this.addMarker(device.longitude, device.latitude, device.status, device.onlineStatus,device.sn); this.addMarker(device.longitude, device.latitude, device.status, device.onlineStatus,device.sn);
} else { } else {
console.warn(`无效的经纬度值: 经度=${device.longitude}, 纬度=${device.latitude}`); console.warn(`无效的经纬度值: 经度=${device.longitude}, 纬度=${device.latitude}`);
} }