接口联调

This commit is contained in:
binbin_pan 2024-03-20 17:45:15 +08:00
parent 5fd4428129
commit a9bd1b60ca
8 changed files with 65 additions and 67 deletions

View File

@ -11,8 +11,7 @@
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
<script async type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
<script src="https://mapopen.bj.bcebos.com/github/BMapGLLib/TrackAnimation/src/TrackAnimation.min.js"></script>
<script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
</html>

View File

@ -21,9 +21,9 @@
</span>
</div>
<div class="time_select">
<el-date-picker v-model="timeRange" size="media" type="datetimerange"
<el-date-picker v-model="timeRange" size="default" type="datetimerange" :unlink-panels="true"
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
<el-button type="primary" style="margin-left: 12px;" size="media" @click="searchByTimeFn">查询</el-button>
<el-button type="primary" style="margin-left: 12px;" size="default" @click="searchByTimeFn">查询</el-button>
</div>
<div class="map_line_out">
<mapLine ref="mapLineRef"></mapLine>
@ -40,8 +40,8 @@ import moment from "moment";
const mapLineShow = ref(false)
const mapLineRef = ref()
const timeRange = ref<[Date, Date]>([
new Date(2023, 1, 1, 10, 0),
new Date(2024, 1, 1, 10, 0),
moment().subtract(3, 'month').toDate(),
new Date(),
])
const detailsInfo = reactive({
duration: '',
@ -84,7 +84,6 @@ const initApiBmaDevInfoList = async (maId:any) => {
try {
const res:any = await apiBmaDevInfoList(maId)
console.log("apiBmaDevInfoList", res)
detailsInfo.duration = res.duration
detailsInfo.maName = res.maName
detailsInfo.maStatus = res.maStatus
@ -106,10 +105,20 @@ const searchByTimeFn=()=>{
// mapLineRef.value.initMapLine(params)
initApiBmCompanyInfoTimeListTime(params)
}
const open = (maId:any) => {
console.log("maIdmaId",maId)
let startLonLat: any = reactive([
{
lon: null,
lat: null,
}
])
const open = (data:any) => {
// data.value
startLonLat[0].lon = data.value[0]
startLonLat[0].lat = data.value[1]
mapLineShow.value = true
maId=maId
maId = data.name
initApiBmaDevInfoList(maId)
let params={
startTime:moment(timeRange.value[0]).format('YYYY.MM.DD'),
@ -123,51 +132,42 @@ const open = (maId:any) => {
})
}
const initApiBmCompanyInfoTimeListTime = async (val: any) => {
// console.log("val-->",val)
try {
// const res: any = await apiBmCompanyInfoTimeListTime(val)
const res: any = await apiBmCompanyInfoTimeListTime(val)
//
const res = [
{
"id": 1,
"lat": 31.22,
"lon": 121.48,
"time": "2022-12-10 10:10:10"
},
{
"id": 2,
"lat": 29.588885,
"lon": 106.621131,
"time": "2023-12-19 10:10:10"
},
{
"id": 3,
"lat": 39.904989,
"lon": 116.405285,
"time": "2023-12-19 10:10:10"
},
{
"id": 4,
"lat": 31.820587,
"lon": 117.227219,
"time": "2023-12-19 10:10:10"
}
]
console.log("res-apiBmCompanyInfoTimeListTime",res)
// domShow.value = true
// console.log("apiBmCompanyInfoTimeListTime", res)
// res.forEach((ele: any) => {
// linePointList.push(new BMapGL.Point(Number(ele.lon), Number(ele.lat)))
// })
mapLineRef.value.initMapLine(res,val.id)
// nextTick(() => {
// initMap()
// centerPoint = getcenterpoiont(res[0], res[res.length - 1])
// console.log("centerPoint", centerPoint)
// initCustomDot(centerPoint)
// })
// const res = [
// {
// "id": 1,
// "lat": 31.22,
// "lon": 121.48,
// "time": "2022-12-10 10:10:10"
// },
// // {
// // "id": 2,
// // "lat": 29.588885,
// // "lon": 106.621131,
// // "time": "2023-12-19 10:10:10"
// // },
// // {
// // "id": 3,
// // "lat": 39.904989,
// // "lon": 116.405285,
// // "time": "2023-12-19 10:10:10"
// // },
// {
// "id": 4,
// "lat": 31.820587,
// "lon": 117.227219,
// "time": "2023-12-19 10:10:10"
// }
// ]
let startLonLatObj = JSON.parse(JSON.stringify(startLonLat[0]))
res.unshift(startLonLatObj)
// console.log("res-->>>",res)
mapLineRef.value.initMapLine(res, val.id)
} catch (error) {
console.log('err-->>>', error)

View File

@ -197,7 +197,7 @@ const mapProps = reactive({
},
effectScatterCallBack: (params: any) => {
console.log("equipmentDialogRef999", params)
equipmentDialogRef.value.open(params.data.name)
equipmentDialogRef.value.open(params.data)
},
// seriesData:[]
seriesData: [

View File

@ -125,7 +125,7 @@ onBeforeMount(() => {
color: $main-color;
padding-top: 24px;
padding-left: 26px;
cursor: pointer;
}
.activeSub {

View File

@ -51,7 +51,10 @@ const options:any = {
series: [{
name: '设备数量',
data:props.list
}]
}],
accessibility:{
enabled: false
}
}

View File

@ -20,14 +20,14 @@ const state = reactive({
}
})
onMounted(() => {
console.log("map", "map")
// console.log("map", "map")
})
let linePointList: any = []
const initMap = () => {
map = new BMapGL.Map("equipmentIdMap" + domId.value);
map.centerAndZoom(new BMapGL.Point(centerPoint), 18);
map.centerAndZoom(new BMapGL.Point(), 18);
console.log("map", map)
map.enableScrollWheelZoom();
setTimeout(() => {
@ -142,11 +142,11 @@ const getcenterpoiont = (pointStart: any, pointEnd: any) => {
const pointcenter = new BMapGL.Point(lngcenter, latcenter);
return pointcenter;
}
const initMapLine = (res: any, id: any) => {
domId.value = id
domShow.value = false
linePointList = []
res.forEach((ele: any) => {
linePointList.push(new BMapGL.Point(Number(ele.lon), Number(ele.lat)))
})
@ -155,7 +155,7 @@ const initMapLine = (res: any, id: any) => {
setTimeout(() => {
initMap()
centerPoint = getcenterpoiont(res[0], res[res.length - 1])
console.log("centerPoint", centerPoint)
initCustomDot(centerPoint)
})
})

View File

@ -57,14 +57,10 @@ export function apiBmCompanyInfoColtdList() {
}
// 根据设备id查询设备详情相关信息
export function apiBmaDevInfoList(maId:any) {
return get(`maDevInfo/list/${maId}`,{})
return get(`item-center/maDevInfo/ma-list/${maId}`,{})
}
// 根据时间查询设备历史经纬度
export function apiBmCompanyInfoTimeListTime(params:any) {
const urlStr= `bmCompanyInfo/time-list/${params.startTime}/${params.endTime}/${params.id}`
const urlStr= `user-service/bmCompanyInfo/time-list/${params.startTime}/${params.endTime}/${params.id}`
return get(urlStr,{})
}

View File

@ -6,7 +6,7 @@
<img src="@/assets/img/setting.png" />
</div>
<div class="right_title_more_info">
<span class="weather">晴转多云 16 </span>
<!-- <span class="weather">晴转多云 16 </span> -->
<span class="time">{{ nowTime }}</span>
</div>
</div>