consultInfo.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div>
  3. <NavBar />
  4. <div class="bigBox">
  5. <van-collapse v-model="activeNames" @open="addActiveNames">
  6. <div class="titleBox">
  7. <div class="textTitle">{{ taskData.taskName }}</div>
  8. <div class="text">调阅开始时间:{{ taskData.taskStartTime }}</div>
  9. <div class="text" v-if="taskData.taskStatus == 2">调阅结束时间:{{ taskData.taskEndTime }}</div>
  10. </div>
  11. <!-- 进行调阅 -->
  12. <!-- <div @click="editTaskInfo">进行调阅</div> -->
  13. <div v-if="taskData.taskStatus == 2">
  14. <!-- 调阅列表 -->
  15. <div class="topBox" v-for="item in taskData.coreMonitoringTaskRegistrationMonitorVOList" :key="item.id">
  16. <!-- //主机列表组件 -->
  17. <MonitoingList :list="item" :taskStatus="taskData.taskStatus"></MonitoingList>
  18. </div>
  19. </div>
  20. <div v-else>
  21. <van-collapse-item :name="item.hostId" v-for="item in hostList" :key="item.hostId">
  22. <template #title>
  23. <div class="textTitle">{{ item.hostName }}</div>
  24. </template>
  25. <passage
  26. ref="passage"
  27. :list="item.deviceVOS"
  28. :taskId="$route.params.id.split('_')[0]"
  29. :hostId="item.hostId"
  30. @resetList="getHostHandlerA"
  31. ></passage>
  32. </van-collapse-item>
  33. </div>
  34. </van-collapse>
  35. <!-- 底部按钮 -->
  36. <div class="bottomClass" v-if="this.$route.params.id.split('_')[1] != 2">
  37. <!-- <van-row>
  38. <van-col span="24">
  39. <van-button type="info" @click="addInfoHandler">添加调阅记录</van-button>
  40. </van-col>
  41. </van-row> -->
  42. <van-row v-if="hostList && hostList.length > 0">
  43. <van-col span="24">
  44. <van-button type="info" @click="endMontor">结束调阅</van-button>
  45. </van-col>
  46. </van-row>
  47. </div>
  48. </div>
  49. <!-- 扫描弹框 -->
  50. <scandialog ref="scandialog" @input="resultImg" @changeNFC="getNFC"></scandialog>
  51. </div>
  52. </template>
  53. <script>
  54. import NavBar from '@/components/NavBar'
  55. //通道列表
  56. import passage from './passage.vue'
  57. // 主机列表组件
  58. import MonitoingList from './monitoringList.vue'
  59. import { upload } from '@/api/public'
  60. import { Col, Row, Dialog, Toast, Icon, Picker } from 'vant'
  61. import { registrationList, getEndInfo, login, getSysDeviceByTaskId, registration } from '@/api/toConsult.js'
  62. import scandialog from '@/components/nfcPopup/alone.vue'
  63. import { base64ToBlob } from '@/utils/base64TurnImg.js'
  64. export default {
  65. data() {
  66. return {
  67. endNum: false, //判断是否能结束调阅
  68. taskData: {},
  69. hostList: [], //主机列表
  70. activeNames: []
  71. }
  72. },
  73. components: {
  74. scandialog,
  75. passage,
  76. NavBar,
  77. Dialog,
  78. Icon,
  79. Picker,
  80. Col,
  81. Row,
  82. MonitoingList
  83. },
  84. created() {
  85. this.init(1)
  86. },
  87. methods: {
  88. //项目初始化获取数据
  89. init(num=0) {
  90. registrationList({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  91. let { code, data, msg } = res
  92. if (code == 200) {
  93. this.taskData = data
  94. //如果当前是调阅中则获取视频主机和通道
  95. if (data && data.taskStatus < 2) {
  96. this.getHostHandler(num)
  97. }
  98. }
  99. })
  100. },
  101. getHostHandlerA(num) {
  102. // this.getHostHandler()
  103. this.init(num)
  104. },
  105. getHostHandler(num = 0) {
  106. // num//判断是不是第一次初始化
  107. console.log(num);
  108. getSysDeviceByTaskId({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  109. let { code, data, msg } = res
  110. if (code == 200) {
  111. this.hostList = data
  112. if (num == 1) {
  113. this.activeNames = [this.hostList[0].hostId]
  114. } else {
  115. console.log(this.activeNames, '////')
  116. }
  117. }
  118. })
  119. },
  120. addInfoHandler() {
  121. this.$router.push('/addInfo/' + this.$route.params.id.split('_')[0] + '_' + this.taskData.id + '_add')
  122. },
  123. //结束调阅
  124. endMontor() {
  125. //没有记录的时候不能结束调阅
  126. let falg = this.taskData.coreMonitoringTaskRegistrationMonitorVOList
  127. if (falg && falg.length > 0) {
  128. let startDate = JSON.parse(JSON.stringify(this.taskData.taskStartTime))
  129. startDate = Date.parse(new Date(startDate))
  130. let endDate = Date.parse(new Date())
  131. if (endDate - startDate) {
  132. Dialog.confirm({
  133. title: '提示',
  134. message: `当前调阅时长为${this.dateTime(endDate - startDate)},是否结束调阅?`
  135. })
  136. .then(() => {
  137. this.$refs.scandialog.visible = true
  138. this.globalLoading = true
  139. })
  140. .catch(() => {
  141. // on cancel
  142. })
  143. }
  144. } else {
  145. Dialog({ message: '调阅项目登记不能为全空!' })
  146. return
  147. }
  148. // else {
  149. // this.$refs.scandialog.visible = true
  150. // startDate = new Date(startDate)
  151. // }
  152. },
  153. dateTime(msd) {
  154. //将毫秒秒转化为xx小时xx分钟xx秒
  155. let time = parseFloat(msd) / 1000 //先将毫秒转化成秒
  156. if (null != time && '' != time) {
  157. if (time > 60 && time < 60 * 60) {
  158. time =
  159. parseInt(time / 60.0) + '分钟' + parseInt((parseFloat(time / 60.0) - parseInt(time / 60.0)) * 60) + '秒'
  160. } else if (time >= 60 * 60 && time < 60 * 60 * 24) {
  161. time =
  162. parseInt(time / 3600.0) +
  163. '小时' +
  164. parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) +
  165. '分钟' +
  166. parseInt(
  167. (parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
  168. parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) *
  169. 60
  170. ) +
  171. '秒'
  172. } else {
  173. time = parseInt(time) + '秒'
  174. }
  175. }
  176. return time
  177. },
  178. //文件上传
  179. resultImg(img) {
  180. this.photoHandler(img[0].url)
  181. },
  182. //上传NFC
  183. getNFC(nfc) {
  184. this.photoHandler('', nfc)
  185. },
  186. //扫描图片并上传到服务器和后端
  187. photoHandler(img = '', nfc = '') {
  188. //上传到服务器
  189. //开始调阅上传
  190. let obj = {
  191. endPicture: img,
  192. endNfc: nfc,
  193. taskId: this.$route.params.id.split('_')[0]
  194. }
  195. registration(obj).then(res => {
  196. let { code, data, msg } = res
  197. if (code == 200) {
  198. //结束调阅
  199. this.endHandler()
  200. }
  201. })
  202. },
  203. endHandler() {
  204. getEndInfo({
  205. id: this.taskData.id,
  206. taskId: this.$route.params.id.split('_')[0]
  207. }).then(res => {
  208. this.$router.go(-1)
  209. })
  210. },
  211. addActiveNames() {
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. .van-collapse-item {
  218. margin: 20px;
  219. margin-top: 0px;
  220. margin-bottom: 0px;
  221. }
  222. .titleBox {
  223. margin: 20px;
  224. margin-bottom: 0px;
  225. background-color: #fff;
  226. }
  227. .bigBox {
  228. height: calc(100vh - 260px);
  229. overflow: scroll;
  230. // height: 100vh;
  231. // padding: 20px;
  232. background-color: #f2f2f2;
  233. .textTitle {
  234. font-size: 30px;
  235. font-weight: bold;
  236. padding: 20px;
  237. }
  238. .text {
  239. padding: 20px;
  240. font-size: 26px;
  241. color: #b0b0b0;
  242. }
  243. .topBox {
  244. // margin-bottom: 10px;
  245. // margin: 20px;
  246. color: black;
  247. margin-top: 10px;
  248. }
  249. .bottomClass {
  250. position: fixed;
  251. width: 100%;
  252. bottom: 0%;
  253. }
  254. .van-button {
  255. width: 100%;
  256. margin-top: 10px;
  257. border-radius: 10px;
  258. }
  259. }
  260. </style>