detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <div class="videoDaysDetail">
  3. <DialogCom title="录像详情" :visible.sync="isShow" width="1100px">
  4. <el-descriptions
  5. title="基础信息"
  6. :column="2"
  7. border
  8. :label-style="labelStyle"
  9. :contentStyle="content_style"
  10. ><el-descriptions-item label="监控主机">{{
  11. data.hostName
  12. }}</el-descriptions-item>
  13. <el-descriptions-item label="通道名称">{{
  14. data.channelName
  15. }}</el-descriptions-item>
  16. <!-- <el-descriptions-item label="IP地址">{{
  17. data.channelIp
  18. }}</el-descriptions-item> -->
  19. </el-descriptions>
  20. <el-tabs type="border-card">
  21. <el-tab-pane label="录像存储情况">
  22. <!-- <el-descriptions
  23. title="录像存储天数"
  24. :column="3"
  25. border
  26. :label-style="labelStyle"
  27. :contentStyle="content_style"
  28. v-if="data.storage == null || data.storage.planDays == null"
  29. >
  30. <el-descriptions-item label="存储状态"> 未知 </el-descriptions-item>
  31. </el-descriptions>
  32. <div v-else>
  33. <el-descriptions
  34. title="录像存储天数"
  35. :column="3"
  36. border
  37. :label-style="labelStyle"
  38. :contentStyle="content_style"
  39. >
  40. <el-descriptions-item label="计划存储"
  41. >{{ data.storage.planDays }}天</el-descriptions-item
  42. >
  43. <el-descriptions-item label="实际存储"
  44. >{{ data.storage.realDays }}天</el-descriptions-item
  45. >
  46. <el-descriptions-item label="最早录像存储日期">{{
  47. data.storage.earliestTime
  48. ? dayjs(data.storage.earliestTime).format("YYYY年M月D日")
  49. : ""
  50. }}</el-descriptions-item>
  51. </el-descriptions>
  52. <el-descriptions :column="1">
  53. <el-descriptions-item label="存储状态">
  54. &lt;!&ndash; <time-line></time-line>&ndash;&gt;
  55. <ul class="legend-box">
  56. <li>
  57. <i class="legend" style="background-color: green"></i>
  58. <span>录像完整</span>
  59. </li>
  60. <li>
  61. <i class="legend" style="background-color: orange"></i>
  62. <span>部分丢失</span>
  63. </li>
  64. <li>
  65. <i class="legend" style="background-color: red"></i>
  66. <span>全部丢失</span>
  67. </li>
  68. <li>
  69. <i class="legend" style="background-color: #cbd5e0"></i>
  70. <span>计划录像天数</span>
  71. </li>
  72. </ul>
  73. </el-descriptions-item>
  74. </el-descriptions>
  75. <div class="calendar-box">
  76. <Calendar
  77. :startDate="calenderStartDate"
  78. :endDate="data.storage.lastTime"
  79. :full="data.storage.fullDates"
  80. :paritialLoss="data.storage.partialLossDates"
  81. :allLoss="data.storage.allLostDates"
  82. @select="onSelectDate"
  83. ></Calendar>
  84. </div>
  85. </div>-->
  86. <div style="height: 10px"></div>
  87. <el-descriptions
  88. title="录像完整性"
  89. :column="3"
  90. border
  91. :label-style="labelStyle"
  92. :contentStyle="content_style"
  93. v-if="integrity == null || integrity.state == null"
  94. >
  95. <el-descriptions-item label="检测结果"> 未知 </el-descriptions-item>
  96. </el-descriptions>
  97. <div v-else>
  98. <el-descriptions
  99. title="录像完整性"
  100. :column="3"
  101. border
  102. :label-style="labelStyle"
  103. :contentStyle="content_style"
  104. >
  105. <el-descriptions-item label="检测结果">{{
  106. getLabel(videoIntegrityState, integrity.state)
  107. }}</el-descriptions-item>
  108. <el-descriptions-item label="录像日期">{{
  109. dayjs(integrity.recordDate).format("YYYY年M月D日")
  110. }}</el-descriptions-item>
  111. <el-descriptions-item label="丢失时长">{{
  112. lostDurationText(integrity.loseDuration)
  113. }}</el-descriptions-item>
  114. <el-descriptions-item label="更新时间">{{
  115. dayjs(integrity.updateTime).format("YYYY年M月D日H时m分")
  116. }}</el-descriptions-item>
  117. </el-descriptions>
  118. <el-descriptions :column="1">
  119. <el-descriptions-item label="丢失时段">
  120. <!-- <time-line></time-line>-->
  121. <ul class="legend-box">
  122. <li>
  123. <i class="legend" style="background-color: #00b2ff"></i>
  124. <span>计划时长</span>
  125. </li>
  126. <li>
  127. <i class="legend" style="background-color: #eaeaea"></i>
  128. <span>未计划时长</span>
  129. </li>
  130. <li>
  131. <i class="legend" style="background-color: green"></i>
  132. <span>有录像</span>
  133. </li>
  134. <li>
  135. <i class="legend" style="background-color: red"></i>
  136. <span>无录像</span>
  137. </li>
  138. </ul>
  139. </el-descriptions-item>
  140. </el-descriptions>
  141. <div class="time-line-box">
  142. <!-- <div style="width: 100%;height: 20px;background-color: red; "></div>-->
  143. <progress-bar
  144. :timeCell="timeCells"
  145. :lostData="lostData"
  146. ></progress-bar>
  147. </div>
  148. </div>
  149. </el-tab-pane>
  150. <el-tab-pane label="实时录像质量">
  151. <el-descriptions
  152. title="实时录像质量"
  153. :column="3"
  154. border
  155. :label-style="labelStyle"
  156. :contentStyle="content_style"
  157. v-if="data.quality == null || data.quality.quality == null"
  158. >
  159. <el-descriptions-item label="检测结果"> 未知 </el-descriptions-item>
  160. </el-descriptions>
  161. <div v-else>
  162. <el-descriptions
  163. title="实时录像质量"
  164. :column="2"
  165. border
  166. :label-style="labelStyle"
  167. :contentStyle="content_style"
  168. >
  169. <el-descriptions-item label="检测结果">{{
  170. getLabel(videoDiagnosisState, data.quality.quality)
  171. }}</el-descriptions-item>
  172. <el-descriptions-item label="更新时间">{{
  173. dayjs(data.quality.updateTime).format("YYYY年M月D日H时m分")
  174. }}</el-descriptions-item>
  175. <el-descriptions-item
  176. label="诊断截图"
  177. v-if="data.quality.quality == 1"
  178. >
  179. <div>
  180. <ul class="legend-box legend-box-quality">
  181. <li>
  182. <el-tag
  183. size="small"
  184. type="danger"
  185. v-if="data.quality.signalLost"
  186. >视频信号</el-tag
  187. >
  188. </li>
  189. <li>
  190. <el-tag
  191. size="small"
  192. type="danger"
  193. v-if="data.quality.occlude"
  194. >遮挡</el-tag
  195. >
  196. </li>
  197. <li>
  198. <el-tag
  199. size="small"
  200. type="danger"
  201. v-if="data.quality.blurry"
  202. >模糊</el-tag
  203. >
  204. </li>
  205. <li>
  206. <el-tag
  207. size="small"
  208. type="danger"
  209. v-if="data.quality.colorCast"
  210. >偏色</el-tag
  211. >
  212. </li>
  213. <li>
  214. <el-tag
  215. size="small"
  216. type="danger"
  217. v-if="data.quality.snowflake"
  218. >雪花</el-tag
  219. >
  220. </li>
  221. <li>
  222. <el-tag
  223. size="small"
  224. type="danger"
  225. v-if="data.quality.stripe"
  226. >条纹</el-tag
  227. >
  228. </li>
  229. <li>
  230. <el-tag
  231. size="small"
  232. type="danger"
  233. v-if="data.quality.contrast"
  234. >对比度</el-tag
  235. >
  236. </li>
  237. <li>
  238. <el-tag
  239. size="small"
  240. type="danger"
  241. v-if="data.quality.brightness"
  242. >亮度</el-tag
  243. >
  244. </li>
  245. </ul>
  246. <div
  247. style="
  248. display: block;
  249. width: 300px;
  250. max-height: 300px;
  251. margin-top: 20px;
  252. "
  253. >
  254. <el-image
  255. :src="imgUrl(data.quality.image)"
  256. :preview-src-list="[imgUrl(data.quality.image)]"
  257. >
  258. <div slot="error" class="image-slot">
  259. <i class="el-icon-picture-outline"></i>
  260. </div>
  261. </el-image>
  262. </div>
  263. </div>
  264. </el-descriptions-item>
  265. </el-descriptions>
  266. </div>
  267. </el-tab-pane>
  268. </el-tabs>
  269. <div slot="footer" class="dialog-footer" style="margin-top: 20px">
  270. <el-button @click="onHide">关闭</el-button>
  271. </div>
  272. </DialogCom>
  273. </div>
  274. </template>
  275. <script>
  276. import ProgressBar from "./ProgressBar";
  277. import Calendar from "./Calendar.vue";
  278. import dayjs from "dayjs";
  279. import { detail } from "@/api/iot/videoDiagnosis.js";
  280. import { getLabel } from "@/views/commonOption.js";
  281. import { integrity } from "@/api/iot/videoDiagnosis";
  282. export default {
  283. components: { ProgressBar, Calendar },
  284. data() {
  285. return {
  286. isShow: false,
  287. data: {},
  288. integrity: {},
  289. id: null,
  290. // playVideoObj: {}, //选中的正在播放的录像
  291. timeCells: [], //录像时间块
  292. lostData: [], //不存在视频的时间块
  293. // start_timestamp: new Date().getTime() - 5 * 60 * 60 * 1000, //刻度轴开始时间
  294. labelStyle: {
  295. color: "#000",
  296. "text-align": "center",
  297. height: "40px",
  298. width: "120px",
  299. "word-break": "keep-all",
  300. },
  301. content_style: {
  302. "text-align": "left",
  303. "min-width": "250px",
  304. "word-break": "break-all",
  305. },
  306. };
  307. },
  308. props: ["videoIntegrityState", "videoDaysState", "videoDiagnosisState"],
  309. computed: {
  310. calenderStartDate() {
  311. if (this.data == null || this.data.storage == null) {
  312. return new Date();
  313. }
  314. if (this.data.storage.earliestTime) {
  315. return this.data.storage.earliestTime;
  316. }
  317. let d = dayjs().add(this.data.storage.planDays * -1 - 1, "day");
  318. return d;
  319. },
  320. },
  321. methods: {
  322. dayjs,
  323. getLabel,
  324. async show(hostCode, channelCode) {
  325. detail(hostCode, channelCode).then((r) => {
  326. let data = r.data;
  327. data.hostCode = hostCode;
  328. data.channelCode = channelCode;
  329. // this.data.storage.fullDates=["2024-02-15","2024-02-16","2024-02-17","2024-02-18","2024-02-19"]
  330. // this.data.storage.partialLossDates=["2024-02-5","2024-02-6","2024-02-7","2024-02-8","2024-02-9"]
  331. // this.data.storage.allLostDates=["2024-02-10","2024-02-11","2024-02-12","2024-02-13","2024-02-14"]
  332. this.handleInterity(data.integrity);
  333. this.data = data;
  334. this.isShow = true;
  335. });
  336. },
  337. getIntegrity(hostCode, channelCode, date) {
  338. integrity(hostCode, channelCode, dayjs(date).format("YYYY-MM-DD")).then(
  339. (r) => {
  340. this.handleInterity(r.data);
  341. }
  342. );
  343. },
  344. handleInterity(integrity) {
  345. this.integrity = integrity;
  346. let timeCells = [];
  347. let lostData = [];
  348. if (integrity && integrity.recordDate) {
  349. let recordDateStr = dayjs(integrity.recordDate).format("YYYY-MM-DD");
  350. if (integrity.checks) {
  351. timeCells = integrity.checks.map((d) => ({
  352. beginTime: `${recordDateStr} ${d.st}`,
  353. endTime: `${recordDateStr} ${d.et}`,
  354. }));
  355. }
  356. if (integrity.losts) {
  357. lostData = integrity.losts.map((d) => ({
  358. beginTime: `${recordDateStr} ${d.st}`,
  359. endTime: `${recordDateStr} ${d.et}`,
  360. }));
  361. }
  362. }
  363. this.timeCells = timeCells;
  364. this.lostData = lostData;
  365. },
  366. onHide() {
  367. this.isShow = false;
  368. this.id = null;
  369. this.integrity = {};
  370. this.data = {};
  371. (this.timeCells = []), //录像时间块
  372. (this.lostData = []);
  373. },
  374. onSelectDate(date) {
  375. this.getIntegrity(this.data.hostCode, this.data.channelCode, date);
  376. },
  377. lostDurationText(duration) {
  378. if (!duration || duration == "0") {
  379. return "未丢失";
  380. }
  381. let str = "";
  382. let hour = Math.floor(duration / 60);
  383. if (hour > 0) {
  384. str += `${hour}小时`;
  385. }
  386. let minute = duration % 60;
  387. if (minute > 0) {
  388. str += `${minute}分`;
  389. }
  390. return str;
  391. },
  392. imgUrl(url) {
  393. // 如果传入的是 base64 字符串,直接返回
  394. if (url.startsWith('data:image')) {
  395. return url;
  396. }
  397. // 否则,返回原来的 URL
  398. return url;
  399. }
  400. },
  401. };
  402. </script>
  403. <style lang="scss">
  404. .videoDaysDetail {
  405. .block {
  406. display: block;
  407. }
  408. .time-line {
  409. margin-top: 10px;
  410. margin-left: 80px;
  411. }
  412. .list-title {
  413. font-size: 16px;
  414. font-family: PingFangSC-Medium, PingFang SC;
  415. font-weight: 500;
  416. color: #181b1e;
  417. }
  418. .list-company {
  419. font-size: 14px;
  420. font-family: PingFangSC-Regular, PingFang SC;
  421. font-weight: 400;
  422. color: #2991ff;
  423. margin-top: 15px;
  424. margin-bottom: 15px;
  425. }
  426. .list-desc {
  427. font-size: 14px;
  428. font-family: PingFangSC-Regular, PingFang SC;
  429. font-weight: 400;
  430. color: #596878;
  431. }
  432. .el-tag--small {
  433. margin-bottom: 10px;
  434. }
  435. .reTip {
  436. display: block;
  437. background: #f00;
  438. border-radius: 50%;
  439. width: 4px;
  440. height: 4px;
  441. top: -21px;
  442. right: -26px;
  443. position: relative;
  444. z-index: 4;
  445. }
  446. //左侧时间
  447. .time {
  448. color: rgb(181 215 251);
  449. position: absolute;
  450. left: -35px;
  451. top: -1px;
  452. .year {
  453. font-size: 14px;
  454. font-family: PingFangSC-Regular, PingFang SC;
  455. font-weight: 400;
  456. color: #20354a;
  457. }
  458. .day {
  459. font-size: 14px;
  460. font-family: PingFangSC-Regular, PingFang SC;
  461. font-weight: 400;
  462. color: #596878;
  463. text-align: center;
  464. margin-top: 10px;
  465. }
  466. }
  467. .legend-box {
  468. display: flex;
  469. flex-direction: row;
  470. justify-content: flex-start;
  471. align-items: center;
  472. > li {
  473. display: flex;
  474. flex-direction: row;
  475. justify-content: flex-start;
  476. align-items: center;
  477. margin-right: 20px;
  478. i {
  479. margin-right: 5px;
  480. }
  481. }
  482. }
  483. .legend-box-quality {
  484. > li {
  485. margin-right: 5px;
  486. }
  487. }
  488. .time-line-box {
  489. width: 100%;
  490. padding: 0 80px 50px 80px;
  491. }
  492. .calendar-box {
  493. width: 100%;
  494. display: flex;
  495. flex-wrap: wrap;
  496. justify-content: space-between;
  497. //>div{
  498. // width: 30%;
  499. //}
  500. }
  501. .el-calendar-table .el-calendar-day {
  502. padding: 5px;
  503. height: auto;
  504. }
  505. .el-calendar__button-group {
  506. display: none;
  507. }
  508. .legend {
  509. display: block;
  510. width: 14px;
  511. height: 10px;
  512. margin-right: 5px;
  513. }
  514. }
  515. </style>