consultInfo.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div>
  3. <NavBar :go="{type:'push',path:'/monitoringCall'}" />
  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. <!-- ------------ -->
  21. <div v-else>
  22. <van-collapse-item :name="item.hostId" v-for="item in hostList" :key="item.hostId">
  23. <template #title>
  24. <div class="textTitle">{{ item?.hostName }}</div>
  25. </template>
  26. <passage ref="passage" :list="item?.deviceVOS" :taskId="$route.params.id.split('_')[0]" :hostId="item.hostId" @resetList="getHostHandler"></passage>
  27. </van-collapse-item>
  28. </div>
  29. </van-collapse>
  30. <!-- 底部按钮 -->
  31. <div class="bottomClass" v-if="this.$route.params.id.split('_')[1] != 2">
  32. <!-- <van-row>
  33. <van-col span="24">
  34. <van-button type="info" @click="addInfoHandler">添加调阅记录</van-button>
  35. </van-col>
  36. </van-row> -->
  37. <van-row v-if="hostList&&hostList.length>0">
  38. <van-col span="24">
  39. <van-button type="info" @click="endMontor">结束调阅</van-button>
  40. </van-col>
  41. </van-row>
  42. </div>
  43. </div>
  44. <!-- 扫描弹框 -->
  45. <scandialog ref="scandialog" @change="resultImg" @changeNFC="getNFC"></scandialog>
  46. </div>
  47. </template>
  48. <script>
  49. import NavBar from '@/components/NavBar'
  50. //通道列表
  51. import passage from './passage.vue'
  52. // 主机列表组件
  53. import MonitoingList from './monitoringList.vue'
  54. import { upload } from '@/api/public'
  55. import { Col, Row, Dialog, Toast, Icon, Picker } from 'vant'
  56. import { registrationList, getEndInfo, login, getSysDeviceByTaskId, registration } from '@/api/toConsult.js'
  57. import scandialog from '@/components/nfcPopup/alone.vue'
  58. import { base64ToBlob } from '@/utils/base64TurnImg.js'
  59. export default {
  60. data() {
  61. return {
  62. taskData: {},
  63. hostList:[],//主机列表
  64. activeNames: []
  65. }
  66. },
  67. components: {
  68. scandialog,
  69. passage,
  70. NavBar,
  71. Dialog,
  72. Icon,
  73. Picker,
  74. Col,
  75. Row,
  76. MonitoingList
  77. },
  78. created() {
  79. this.init()
  80. },
  81. methods: {
  82. //项目初始化获取数据
  83. init() {
  84. registrationList({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  85. let { code, data, msg } = res
  86. if (code == 200) {
  87. this.taskData = data
  88. //如果当前是调阅中则获取视频主机和通道
  89. if (data?.taskStatus < 2) {
  90. this.getHostHandler()
  91. }
  92. }
  93. })
  94. },
  95. getHostHandler() {
  96. getSysDeviceByTaskId({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  97. let { code, data, msg } = res
  98. if (code == 200) {
  99. this.hostList=data
  100. this.activeNames=[this.hostList[0].hostId]
  101. }
  102. })
  103. },
  104. addInfoHandler() {
  105. console.log(this.taskData)
  106. this.$router.push('/addInfo/' + this.$route.params.id.split('_')[0] + '_' + this.taskData.id + '_add')
  107. },
  108. //结束调阅
  109. endMontor() {
  110. //没有记录的时候不能结束调阅
  111. if (!this.taskData?.coreMonitoringTaskRegistrationMonitorVOList||this.taskData?.coreMonitoringTaskRegistrationMonitorVOList?.length == 0) {
  112. Dialog({ message: '该调阅没有记录不能进行结束操作!' })
  113. return
  114. }
  115. let startDate = JSON.parse(JSON.stringify(this.taskData.taskStartTime))
  116. startDate = Date.parse(new Date(startDate))
  117. let endDate = Date.parse(new Date())
  118. if (endDate - startDate <= 3600000) {
  119. Dialog({ message: '该调阅未满一个小时请确认' })
  120. // 未满一小时不能结束调阅
  121. } else {
  122. this.$refs.scandialog.visible = true
  123. startDate = new Date(startDate)
  124. }
  125. },
  126. //文件上传
  127. resultImg(img) {
  128. let obj = base64ToBlob(img.base)
  129. let formData = new FormData()
  130. obj.name = '调阅.jpg'
  131. formData.append('file', base64ToBlob(img.base))
  132. upload(formData, 'image')
  133. .then(res => {
  134. console.log(process.env.NODE_ENV)
  135. /*上传成功*/
  136. let imgUrl = process.env.NODE_ENV === 'development' ? res.data.url : window.origin + res.data.url
  137. this.photoHandler(imgUrl)
  138. // this.$emit("imgUrl", res.data.url);
  139. })
  140. .catch(err => {
  141. /*上传失败*/
  142. })
  143. },
  144. //上传NFC
  145. getNFC(nfc) {
  146. this.photoHandler('', nfc)
  147. },
  148. //扫描图片并上传到服务器和后端
  149. photoHandler(img = '', nfc = '') {
  150. //上传到服务器
  151. //开始调阅上传
  152. let obj = {
  153. endPicture: img,
  154. endNfc: nfc,
  155. taskId: this.$route.params.id.split('_')[0]
  156. }
  157. registration(obj).then(res => {
  158. let { code, data, msg } = res
  159. if (code == 200) {
  160. Toast.success('扫描成功')
  161. setTimeout(() => {
  162. //结束调阅
  163. this.endHandler()
  164. }, 2000);
  165. }
  166. })
  167. },
  168. endHandler() {
  169. getEndInfo({
  170. id: this.taskData.id,
  171. taskId: this.$route.params.id.split('_')[0]
  172. }).then(res => {
  173. this.$router.push('/monitoringCall')
  174. })
  175. },
  176. addActiveNames(){
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .van-collapse-item {
  183. margin: 20px;
  184. margin-top: 0px;
  185. margin-bottom: 0px;
  186. }
  187. .titleBox{
  188. margin: 20px;
  189. margin-bottom: 0px;
  190. background-color: #fff;
  191. }
  192. .bigBox {
  193. height: calc(100vh - 260px);
  194. overflow: scroll;
  195. // height: 100vh;
  196. // padding: 20px;
  197. background-color: #f2f2f2;
  198. .textTitle {
  199. font-size: 30px;
  200. font-weight: bold;
  201. padding: 20px;
  202. padding-bottom: 0px;
  203. }
  204. .text {
  205. padding: 20px;
  206. font-size: 26px;
  207. color: #b0b0b0;
  208. }
  209. .topBox {
  210. // margin-bottom: 10px;
  211. // margin: 20px;
  212. color: black;
  213. margin-top: 10px;
  214. }
  215. .bottomClass {
  216. position: fixed;
  217. width: 100%;
  218. bottom: 0%;
  219. }
  220. .van-button {
  221. width: 100%;
  222. margin-top: 10px;
  223. border-radius: 10px;
  224. }
  225. }
  226. </style>