eventdetailsdialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="visual-con">
  3. <!--头部-->
  4. <vheader></vheader>
  5. <!--主体-->
  6. <div class="visual-body">
  7. <button @click="showEventDialog"
  8. style="position: absolute; left:50%;top: 50vh; transform: translateX(-50%);">触发事件详情
  9. </button>
  10. <!-- 弹层 -->
  11. <el-dialog title="事件详情" :visible.sync="eventDialog" v-if="eventDialog" width="95%"
  12. @close="cancelEventShow()">
  13. <div class="dia-event-info">
  14. <el-row>
  15. <!-- 左侧 -->
  16. <el-col :span="18" class="dia-left">
  17. <div ref="imageTofile" style="height: 75vh;">
  18. <!-- 应急预案 -->
  19. <div class="dia-left-top">
  20. <div class="dia-left-top-tit">应急预案</div>
  21. <div class="dia-left-top-carousel">
  22. <el-carousel height="30px" direction="vertical" :interval="2000">
  23. <el-carousel-item v-for="item in 3" :key="item">
  24. <a href="#">这是一条应急预案</a>
  25. </el-carousel-item>
  26. </el-carousel>
  27. </div>
  28. </div>
  29. <!-- 应急预案end -->
  30. <!-- 左侧资源 -->
  31. <div class="leftbar" style="width:fit-content !important;bottom:0rem;left: 1rem; top: unset;">
  32. <div class="forthis">
  33. <dv-border-box-7 backgroundColor="#040b1f" :color="['#25335d', '#5baffd']">
  34. <div class="i-list-con">
  35. <div class="d-l-con-icon" style="flex-direction:row;flex-wrap: nowrap;">
  36. <div class="icon-con" style="width: fit-content !important;"
  37. v-for="(item,index) in resourcesList">
  38. <div class="iconfont icon icon-normal" :class="item.icon"></div>
  39. <div class="icon-text">
  40. <h5>{{ item.resourceName }}</h5>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </dv-border-box-7>
  46. </div>
  47. </div>
  48. <!-- 左侧资源end -->
  49. <!-- 底部工具栏 -->
  50. <!-- <div class="dia-left-btm-tool">
  51. </div> -->
  52. <!-- 底部工具栏end -->
  53. <!-- 地图 -->
  54. <supermapDialog ref="supermapDialog"
  55. style="position: absolute; top:0;left: 0;"
  56. :mapDiv="'forestWarmSuperMap'"
  57. :mapSite="{zoom:16,doubleClickZoom:false,dragging:false,scrollWheelZoom:false}"
  58. :codes="['9fa5']"
  59. :isSideBySide="false"
  60. :isdynamicPlotting="true"/>
  61. <!-- 地图end -->
  62. </div>
  63. </el-col>
  64. <!-- 左侧end -->
  65. <!-- 右侧 -->
  66. <el-col :span="6" class="dia-right">
  67. <div class="e-right">
  68. <div class="forthis">
  69. <dv-border-box-7 backgroundColor="#040b1f" :color="['#25335d', '#5baffd']"
  70. style="padding-bottom:1rem ;">
  71. <div class="i-list-con">
  72. <div class="this-con h-45">
  73. <div class="z-info-list" style="margin-top: 0;">
  74. <el-timeline>
  75. <el-timeline-item color="#2bacf7" :timestamp="item.createTime"
  76. placement="top" v-for="(item,index) in eventlog">
  77. <el-card>
  78. <div class="z-info-list-con">
  79. <div class="user-and-time flex-d">
  80. <span>{{ item.createName }}</span><span><i
  81. class="el-icon-location"></i> 定位</span>
  82. </div>
  83. <div class="z-info">
  84. <div class="this-con-list-info">
  85. {{ item.logContent }}
  86. </div>
  87. <div>
  88. <el-image :src="url"
  89. :preview-src-list="srcList"
  90. style="width:3rem; height:3rem;margin: 2px;"
  91. v-for="(item,index) in 10">
  92. </el-image>
  93. </div>
  94. </div>
  95. </div>
  96. </el-card>
  97. </el-timeline-item>
  98. </el-timeline>
  99. </div>
  100. </div>
  101. </div>
  102. </dv-border-box-7>
  103. </div>
  104. <div class="forthis">
  105. <dv-border-box-7 backgroundColor="#040b1f" :color="['#25335d', '#5baffd']">
  106. <div class="i-list-con">
  107. <div class="this-con h-25 no-padding">
  108. <div class="z-info-list" style="margin-top: 0;">
  109. <div class="z-info-btm-grp">
  110. <div class="z-info-btm-grp-top">
  111. <div class="z-info-btm-grp-left">
  112. <el-button size="small" icon="el-icon-s-flag">责任制
  113. </el-button>
  114. <el-button size="small" icon="el-icon-upload">上传
  115. </el-button>
  116. <el-button size="small" icon="el-icon-download" @click="toImage()">保存
  117. </el-button>
  118. </div>
  119. <div class="z-info-btm-grp-right">
  120. <el-button size="small" icon="el-icon-mic">会议
  121. </el-button>
  122. </div>
  123. </div>
  124. <div class="z-info-btm-input">
  125. <el-input type="textarea" v-model="feedback"
  126. :autosize="{ minRows: 7, maxRows: 7}" placeholder="请输入反馈信息">
  127. </el-input>
  128. <div class="z-info-btm-input-btn">
  129. <el-button size="small" icon="el-icon-chat-dot-square">发送
  130. </el-button>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </dv-border-box-7>
  138. </div>
  139. </div>
  140. </el-col>
  141. <!-- 左侧end -->
  142. </el-row>
  143. </div>
  144. </el-dialog>
  145. </div>
  146. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  147. </div>
  148. </template>
  149. <script>
  150. import html2canvas from 'html2canvas'//截图组件
  151. import supermapDialog from '@/components/supermap' //超图
  152. import vheader from '@/components/v-header.vue' //一体化共用头部
  153. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  154. import {
  155. getEventDetail
  156. } from '@/api/forest'
  157. export default {
  158. components: {
  159. vheader,
  160. vBottomMenu,
  161. supermapDialog
  162. },
  163. data() {
  164. return {
  165. eventlog: [],
  166. eventDialog: false,
  167. resourcesList: [{
  168. resourceName: '取水口',
  169. count: '1',
  170. icon: 'sj-icon-waterintake'
  171. },
  172. {
  173. resourceName: '水鹤',
  174. count: '1',
  175. icon: 'sj-icon-watercrane'
  176. },
  177. {
  178. resourceName: '消防栓',
  179. count: '1',
  180. icon: 'sj-icon-firehydrant'
  181. },
  182. {
  183. resourceName: '起降点',
  184. count: '1',
  185. icon: 'sj-icon-landing'
  186. },
  187. {
  188. resourceName: '检查站',
  189. count: '1',
  190. icon: 'sj-icon-checkpoint'
  191. },
  192. {
  193. resourceName: '防火队',
  194. count: '1',
  195. icon: 'sj-icon-fireteam'
  196. },
  197. {
  198. resourceName: '重点区域',
  199. count: '1',
  200. icon: 'sj-icon-tcqh'
  201. },
  202. {
  203. resourceName: '摄像头',
  204. count: '1',
  205. icon: 'sj-icon-jkzx'
  206. }
  207. ],
  208. //图片虚拟
  209. url: require('@/assets/images/visual/img-sample.png'),
  210. srcList: [
  211. require('@/assets/images/visual/img-sample.png'),
  212. require('@/assets/images/visual/img-sample2.png')
  213. ],
  214. //文本域
  215. feedback: ''
  216. }
  217. },
  218. methods: {
  219. cancelEventShow() {
  220. console.log('关闭事件弹窗')
  221. this.eventlog = []
  222. },
  223. showEventDialog(eventCode) {
  224. let that = this
  225. //获取事件详情
  226. getEventDetail({ eventCode: eventCode }).then(res => {
  227. this.eventDialog = true
  228. this.eventlog = res.data.eventlog
  229. console.log(this.eventlog)
  230. if (res.data.catalogue != null && res.data.catalogue.length > 0) {
  231. let markersMap = {
  232. lng: 124.59,
  233. lat: 43.02,
  234. icon: 'marker',
  235. bindPopupHtml: '',
  236. click: '',
  237. parameter: '',
  238. keepBindPopup: false,
  239. isAggregation: false,
  240. radius: 0
  241. }
  242. if (res.data.catalogue[0].eventStatusValue == 'forest_event_status_1' || res.data.catalogue[0].eventStatusValue == 'forest_event_status_2' || res.data.catalogue[0].eventStatusValue == 'forest_event_status_3') {
  243. markersMap.icon = 'sj-icon-map-clz'
  244. markersMap.isAggregation = false
  245. } else if (res.data.catalogue[0].eventStatusValue == 'event_event_status_4') {
  246. markersMap.icon = 'sj-icon-map-wcl'
  247. } else if (res.data.catalogue[0].eventStatusValue == 'event_event_status_5') {
  248. markersMap.icon = 'sj-icon-map-wcl'
  249. } else if (res.data.catalogue[0].eventStatusValue == 'event_event_status_6') {
  250. markersMap.icon = 'sj-icon-map-wcl'
  251. } else {
  252. markersMap.icon = 'sj-icon-map-ywc'
  253. }
  254. markersMap.lng = res.data.catalogue[0].longitude
  255. markersMap.lat = res.data.catalogue[0].latitude
  256. if (res.data.eventdetail != null && res.data.eventdetail.length > 0 && res.data.eventdetail[0].fireRadius != null && res.data.eventdetail[0].fireRadius != '' && res.data.eventdetail[0].fireRadius > 0) {
  257. markersMap.radius = res.data.eventdetail[0].fireRadius
  258. }
  259. setTimeout(() => {
  260. that.$refs.supermapDialog.dynamicPlotting()//弹出动态绘制窗口,防止截图位置改变
  261. that.$refs.supermapDialog.clearM(false)
  262. that.$refs.supermapDialog.setMarkersRadius([markersMap])
  263. that.$refs.supermapDialog.dropLocation(res.data.catalogue[0].latitude, res.data.catalogue[0].longitude)
  264. }, 1000)
  265. }
  266. })
  267. },
  268. // 页面元素转图片
  269. toImage() {
  270. // 手动创建一个 canvas 标签
  271. const canvas = document.createElement('canvas')
  272. // 获取父标签,意思是这个标签内的 DOM 元素生成图片
  273. // imageTofile是给截图范围内的父级元素自定义的ref名称
  274. // let canvasBox = this.$refs.imageTofile
  275. let canvasBox = document.getElementById('forestWarmSuperMap')
  276. let toolbar=document.getElementById('toolbar');
  277. canvasBox.removeChild(toolbar);
  278. // 获取父级的宽高
  279. const width = parseInt(window.getComputedStyle(canvasBox).width)
  280. const height = parseInt(window.getComputedStyle(canvasBox).height)
  281. // 宽高 * 2 并放大 2 倍 是为了防止图片模糊
  282. canvas.width = width * 2
  283. canvas.height = height * 2
  284. canvas.style.width = width + 'px'
  285. canvas.style.height = height + 'px'
  286. const context = canvas.getContext('2d')
  287. context.scale(2, 2)
  288. const options = {
  289. backgroundColor: null,
  290. canvas: canvas,
  291. useCORS: true
  292. }
  293. html2canvas(canvasBox, options).then((canvas) => {
  294. // toDataURL 图片格式转成 base64
  295. let dataURL = canvas.toDataURL('image/png')
  296. console.log(dataURL)
  297. this.downloadImage(dataURL)
  298. })
  299. canvasBox.appendChild(toolbar)
  300. },
  301. //下载图片
  302. downloadImage(url) {
  303. // 如果是在网页中可以直接创建一个 a 标签直接下载
  304. let a = document.createElement('a')
  305. a.href = url
  306. a.download = '首页截图'
  307. a.click()
  308. }
  309. }
  310. }
  311. </script>
  312. <style>
  313. </style>