securityAlarmInfo.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="securityAlarmInfo">
  3. <a-row style="height: 100%">
  4. <a-col :span="4" style="height: 800px">
  5. <security-device-select :tree-data="treeData"/>
  6. </a-col>
  7. <a-col :span="20" style="height: 100%;padding: 15px">
  8. <div class="securityAlarmInfo-query">
  9. <Query :show="['time']" :query-data.sync="formData" :search="search">
  10. <template #extraItem>
  11. <a-form-model-item label="告警类型">
  12. <a-select defaultValue="all" style="width: 150px">
  13. <a-select-option value="all">全部</a-select-option>
  14. <a-select-option value="fumes">烟雾告警</a-select-option>
  15. <a-select-option value="fire">火焰告警</a-select-option>
  16. <a-select-option value="trespass">非法闯入</a-select-option>
  17. <a-select-option value="violation">违规行为</a-select-option>
  18. </a-select>
  19. </a-form-model-item>
  20. <a-form-model-item label="处理情况">
  21. <a-select defaultValue="all" style="width: 120px">
  22. <a-select-option value="all">全部</a-select-option>
  23. <a-select-option value="finish">已处理</a-select-option>
  24. <a-select-option value="todo">待处理</a-select-option>
  25. </a-select>
  26. </a-form-model-item>
  27. </template>
  28. </Query>
  29. </div>
  30. <div class="securityAlarmInfo-list">
  31. <a-table :rowKey="(record, index) => index"
  32. :columns="columns"
  33. :data-source="tableData"
  34. >
  35. <template #level="text">
  36. <span v-if="text==0" style="color: #ffbf6b">一般告警</span>
  37. <span v-if="text==1" style="color: #d26e64">重要告警</span>
  38. <span v-if="text==2" style="color: #b83023">紧急告警</span>
  39. </template>
  40. <template #type="text">
  41. <span v-if="text==0" style="color: #ffbf6b">火焰告警</span>
  42. <span v-if="text==1" style="color: #d26e64">水浸告警</span>
  43. <span v-if="text==2" style="color: #b83023">摄像头离线</span>
  44. </template>
  45. <template #operation="text">
  46. <a-button type="link">确认处理</a-button>
  47. <a-button type="link" @click="viewDetail">查看详情</a-button>
  48. </template>
  49. </a-table>
  50. </div>
  51. </a-col>
  52. </a-row>
  53. <!--告警详情-->
  54. <a-modal class="securityPersonMoreDetail" v-if="showDetail"
  55. :visible="true"
  56. :width="800"
  57. :footer="null"
  58. @cancel="handleCancel"
  59. >
  60. <div>告警详情</div>
  61. <a-divider/>
  62. <div style="width: 100%;height: 100%">
  63. <div style="height: 250px;width: 100%">
  64. <img width="100%" height="100%" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"/>
  65. </div>
  66. <div style="margin-top: 20px">
  67. <a-descriptions :column="3" size="small">
  68. <a-descriptions-item label="监控点">
  69. {{ currItem.area }}
  70. </a-descriptions-item>
  71. <a-descriptions-item label="告警区域">
  72. {{ currItem.source }}
  73. </a-descriptions-item>
  74. <a-descriptions-item label="告警类型">
  75. <span v-if="currItem.type==0" style="color: #ffbf6b">火焰告警</span>
  76. <span v-if="currItem.type==1" style="color: #d26e64">水浸告警</span>
  77. <span v-if="currItem.type==2" style="color: #b83023">摄像头离线</span>
  78. </a-descriptions-item>
  79. <a-descriptions-item label="告警时间">
  80. {{ currItem.time }}
  81. </a-descriptions-item>
  82. <a-descriptions-item label="告警级别">
  83. <span v-if="currItem.level==1">一般告警</span>
  84. <span v-if="currItem.level==2">重要告警</span>
  85. <span v-if="currItem.level==3">紧急告警</span>
  86. </a-descriptions-item>
  87. <a-descriptions-item label="准确率">
  88. 98%
  89. </a-descriptions-item>
  90. </a-descriptions>
  91. </div>
  92. </div>
  93. </a-modal>
  94. </div>
  95. </template>
  96. <script>
  97. import SecurityDeviceSelect from "@/components/security/common/securityDeviceSelect.vue";
  98. import TimeRange from "@/components/common/timeRange.vue";
  99. import Query from "@/components/common/query.vue";
  100. import apiSecurityCamera from "@/api/security/apiSecurityCamera";
  101. import moment from "@/utils/moment_set";
  102. export default {
  103. data() {
  104. return {
  105. showDetail: false,
  106. formData: {},
  107. treeData: [],
  108. currItem: {},
  109. tableData: [
  110. {
  111. time: '2023-04-20 08:43:00',
  112. area: '一层大厅',
  113. level: 1,
  114. source: '一层大厅东南角1号球机',
  115. type: 2,
  116. },
  117. {
  118. time: '2023-04-21 01:05:06',
  119. area: '一层大厅',
  120. level: 1,
  121. source: '一层大厅东南角1号球机',
  122. type: 2,
  123. },
  124. {
  125. time: '2023-04-21 01:05:06',
  126. area: '一层大厅',
  127. level: 1,
  128. source: '一层大厅东南角1号球机',
  129. type: 2,
  130. },
  131. ],
  132. columns: [
  133. {
  134. title: '告警时间',
  135. dataIndex: 'time',
  136. key: 'time'
  137. },
  138. {
  139. title: '告警区域',
  140. dataIndex: 'area',
  141. key: 'area'
  142. },
  143. {
  144. title: '告警级别',
  145. dataIndex: 'level',
  146. key: 'level',
  147. scopedSlots: {customRender: 'level'},
  148. },
  149. {
  150. title: '告警来源',
  151. dataIndex: 'source',
  152. key: 'source'
  153. },
  154. {
  155. title: '告警类型',
  156. dataIndex: 'type',
  157. key: 'type',
  158. scopedSlots: {customRender: 'type'},
  159. },
  160. {
  161. title: '操作',
  162. dataIndex: 'operation',
  163. key: 'operation',
  164. minWidth: 220,
  165. align: 'center',
  166. scopedSlots: {customRender: 'operation'},
  167. }
  168. ]
  169. }
  170. },
  171. components: {
  172. Query,
  173. SecurityDeviceSelect,
  174. TimeRange,
  175. },
  176. mounted() {
  177. this.getCameraList()
  178. },
  179. methods: {
  180. getCameraList() {
  181. let app = this;
  182. apiSecurityCamera.getCameraList().then(res => {
  183. res.forEach(item => {
  184. item.title = item.deviceName;
  185. item.key = item.deviceId;
  186. item.slots = {icon: 'camera',};
  187. })
  188. res.sort((a, b) => {
  189. if (a.title > b.title) {
  190. return 1
  191. } else {
  192. return -1
  193. }
  194. })
  195. this.treeData = res;
  196. app.genData();
  197. })
  198. },
  199. viewDetail() {
  200. this.showDetail = true;
  201. },
  202. handleCancel() {
  203. this.showDetail = false
  204. },
  205. search() {
  206. },
  207. randomDate() {
  208. let startDate = this.$moment().startOf('month').toDate();;
  209. let endDate = new Date();
  210. let date = new Date(+startDate + Math.random() * (endDate - startDate));
  211. let hour = 0 + Math.random() * (23 - 0) | 0;
  212. let minute = 0 + Math.random() * (59 - 0) | 0;
  213. let second = 0 + Math.random() * (59 - 0) | 0;
  214. date.setHours(hour);
  215. date.setMinutes(minute);
  216. date.setSeconds(second);
  217. return date;
  218. },
  219. randomCamera() {
  220. let index = Math.floor(Math.random() * this.treeData.length);
  221. return this.treeData[index].title;
  222. },
  223. genData() {
  224. this.tableData = [];
  225. for (let i = 0; i < 35; i++) {
  226. let deviceName = this.randomCamera();
  227. let time = this.$moment(this.randomDate()).format("YYYY/MM/DD HH:mm:ss")
  228. let obj = {
  229. time: time,
  230. area: 'B2',
  231. level: 1,
  232. source: deviceName,
  233. type: 2,
  234. }
  235. this.tableData.push(obj);
  236. }
  237. this.tableData.sort((a,b)=>{
  238. if (a.time>b.time) {
  239. return -1;
  240. }
  241. return 1;
  242. })
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="less" scoped>
  248. .securityAlarmInfo {
  249. width: 100%;
  250. height: auto;
  251. padding: 15px;
  252. background-color: #ffffff;
  253. .securityAlarmInfo-list {
  254. margin: 15px 0px;
  255. }
  256. }
  257. </style>