fuliqi
2024-09-13 e80067335467ca48cb94f03de3794ad93a45ad5d
src/views/system/monitor/recovery/index.vue
@@ -1,5 +1,15 @@
<template>
  <div class="app-container">
    <div
      style="display: flex;flex-direction: row;min-width: 158px;max-width: 158px;margin-bottom: 5px;border-radius: 1px; user-select: none"
    >
      <div @click="clickTab(null)" class="tab"
           :class="{tabActive: null == queryParams.provinceTag, tabInactive: null != queryParams.provinceTag}">全部
      </div>
      <div @click="clickTab(0)" class="tab"
           :class="{tabActive: 0 === queryParams.provinceTag, tabInactive: 0 !== queryParams.provinceTag}">省厅考核
      </div>
    </div>
    <el-card class="box-card" >
      <el-row type="flex" align="middle" justify="space-between">
        <el-col :span="4">
@@ -54,7 +64,7 @@
          />
        </el-select>
      </el-form-item>
      <el-form-item label="监控类型" prop="onState">
      <el-form-item label="监控类型" prop="cameraFunType">
        <el-select
          v-model="queryParams.cameraFunType"
          placeholder="请选择监控类型"
@@ -70,40 +80,33 @@
        <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
      </el-form-item>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
        >导出</el-button>
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="monitorList" @selection-change="handleSelectionChange">
      <el-table-column label="设备名称" align="center" prop="name" />
      <el-table-column label="设备名称" align="center" prop="name" width="280" fixed show-overflow-tooltip/>
      <el-table-column label="设备编码" align="center" prop="serialNumber" width="180px" />
      <el-table-column label="标签" align="center" v-if="columns[0].visible">
      <el-table-column label="设备类型" align="center" prop="cameraFunType" width="180px">
        <template slot-scope="scope">
          {{ translateCameraFunType(scope.row.cameraFunType) }}
        </template>
      </el-table-column>
      <el-table-column label="标签" align="center" width="180px" v-if="columns[0].visible">
        <template slot-scope="scope">
          <div>{{ scope.row.provinceTag == 0 ? "省厅" : "市局" }}</div>
        </template>
      </el-table-column>
      <el-table-column label="区域" align="center" prop="area" v-if="columns[1].visible"/>
      <el-table-column label="设备状态" align="center" prop="onState" v-if="columns[2].visible">
      <el-table-column label="设备状态" align="center" width="180px" prop="onState" v-if="columns[2].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
          <dict-tag :options="dict.type.camera_state" width="180px" :value="scope.row.onState"/>
      </template>
      </el-table-column>
      <el-table-column label="是否生成异常工单" align="center" prop="error" v-if="columns[3].visible" />
      <el-table-column label="异常原因" align="center" prop="reason" v-if="columns[4].visible" />
      <el-table-column label="异常恢复时间" align="center" prop="recoveryTime" width="180" v-if="columns[5].visible">
      <el-table-column label="是否生成异常工单" align="center" prop="error" width="180px" v-if="columns[3].visible"/>
      <el-table-column label="异常原因" align="center" prop="reason" width="180px" v-if="columns[4].visible"/>
      <el-table-column label="异常恢复时间" align="center" prop="recoveryTime" width="180px" v-if="columns[5].visible">
      </el-table-column>
      <el-table-column label="管理单位" align="center" prop="unitName" v-if="columns[6].visible" />
      <el-table-column label="管理单位" align="center" prop="unitName" width="180px" v-if="columns[6].visible"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
@@ -111,7 +114,8 @@
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row,scope.index)"
          >详细</el-button>
          >详细
          </el-button>
        </template>
      </el-table-column>
    </el-table>
@@ -163,8 +167,16 @@
</template>
<script>
import { recoveryException, listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor } from "@/api/platform/monitor";
import {
  recoveryException,
  listMonitor,
  getMonitor,
  delMonitor,
  addMonitor,
  updateMonitor
} from "@/api/platform/monitor";
import { listDept } from "@/api/system/dept";
export default {
  name: "Monitor",
  dicts: ['sys_normal_disable','platform_yes_no','camera_state'],
@@ -248,6 +260,35 @@
    });
  },
  methods: {
    translateCameraFunType(cameraFunType) {
      // 校验输入是否为字符串
      if (typeof cameraFunType !== 'string') {
        return "";
      }
      // 分割字符串为数组,并去除空字符串
      const types = cameraFunType.split('/').filter(type => type);
      // 校验并转换每个类型
      const translatedTypes = types.map(type => {
        switch (type) {
          case '1':
            return '视频';
          case '2':
            return '车辆';
          case '3':
            return '人脸';
          default:
            return ''
        }
      });
      return translatedTypes.join(', ');
    },
    clickTab(active) {
      this.queryParams.provinceTag = active
      this.getList()
      this.getVideoCount()
    },
    /** 查询设备资产列表 */
    getList() {
      this.loading = true;
@@ -259,7 +300,7 @@
    },
    /** 查询异常恢复设备统计数 */
    getVideoCount() {
      recoveryException().then(response => {
      recoveryException(this.queryParams).then(response => {
        this.count = response.data;
      });
    },
@@ -349,7 +390,8 @@
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
@@ -362,6 +404,30 @@
</script>
<style lang="scss" scoped>
.tab {
  padding: 5px 15px;
}
.tab:hover {
  cursor: pointer;
  user-select: none;
}
.tabActive {
  color: white;
  background-color: #409eff;
  border: none;
  border-radius: 1px;
}
.tabInactive {
  background-color: #edf2f6;
  color: #409eff;
}
.tabInactive:hover {
  background-color: #edf2f6;
}
.box-card {
  background-color: #ffffff;
@@ -369,6 +435,7 @@
  margin-bottom: 20px;
  height: 120px
}
.icon-container {
  display: flex;
  justify-content: center;
@@ -378,6 +445,7 @@
  height: 80px;
  margin-left: 5%;
}
.el-icon-refresh-left {
  font-size: 50px;
  color: #FFFFFF;