detail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="detail">
  3. <nav-bar></nav-bar>
  4. <card class="info">
  5. <div>{{ info.channelName }}</div>
  6. </card>
  7. <card>
  8. <van-cell-group>
  9. <van-cell
  10. title="实时视频质量"
  11. :value="info.quality ? getDictLabel(info.quality.quality, 'video_diagnosis_state', '未上报') : '未上报'"
  12. title-style="font-weight:700"
  13. />
  14. <van-cell
  15. v-if="info.quality != null && info.quality.quality != null"
  16. value-class="cell-quality-value"
  17. title-style="display:none"
  18. >
  19. <template #default>
  20. <div>诊断截图</div>
  21. <div class="quality-tags">
  22. <van-tag type="danger" v-if="info.quality.signalLost == 1">信号丢失</van-tag>
  23. <van-tag type="danger" v-if="info.quality.occlude == 1">遮挡</van-tag>
  24. <van-tag type="danger" v-if="info.quality.brightness == 1">亮度</van-tag>
  25. <van-tag type="danger" v-if="info.quality.colorCast == 1">偏色</van-tag>
  26. <van-tag type="danger" v-if="info.quality.snowflake == 1">雪花</van-tag>
  27. <van-tag type="danger" v-if="info.quality.stripe == 1">条纹</van-tag>
  28. <van-tag type="danger" v-if="info.quality.contrast == 1">对比度</van-tag>
  29. <van-tag type="danger" v-if="info.quality.blurry == 1">模糊</van-tag>
  30. </div>
  31. <van-image
  32. height="20vh"
  33. :src="info.quality.image"
  34. @click="
  35. () => {
  36. showImage = true
  37. }
  38. "
  39. ></van-image>
  40. <van-image-preview v-model="showImage" :images="[info.quality.image]"></van-image-preview
  41. ></template>
  42. </van-cell>
  43. </van-cell-group>
  44. </card>
  45. <card v-if="!info.storage">
  46. <van-cell title="录像存储情况" value="未上报" title-style="font-weight:700;"> </van-cell>
  47. </card>
  48. <card v-else>
  49. <van-cell-group>
  50. <van-cell title="录像存储情况" title-style="font-weight:700;">
  51. <!-- <template #default>
  52. <van-tag type="success" v-if="info.storage.planDays === info.storage.realDays">正常</van-tag>
  53. <van-tag type="warning" v-else>异常</van-tag>
  54. </template> -->
  55. </van-cell>
  56. <van-cell title="计划存储天数" :value="`${info.storage.planDays}天`"></van-cell>
  57. <van-cell title="实际存储天数" :value="`${info.storage.realDays}天`"></van-cell>
  58. <van-cell value-class="cell-calender-value" title-class="cell-calender-title">
  59. <template #title></template>
  60. <template #default>
  61. <calendar
  62. ref="calendar"
  63. :data="info.storage"
  64. :earlistDate="info.storage.earliestTime"
  65. :defaultSelectedDate="selectDate"
  66. @change="onChange"
  67. ></calendar>
  68. </template>
  69. </van-cell>
  70. <van-cell title="录像完整性" title-style="font-weight:500;"></van-cell>
  71. <van-cell title="日期" :value="dayjs(selectDate).format('YYYY年M月D日')" v-if="selectDate"
  72. ></van-cell>
  73. <van-cell title="丢失时长">
  74. <template #default>
  75. {{ integrity ? lostDurationText(integrity.loseDuration) : '未知' }}
  76. </template>
  77. </van-cell>
  78. </van-cell-group>
  79. </card>
  80. </div>
  81. </template>
  82. <script>
  83. import KList from '@/components/list/index.vue'
  84. import * as api from '@/api/iot/videoDiagnosis.js'
  85. import Card from '@/components/card/index.vue'
  86. import Calendar from './components/calender.vue'
  87. import { getLabel } from '@/utils/optionEx'
  88. import NavBar from '@/components/NavBar'
  89. import { mapGetters } from 'vuex'
  90. import dayjs from 'dayjs'
  91. export default {
  92. data() {
  93. return {
  94. info: {},
  95. showImage:false,
  96. hostCode: this.$route.query.hostCode,
  97. channelCode: this.$route.query.channelCode,
  98. integrity: {},
  99. selectDate:null,
  100. dicts: ['video_diagnosis_state']
  101. }
  102. },
  103. components: { NavBar, KList, Card, Calendar },
  104. computed: {
  105. ...mapGetters(['dictionary'])
  106. },
  107. mounted() {
  108. this.getInfo()
  109. },
  110. methods: {
  111. getLabel,
  112. getInfo() {
  113. api.detail(this.hostCode, this.channelCode).then(r => {
  114. this.info = r.data
  115. this.integrity = r.data.integrity
  116. if(r.data.integrity){
  117. this.selectDate=r.data.integrity.recordDate;
  118. }
  119. })
  120. },
  121. onChange(day) {
  122. this.selectDate = day
  123. api.integrity(this.hostCode, this.channelCode, dayjs(day).format('YYYY-MM-DD')).then(r => {
  124. this.integrity = r.data
  125. })
  126. },
  127. lostDurationText(duration) {
  128. if (!duration) {
  129. return '未丢失'
  130. }
  131. let str = ''
  132. let hour = Math.floor(duration / 60)
  133. if (hour > 0) {
  134. str += `${hour}小时`
  135. }
  136. let minute = duration % 60
  137. str += `${minute}分`
  138. return str
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .cell-quality-value {
  145. width: 100%;
  146. }
  147. .quality-tags{
  148. >span{
  149. margin-left:1vw;
  150. }
  151. >span:first-child{
  152. margin-left:0;
  153. }
  154. }
  155. .cell-calender-value {
  156. width: 100%;
  157. }
  158. .cell-calender-title {
  159. display: none;
  160. }
  161. .detail {
  162. margin: 15px;
  163. }
  164. // .info {
  165. // ::v-deep .van-cell__title {
  166. // max-width: 40%;
  167. // }
  168. // ::v-deep .van-cell__value {
  169. // max-width: 60%;
  170. // }
  171. // }
  172. </style>