alarmTotal.vue 6.0 KB

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