consultInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. <areaMonitoringList :list="item" :taskStatus="taskData.taskStatus"></areaMonitoringList>
  18. </div>
  19. </div>
  20. <div class="topBox" 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. <!-- <van-collapse-item>
  34. <template #title>
  35. <div class="textTitle">区域列表</div>
  36. </template> -->
  37. <areaPassage
  38. ref="passage"
  39. :list="retrievalAreaList"
  40. :taskId="$route.params.id.split('_')[0]"
  41. @resetList="getHostHandlerA"
  42. ></areaPassage>
  43. <!-- </van-collapse-item> -->
  44. </div>
  45. </van-collapse>
  46. <!-- 底部按钮 -->
  47. <div class="bottomClass" v-if="this.$route.params.id.split('_')[1] != 2">
  48. <!-- <van-row>
  49. <van-col span="24">
  50. <van-button type="info" @click="addInfoHandler">添加调阅记录</van-button>
  51. </van-col>
  52. </van-row> -->
  53. <van-row v-if="retrievalAreaList && retrievalAreaList.length > 0">
  54. <van-col span="24">
  55. <van-button type="info" @click="endMontor">结束调阅</van-button>
  56. </van-col>
  57. </van-row>
  58. </div>
  59. </div>
  60. <van-action-sheet v-model="showSign" :title="shwoSignTitle" class="sheet">
  61. <writingPad ref="esign" :old-signature-seal="oldSignatureSeal" @resultImg="resultSignImg" @cancelSign="cancelSign"></writingPad>
  62. </van-action-sheet>
  63. <!-- 扫描弹框 -->
  64. <scandialog ref="scandialog" @input="resultImg" @changeNFC="getNFC"></scandialog>
  65. <van-dialog v-model="confirmShow" title="引入签名" show-cancel-button @confirm="confirmSignImg">
  66. <van-image :src="this_window + oldSignatureSeal" />
  67. </van-dialog>
  68. </div>
  69. </template>
  70. <script>
  71. import NavBar from '@/components/NavBar'
  72. //通道列表
  73. import passage from './passage.vue'
  74. import areaPassage from './areaPassage.vue'
  75. // 主机列表组件
  76. import MonitoingList from './monitoringList.vue'
  77. import areaMonitoringList from './areaMonitoringList.vue'
  78. import { upload } from '@/api/public'
  79. import { Col, Row, Dialog, Toast, Icon, Picker } from 'vant'
  80. import { registrationList, finishRegistration, login, getSysDeviceByTaskId, registration } from '@/api/toConsult.js'
  81. import scandialog from '@/components/nfcPopup/alone.vue'
  82. import writingPad from '@/components/writingPad/index.vue'
  83. import imgCom from '@/components/imgCom/index.vue'
  84. import { base64ToBlob } from '@/utils/base64TurnImg.js'
  85. export default {
  86. data() {
  87. return {
  88. endNum: false, //判断是否能结束调阅
  89. taskData: {},
  90. hostList: [], //主机列表
  91. retrievalAreaList:[], // 监控调阅区域名称
  92. activeNames: [],
  93. showSign:false,
  94. shwoSignTitle:"签名",
  95. signImgUrl:"",
  96. oldSignatureSeal:"",
  97. confirmShow:false,
  98. this_window: process.env.NODE_ENV === 'development' ? '/dev' : window.origin,
  99. }
  100. },
  101. components: {
  102. scandialog,
  103. areaPassage,
  104. // passage,
  105. NavBar,
  106. Dialog,
  107. Icon,
  108. Picker,
  109. Col,
  110. Row,
  111. // MonitoingList,
  112. areaMonitoringList,
  113. writingPad,
  114. imgCom,
  115. },
  116. created() {
  117. this.init(1)
  118. },
  119. mounted() {
  120. this.oldSignatureSeal = JSON.parse(window.sessionStorage.getItem('SET_MASTER_SIGNATURE_SEAL')) + '';
  121. },
  122. methods: {
  123. //项目初始化获取数据
  124. init(num=0) {
  125. registrationList({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  126. let { code, data, msg } = res
  127. if (code == 200) {
  128. this.taskData = data
  129. if (data && data.taskStatus < 2) {
  130. this.getHostHandler(num)
  131. }
  132. if(num === 1 && data.taskStatus !=2){
  133. Dialog.alert({
  134. message: '当前为监控调阅区域选择界面,请根据实际调阅情况选择,无需全部填写。',
  135. }).then(() => {
  136. });
  137. } }
  138. })
  139. },
  140. getHostHandlerA(num) {
  141. // this.getHostHandler()
  142. this.init(num)
  143. },
  144. getHostHandler(num = 0) {
  145. // num//判断是不是第一次初始化
  146. // getSysDeviceByTaskId({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
  147. // let { code, data, msg } = res
  148. // if (code == 200) {
  149. // this.hostList = data
  150. // if (num == 1) {
  151. // this.activeNames = [this.hostList[0].hostId]
  152. // } else {
  153. // console.log(this.activeNames, '////')
  154. // }
  155. // }
  156. // })
  157. //获取调阅字典
  158. this.getDictHandler('video_retrieval_area', res => {
  159. let areaList = JSON.parse(JSON.stringify(res));
  160. if(this.taskData.coreMonitoringTaskRegistrationMonitorVOList){
  161. areaList.forEach(area=>{
  162. let tempList= this.taskData.coreMonitoringTaskRegistrationMonitorVOList.filter(item=>item.areaCode == area.dictValue);
  163. if(tempList && tempList.length>0)
  164. {
  165. if(tempList[0].coreMonitoringTaskMonitorInfoList && tempList[0].coreMonitoringTaskMonitorInfoList.findIndex(x=>{
  166. return x.situation=="1";
  167. })>-1)
  168. {
  169. this.$set(area, 'type', 2)
  170. }
  171. else{
  172. this.$set(area, 'type', 1)
  173. }
  174. }
  175. else{
  176. this.$set(area, 'type', 0)
  177. }
  178. });
  179. }
  180. else{
  181. areaList.forEach(area=>{
  182. this.$set(area, 'type', 0)
  183. })
  184. }
  185. this.retrievalAreaList=areaList;
  186. // this.dataList.forEach(item => {
  187. // this.$set(item, 'situation', '') //异常情况初始化默认值
  188. // this.$set(item, 'isChecked', false) //选中初始值
  189. // this.$set(item, 'abnormalIllustrate', '') //情况说明初始化默认值
  190. // })
  191. })
  192. },
  193. addInfoHandler() {
  194. this.$router.push('/addInfo/' + this.$route.params.id.split('_')[0] + '_' + this.taskData.id + '_add')
  195. },
  196. //结束调阅
  197. endMontor() {
  198. //没有记录的时候不能结束调阅
  199. let falg = this.taskData.coreMonitoringTaskRegistrationMonitorVOList
  200. if (falg && falg.length > 0) {
  201. let startDate = JSON.parse(JSON.stringify(this.taskData.taskStartTime))
  202. let obj=startDate.replace(/-/g,"/");
  203. startDate = Date.parse(new Date(startDate))
  204. if(!startDate){
  205. startDate = Date.parse(new Date(obj));
  206. }
  207. let endDate = Date.parse(new Date())
  208. if (endDate - startDate) {
  209. this.shwoSignTitle= `调阅时长为${this.dateTime(endDate - startDate)},是否结束调阅?`;
  210. this.showSign=true;
  211. // Dialog.confirm({
  212. // title: '提示',
  213. // message: `当前调阅时长为${this.dateTime(endDate - startDate)},是否结束调阅?`
  214. // }).then(() => {
  215. // this.$refs.scandialog.visible = true
  216. // this.globalLoading = true
  217. // })
  218. // .catch(() => {
  219. // // on cancel
  220. // })
  221. }
  222. } else {
  223. Dialog({ message: '调阅项目登记不能为全空!' })
  224. return
  225. }
  226. // else {
  227. // this.$refs.scandialog.visible = true
  228. // startDate = new Date(startDate)
  229. // }
  230. },
  231. dateTime(msd) {
  232. //将毫秒秒转化为xx小时xx分钟xx秒
  233. let time = parseFloat(msd) / 1000 //先将毫秒转化成秒
  234. if (null != time && '' != time) {
  235. if (time > 60 && time < 60 * 60) {
  236. time =
  237. parseInt(time / 60.0) + '分钟' + parseInt((parseFloat(time / 60.0) - parseInt(time / 60.0)) * 60) + '秒'
  238. } else if (time >= 60 * 60 && time < 60 * 60 * 24) {
  239. time =
  240. parseInt(time / 3600.0) +
  241. '小时' +
  242. parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) +
  243. '分钟' +
  244. parseInt(
  245. (parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
  246. parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) *
  247. 60
  248. ) +
  249. '秒'
  250. } else {
  251. time = parseInt(time) + '秒'
  252. }
  253. }
  254. return time
  255. },
  256. cancelSign()
  257. {
  258. this.showSign=false;
  259. },
  260. confirmSignImg(){
  261. // this.cancelSign();
  262. // this.submitSign(this.oldSignatureSeal);
  263. this.signImgUrl = this.oldSignatureSeal;
  264. this.showSign=false;
  265. this.$refs.scandialog.visible = true
  266. this.globalLoading = true
  267. },
  268. //上传签名图到服务器
  269. resultSignImg(img,oldImgUrl) {
  270. if (oldImgUrl !== "" && oldImgUrl !== null && oldImgUrl !== "null"){
  271. //this.submitSign(oldImgUrl)
  272. this.confirmShow =true;
  273. this.oldSignatureSeal = oldImgUrl;
  274. }else {
  275. let obj = base64ToBlob(img)
  276. let formData = new FormData()
  277. obj.name = '签名.jpg'
  278. formData.append('file', base64ToBlob(img))
  279. upload(formData, 'image')
  280. .then(res => {
  281. /*上传成功*/
  282. this.signImgUrl = process.env.NODE_ENV === 'development' ? res.data.url : res.data.url
  283. this.showSign=false;
  284. this.$refs.scandialog.visible = true
  285. this.globalLoading = true
  286. })
  287. .catch(err => {
  288. /*上传失败*/
  289. })
  290. }
  291. },
  292. //文件上传
  293. resultImg(img) {
  294. this.photoHandler(img[0].url)
  295. },
  296. //上传NFC
  297. getNFC(nfc) {
  298. this.photoHandler('', nfc)
  299. },
  300. //扫描图片并上传到服务器和后端
  301. photoHandler(img = '', nfc = '') {
  302. //上传到服务器
  303. //开始调阅上传
  304. let obj = {
  305. endPicture: img,
  306. endNfc: nfc,
  307. taskId: this.$route.params.id.split('_')[0]
  308. }
  309. registration(obj).then(res => {
  310. let { code, data, msg } = res
  311. if (code == 200) {
  312. //结束调阅
  313. this.endHandler()
  314. }
  315. })
  316. },
  317. endHandler() {
  318. finishRegistration({
  319. id: this.taskData.id,
  320. signImgUrl:this.signImgUrl,
  321. taskId: this.$route.params.id.split('_')[0]
  322. }).then(res => {
  323. this.$router.go(-1)
  324. })
  325. },
  326. addActiveNames() {
  327. }
  328. }
  329. }
  330. </script>
  331. <style lang="scss" scoped>
  332. .van-collapse-item {
  333. margin: 20px;
  334. margin-top: 0px;
  335. margin-bottom: 0px;
  336. }
  337. .titleBox {
  338. margin: 20px;
  339. margin-bottom: 0px;
  340. background-color: #fff;
  341. }
  342. .bigBox {
  343. height: calc(100vh - 260px);
  344. overflow: scroll;
  345. // height: 100vh;
  346. // padding: 20px;
  347. background-color: #f2f2f2;
  348. .textTitle {
  349. font-size: 30px;
  350. font-weight: bold;
  351. padding: 20px;
  352. }
  353. .text {
  354. padding: 20px;
  355. font-size: 26px;
  356. color: #b0b0b0;
  357. }
  358. .topBox {
  359. // margin-bottom: 10px;
  360. // margin: 20px;
  361. color: black;
  362. margin-top: 10px;
  363. }
  364. .bottomClass {
  365. position: fixed;
  366. width: 100%;
  367. bottom: 0%;
  368. }
  369. .van-button {
  370. width: 100%;
  371. margin-top: 10px;
  372. border-radius: 10px;
  373. }
  374. }
  375. </style>