1
0

index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <el-dialog v-model="dialogVisible" width="80%" top="4vh">
  3. <template #title>
  4. <div class="dialog-title">
  5. <img class="dialog-title-img" src="@/assets/imgs/dialog-title.png" />
  6. <div class="title">设备报警信息</div>
  7. </div>
  8. </template>
  9. <div class="dialog-body">
  10. <img class="dialog-img" src="@/assets/imgs/dialog.png" />
  11. <div class="dialog-table">
  12. <el-table
  13. :data="tableData"
  14. stripe
  15. size="mini"
  16. height="48vh"
  17. ref="fitting_table"
  18. style="width: 100%"
  19. >
  20. <el-table-column
  21. v-for="(item, index) in tableHeader"
  22. :key="index"
  23. sortable
  24. :prop="item.code"
  25. :label="item.title"
  26. align="center"
  27. >
  28. </el-table-column>
  29. </el-table>
  30. <el-pagination
  31. @current-change="handleCurrentChange"
  32. :current-page="page.currentPage"
  33. :page-size="page.pagesize"
  34. layout="total, prev, pager, next, jumper"
  35. :total="page.total"
  36. >
  37. </el-pagination>
  38. </div>
  39. </div>
  40. <template #footer>
  41. <span class="dialog-footer">
  42. <el-button size="mini" round @click="cancel">关闭</el-button>
  43. </span>
  44. </template>
  45. </el-dialog>
  46. </template>
  47. <script>
  48. import { GetTableData } from "@/api/zhbj/index.js";
  49. import dayjs from "dayjs";
  50. export default {
  51. name: "alarm", //
  52. components: {},
  53. props: {},
  54. data() {
  55. return {
  56. dialogVisible: false,
  57. tableData: [],
  58. tableHeader: [
  59. { title: "时间", code: "ts" },
  60. { title: "场站名称", code: "stationname" },
  61. { title: "设备名称", code: "devicename" },
  62. { title: "是否确认", code: "confirmed" },
  63. { title: "报警描述显示", code: "description" },
  64. ],
  65. page: {
  66. pagesize: 10,
  67. currentPage: 1,
  68. total: 0,
  69. },
  70. wtid: "",
  71. wpid: "",
  72. };
  73. },
  74. created() {},
  75. methods: {
  76. // 初始化弹窗数据
  77. openDialog(wtid, wpid) {
  78. this.wtid = wtid;
  79. this.wpid = wpid;
  80. if (wtid && wpid) {
  81. this.getTableData();
  82. this.dialogVisible = true;
  83. }
  84. },
  85. getTableData() {
  86. GetTableData({
  87. begin: dayjs().startOf('day').format("YYYY-MM-DD HH:mm:ss"),
  88. end: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  89. alarmType: "windturbine",
  90. stationid: this.wpid,
  91. deviceid: this.wtid,
  92. pageNum: this.page.currentPage,
  93. pageSize: this.page.pagesize,
  94. description: "",
  95. }).then(({ data }) => {
  96. if (data.ls.length) {
  97. this.tableData = data.ls.map((item) => {
  98. return {
  99. ...item,
  100. confirmed: item.confirmed ? "是" : "否",
  101. ts: dayjs(item.ts).format("YYYY-MM-DD HH:mm:ss"),
  102. };
  103. });
  104. this.page.total = data.total;
  105. } else {
  106. this.tableData = [];
  107. this.page.total = 0;
  108. }
  109. });
  110. },
  111. // 取消操作
  112. cancel() {
  113. this.wtid = "";
  114. this.wpid = "";
  115. this.page.currentPage = 1;
  116. this.dialogVisible = false;
  117. },
  118. handleCurrentChange(val) {
  119. this.page.currentPage = val;
  120. this.getTableData();
  121. },
  122. },
  123. mounted() {},
  124. computed: {},
  125. };
  126. </script>
  127. <style lang="less" scoped>
  128. .dialog-footer button:first-child {
  129. border-color: transparent;
  130. margin-right: 10px;
  131. background-color: rgba(0, 70, 199, 0.2) !important;
  132. color: #b3b3b3;
  133. }
  134. .el-dialog {
  135. .el-dialog__body {
  136. height: calc(100vh - 320px);
  137. }
  138. }
  139. .footerButton {
  140. justify-content: right;
  141. .el-button:first-child {
  142. width: 108px;
  143. }
  144. .el-button:last-of-type {
  145. width: 108px;
  146. background: rgba(0, 70, 199, 0.4) !important;
  147. }
  148. }
  149. .el-pagination {
  150. text-align: right;
  151. }
  152. </style>