Commit b3e721dfc621cf44d01bb89a2f6228f9957a89eb
1 parent
f27bd761
fix():添加历史回放视频上传和下载
Showing
11 changed files
with
472 additions
and
64 deletions
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/Jt1078OfCarController.java
| @@ -28,9 +28,11 @@ import com.genersoft.iot.vmp.vmanager.jt1078.platform.ben.HttpClientPostEntity; | @@ -28,9 +28,11 @@ import com.genersoft.iot.vmp.vmanager.jt1078.platform.ben.HttpClientPostEntity; | ||
| 28 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.Jt1078ConfigBean; | 28 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.Jt1078ConfigBean; |
| 29 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.RtspConfigBean; | 29 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.RtspConfigBean; |
| 30 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.TuohuaConfigBean; | 30 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.TuohuaConfigBean; |
| 31 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; | ||
| 31 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.PatrolDataReq; | 32 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.PatrolDataReq; |
| 32 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.handler.HttpClientUtil; | 33 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.handler.HttpClientUtil; |
| 33 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.FlowService; | 34 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.FlowService; |
| 35 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.HisToryRecordService; | ||
| 34 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.Jt1078OfService; | 36 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.Jt1078OfService; |
| 35 | import com.genersoft.iot.vmp.vmanager.streamProxy.StreamProxyController; | 37 | import com.genersoft.iot.vmp.vmanager.streamProxy.StreamProxyController; |
| 36 | import com.genersoft.iot.vmp.vmanager.streamPush.StreamPushController; | 38 | import com.genersoft.iot.vmp.vmanager.streamPush.StreamPushController; |
| @@ -106,6 +108,8 @@ public class Jt1078OfCarController { | @@ -106,6 +108,8 @@ public class Jt1078OfCarController { | ||
| 106 | private FlowService flowService; | 108 | private FlowService flowService; |
| 107 | @Resource | 109 | @Resource |
| 108 | private Jt1078OfService jt1078OfService; | 110 | private Jt1078OfService jt1078OfService; |
| 111 | + @Resource | ||
| 112 | + private HisToryRecordService hisToryRecordService; | ||
| 109 | //存储历史端口 key -->端口 value ---> sim-channel-startTime-endTime-port | 113 | //存储历史端口 key -->端口 value ---> sim-channel-startTime-endTime-port |
| 110 | public static final ConcurrentHashMap<Integer, Set<String>> map = new ConcurrentHashMap<>(); | 114 | public static final ConcurrentHashMap<Integer, Set<String>> map = new ConcurrentHashMap<>(); |
| 111 | 115 | ||
| @@ -157,7 +161,6 @@ public class Jt1078OfCarController { | @@ -157,7 +161,6 @@ public class Jt1078OfCarController { | ||
| 157 | String msg = jt1078ConfigBean.formatMessageHistoryUpload(stream); | 161 | String msg = jt1078ConfigBean.formatMessageHistoryUpload(stream); |
| 158 | HttpClientPostEntity httpClientPost = this.httpClientUtil.doPost(url, msg, (String) null); | 162 | HttpClientPostEntity httpClientPost = this.httpClientUtil.doPost(url, msg, (String) null); |
| 159 | chooseEntity(httpClientPost, url, false); | 163 | chooseEntity(httpClientPost, url, false); |
| 160 | - | ||
| 161 | } catch (Exception e) { | 164 | } catch (Exception e) { |
| 162 | throw new RuntimeException(e); | 165 | throw new RuntimeException(e); |
| 163 | } | 166 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/controller/HistoryRecordController.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.controller; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; | ||
| 4 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.HisToryRecordService; | ||
| 5 | +import lombok.AllArgsConstructor; | ||
| 6 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 历史视频下载记录控制层 | ||
| 13 | + * | ||
| 14 | + * @Author WangXin | ||
| 15 | + * @Data 2025/2/22 | ||
| 16 | + * @Version 1.0.0 | ||
| 17 | + */ | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("/historyRecord") | ||
| 20 | +@AllArgsConstructor | ||
| 21 | +public class HistoryRecordController { | ||
| 22 | + | ||
| 23 | + private final HisToryRecordService hisToryRecordService; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 添加历史下载记录 | ||
| 27 | + * @param record 历史视频下载记录对象 | ||
| 28 | + */ | ||
| 29 | + @PostMapping("/addRecode") | ||
| 30 | + public String addRecode(@RequestBody HistoryRecord record) { | ||
| 31 | + return hisToryRecordService.addRecode(record); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +} |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/domain/HistoryRecord.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.domain; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.NoArgsConstructor; | ||
| 7 | +import lombok.experimental.SuperBuilder; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.util.Date; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 历史视频下载记录类 | ||
| 14 | + * | ||
| 15 | + * @Author WangXin | ||
| 16 | + * @Data 2025/2/22 | ||
| 17 | + * @Version 1.0.0 | ||
| 18 | + */ | ||
| 19 | +@Data | ||
| 20 | +@SuperBuilder | ||
| 21 | +@AllArgsConstructor | ||
| 22 | +@NoArgsConstructor | ||
| 23 | +public class HistoryRecord { | ||
| 24 | + /** | ||
| 25 | + * 主键 | ||
| 26 | + */ | ||
| 27 | + private String id; | ||
| 28 | + /** | ||
| 29 | + * 名称 | ||
| 30 | + */ | ||
| 31 | + private String name; | ||
| 32 | + /** | ||
| 33 | + * sim号 | ||
| 34 | + */ | ||
| 35 | + private String sim; | ||
| 36 | + /** | ||
| 37 | + * 通道号 | ||
| 38 | + */ | ||
| 39 | + private String channel; | ||
| 40 | + /** | ||
| 41 | + * 状态 | ||
| 42 | + */ | ||
| 43 | + private String status; | ||
| 44 | + /** | ||
| 45 | + * FTP IP | ||
| 46 | + */ | ||
| 47 | + private String ip; | ||
| 48 | + /** | ||
| 49 | + * FTP端口 | ||
| 50 | + */ | ||
| 51 | + private String port; | ||
| 52 | + /** | ||
| 53 | + * FTP账号 | ||
| 54 | + */ | ||
| 55 | + private String username; | ||
| 56 | + /** | ||
| 57 | + * FTP密码 | ||
| 58 | + */ | ||
| 59 | + private String password; | ||
| 60 | + /** | ||
| 61 | + * 修改时间 | ||
| 62 | + */ | ||
| 63 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 64 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 65 | + private Date createTime; | ||
| 66 | + /** | ||
| 67 | + * 创建时间 | ||
| 68 | + */ | ||
| 69 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 70 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 71 | + private Date updateTime; | ||
| 72 | + /** | ||
| 73 | + * 创建人 | ||
| 74 | + */ | ||
| 75 | + private String createBy; | ||
| 76 | + /** | ||
| 77 | + * 修改人 | ||
| 78 | + */ | ||
| 79 | + private String updateBy; | ||
| 80 | + /** | ||
| 81 | + * 备注 | ||
| 82 | + */ | ||
| 83 | + private String remark; | ||
| 84 | + | ||
| 85 | +} |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/mapper/HisToryRecordMapper.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.mapper; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Author WangXin | ||
| 8 | + * @Data 2025/2/22 | ||
| 9 | + * @Version 1.0.0 | ||
| 10 | + */ | ||
| 11 | +@Mapper | ||
| 12 | +public interface HisToryRecordMapper { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 添加历史下载记录 | ||
| 16 | + * @param record 历史视频下载记录对象 | ||
| 17 | + */ | ||
| 18 | + Integer addRecode(HistoryRecord record); | ||
| 19 | +} |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/service/HisToryRecordService.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.service; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author WangXin | ||
| 7 | + * @Data 2025/2/22 | ||
| 8 | + * @Version 1.0.0 | ||
| 9 | + */ | ||
| 10 | +public interface HisToryRecordService { | ||
| 11 | + /** | ||
| 12 | + * 添加历史下载记录 | ||
| 13 | + * @param record 历史视频下载记录对象 | ||
| 14 | + */ | ||
| 15 | + String addRecode(HistoryRecord record); | ||
| 16 | +} |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/service/impl/HisToryRecordServiceImpl.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.service.impl; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; | ||
| 4 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.mapper.HisToryRecordMapper; | ||
| 5 | +import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.HisToryRecordService; | ||
| 6 | +import lombok.AllArgsConstructor; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author WangXin | ||
| 11 | + * @Data 2025/2/22 | ||
| 12 | + * @Version 1.0.0 | ||
| 13 | + */ | ||
| 14 | +@Service | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public class HisToryRecordServiceImpl implements HisToryRecordService { | ||
| 17 | + | ||
| 18 | + private final HisToryRecordMapper hisToryRecordMapper; | ||
| 19 | + /** | ||
| 20 | + * 添加历史下载记录 | ||
| 21 | + * @param record 历史视频下载记录对象 | ||
| 22 | + */ | ||
| 23 | + @Override | ||
| 24 | + public String addRecode(HistoryRecord record) { | ||
| 25 | + return hisToryRecordMapper.addRecode(record) > 0 ? "success" : "fail"; | ||
| 26 | + } | ||
| 27 | +} |
src/main/resources/mapper/HisToryRecordMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE mapper | ||
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | +<mapper namespace="com.genersoft.iot.vmp.vmanager.jt1078.platform.mapper.HisToryRecordMapper"> | ||
| 6 | + | ||
| 7 | + <insert id="addRecode"> | ||
| 8 | + INSERT INTO `wvp_history_record` | ||
| 9 | + (`id`, `name`, `sim`, `channel`, `status`, `ip`, `port`, `username`, `password`, `create_time`, `update_time`, `create_by`, `update_by`, `remark`) | ||
| 10 | + VALUES | ||
| 11 | + (#{id}, #{name}, #{sim}, #{channel}, #{status}, #{ip}, #{port}, #{username}, #{password}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{remark}) | ||
| 12 | + </insert> | ||
| 13 | +</mapper> |
web_src/src/components/FlowStatistics.vue
| @@ -228,11 +228,7 @@ export default { | @@ -228,11 +228,7 @@ export default { | ||
| 228 | */ | 228 | */ |
| 229 | searchFlowList() { | 229 | searchFlowList() { |
| 230 | this.loading = true | 230 | this.loading = true |
| 231 | - let simChannel = null; | ||
| 232 | - console.log(this.sim_channel); | ||
| 233 | - if (this.sim_channel) { | ||
| 234 | - simChannel = this.sim_channel[this.sim_channel.length - 1]; | ||
| 235 | - } | 231 | + let simChannel = this.sim_channel; |
| 236 | this.$axios({ | 232 | this.$axios({ |
| 237 | method: "GET", | 233 | method: "GET", |
| 238 | url: "/flow/list/" + this.timeType + "/" + this.statisticsType + "/" + this.time + "/" + simChannel, | 234 | url: "/flow/list/" + this.timeType + "/" + this.statisticsType + "/" + this.time + "/" + simChannel, |
web_src/src/components/HistoricalRecord.vue
| 1 | <template> | 1 | <template> |
| 2 | <div style="width: 2000px"> | 2 | <div style="width: 2000px"> |
| 3 | - <el-container v-loading="loading" style="height: 100%;width: 100%" element-loading-text="拼命加载中"> | ||
| 4 | - <div style="width:100%;display: flex;flex-direction: column;justify-content: space-between;"> | ||
| 5 | - <div class="block" style="width: 99%;text-align:left;margin-bottom:15px;"> | ||
| 6 | - <el-card class="box-card" style="width: 100%"> | ||
| 7 | - <car-tree v-model="sim_channel" /> | ||
| 8 | - <el-date-picker | ||
| 9 | - v-model="date" | ||
| 10 | - align="right" | ||
| 11 | - type="date" | ||
| 12 | - placeholder="选择日期" | ||
| 13 | - :picker-options="pickerOptions"> | ||
| 14 | - </el-date-picker> | ||
| 15 | - <el-time-picker | ||
| 16 | - is-range | ||
| 17 | - v-model="timeList" | ||
| 18 | - range-separator="至" | ||
| 19 | - start-placeholder="开始时间" | ||
| 20 | - end-placeholder="结束时间" | ||
| 21 | - placeholder="选择时间范围"> | ||
| 22 | - </el-time-picker> | ||
| 23 | - <el-button @click="searchHitoryList()">搜索</el-button> | ||
| 24 | - <el-button @click="downloadFunction()">下载播放视频</el-button> | ||
| 25 | - </el-card> | ||
| 26 | - </div> | ||
| 27 | - | ||
| 28 | - <div style="width: 100%;display:flex;flex-direction:row; justify-content:space-between;"> | ||
| 29 | - <div style="width:22%;height: 80vh" > | ||
| 30 | - <historical-data :history-data="historyData" @click="clickHistoricalPlay" /> | ||
| 31 | - </div> | ||
| 32 | - <div style="width: 77%;"> | ||
| 33 | - <div style="width: 99%;height: 80vh;display: flex;flex-wrap: wrap;background-color: #000;"> | 3 | + <el-container v-loading="loading" style="height: 93vh;" element-loading-text="拼命加载中"> |
| 4 | + <el-aside width="400px" style="background-color: #ffffff;height: 100%;"> | ||
| 5 | + <el-main style="padding: 0;width: 100%;height: 68%;background: white;margin-bottom: 10px"> | ||
| 6 | + <device1078-tree :tree-data="sourceValue" @node-click="nodeClick"></device1078-tree> | ||
| 7 | + </el-main> | ||
| 8 | + <el-footer style="width: 100%;height: 30%;background: grey"> | ||
| 9 | + <el-form ref="form" class="historyButton" style="padding-top: 20px"> | ||
| 10 | + <el-form-item label="日期"> | ||
| 11 | + <el-date-picker | ||
| 12 | + v-model="date" | ||
| 13 | + align="right" | ||
| 14 | + type="date" | ||
| 15 | + style="width: 70%;" | ||
| 16 | + placeholder="选择日期" | ||
| 17 | + :picker-options="pickerOptions"> | ||
| 18 | + </el-date-picker> | ||
| 19 | + </el-form-item> | ||
| 20 | + <el-form-item label="时间"> | ||
| 21 | + <el-time-picker | ||
| 22 | + is-range | ||
| 23 | + v-model="timeList" | ||
| 24 | + style="width: 70%;" | ||
| 25 | + range-separator="至" | ||
| 26 | + start-placeholder="开始时间" | ||
| 27 | + end-placeholder="结束时间" | ||
| 28 | + placeholder="选择时间范围"> | ||
| 29 | + </el-time-picker> | ||
| 30 | + </el-form-item> | ||
| 31 | + <el-form-item> | ||
| 32 | + <el-button type="primary" @click="searchHistoryList" style="width: 70%;">搜索</el-button> | ||
| 33 | + </el-form-item> | ||
| 34 | + </el-form> | ||
| 35 | + </el-footer> | ||
| 36 | + </el-aside> | ||
| 37 | + <el-container style="height: 93vh;"> | ||
| 38 | + <el-main style="padding: 0;height: 65%;"> | ||
| 39 | + <div class="scroll-container" | ||
| 40 | + style="width: 100%;height: 99%;display: flex;flex-wrap: wrap;background-color: #000;"> | ||
| 41 | + <div style="width: 99%;height: 99%;display: flex;flex-wrap: wrap;background-color: #000;"> | ||
| 34 | <div v-if="!videoUrl[0]" style="color: #ffffff;font-size: 30px;font-weight: bold;"></div> | 42 | <div v-if="!videoUrl[0]" style="color: #ffffff;font-size: 30px;font-weight: bold;"></div> |
| 35 | <player ref="player" v-else :videoUrl="videoUrl[0]" fluent autoplay @screenshot="shot" | 43 | <player ref="player" v-else :videoUrl="videoUrl[0]" fluent autoplay @screenshot="shot" |
| 36 | - @destroy="destroy" style="width: 100%;height: 100%;"/> | 44 | + @destroy="destroy" style="width: 100%;height: 99%;"/> |
| 37 | </div> | 45 | </div> |
| 38 | </div> | 46 | </div> |
| 39 | - </div> | ||
| 40 | - </div> | 47 | + </el-main> |
| 48 | + <el-footer style="width: 100%;height: 30%;"> | ||
| 49 | + <historical-data :history-data="historyData" @click="clickHistoricalPlay" /> | ||
| 50 | + </el-footer> | ||
| 51 | + </el-container> | ||
| 41 | </el-container> | 52 | </el-container> |
| 42 | </div> | 53 | </div> |
| 43 | </template> | 54 | </template> |
| @@ -49,15 +60,23 @@ import player from "./common/jessibuca.vue"; | @@ -49,15 +60,23 @@ import player from "./common/jessibuca.vue"; | ||
| 49 | import CarTree from "./JT1078Components/cascader/CarTree.vue"; | 60 | import CarTree from "./JT1078Components/cascader/CarTree.vue"; |
| 50 | import {parseTime} from "../../utils/ruoyi"; | 61 | import {parseTime} from "../../utils/ruoyi"; |
| 51 | import HistoricalData from "./JT1078Components/historical/HistoricalDataTree.vue"; | 62 | import HistoricalData from "./JT1078Components/historical/HistoricalDataTree.vue"; |
| 63 | +import HistoryList from "./JT1078Components/HistoryData.vue"; | ||
| 64 | +import Device1078Tree from "./JT1078Components/deviceList/Device1078Tree.vue"; | ||
| 52 | 65 | ||
| 53 | export default { | 66 | export default { |
| 54 | //import引入的组件需要注入到对象中才能使用" | 67 | //import引入的组件需要注入到对象中才能使用" |
| 55 | - components: {HistoricalData, CarTree, player}, | 68 | + components: {HistoryList, Device1078Tree, HistoricalData, CarTree, player}, |
| 56 | props: {}, | 69 | props: {}, |
| 57 | data() { | 70 | data() { |
| 58 | //这里存放数据" | 71 | //这里存放数据" |
| 59 | return { | 72 | return { |
| 60 | - historyData: [], | 73 | + historyData: [{name: "aaaa"},{name: "bbbb"}], |
| 74 | + targetValue: [], | ||
| 75 | + //源列表数据 | ||
| 76 | + sourceValue: [], | ||
| 77 | + //车辆数据定时器 | ||
| 78 | + carInfoTimeout: null, | ||
| 79 | + simList: [], | ||
| 61 | //遮罩层 | 80 | //遮罩层 |
| 62 | loading: false, | 81 | loading: false, |
| 63 | //sim号和通道号,格式为:sim-channel | 82 | //sim号和通道号,格式为:sim-channel |
| @@ -104,6 +123,135 @@ export default { | @@ -104,6 +123,135 @@ export default { | ||
| 104 | //方法集合", | 123 | //方法集合", |
| 105 | methods: { | 124 | methods: { |
| 106 | /** | 125 | /** |
| 126 | + * 树点击事件 | ||
| 127 | + */ | ||
| 128 | + nodeClick(data, node) { | ||
| 129 | + if (data.children === undefined && data) { | ||
| 130 | + let split = data.id.split("_"); | ||
| 131 | + if (split.length === 3){ | ||
| 132 | + this.sim_channel = split[1] + '_' + split[2] | ||
| 133 | + } else { | ||
| 134 | + console.log("node click ==> ",data) | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + /** | ||
| 139 | + * 查询车辆信息 | ||
| 140 | + */ | ||
| 141 | + getCarInfoBuffer() { | ||
| 142 | + this.loading = true; | ||
| 143 | + this.getCarInfo() | ||
| 144 | + }, | ||
| 145 | + getCarInfo() { | ||
| 146 | + this.$axios({ | ||
| 147 | + method: 'get', | ||
| 148 | + url: `/api/jt1078/query/car/tree/100`, | ||
| 149 | + }).then(res => { | ||
| 150 | + if (res && res.data && res.data.data) { | ||
| 151 | + if (res.data.data.code == 1) { | ||
| 152 | + //处理数据 | ||
| 153 | + this.simList = [] | ||
| 154 | + this.processingSimList(res.data.data.result) | ||
| 155 | + this.processingTreeData(res.data.data.result, 0); | ||
| 156 | + this.statisticsOnline(res.data.data.result) | ||
| 157 | + this.sourceValue = res.data.data.result; | ||
| 158 | + this.loading = false | ||
| 159 | + //定时更新数据 | ||
| 160 | + let this_ = this | ||
| 161 | + this.carInfoTimeout = setTimeout(function () { | ||
| 162 | + this_.getCarInfo() | ||
| 163 | + }, 45000); | ||
| 164 | + } else if (res.data.data.message) { | ||
| 165 | + this.$message.error(res.data.data.message); | ||
| 166 | + } | ||
| 167 | + } else { | ||
| 168 | + this.$message.error("请求错误,请刷新再试"); | ||
| 169 | + } | ||
| 170 | + this.loading = false | ||
| 171 | + }).catch(error => { | ||
| 172 | + this.$message.error(error.message); | ||
| 173 | + }) | ||
| 174 | + }, | ||
| 175 | + /** | ||
| 176 | + * 统计树节点下一级有多少在线数量 | ||
| 177 | + */ | ||
| 178 | + statisticsOnline(data) { | ||
| 179 | + for (let i in data) { | ||
| 180 | + if (data[i].abnormalStatus === undefined && data[i].children && data[i].children.length > 0) { | ||
| 181 | + data[i].onlineData = data[i].children.filter(item => item.abnormalStatus === 1); | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + }, | ||
| 185 | + /** | ||
| 186 | + * 处理返回的tree数据 | ||
| 187 | + */ | ||
| 188 | + processingTreeData(data, pid, parent) { | ||
| 189 | + for (let i in data) { | ||
| 190 | + data[i].pid = pid | ||
| 191 | + data[i].parent = parent; | ||
| 192 | + if (data[i].children || (Array.isArray(data[i].children) && data[i].abnormalStatus === undefined)) { | ||
| 193 | + this.processingTreeData(data[i].children, data[i].id, data[i]); | ||
| 194 | + } else { | ||
| 195 | + data[i].name = data[i].code | ||
| 196 | + if (data[i].abnormalStatus !== 1) { | ||
| 197 | + data[i].disabled = true; | ||
| 198 | + let targetValue = this.targetValue; | ||
| 199 | + if (targetValue.length > 0) { | ||
| 200 | + this.disableItemsByName(targetValue, data[i].name); | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + this.addChannels(data[i]) | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + }, | ||
| 207 | + /** | ||
| 208 | + * 添加通道 | ||
| 209 | + */ | ||
| 210 | + addChannels(data) { | ||
| 211 | + let labels = ['ADAS', 'DSM', '路况', '司机', '整车前', '中门', '倒车', '前门客流', '后面客流']; | ||
| 212 | + let children = []; | ||
| 213 | + for (let i in labels) { | ||
| 214 | + children.push({ | ||
| 215 | + id: `${data.id}_${data.sim}_${Number(i) + Number(1)}`, | ||
| 216 | + pid: data.id, | ||
| 217 | + name: labels[i], | ||
| 218 | + disabled: data.disabled, | ||
| 219 | + parent: data | ||
| 220 | + }) | ||
| 221 | + } | ||
| 222 | + data.children = children; | ||
| 223 | + }, | ||
| 224 | + /** | ||
| 225 | + * 处理巡查列表数据 | ||
| 226 | + */ | ||
| 227 | + disableItemsByName(arr, targetName) { | ||
| 228 | + arr.forEach(item => { | ||
| 229 | + // 检查当前项是否是对象并且包含 name 属性且值为 targetName | ||
| 230 | + if (item && typeof item === 'object' && item.name === targetName) { | ||
| 231 | + item.disabled = true; | ||
| 232 | + } | ||
| 233 | + // 如果当前项有 children 属性且是数组,则递归调用自身 | ||
| 234 | + if (item && Array.isArray(item.children)) { | ||
| 235 | + this.disableItemsByName(item.children, targetName); | ||
| 236 | + } | ||
| 237 | + }); | ||
| 238 | + }, | ||
| 239 | + /** | ||
| 240 | + * 原始sim列表数据 (用来验证视屏巡查车辆是否在线) | ||
| 241 | + * @param data 查询后台树列表 | ||
| 242 | + */ | ||
| 243 | + processingSimList(data) { | ||
| 244 | + if (data && data.length > 0) { | ||
| 245 | + for (let i in data) { | ||
| 246 | + if (data[i].children === undefined && data[i].abnormalStatus) { | ||
| 247 | + this.simList.push(data[i]); | ||
| 248 | + } else if (data[i].children && data[i].children.length > 0) { | ||
| 249 | + this.processingSimList(data[i].children); | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | + } | ||
| 253 | + }, | ||
| 254 | + /** | ||
| 107 | * 点击播放视频 | 255 | * 点击播放视频 |
| 108 | */ | 256 | */ |
| 109 | clickHistoricalPlay(data) { | 257 | clickHistoricalPlay(data) { |
| @@ -123,15 +271,16 @@ export default { | @@ -123,15 +271,16 @@ export default { | ||
| 123 | /** | 271 | /** |
| 124 | * 搜索历史视频 | 272 | * 搜索历史视频 |
| 125 | */ | 273 | */ |
| 126 | - searchHitoryList() { | 274 | + searchHistoryList() { |
| 127 | this.getDateTime(); | 275 | this.getDateTime(); |
| 128 | let simChannel = this.sim_channel; | 276 | let simChannel = this.sim_channel; |
| 277 | + console.log(this.sim_channel) | ||
| 129 | if (this.isEmpty(simChannel)) { | 278 | if (this.isEmpty(simChannel)) { |
| 130 | this.$message.error('请选择车辆'); | 279 | this.$message.error('请选择车辆'); |
| 131 | return; | 280 | return; |
| 132 | } | 281 | } |
| 133 | - let split = simChannel[simChannel.length - 1].split('-'); | ||
| 134 | - console.log("simChannel:",simChannel) | 282 | + let split = simChannel.split('_'); |
| 283 | + console.log("simChannel:", simChannel) | ||
| 135 | let sim = split[0]; | 284 | let sim = split[0]; |
| 136 | if (this.isEmpty(sim)) { | 285 | if (this.isEmpty(sim)) { |
| 137 | this.$message.error('无法获取SIM卡信息,请检查设备'); | 286 | this.$message.error('无法获取SIM卡信息,请检查设备'); |
| @@ -142,6 +291,7 @@ export default { | @@ -142,6 +291,7 @@ export default { | ||
| 142 | this.$message.error('请选择通道'); | 291 | this.$message.error('请选择通道'); |
| 143 | return; | 292 | return; |
| 144 | } | 293 | } |
| 294 | + console.log(channel); | ||
| 145 | if (this.isEmpty(this.startTime) || this.isEmpty(this.endTime)) { | 295 | if (this.isEmpty(this.startTime) || this.isEmpty(this.endTime)) { |
| 146 | this.$message.error('请选择开始和结束时间'); | 296 | this.$message.error('请选择开始和结束时间'); |
| 147 | return; | 297 | return; |
| @@ -151,7 +301,7 @@ export default { | @@ -151,7 +301,7 @@ export default { | ||
| 151 | method: 'get', | 301 | method: 'get', |
| 152 | url: '/api/jt1078/query/history/list/' + sim + '/' + channel + "/" + this.startTime + "/" + this.endTime | 302 | url: '/api/jt1078/query/history/list/' + sim + '/' + channel + "/" + this.startTime + "/" + this.endTime |
| 153 | }).then( | 303 | }).then( |
| 154 | - res=>{ | 304 | + res => { |
| 155 | console.log(res.data) | 305 | console.log(res.data) |
| 156 | let items = res.data.data.obj.data.items; | 306 | let items = res.data.data.obj.data.items; |
| 157 | if (res && res.data && res.data.data && res.data.data.obj && res.data.data.code == 1 && res.data.data.obj.data && items) { | 307 | if (res && res.data && res.data.data && res.data.data.obj && res.data.data.code == 1 && res.data.data.obj.data && items) { |
| @@ -168,11 +318,11 @@ export default { | @@ -168,11 +318,11 @@ export default { | ||
| 168 | } else if (items === undefined) { | 318 | } else if (items === undefined) { |
| 169 | this.historyData = []; | 319 | this.historyData = []; |
| 170 | this.loading = false | 320 | this.loading = false |
| 171 | - }else { | 321 | + } else { |
| 172 | this.loading = false | 322 | this.loading = false |
| 173 | } | 323 | } |
| 174 | }).cache(res => { | 324 | }).cache(res => { |
| 175 | - this.$message.error(res.msg); | 325 | + this.$message.error(res.msg); |
| 176 | this.loading = false | 326 | this.loading = false |
| 177 | }) | 327 | }) |
| 178 | }, | 328 | }, |
| @@ -182,8 +332,8 @@ export default { | @@ -182,8 +332,8 @@ export default { | ||
| 182 | getDateTime() { | 332 | getDateTime() { |
| 183 | let date = this.date; | 333 | let date = this.date; |
| 184 | let timeList = this.timeList; | 334 | let timeList = this.timeList; |
| 185 | - console.log(date) | ||
| 186 | - console.log(timeList) | 335 | + console.log("date ",date) |
| 336 | + console.log("timeList ",timeList) | ||
| 187 | if (this.isEmpty(date)) { | 337 | if (this.isEmpty(date)) { |
| 188 | this.$message.error("请选择日期") | 338 | this.$message.error("请选择日期") |
| 189 | return false; | 339 | return false; |
| @@ -219,7 +369,7 @@ export default { | @@ -219,7 +369,7 @@ export default { | ||
| 219 | this.$axios({ | 369 | this.$axios({ |
| 220 | method: 'get', | 370 | method: 'get', |
| 221 | url: '/api/jt1078/query/send/request/io/history/' + e.sim + '/' + e.channel + "/" + e.startTime + "/" + e.endTime + "/" + e.channelMapping | 371 | url: '/api/jt1078/query/send/request/io/history/' + e.sim + '/' + e.channel + "/" + e.startTime + "/" + e.endTime + "/" + e.channelMapping |
| 222 | - }).then(res=> { | 372 | + }).then(res => { |
| 223 | if (res.data && res.data.data && res.data.data.data) { | 373 | if (res.data && res.data.data && res.data.data.data) { |
| 224 | let videoUrl1; | 374 | let videoUrl1; |
| 225 | if (location.protocol === "https:") { | 375 | if (location.protocol === "https:") { |
| @@ -322,6 +472,7 @@ export default { | @@ -322,6 +472,7 @@ export default { | ||
| 322 | }, | 472 | }, |
| 323 | //生命周期 - 创建完成(可以访问当前this实例)", | 473 | //生命周期 - 创建完成(可以访问当前this实例)", |
| 324 | created() { | 474 | created() { |
| 475 | + this.getCarInfoBuffer() | ||
| 325 | }, | 476 | }, |
| 326 | //生命周期 - 挂载完成(可以访问DOM元素)", | 477 | //生命周期 - 挂载完成(可以访问DOM元素)", |
| 327 | mounted() { | 478 | mounted() { |
web_src/src/components/JT1078Components/HistoryData.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div style="width: 100%;border: black 100px"> | ||
| 3 | + <el-row :gutter="20"> | ||
| 4 | + <el-col :span="6"><div class="grid-content bg-purple">{{data.name}}</div></el-col> | ||
| 5 | + <el-col :span="6" :offset="12"> | ||
| 6 | + <el-button icon="el-icon-upload" size="small" style="border: none"></el-button> | ||
| 7 | + <el-button icon="el-icon-download" size="small" style="border: none"></el-button> | ||
| 8 | + </el-col> | ||
| 9 | + </el-row> | ||
| 10 | + </div> | ||
| 11 | +</template> | ||
| 12 | + | ||
| 13 | +<script> | ||
| 14 | +//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等), | ||
| 15 | +//例如:import 《组件名称》 from '《组件路径》, | ||
| 16 | + export default { | ||
| 17 | + //import引入的组件需要注入到对象中才能使用" | ||
| 18 | + components: {}, | ||
| 19 | + props: { | ||
| 20 | + data: { | ||
| 21 | + type: Object, | ||
| 22 | + default: null | ||
| 23 | + } | ||
| 24 | + }, | ||
| 25 | + data() { | ||
| 26 | + //这里存放数据" | ||
| 27 | + | ||
| 28 | + return {}; | ||
| 29 | + }, | ||
| 30 | + //计算属性 类似于data概念", | ||
| 31 | + computed: {}, | ||
| 32 | + //监控data中的数据变化", | ||
| 33 | + watch: {}, | ||
| 34 | + //方法集合", | ||
| 35 | + methods: {}, | ||
| 36 | + //生命周期 - 创建完成(可以访问当前this实例)", | ||
| 37 | + created() { | ||
| 38 | + }, | ||
| 39 | + //生命周期 - 挂载完成(可以访问DOM元素)", | ||
| 40 | + mounted() { | ||
| 41 | + }, | ||
| 42 | + beforeCreate() { | ||
| 43 | + }, //生命周期 - 创建之前", | ||
| 44 | + beforeMount() { | ||
| 45 | + }, //生命周期 - 挂载之前", | ||
| 46 | + beforeUpdate() { | ||
| 47 | + }, //生命周期 - 更新之前", | ||
| 48 | + updated() { | ||
| 49 | + }, //生命周期 - 更新之后", | ||
| 50 | + beforeDestroy() { | ||
| 51 | + }, //生命周期 - 销毁之前", | ||
| 52 | + destroyed() { | ||
| 53 | + }, //生命周期 - 销毁完成", | ||
| 54 | + activated() { | ||
| 55 | + } //如果页面有keep-alive缓存功能,这个函数会触发", | ||
| 56 | + }; | ||
| 57 | +</script> | ||
| 58 | +<style scoped> | ||
| 59 | + | ||
| 60 | +</style> |
web_src/src/components/JT1078Components/historical/HistoricalDataTree.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div style="width: 100%;height: 80vh" class="page-container"> | ||
| 3 | - <el-card class="box-card" > | ||
| 4 | - <div class="scroll-container"> | ||
| 5 | - <el-scrollbar style="height: 79vh"> | ||
| 6 | - <el-tree v-if="historyData.length > 0" :data="historyData" class="historical-list-tree"> | ||
| 7 | - <span class="custom-tree-node" slot-scope="{ node , data }"> | ||
| 8 | - <el-button @click="clickButton(data)" >{{ data.name }}</el-button> | ||
| 9 | - </span> | ||
| 10 | - </el-tree> | ||
| 11 | - <el-empty v-else></el-empty> | ||
| 12 | - </el-scrollbar> | ||
| 13 | - </div> | ||
| 14 | - </el-card> | 2 | + <div style="width: 100%;height: 100%" class="page-container"> |
| 3 | + <div class="scroll-container"> | ||
| 4 | + <el-scrollbar style="width:100%;height: 79vh"> | ||
| 5 | + <el-tree v-if="historyData.length > 0" :data="historyData" class="historical-list-tree"> | ||
| 6 | + <span class="custom-tree-node" style="width: 100%;border: 1px" slot-scope="{ node , data }"> | ||
| 7 | + <history-data :data="data"></history-data> | ||
| 8 | + </span> | ||
| 9 | + </el-tree> | ||
| 10 | + <el-empty v-else></el-empty> | ||
| 11 | + </el-scrollbar> | ||
| 12 | + </div> | ||
| 15 | </div> | 13 | </div> |
| 16 | </template> | 14 | </template> |
| 17 | <script> | 15 | <script> |
| 16 | +import HistoryData from "../HistoryData.vue"; | ||
| 17 | + | ||
| 18 | export default { | 18 | export default { |
| 19 | name: 'historical-data', | 19 | name: 'historical-data', |
| 20 | + components: {HistoryData}, | ||
| 20 | props: { | 21 | props: { |
| 21 | historyData: { | 22 | historyData: { |
| 22 | type: Array, | 23 | type: Array, |
| @@ -40,6 +41,7 @@ export default { | @@ -40,6 +41,7 @@ export default { | ||
| 40 | }, | 41 | }, |
| 41 | //生命周期 - 挂载完成(可以访问DOM元素)", | 42 | //生命周期 - 挂载完成(可以访问DOM元素)", |
| 42 | mounted() { | 43 | mounted() { |
| 44 | + | ||
| 43 | }, | 45 | }, |
| 44 | beforeCreate() { | 46 | beforeCreate() { |
| 45 | }, //生命周期 - 创建之前", | 47 | }, //生命周期 - 创建之前", |
| @@ -58,6 +60,7 @@ export default { | @@ -58,6 +60,7 @@ export default { | ||
| 58 | }; | 60 | }; |
| 59 | </script> | 61 | </script> |
| 60 | <style scoped> | 62 | <style scoped> |
| 63 | + | ||
| 61 | .page-container { | 64 | .page-container { |
| 62 | display: flex; | 65 | display: flex; |
| 63 | flex-direction: column; | 66 | flex-direction: column; |