deviceErrManage.vue 14.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="报警信息" name="alarmMessage">
        <!-- <Device ref="Device" /> -->
        <el-form
          :model="queryConfig"
          ref="queryConfig"
          label-width="110px"
          class="demo-queryConfig"
        >
          <el-row :gutter="10">
            <el-col :span="4">
              <el-form-item label="设备编码:" prop="">
                <el-input
                  v-model="queryConfig.equipmentCode"
                  placeholder="请选择设备编码"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="设备名称:" prop="">
                <el-input
                  v-model="queryConfig.equipmentName"
                  placeholder="请选择设备名称"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="报警编码:" prop="">
                <el-input
                  v-model="queryConfig.alarmCode"
                  placeholder="请选择报警编码"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="报警信息:" prop="">
                <el-input
                  v-model="queryConfig.alarm"
                  placeholder="请选择报警信息"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="开始时间">
                <el-date-picker
                  v-model="queryConfig.startTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 99%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="结束时间">
                <el-date-picker
                  v-model="queryConfig.endTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 99%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="23" class="button-col">
              <el-form-item label="" prop="">
                <el-button
                  icon="el-icon-search"
                  class="T1"
                  @click="btnAction()"
                  type="primary"
                  size="small"
                  >查询</el-button
                >
                <el-button class="T1" size="small" @click="details('details')"
                  >查询详情</el-button
                >
                <el-button class="T1" size="small" @click="ExportListOne()"
                  >导出</el-button
                >
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div class="table">
          <el-table
            :data="tableData"
            border
            stripe
            :height="TableHeight"
            @selection-change="handleSelectionChange"
            :header-cell-style="{ color: '#000000' }"
          >
            <el-table-column
              type="selection"
              align="center"
              width="55"
            ></el-table-column>
            <el-table-column prop="id" label="id" width="80"> </el-table-column>
            <el-table-column prop="equipmentCode" label="设备编码">
            </el-table-column>
            <el-table-column prop="equipmentName" label="设备名称">
            </el-table-column>
            <el-table-column prop="alarmCode" label="报警编码">
            </el-table-column>
            <el-table-column prop="alarm" label="报警信息"> </el-table-column>
            <el-table-column prop="duration" label="持续时间">
            </el-table-column>
            <el-table-column prop="isEnd" label="是否结束"> </el-table-column>
            <el-table-column prop="startTime" label="开始时间">
            </el-table-column>
            <el-table-column prop="endTime" label="结束时间"> </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              style="margin-top: 15px"
              align="center"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="queryConfig.currentPage"
              :page-sizes="[20, 50, 100]"
              :page-size="queryConfig.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
            />
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="报警统计" name="alarmStatistics">
        <el-form
          :model="queryConfigTwo"
          ref="queryConfigTwo"
          label-width="110px"
          class="demo-queryConfigTwo"
        >
          <el-row :gutter="10">
            <el-col :span="4">
              <el-form-item label="设备编码:" prop="">
                <el-input
                  v-model="queryConfigTwo.equipmentCode"
                  placeholder="请选择设备编码"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="设备名称:" prop="">
                <el-input
                  v-model="queryConfigTwo.equipmentName"
                  placeholder="请选择设备名称"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="报警编码:" prop="">
                <el-input
                  v-model="queryConfigTwo.alarmCode"
                  placeholder="请选择报警编码"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="报警信息:" prop="">
                <el-input
                  v-model="queryConfigTwo.alarm"
                  placeholder="请选择报警信息"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="开始时间">
                <el-date-picker
                  v-model="queryConfigTwo.startTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 99%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="结束时间">
                <el-date-picker
                  v-model="queryConfigTwo.endTime"
                  type="datetime"
                  placeholder="选择日期时间"
                  style="width: 99%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="23" class="button-col">
              <el-form-item label="" prop="">
                <el-button
                  icon="el-icon-search"
                  class="T1"
                  @click="btnActionTwo()"
                  type="primary"
                  size="small"
                  >查询</el-button
                >
                <el-button class="T1" size="small" @click="ExportListTwo()"
                  >导出</el-button
                >
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div class="table">
          <el-table
            :data="tableDataTwo"
            border
            stripe
            :height="TableHeight"
            @selection-change="handleSelectionChangeTwo"
            :header-cell-style="{ color: '#000000' }"
          >
            <el-table-column prop="equipmentCode" label="设备编码">
            </el-table-column>
            <el-table-column prop="equipmentName" label="设备名称">
            </el-table-column>
            <el-table-column prop="alarmCode" label="报警编码">
            </el-table-column>
            <el-table-column prop="alarm" label="报警信息"> </el-table-column>
            <el-table-column prop="counts" label="统计次数"> </el-table-column>
            <el-table-column prop="beginDateTime" label="开始时间">
            </el-table-column>
            <el-table-column prop="endDateTime" label="结束时间">
            </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination
              style="margin-top: 15px"
              align="center"
              @size-change="handleSizeChangeTwo"
              @current-change="handleCurrentChangeTwo"
              :current-page="queryConfigTwo.currentPage"
              :page-sizes="[20, 50, 100]"
              :page-size="queryConfigTwo.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalTwo"
            />
          </div>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import {
  GetEquipmentAlarmRecordDtoByPage,
  GetEquipmentAlarmRecordDtoStatisticsByPage,
} from "@/api/deviceManage/deviceErrManage";
import downloadFile from "@/api/user";
export default {
  data() {
    return {
      activeName: "alarmMessage",
      tableData: [],
      tableDataTwo: [],
      //查询条件
      queryConfig: {
        currentPage: 1,
        pageSize: 20,
        equipmentCode: "",
        equipmentName: "",
        alarmCode: "",
        alarm: "",
        startTime: this.$moment()
          .subtract(7, "days")
          .format("YYYY-MM-DD 00:00:00"),
        endTime: this.$moment().add(1, "days").format("YYYY-MM-DD 23:59:59"),
      },
      queryConfigTwo: {
        currentPage: 1,
        pageSize: 20,
        equipmentCode: "",
        equipmentName: "",
        alarmCode: "",
        alarm: "",
        startTime: this.$moment()
          .subtract(7, "days")
          .format("YYYY-MM-DD 00:00:00"),
        endTime: this.$moment().add(1, "days").format("YYYY-MM-DD 23:59:59"),
      },
      total: 0,
      totalTwo: 0,
      dialogFormVisible: false,
      multipleSelection: [],
      detailsData: [],
      title: "",
      export: "http://localhost:5221/api/Equipment/ExportEquipmentAlarmRecord",
      exportTwo:
        "http://localhost:5221/api/Equipment/ExportEquipmentAlarmRecordStatistics",
    };
  },
  created() {
    this.getTableList();
  },
  computed: {
    TableHeight() {
      return `calc(100vh - 380px )`;
    },
  },
  methods: {
    btnAction() {
      this.getTableList();
    },
    btnActionTwo() {
      const params = {
        pageNumber: this.queryConfigTwo.currentPage,
        perPageCount: this.queryConfigTwo.pageSize,
        queryConfig: this.queryConfigTwo,
      };
      this.listLoading = true;
      GetEquipmentAlarmRecordDtoStatisticsByPage(params).then((response) => {
        this.totalTwo = response.data.totalCount;
        this.tableDataTwo = response.data.data;
        this.listLoading = false;
      });
    },
    //表格数据
    getTableList() {
      const params = {
        pageNumber: this.queryConfig.currentPage,
        perPageCount: this.queryConfig.pageSize,
        queryConfig: this.queryConfig,
      };
      this.listLoading = true;
      GetEquipmentAlarmRecordDtoByPage(params).then((response) => {
        this.total = response.data.totalCount;
        this.tableData = response.data.data;
        this.listLoading = false;
      });
    },
    //查询详情
    details() {
      if (this.multipleSelection.length == 0) {
        this.$alert("请选择一条数据!", "标题名称", {
          confirmButtonText: "确定",
        });
      } else {
        this.queryConfigTwo.alarmCode = this.multipleSelection[0].alarmCode;
        this.queryConfigTwo.alarm = this.multipleSelection[0].alarm;
        this.queryConfigTwo.startTime = this.multipleSelection[0].startTime;
        this.queryConfigTwo.endTime = this.multipleSelection[0].endTime;
        this.btnActionTwo();
        this.activeName = "alarmStatistics";
      }
    },
    //获取表格行数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //导出
    ExportListOne() {
      const params = {
        pageNumber: this.queryConfig.currentPage,
        perPageCount: this.queryConfig.pageSize,
        queryConfig: this.queryConfig,
      };
      let text = "设备报警信息数据.xlsx";
      // 调用下载函数
      downloadFile(this.exportTwo, params, text);
    },
    //导出
    ExportListTwo() {
      const params = {
        pageNumber: this.queryConfigTwo.currentPage,
        perPageCount: this.queryConfigTwo.pageSize,
        queryConfig: this.queryConfigTwo,
      };
      let text = "设备报警统计信息数据.xlsx";
      // 调用下载函数
      downloadFile(this.exportTwo, params, text);
    },
    //分页1
    handleSizeChange(val) {
      this.queryConfig.pageSize = val;
      this.queryConfig.currentPage = 1;
      this.getTableList();
    },
    handleCurrentChange(val) {
      this.queryConfig.currentPage = val;
      this.getTableList();
    },
    //分页2
    handleSizeChangeTwo(val) {
      this.queryConfigTwo.pageSize = val;
      this.queryConfigTwo.currentPage = 1;
      this.btnActionTwo();
    },
    handleCurrentChangeTwo(val) {
      this.queryConfigTwo.currentPage = val;
      this.btnActionTwo();
    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
    close() {
      this.dialogFormVisible = false;
    },
  },
};
</script>
<style>
/* 修改复选框大小 */
.el-table .el-checkbox {
  transform: scale(1.8) !important; /* 调整大小 */
  margin-top: 5px;
}
.el-row {
  margin-bottom: 5px;
}
.interfacel-content {
  display: flex;
  border-radius: 4px;
  min-height: 46px;
  margin-bottom: 10px;
  align-items: center;
}
.table {
  border: 1px solid #e5e9f2;
}
.T1 {
  border: 1px solid #b3d8ff;
}
.pagination-container {
  text-align: center; /* 使分页组件靠右 */
  margin-top: 20px; /* 添加顶部间距 */
}
.button-col {
  display: flex;
  justify-content: flex-end; /* 按钮靠右对齐 */
}
.custom-input .el-input__inner {
  background-color: #ffeb3b; /* 设置输入框背景颜色为黄色 */
}
</style>