| | |
| | | }}
|
| | | </div>
|
| | | <div class="info">
|
| | | {{ item.vehicleNumber }} {{ item.warnType }}
|
| | | {{ item.keepTime }} {{ item.startTime }}
|
| | | {{ item.vehicleNumber }} {{ item.warnType }} {{ item.keepTime }}
|
| | | {{ item.startTime }}
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | |
| | | getCarWarnList,
|
| | | getWarnGroupCount,
|
| | | getWarnGroupCountTop10,
|
| | | getCarInfoById,
|
| | | getRealVideo,
|
| | | } from "./service";
|
| | | export default {
|
| | | data() {
|
| | |
| | | }
|
| | | },
|
| | | },
|
| | | filters: {
|
| | | |
| | | },
|
| | |
|
| | | created() {
|
| | | window.toCarDetail = (record) => {
|
| | | this.toCarDetail(record);
|
| | |
| | | "AMap.AutoComplete",
|
| | | "AMap.Geocoder",
|
| | | "AMap.MarkerCluster",
|
| | | "AMap.Geocoder",
|
| | | ],
|
| | | })
|
| | | .then((AMap) => {
|
| | |
| | | this.infoWindow.open(this.map, e.target.getPosition());
|
| | |
|
| | | try {
|
| | | // 并行请求车辆信息和视频地址
|
| | | const [carInfoRes, videoRes] = await Promise.all([
|
| | | this.getCarInfo(item.id),
|
| | | // 使用高德地图API获取地址信息
|
| | | const geocoder = new this.AMap.Geocoder();
|
| | | const location = [Number(item.longitude), Number(item.latitude)];
|
| | |
|
| | | const [addressResult, videoRes] = await Promise.all([
|
| | | new Promise((resolve) => {
|
| | | geocoder.getAddress(location, (status, result) => {
|
| | | if (status === "complete" && result.regeocode) {
|
| | | console.log("result", result,'status',status);
|
| | | resolve(result.regeocode.formattedAddress);
|
| | | } else {
|
| | | resolve("未知地址");
|
| | | }
|
| | | });
|
| | | }),
|
| | | this.getVideoUrl(item.id),
|
| | | ]);
|
| | |
|
| | |
| | | this.infoWindow.setContent(
|
| | | this.listRender({
|
| | | ...item,
|
| | | ...carInfoRes.data,
|
| | | drivingTime:this.formatterTime(item.drivingTime || 0) ,
|
| | | location: addressResult,
|
| | | videoUrl: videoRes.data.url,
|
| | | })
|
| | | );
|
| | |
|
| | | if (flvjs.isSupported()) {
|
| | | this.flvPlayer = flvjs.createPlayer({
|
| | | type: "flv",
|
| | | isLive: true,
|
| | | cors: true,
|
| | | hasAudio: true,
|
| | | hasVideo: true,
|
| | | url: videoRes.data.url,
|
| | | enableWorker: true,
|
| | | enableStashBuffer: false,
|
| | | seekType: "range",
|
| | | });
|
| | | let video = document.getElementById("monitoringCard");
|
| | | this.flvPlayer.attachMediaElement(video);
|
| | | this.flvPlayer.load();
|
| | | this.flvPlayer.play();
|
| | | }
|
| | | // if (flvjs.isSupported()) {
|
| | | // this.flvPlayer = flvjs.createPlayer({
|
| | | // type: "flv",
|
| | | // isLive: true,
|
| | | // cors: true,
|
| | | // hasAudio: true,
|
| | | // hasVideo: true,
|
| | | // url: videoRes.data.url,
|
| | | // enableWorker: true,
|
| | | // enableStashBuffer: false,
|
| | | // seekType: "range",
|
| | | // });
|
| | | // let video = document.getElementById("monitoringCard");
|
| | | // this.flvPlayer.attachMediaElement(video);
|
| | | // this.flvPlayer.load();
|
| | | // this.flvPlayer.play();
|
| | | // }
|
| | | } catch (error) {
|
| | | this.infoWindow.setContent(
|
| | | '<div style="padding: 20px;text-align: center;color: red;">获取车辆信息失败</div>'
|
| | |
| | | });
|
| | | }
|
| | | },
|
| | |
|
| | | // 获取车辆信息
|
| | | async getCarInfo(carId) {
|
| | | // 获取视频地址
|
| | | async getVideoUrl(carId) {
|
| | | try {
|
| | | const res = await getCarInfoById({ id: carId });
|
| | | if (res) {
|
| | | return {
|
| | | data: {
|
| | | ...res,
|
| | | id: carId,
|
| | | },
|
| | | };
|
| | | }
|
| | | return {
|
| | | data: {
|
| | | id: carId,
|
| | | },
|
| | | };
|
| | | const res = await getRealVideo({ id: carId });
|
| | | return res;
|
| | | } catch (error) {
|
| | | return {
|
| | | data: {
|
| | | licensePlate: "",
|
| | | driver: "",
|
| | | location: "",
|
| | | coordinates: "",
|
| | | speed: "0km/h",
|
| | | drivingTime: "0小时0分钟",
|
| | | url: "",
|
| | | },
|
| | | };
|
| | | }
|
| | | },
|
| | |
|
| | | // 获取视频地址
|
| | | async getVideoUrl(carId) {
|
| | | // TODO: 替换为实际的API调用
|
| | | return new Promise((resolve) => {
|
| | | setTimeout(() => {
|
| | | resolve({
|
| | | data: {
|
| | | url: "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
|
| | | },
|
| | | });
|
| | | }, 500);
|
| | | });
|
| | | },
|
| | |
|
| | | listRender(record) {
|
| | |
| | | id="monitoringCard"
|
| | | :controls="false"
|
| | | autoplay
|
| | | src="${record.videoUrl}"
|
| | | width="620">
|
| | | </video>
|
| | | <div style="position: absolute; right: 11px; top: 10px">
|
| | |
| | | record.vehicleNumber || ""
|
| | | }</div>
|
| | | <div style="font-weight: 500; font-size: 18px;color: rgba(0, 0, 0, 0.85);line-height: 25px;">驾驶员:${
|
| | | record.driverName||''
|
| | | record.driverName || ""
|
| | | }</div>
|
| | | </div>
|
| | | <div style="display: flex; justify-content: space-between">
|
| | | <div style="font-weight: 500; font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">位置:${
|
| | | <div style="font-weight: 500; font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;width: 200px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="${record.location}">位置:${
|
| | | record.location
|
| | | }</div>
|
| | | <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">经纬度:${
|
| | | record.longitude +',' + record.latitude
|
| | | record.longitude + "," + record.latitude
|
| | | }</div>
|
| | | </div>
|
| | | <div style="display: flex; justify-content: space-between">
|
| | | <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">当前时速:${
|
| | | record.speed
|
| | | }</div>
|
| | | record.speed || ""
|
| | | }${record.speed && "km/h"}</div>
|
| | | <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">驾驶时长:${
|
| | | record.drivingTime
|
| | | }</div>
|
| | |
| | | </div>
|
| | | </div>`;
|
| | | },
|
| | | formatterTime(value) {
|
| | | if (!value) return "";
|
| | | const hours = Math.floor(value / 60);
|
| | | const minutes = value % 60;
|
| | | if (hours > 0) {
|
| | | return `${hours}小时${minutes}分钟`;
|
| | | } else {
|
| | | return `${minutes}分钟`;
|
| | | }
|
| | | },
|
| | | // 获取预警情况统计
|
| | | getCountList() {
|
| | | echarts.dispose(document.getElementById("countChart"));
|
| | |
| | | // 获取预警排行统计前10 |
| | | export const getCarInfoById = (data) => { |
| | | return axios.get(`/system/car/getCarInfo/${data.id}`, data) |
| | | } |
| | | // 获取监控 |
| | | export const getRealVideo = (data) => { |
| | | return axios.get(`/system/car/getRealVideo/${data.id}`, data) |
| | | } |