接口联调

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> <div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </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://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> <script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
</html> </html>

View File

@ -21,9 +21,9 @@
</span> </span>
</div> </div>
<div class="time_select"> <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="结束日期" /> 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>
<div class="map_line_out"> <div class="map_line_out">
<mapLine ref="mapLineRef"></mapLine> <mapLine ref="mapLineRef"></mapLine>
@ -40,8 +40,8 @@ import moment from "moment";
const mapLineShow = ref(false) const mapLineShow = ref(false)
const mapLineRef = ref() const mapLineRef = ref()
const timeRange = ref<[Date, Date]>([ const timeRange = ref<[Date, Date]>([
new Date(2023, 1, 1, 10, 0), moment().subtract(3, 'month').toDate(),
new Date(2024, 1, 1, 10, 0), new Date(),
]) ])
const detailsInfo = reactive({ const detailsInfo = reactive({
duration: '', duration: '',
@ -84,7 +84,6 @@ const initApiBmaDevInfoList = async (maId:any) => {
try { try {
const res:any = await apiBmaDevInfoList(maId) const res:any = await apiBmaDevInfoList(maId)
console.log("apiBmaDevInfoList", res)
detailsInfo.duration = res.duration detailsInfo.duration = res.duration
detailsInfo.maName = res.maName detailsInfo.maName = res.maName
detailsInfo.maStatus = res.maStatus detailsInfo.maStatus = res.maStatus
@ -106,10 +105,20 @@ const searchByTimeFn=()=>{
// mapLineRef.value.initMapLine(params) // mapLineRef.value.initMapLine(params)
initApiBmCompanyInfoTimeListTime(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 mapLineShow.value = true
maId=maId maId = data.name
initApiBmaDevInfoList(maId) initApiBmaDevInfoList(maId)
let params={ let params={
startTime:moment(timeRange.value[0]).format('YYYY.MM.DD'), startTime:moment(timeRange.value[0]).format('YYYY.MM.DD'),
@ -123,51 +132,42 @@ const open = (maId:any) => {
}) })
} }
const initApiBmCompanyInfoTimeListTime = async (val: any) => { const initApiBmCompanyInfoTimeListTime = async (val: any) => {
// console.log("val-->",val)
try { try {
// const res: any = await apiBmCompanyInfoTimeListTime(val) const res: any = await apiBmCompanyInfoTimeListTime(val)
// //
const res = [ // const res = [
{ // {
"id": 1, // "id": 1,
"lat": 31.22, // "lat": 31.22,
"lon": 121.48, // "lon": 121.48,
"time": "2022-12-10 10:10:10" // "time": "2022-12-10 10:10:10"
}, // },
{ // // {
"id": 2, // // "id": 2,
"lat": 29.588885, // // "lat": 29.588885,
"lon": 106.621131, // // "lon": 106.621131,
"time": "2023-12-19 10:10:10" // // "time": "2023-12-19 10:10:10"
}, // // },
{ // // {
"id": 3, // // "id": 3,
"lat": 39.904989, // // "lat": 39.904989,
"lon": 116.405285, // // "lon": 116.405285,
"time": "2023-12-19 10:10:10" // // "time": "2023-12-19 10:10:10"
}, // // },
{ // {
"id": 4, // "id": 4,
"lat": 31.820587, // "lat": 31.820587,
"lon": 117.227219, // "lon": 117.227219,
"time": "2023-12-19 10:10:10" // "time": "2023-12-19 10:10:10"
} // }
] // ]
console.log("res-apiBmCompanyInfoTimeListTime",res)
// domShow.value = true
// console.log("apiBmCompanyInfoTimeListTime", res)
// res.forEach((ele: any) => { let startLonLatObj = JSON.parse(JSON.stringify(startLonLat[0]))
// linePointList.push(new BMapGL.Point(Number(ele.lon), Number(ele.lat)))
// }) res.unshift(startLonLatObj)
// console.log("res-->>>",res)
mapLineRef.value.initMapLine(res, val.id) mapLineRef.value.initMapLine(res, val.id)
// nextTick(() => {
// initMap()
// centerPoint = getcenterpoiont(res[0], res[res.length - 1])
// console.log("centerPoint", centerPoint)
// initCustomDot(centerPoint)
// })
} catch (error) { } catch (error) {
console.log('err-->>>', error) console.log('err-->>>', error)

View File

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

View File

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

View File

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

View File

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

View File

@ -57,14 +57,10 @@ export function apiBmCompanyInfoColtdList() {
} }
// 根据设备id查询设备详情相关信息 // 根据设备id查询设备详情相关信息
export function apiBmaDevInfoList(maId:any) { export function apiBmaDevInfoList(maId:any) {
return get(`maDevInfo/list/${maId}`,{}) return get(`item-center/maDevInfo/ma-list/${maId}`,{})
} }
// 根据时间查询设备历史经纬度 // 根据时间查询设备历史经纬度
export function apiBmCompanyInfoTimeListTime(params:any) { 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,{}) return get(urlStr,{})
} }

View File

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