index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div
  3. class="ele-body"
  4. :style="
  5. $route.query.isDrawer
  6. ? {
  7. position: 'fixed',
  8. height: '100vh',
  9. top: '0',
  10. bottom: '0',
  11. left: '0',
  12. right: '0',
  13. zIndex: 1000,
  14. background: '#fff'
  15. }
  16. : {}
  17. "
  18. >
  19. <el-card shadow="never" v-loading="loading">
  20. <message-search @search="reload"> </message-search>
  21. <!-- 数据表格 -->
  22. <ele-pro-table
  23. ref="table"
  24. :pageSizes="tablePageSizes"
  25. :columns="columns"
  26. :datasource="datasource"
  27. cache-key="systemRoleTable"
  28. >
  29. </ele-pro-table>
  30. </el-card>
  31. </div>
  32. </template>
  33. <script>
  34. import MessageSearch from './components/message-search.vue';
  35. import { alarmlogsheetPage } from '@/api/warning/index.js';
  36. import dictMixins from '@/mixins/dictMixins';
  37. export default {
  38. mixins: [dictMixins],
  39. components: {
  40. MessageSearch
  41. },
  42. data() {
  43. return {
  44. // 表格列配置
  45. columns: [
  46. {
  47. columnKey: 'index',
  48. label: '序号',
  49. type: 'index',
  50. width: 55,
  51. align: 'center',
  52. showOverflowTooltip: true,
  53. fixed: 'left'
  54. },
  55. {
  56. prop: 'alarmLevel',
  57. label: '告警级别',
  58. align: 'center',
  59. showOverflowTooltip: true,
  60. minWidth: 110,
  61. formatter: (_row, _column, cellValue) => {
  62. const map = {
  63. 1: '提示',
  64. 2: '一般',
  65. 3: '严重',
  66. 4: '紧急',
  67. 5: '致命'
  68. };
  69. return map[cellValue] || '-';
  70. }
  71. },
  72. {
  73. prop: 'deviceCode',
  74. label: '设备编号',
  75. align: 'center',
  76. showOverflowTooltip: true,
  77. minWidth: 110
  78. },
  79. {
  80. prop: 'deviceName',
  81. label: '设备名称',
  82. align: 'center',
  83. showOverflowTooltip: true,
  84. minWidth: 110
  85. },
  86. {
  87. prop: 'description',
  88. label: '告警描述',
  89. align: 'center',
  90. showOverflowTooltip: true,
  91. minWidth: 180
  92. },
  93. {
  94. prop: 'generateDocumentType',
  95. label: '生成单据类型',
  96. formatter: (_row, _column, cellValue) => {
  97. return cellValue == 1
  98. ? '巡点检'
  99. : cellValue == 2
  100. ? '保养'
  101. : cellValue == 3
  102. ? '维修'
  103. : cellValue == 5
  104. ? '量具送检'
  105. : '';
  106. },
  107. align: 'center',
  108. showOverflowTooltip: true,
  109. minWidth: 110
  110. },
  111. {
  112. prop: 'generateDocumentCode',
  113. label: '生成单据编码',
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. minWidth: 110
  117. },
  118. {
  119. prop: 'remark',
  120. label: '备注',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 110
  124. },
  125. {
  126. prop: 'alarmTime',
  127. label: '告警时间',
  128. align: 'center',
  129. showOverflowTooltip: true,
  130. minWidth: 160,
  131. formatter: (_row, _column, cellValue) => {
  132. return this.$util.toDateString(cellValue);
  133. }
  134. }
  135. ],
  136. // 加载状态
  137. loading: false
  138. };
  139. },
  140. computed: {},
  141. created() {
  142. this.requestDict('规则状态');
  143. },
  144. methods: {
  145. /* 表格数据源 */
  146. datasource({ page, limit, where, order }) {
  147. return alarmlogsheetPage({
  148. pageNum: page,
  149. size: limit,
  150. ...where
  151. });
  152. },
  153. /* 刷新表格 */
  154. reload(where) {
  155. this.$refs.table.reload({ page: 1, where, ruleType: 2 });
  156. }
  157. }
  158. };
  159. </script>
  160. <style lang="scss" scoped></style>