alarmTotal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="app-container">
  3. <!-- 返回start -->
  4. <div class="siteTitle">
  5. <el-button class="goBack" @click="goBack">返回</el-button>
  6. 站点【{{alarmGradeList.siteName}}】{{
  7. alarmGradeList.type == 0
  8. ? '总数'
  9. : alarmGradeList.type == 1
  10. ? '一级告警'
  11. : alarmGradeList.type == 2
  12. ? '二级告警'
  13. : alarmGradeList.type == 3
  14. ? '其它'
  15. : ''
  16. }}
  17. </div>
  18. <!-- 返回end -->
  19. <!-- 表格start -->
  20. <el-table
  21. :data="tableData"
  22. border
  23. stripe
  24. :header-cell-style="headClass"
  25. :cell-style="cellStyle"
  26. >
  27. <el-table-column
  28. fixed
  29. prop="soeTime"
  30. label="发生时间"
  31. width=""
  32. ></el-table-column>
  33. <el-table-column
  34. prop="measDesc"
  35. label="测点描述"
  36. width=""
  37. ></el-table-column>
  38. <el-table-column
  39. prop="alarmName"
  40. label="告警名称"
  41. width=""
  42. ></el-table-column>
  43. <el-table-column
  44. prop="alarmType"
  45. label="告警类型"
  46. width=""
  47. ></el-table-column>
  48. <el-table-column prop="check" label="详情" width="">
  49. <template #default="scope">
  50. <span @click="checkItem_addItem(scope.row)">查看</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="eddl" label="状态" width="">
  54. <template #default="scope">
  55. <span
  56. :style="{
  57. color:
  58. scope.row.handlingStatus == 1
  59. ? '#8DCF6E'
  60. : scope.row.handlingStatus == 2
  61. ? '#FF747B'
  62. : '#5c88fa',
  63. }"
  64. >
  65. {{
  66. scope.row.handlingStatus == 0
  67. ? '未处理'
  68. : scope.row.handlingStatus == 1
  69. ? '已处理'
  70. : scope.row.handlingStatus == 2
  71. ? '待确认'
  72. : scope.row.handlingStatus == 3
  73. ? '自动恢复'
  74. : '过期失效'
  75. }}
  76. </span>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <!-- 表格end -->
  81. <!-- 分页start -->
  82. <div class="paginationBlock">
  83. <el-pagination
  84. @size-change="handleSizeChange"
  85. @current-change="handleCurrentChange"
  86. :current-page="currentPage"
  87. :page-sizes="[15, 20, 25, 30]"
  88. :page-size="pageSize"
  89. layout="total, sizes, prev, pager, next, jumper"
  90. :total="total"
  91. ></el-pagination>
  92. </div>
  93. <!-- 分页end -->
  94. <!--弹框组件开始-----------------------start-->
  95. <dialog-component
  96. :show_Dialog="showDialog"
  97. :dialog-title="dialogTitle"
  98. :item-info="tableItem"
  99. @closeDialog="closeDialog"
  100. @listSelect="listSelect"
  101. ></dialog-component>
  102. <!--弹框组件开始-----------------------end-->
  103. </div>
  104. </template>
  105. <script>
  106. import dialogComponent from './dialogComponent'
  107. // import { useStore } from 'vuex'
  108. import { defineComponent, onMounted, ref } from 'vue'
  109. import * as api from '@/api/alarmManage/index'
  110. import { ElMessage } from 'element-plus'
  111. export default defineComponent({
  112. name: 'AlarmTotal',
  113. props: {
  114. pageShow: Boolean,
  115. alarmGradeList: Object,
  116. },
  117. components: { dialogComponent },
  118. setup(props, { emit }) {
  119. // const store = useStore()
  120. const total = ref(0)
  121. const pageSize = ref(15)
  122. const currentPage = ref(1)
  123. const tableData = ref([])
  124. const showDialog = ref(false)
  125. const dialogTitle = ref('')
  126. const tableItem = ref([])
  127. //查询
  128. function listSelect() {
  129. api
  130. .alarmGradeList({
  131. // siteId: store.state.siteId,
  132. siteId:props.alarmGradeList.siteId,
  133. startTime: props.alarmGradeList.startTime,
  134. endTime: props.alarmGradeList.endTime,
  135. size: pageSize.value,
  136. current: currentPage.value,
  137. type: props.alarmGradeList.type,
  138. })
  139. .then((requset) => {
  140. if (requset.status === 'SUCCESS') {
  141. total.value = requset.data.total
  142. tableData.value = requset.data.records
  143. } else {
  144. ElMessage.error(requset.msg)
  145. }
  146. })
  147. }
  148. // 查看操作
  149. const checkItem_addItem = (row) => {
  150. tableItem.value = row
  151. dialogTitle.value = '告警详情'
  152. showDialog.value = true
  153. }
  154. //查看///添加操作
  155. const handleClick = (row) => {
  156. alert('查看对应站点(页面跳转)')
  157. console.log(row)
  158. }
  159. onMounted(() => {
  160. listSelect()
  161. })
  162. //关闭弹窗
  163. const closeDialog = (flag) => {
  164. showDialog.value = flag
  165. }
  166. //返回
  167. const goBack = () => {
  168. emit('func')
  169. }
  170. //条数
  171. const handleSizeChange = (val) => {
  172. pageSize.value = val
  173. listSelect()
  174. }
  175. //页数
  176. const handleCurrentChange = (val) => {
  177. currentPage.value = val
  178. listSelect()
  179. }
  180. //自定义列样式
  181. const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  182. row, column, rowIndex
  183. // console.log(row, column, rowIndex)
  184. if (columnIndex === 4) {
  185. return `color:#1187FF;cursor:pointer`
  186. } else {
  187. return ''
  188. }
  189. }
  190. // 表头样式设置
  191. const headClass = () => {
  192. return 'background:#FAFAFA;'
  193. }
  194. return {
  195. handleSizeChange,
  196. handleCurrentChange,
  197. goBack,
  198. checkItem_addItem,
  199. headClass,
  200. cellStyle,
  201. handleClick,
  202. listSelect,
  203. closeDialog,
  204. showDialog,
  205. input: '请输入发生时间',
  206. total,
  207. pageSize,
  208. currentPage,
  209. tableData,
  210. dialogTitle,
  211. tableItem,
  212. }
  213. },
  214. })
  215. </script>
  216. <style lang='scss' scoped>
  217. </style>