AlarmWarn.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div class="alarmWarn">
  3. <div class="title" :style="{ color: color }">报警情况占比</div>
  4. <div class="box-flex">
  5. <div class="flex-left">
  6. <alarm-pie></alarm-pie>
  7. </div>
  8. <div class="flex-left">
  9. <alarm-bar></alarm-bar>
  10. </div>
  11. </div>
  12. <div class="reply" :style="{color: color}">筛选查询</div>
  13. <x-form :formItems="selectItems" :day="day" @setDay="setDay" @onClickType="onClickType"></x-form>
  14. <new-table :height="600" :title="title" :listData="list" :tableItems="tableItems" :shows="tableShows">
  15. <template #right>
  16. <el-button size="mini" type="primary" v-if="hasPerm('video:add')" style="margin-right: 10px" @click="digAll">批量处理</el-button>
  17. </template>
  18. <template #type="scope">
  19. <span v-if="scope.row.type === 1">环境报警</span>
  20. <span v-else>设备异常</span>
  21. </template>
  22. <template #class="scope">
  23. <span v-if="scope.row.class === 1">一级</span>
  24. <span v-else>二级</span>
  25. </template>
  26. <template #handler="scope">
  27. <span v-if="scope.row.dig">已处理</span>
  28. <el-button v-else type="primary" size="mini">处理</el-button>
  29. </template>
  30. </new-table>
  31. </div>
  32. </template>
  33. <script>
  34. import { mapState } from 'vuex';
  35. import AlarmPie from "@/views/Alarm/chart/AlarmPie";
  36. import AlarmBar from "@/views/Alarm/chart/AlarmBar";
  37. import XForm from "@/components/XForm";
  38. import NewTable from "@/components/newTable/NewTable";
  39. export default {
  40. name: "AlarmWarn",
  41. components: {
  42. AlarmPie,
  43. AlarmBar,
  44. XForm,
  45. NewTable
  46. },
  47. computed: {
  48. ...mapState(['color'])
  49. },
  50. data() {
  51. return {
  52. selectItems: [
  53. {
  54. id: 1,
  55. type: 'select',
  56. label: '报警类型:',
  57. placeholder: '请选择报警类型',
  58. field: 'areaId',
  59. options: [],
  60. col: 5
  61. },
  62. {
  63. id: 3,
  64. type: 'text',
  65. text: '今日',
  66. value: 1,
  67. col: 1
  68. },
  69. {
  70. id: 4,
  71. type: 'text',
  72. text: '本周',
  73. value: 2,
  74. col: 1
  75. },
  76. {
  77. id: 5,
  78. type: 'text',
  79. text: '本月',
  80. value: 3,
  81. col: 1
  82. },
  83. {
  84. id: 6,
  85. type: 'datepicker',
  86. placeholder: [],
  87. field: 'value1',
  88. col: 6
  89. },
  90. {
  91. id: 7,
  92. type: 'button',
  93. text: '导出数据',
  94. col: 2,
  95. click: 'derive'
  96. }
  97. ],
  98. day: 2,
  99. title: '报警列表',
  100. list: [
  101. {
  102. id: 1,
  103. time: '2021-10-11 14:55:55',
  104. type: 1,
  105. class: 1,
  106. content: '育肥1栋3单元温度过高',
  107. dig: false,
  108. },
  109. {
  110. id: 2,
  111. time: '2021-10-11 14:55:55',
  112. type: 2,
  113. class: 2,
  114. content: '育肥1栋2单元温度传感器异常',
  115. dig: true,
  116. }
  117. ],
  118. tableItems: [
  119. {
  120. prop: 'time',
  121. label: '报警时间',
  122. minWidth: '100',
  123. slotName: 'time'
  124. },
  125. {
  126. prop: 'type',
  127. label: '报警类型',
  128. minWidth: '100',
  129. slotName: 'type'
  130. },
  131. {
  132. prop: 'class',
  133. label: '危险等级',
  134. minWidth: '100',
  135. slotName: 'class'
  136. },
  137. {
  138. prop: 'content',
  139. label: '报警内容',
  140. minWidth: '100',
  141. slotName: 'content'
  142. },
  143. {
  144. label: '处理结果',
  145. minWidth: '100',
  146. slotName: 'handler'
  147. }
  148. ],
  149. tableShows: {
  150. showIndex: false,
  151. showSelect: true,
  152. defaultProp: 'dig'
  153. },
  154. }
  155. },
  156. methods: {
  157. setDay(data) {
  158. this.day = data;
  159. },
  160. onClickType() {},
  161. // 批量处理
  162. digAll() {}
  163. },
  164. }
  165. </script>
  166. <style scoped>
  167. .alarmWarn {
  168. width: 100%;
  169. height: 100%;
  170. padding: 20px 20px 0 20px;
  171. }
  172. .title {
  173. width: 100%;
  174. height: 40px;
  175. border: 1px solid #ddd;
  176. background-color: #f3f3f3;
  177. padding-left: 20px;
  178. line-height: 40px;
  179. }
  180. .box-flex {
  181. width: 100%;
  182. height: 400px;
  183. background-color: #fff;
  184. display: flex;
  185. }
  186. .flex-left {
  187. width: 50%;
  188. height: 100%;
  189. }
  190. .reply {
  191. width: 100%;
  192. border: 1px solid #ddd;
  193. border-bottom: 0;
  194. height: 50px;
  195. background-color: #F3F3F3;
  196. line-height: 50px;
  197. font-size: 18px;
  198. box-sizing: border-box;
  199. padding-left: 20px;
  200. }
  201. </style>