123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" label-width="100px" v-show="showSearch">
- <el-row>
- <el-col :span="6">
- <el-form-item label="告警时间" prop="alarmDateStart">
- <el-date-picker v-model="queryParams.alarmDateStart" type="daterange" start-placeholder="开始日期"
- end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="告警处理时间" prop="alarmDealDateStart">
- <el-date-picker v-model="queryParams.alarmDealDateStart" type="daterange" start-placeholder="开始日期"
- end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="告警处理人" prop="alarmDealPeople">
- <el-input v-model="queryParams.alarmDealPeople" placeholder="请输入告警处理人" clearable size="small"
- @keyup.enter.native="handleQuery" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="告警处理结果" prop="alarmDealResult">
- <el-select v-model="queryParams.alarmDealResult" placeholder="请选择告警处理结果" clearable style="width: 100%">
- <el-option v-for="(item, index) in dealOptions" :key="index.dictValue" :label="item.dictLabel"
- :value="item.dictValue" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-show="show">
- <el-col :span="6">
- <el-form-item label="告警位置" prop="alarmLocation">
- <el-input v-model="queryParams.alarmLocation" placeholder="请输入告警位置" clearable size="small"
- @keyup.enter.native="handleQuery" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="设备名" prop="deviceName">
- <el-input v-model="queryParams.deviceName" placeholder="请输入设备名" clearable size="small"
- @keyup.enter.native="handleQuery" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div style="display:flex;justify-content: space-between;">
- <div>
- <el-button type="primary" size="mini" @click="getData">重新获取告警列表</el-button>
- </div>
- <div>
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- <el-button v-show="show" @click="show = !show" icon="el-icon-arrow-up" size="mini">
- 展开
- </el-button>
- <el-button v-show="!show" @click="show = !show" icon="el-icon-arrow-down" size="mini">
- 展开
- </el-button>
- <right-toolbar style="margin-left: 12px" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </div>
- </div>
- <el-table v-loading="loading" :data="list" style="width: 100%;">
- <el-table-column label="序号" type="index" width="50" />
- <el-table-column v-for="(item, index) in tableOption" :key="index" :label="item.name" :width="item.width"
- :prop="item.label" header-align="center" :align="item.align" :fixed="item.fixed" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <span v-if="item.label == 'alarmDealResult'">
- {{ scope.row.alarmDealResult | dealFormat(dealOptions) }}
- </span>
- <span v-else-if="item.label == 'deviceState'">
- <span>
- {{ scope.row.deviceState | deviceFormat(deviceOptions) }}
- </span>
- </span>
- <span v-else-if="item.label == 'alarmPicUrl'" @click="openImg(scope.row.alarmPicUrl)">
- <img ref="img" :src="scope.row.alarmPicUrl" style="width: 100px;height: 60px;" alt="">
- </span>
- <span v-else>{{ scope.row[item.label] }}</span>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
- @pagination="getList" />
- <el-dialog title="预警图片" v-dialogDrag :visible.sync="dialogImg" @closed="imgClosed" :close-on-click-modal="false">
- <div style="width:100%; height:60vh;">
- <img ref="img" :src="imgUrl" style="width: 100%;height:100%;" alt="">
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { tableOption } from "./js/index";
- import { list } from "@/api/monitor/alrtmList";
- import Axios from "axios";
- export default {
- name: "Online",
- data() {
- return {
- show: false,
- dialogImg: false,
- tableOption: tableOption,
- // 遮罩层
- loading: true,
- // 总条数
- total: 0,
- // 表格数据
- list: [],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10
- },
- showSearch: true,
- dealOptions: [],
- deviceOption: [],
- imgUrl: '',
- };
- },
- created() {
- this.getDicts("alarm_deal_result").then((response) => {
- this.dealOptions = response.data;
- });
- this.getDicts("device_state").then((response) => {
- this.deviceOptions = response.data;
- });
- this.getList();
- },
- filters: {
- dealFormat(row, list) {
- let name = ""
- list.map((e) => {
- if (row == e.dictValue) {
- name = e.dictLabel;
- }
- });
- return name;
- },
- deviceFormat(row, list) {
- let name = ""
- list.map((e) => {
- if (row == e.dictValue) {
- name = e.dictLabel;
- }
- });
- return name;
- }
- },
- methods: {
- /** 查询登录日志列表 */
- getList() {
- this.loading = true;
- list(this.queryParams).then(response => {
- this.list = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.queryForm = this.$options.data().queryForm
- this.handleQuery();
- },
- getData() {
- Axios.post("/prod-api/api/getAccessToken").then(res => {
- console.log(res)
- Axios({
- method: 'POST',
- url: '/prod-api/api/queryAlarmList',
- params: {
- pageNum: 1,
- pageSize: 10,
- token: res.data.data.data.access_token,
- }
- })
- .then(response => {
- this.handleQuery()
- });
- })
- },
- openImg(row) {
- if (row) {
- this.imgUrl = row;
- this.dialogImg = true
- }
- },
- imgClosed() {
- this.imgUrl = this.$options.data().imgUrl
- }
- }
- };
- </script>
|