index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" label-width="100px" v-show="showSearch">
  4. <el-row>
  5. <el-col :span="6">
  6. <el-form-item label="告警时间" prop="alarmDateStart">
  7. <el-date-picker v-model="queryParams.alarmDateStart" type="daterange" start-placeholder="开始日期"
  8. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%">
  9. </el-date-picker>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="6">
  13. <el-form-item label="告警处理时间" prop="alarmDealDateStart">
  14. <el-date-picker v-model="queryParams.alarmDealDateStart" type="daterange" start-placeholder="开始日期"
  15. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%">
  16. </el-date-picker>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="告警处理人" prop="alarmDealPeople">
  21. <el-input v-model="queryParams.alarmDealPeople" placeholder="请输入告警处理人" clearable size="small"
  22. @keyup.enter.native="handleQuery" />
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="6">
  26. <el-form-item label="告警处理结果" prop="alarmDealResult">
  27. <el-select v-model="queryParams.alarmDealResult" placeholder="请选择告警处理结果" clearable style="width: 100%">
  28. <el-option v-for="(item, index) in dealOptions" :key="index.dictValue" :label="item.dictLabel"
  29. :value="item.dictValue" />
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. <el-row v-show="show">
  35. <el-col :span="6">
  36. <el-form-item label="告警位置" prop="alarmLocation">
  37. <el-input v-model="queryParams.alarmLocation" placeholder="请输入告警位置" clearable size="small"
  38. @keyup.enter.native="handleQuery" />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="6">
  42. <el-form-item label="设备名" prop="deviceName">
  43. <el-input v-model="queryParams.deviceName" placeholder="请输入设备名" clearable size="small"
  44. @keyup.enter.native="handleQuery" />
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. </el-form>
  49. <div style="display:flex;justify-content: space-between;">
  50. <div>
  51. <el-button type="primary" size="mini" @click="getData">重新获取告警列表</el-button>
  52. </div>
  53. <div>
  54. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  55. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  56. <el-button v-show="show" @click="show = !show" icon="el-icon-arrow-up" size="mini">
  57. 展开
  58. </el-button>
  59. <el-button v-show="!show" @click="show = !show" icon="el-icon-arrow-down" size="mini">
  60. 展开
  61. </el-button>
  62. <right-toolbar style="margin-left: 12px" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  63. </div>
  64. </div>
  65. <el-table v-loading="loading" :data="list" style="width: 100%;">
  66. <el-table-column label="序号" type="index" width="50" />
  67. <el-table-column v-for="(item, index) in tableOption" :key="index" :label="item.name" :width="item.width"
  68. :prop="item.label" header-align="center" :align="item.align" :fixed="item.fixed" :show-overflow-tooltip="true">
  69. <template slot-scope="scope">
  70. <span v-if="item.label == 'alarmDealResult'">
  71. {{ scope.row.alarmDealResult | dealFormat(dealOptions) }}
  72. </span>
  73. <span v-else-if="item.label == 'deviceState'">
  74. <span>
  75. {{ scope.row.deviceState | deviceFormat(deviceOptions) }}
  76. </span>
  77. </span>
  78. <span v-else-if="item.label == 'alarmPicUrl'" @click="openImg(scope.row.alarmPicUrl)">
  79. <img ref="img" :src="scope.row.alarmPicUrl" style="width: 100px;height: 60px;" alt="">
  80. </span>
  81. <span v-else>{{ scope.row[item.label] }}</span>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  86. @pagination="getList" />
  87. <el-dialog title="预警图片" v-dialogDrag :visible.sync="dialogImg" @closed="imgClosed" :close-on-click-modal="false">
  88. <div style="width:100%; height:60vh;">
  89. <img ref="img" :src="imgUrl" style="width: 100%;height:100%;" alt="">
  90. </div>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. import { tableOption } from "./js/index";
  96. import { list } from "@/api/monitor/alrtmList";
  97. import Axios from "axios";
  98. export default {
  99. name: "Online",
  100. data() {
  101. return {
  102. show: false,
  103. dialogImg: false,
  104. tableOption: tableOption,
  105. // 遮罩层
  106. loading: true,
  107. // 总条数
  108. total: 0,
  109. // 表格数据
  110. list: [],
  111. // 查询参数
  112. queryParams: {
  113. pageNum: 1,
  114. pageSize: 10
  115. },
  116. showSearch: true,
  117. dealOptions: [],
  118. deviceOption: [],
  119. imgUrl: '',
  120. };
  121. },
  122. created() {
  123. this.getDicts("alarm_deal_result").then((response) => {
  124. this.dealOptions = response.data;
  125. });
  126. this.getDicts("device_state").then((response) => {
  127. this.deviceOptions = response.data;
  128. });
  129. this.getList();
  130. },
  131. filters: {
  132. dealFormat(row, list) {
  133. let name = ""
  134. list.map((e) => {
  135. if (row == e.dictValue) {
  136. name = e.dictLabel;
  137. }
  138. });
  139. return name;
  140. },
  141. deviceFormat(row, list) {
  142. let name = ""
  143. list.map((e) => {
  144. if (row == e.dictValue) {
  145. name = e.dictLabel;
  146. }
  147. });
  148. return name;
  149. }
  150. },
  151. methods: {
  152. /** 查询登录日志列表 */
  153. getList() {
  154. this.loading = true;
  155. list(this.queryParams).then(response => {
  156. this.list = response.rows;
  157. this.total = response.total;
  158. this.loading = false;
  159. });
  160. },
  161. /** 搜索按钮操作 */
  162. handleQuery() {
  163. this.queryParams.pageNum = 1;
  164. this.getList();
  165. },
  166. /** 重置按钮操作 */
  167. resetQuery() {
  168. this.queryForm = this.$options.data().queryForm
  169. this.handleQuery();
  170. },
  171. getData() {
  172. Axios.post("/prod-api/api/getAccessToken").then(res => {
  173. console.log(res)
  174. Axios({
  175. method: 'POST',
  176. url: '/prod-api/api/queryAlarmList',
  177. params: {
  178. pageNum: 1,
  179. pageSize: 10,
  180. token: res.data.data.data.access_token,
  181. }
  182. })
  183. .then(response => {
  184. this.handleQuery()
  185. });
  186. })
  187. },
  188. openImg(row) {
  189. if (row) {
  190. this.imgUrl = row;
  191. this.dialogImg = true
  192. }
  193. },
  194. imgClosed() {
  195. this.imgUrl = this.$options.data().imgUrl
  196. }
  197. }
  198. };
  199. </script>