securityAlarmGrid.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="securityAlarmGrid">
  3. <Card title="宫格模式" style="height: 99%;padding-bottom: 12px">
  4. <div style="height: 100%;margin: 0 15px 15px">
  5. <a-row style="height: 100%">
  6. <a-col :span="4" style="height: 90%">
  7. <div style="padding-left: 15px; height: 100%">
  8. <SecurityDeviceSelect :tree-data="treeData"></SecurityDeviceSelect>
  9. </div>
  10. </a-col>
  11. <a-col :span="20" style="height: 90%">
  12. <div style="height: 100%">
  13. <HkwsCamera />
  14. </div>
  15. </a-col>
  16. </a-row>
  17. </div>
  18. </Card>
  19. </div>
  20. </template>
  21. <script>
  22. import HkwsCamera from "@/components/security/camera/hkwsCamera.vue";
  23. import SecurityDeviceSelect from "@/components/security/common/securityDeviceSelect.vue";
  24. export default {
  25. components: {
  26. SecurityDeviceSelect,
  27. HkwsCamera
  28. },
  29. data() {
  30. return {
  31. gridConfig: {
  32. span: 8,
  33. num: 1,
  34. },
  35. playerIdx: 1,
  36. treeData: [
  37. {
  38. title: '一层大厅',
  39. key: '1',
  40. selectable: false,
  41. children: [
  42. {
  43. title: '大厅正门',
  44. key: '1-0',
  45. slots: {
  46. icon: 'camera',
  47. },
  48. },
  49. {
  50. title: '1-2',
  51. key: '1-2',
  52. slots: {
  53. icon: 'camera',
  54. },
  55. },{
  56. title: '1-3',
  57. key: '1-3',
  58. slots: {
  59. icon: 'camera',
  60. },
  61. }
  62. ],
  63. },
  64. {
  65. title: '2F',
  66. key: '2',
  67. selectable: false,
  68. children: [
  69. {
  70. title: '正门',
  71. key: '2-0',
  72. slots: {
  73. icon: 'camera',
  74. },
  75. },{
  76. title: '2-1',
  77. key: '2-1',
  78. slots: {
  79. icon: 'camera',
  80. },
  81. },{
  82. title: '2-2',
  83. key: '2-2',
  84. slots: {
  85. icon: 'camera',
  86. },
  87. }
  88. ],
  89. },
  90. {
  91. title: '3F',
  92. key: '3',
  93. selectable: false,
  94. children: [
  95. {
  96. title: '正门',
  97. key: '3-0',
  98. slots: {
  99. icon: 'camera',
  100. },
  101. },
  102. {
  103. title: '3-1',
  104. key: '3-1',
  105. slots: {
  106. icon: 'camera',
  107. },
  108. },
  109. {
  110. title: '3-2',
  111. key: '3-1',
  112. slots: {
  113. icon: 'camera',
  114. },
  115. }
  116. ],
  117. },
  118. {
  119. title: '4F',
  120. key: '4',
  121. selectable: false,
  122. children: [
  123. {
  124. title: '4-1',
  125. key: '4-1',
  126. slots: {
  127. icon: 'camera',
  128. },
  129. }
  130. ],
  131. },{
  132. title: '5F',
  133. key: '5',
  134. selectable: false,
  135. children: [
  136. {
  137. title: '5-1',
  138. key: '5-1',
  139. slots: {
  140. icon: 'camera',
  141. },
  142. }
  143. ],
  144. },{
  145. title: '6F',
  146. key: '6',
  147. selectable: false,
  148. children: [
  149. {
  150. title: '6-1',
  151. key: '6-1',
  152. slots: {
  153. icon: 'camera',
  154. },
  155. }
  156. ],
  157. },{
  158. title: '7F',
  159. key: '7',
  160. selectable: false,
  161. children: [
  162. {
  163. title: '7-1',
  164. key: '7-1',
  165. slots: {
  166. icon: 'camera',
  167. },
  168. }
  169. ],
  170. },
  171. ],
  172. }
  173. },
  174. methods: {
  175. shot(e) {
  176. // console.log(e)
  177. // send({code:'image',data:e})
  178. var base64ToBlob = function (code) {
  179. let parts = code.split(';base64,');
  180. let contentType = parts[0].split(':')[1];
  181. let raw = window.atob(parts[1]);
  182. let rawLength = raw.length;
  183. let uInt8Array = new Uint8Array(rawLength);
  184. for (let i = 0; i < rawLength; ++i) {
  185. uInt8Array[i] = raw.charCodeAt(i);
  186. }
  187. return new Blob([uInt8Array], {
  188. type: contentType
  189. });
  190. };
  191. let aLink = document.createElement('a');
  192. let blob = base64ToBlob(e); //new Blob([content]);
  193. let evt = document.createEvent("HTMLEvents");
  194. evt.initEvent("click", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
  195. aLink.download = '截图';
  196. aLink.href = URL.createObjectURL(blob);
  197. aLink.click();
  198. },
  199. destroy(idx) {
  200. console.log(idx);
  201. this.clear(idx.substring(idx.length - 1))
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="less" scoped>
  207. .securityAlarmGrid {
  208. width: 100%;
  209. height: 100%;
  210. }
  211. </style>