xiangpei
2024-08-16 7ae73495487e9bebb986d53ca923a9ebac231618
src/views/system/data-manage/equipment/index.vue
@@ -41,9 +41,9 @@
    </el-card>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="关键字" prop="name">
      <el-form-item label="关键字" prop="keyword">
        <el-input
          v-model="queryParams.name"
          v-model="queryParams.keyword"
          placeholder="请输入关键字"
          clearable
          @keyup.enter.native="handleQuery"
@@ -107,12 +107,17 @@
      <el-table-column label="标签" align="center" prop="publicSecurity" width="180" v-if="columns[0].visible"/>
      <el-table-column label="区域" align="center" prop="address" width="180" v-if="columns[1].visible"/>
      <el-table-column label="设备状态" align="center" prop="onState" v-if="columns[2].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
      </template>
        <template slot-scope="scope">
          <dict-tag :options="dict.type.camera_state" :value="scope.row.onState"/>
        </template>
      </el-table-column>
      <el-table-column label="数据时间" align="center" prop="installedTime" width="180" v-if="columns[3].visible"/>
      <el-table-column label="管理单位" align="center" prop="managementUnit" width="180" v-if="columns[4].visible"/>
      <el-table-column v-for="(column, index) in dynamicColumnList" :key="index" :label="column.labelValue" :prop="column.propName" align="center">
        <template slot-scope="scope">
          {{ getDynamicValue(scope.row, column.propName) }}
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  fixed="right">
          <template slot-scope="scope">
            <el-button
@@ -167,12 +172,14 @@
<script>
import { videoCount, listMonitor, getMonitor, delMonitor, addMonitor, updateMonitor } from "@/api/platform/monitor";
import { getDynamicColumnList } from '@/api/platform/dynamicColumn'
import { dataCenter } from "@/api/platform/data-center";
export default {
  name: "Monitor",
  dicts: ['sys_normal_disable', 'platform_yes_no','camera_state'],
  data() {
    return {
      dynamicColumnList: [],
      // 列信息
      columns: [
        { key: 0, label: `标签`, visible: true },
@@ -213,7 +220,7 @@
        pageNum: 1,
        pageSize: 10,
        serialNumber: null,
        name: null,
        keyword: '球机',
        onState: null,
        address: null,
        installedTime: null,
@@ -243,12 +250,26 @@
  created() {
    this.getVideoCount();
    this.getList();
    this.getCountyList();
    this.getDyColumn()
  },
  methods: {
    getDyColumn() {
      // 查询动态列
      let params = {
        tableName: 't_monitor'
      }
      getDynamicColumnList(params).then(res => {
        this.dynamicColumnList = res.data
      })
    },
    getDynamicValue(row, propName) {
      let target = row.dynamicColumnList.filter(item => item.propName === propName)
      return target && target.length > 0 ? target[0].columnValue : ''
    },
    /** 查询设备资产列表 */
    getList() {
      this.loading = true;
      this.getDyColumn()
      dataCenter('assetManagement', this.queryParams).then(response => {
        this.monitorList = response.data;
        this.total = response.total;