fuliqi
2024-12-12 323df6a80616eec19125feba8bdb47adb25334a0
src/views/system/data-manage/data-detail/index.vue
@@ -76,17 +76,22 @@
    </el-row>
    <div style="display: flex;position: relative">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
        <el-form-item label="关键词" prop="bayonetNumber">
          <el-input v-model="queryParams.keyword" placeholder="关键词搜索" clearable @input="handleQuery"/>
        <el-form-item label="关键字" prop="bayonetNumber">
          <el-input v-model="queryParams.keyword" placeholder="国标码/设备名/ip搜索" clearable @keyup.enter.native="handleQuery" @clear="handleQuery"/>
        </el-form-item>
        <el-form-item label="时间范围" prop="timeRange">
          <el-date-picker
            v-model="queryParams.timeRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        <el-form-item :label="this.optionsName" prop="option" v-show = "this.optionsStatus">
          <el-select  v-model="queryParams.option" size="small" clearable @change="handleQuery">
            <el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="时间" prop="date">
            <el-date-picker
              v-model="queryParams.date"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
              @change="handleQuery">
            </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
@@ -106,8 +111,14 @@
    <div>
      <el-table v-loading="loading" :data="tableData.list">
        <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead"
                         :key="index" v-if="showListPD(item)"/>
<!--        <el-table-column :prop="item.prop" :label="item.label" :width="item.width" v-for="(item, index) in tableHead"-->
<!--                         :key="index" v-if="showListPD(item)">-->
        <el-table-column :prop="item.prop" :label="item.label" v-for="(item, index) in tableHead"
                         :key="index" v-if="showListPD(item)">
          <template slot-scope="scope">
            <span :class="{'error-text': scope.row[item.error]}"> {{ scope.row[item.prop] }} </span>
          </template>
        </el-table-column>
      </el-table>
    </div>
@@ -171,7 +182,7 @@
<script>
import {dataCenter} from "@/api/platform/data-center";
import {videoData, carData, faceData, equipment} from "./list";
import {carData, equipment, faceData, videoData} from "./list";
import {listSecurity, updateSecurity} from '@/api/platform/resource-security';
import {getToken} from "@/utils/auth";
@@ -198,6 +209,7 @@
        url: process.env.VUE_APP_BASE_API + "/platform/resourceSecurity/importData"
      },
      imageResourceSecurity: [],
      options: [],
      resourceForm: {},
      resourceOpen: false,
      totalKiosks: 1157,
@@ -228,8 +240,9 @@
        pageNum: 1,
        pageSize: 10,
        keyword: '',
        timeRange: [],
        date: '',
        dataType: 0,
        option: null,
      },
      // 表单参数
      form: {},
@@ -259,49 +272,69 @@
      index: null
    };
  },
  mounted() {
    //修改页签名
    const obj = Object.assign({},this.$route,{title: this.$route.query.ruleName})
    this.$tab.updatePage(obj);
    // 获取当前日期
    const today = new Date();
    // 将日期减去一天
    const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
    // 获取年、月、日
    const year = yesterday.getFullYear();
    let month = (yesterday.getMonth() + 1).toString().padStart(2, '0'); // 月份是从0开始的,所以加1
    let day = yesterday.getDate().toString().padStart(2, '0');
    const year = today.getFullYear();
    let month = (today.getMonth() + 1).toString().padStart(2, '0'); // 月份是从0开始的,所以加1
    let day = today.getDate().toString().padStart(2, '0');
    // 拼接成 yyyy-MM-dd 格式
    let yesterday1 = `${year}-${month}-${day}`;
    this.queryParams.timeRange = [yesterday1, yesterday1]
    this.queryParams.date = `${year}-${month}-${day}`;
    this.index = this.$route.query.index;
    if (this.$route.query.type === '1') {
      let data = videoData.table.filter(item => item.index === this.$route.query.index)[0]
      // if(this.index = 'monitor_qualification'){
      //
      // }
      this.tableHead = data.columns;
      this.cardList = data.card;
      this.showList = data.showList;
      this.optionsStatus = data.optionsStatus;
      this.options = data.options;
      this.optionsName = data.optionsName;
    }
    if (this.$route.query.type === '2') {
      let data = carData.table.filter(item => item.index === this.$route.query.index)[0]
      this.tableHead = data.columns;
      this.cardList = data.card;
      this.showList = data.showList;
      this.optionsStatus = data.optionsStatus;
      this.options = data.options;
      this.optionsName = data.optionsName;
    }
    if (this.$route.query.type === '3') {
      let data = faceData.table.filter(item => item.index === this.$route.query.index)[0]
      this.tableHead = data.columns;
      this.cardList = data.card;
      this.showList = data.showList;
      this.optionsStatus = data.optionsStatus;
      this.options = data.options;
      this.optionsName = data.optionsName;
    }
    if (this.$route.query.type === '4') {
      let data = equipment.table.filter(item => item.index === this.$route.query.index)[0]
      this.tableHead = data.columns;
      this.cardList = data.card;
      this.showList = data.showList;
      this.optionsStatus = data.optionsStatus;
      this.options = data.options;
      this.optionsName = data.optionsName;
    }
    this.getList();
  },
  methods: {
    getColor(value, prop) {
      // 默认颜色
      return 'red';
    },
    clickTab(active) {
      this.queryParams.dataType = active
      this.getList()
@@ -355,10 +388,6 @@
      this.loading = true;
      if (this.index === 'image_resource_security') {
        this.getSecurityCard()
      }
      if (this.queryParams.timeRange && this.queryParams.timeRange.length > 0) {
        this.queryParams.startTime = this.queryParams.timeRange[0]
        this.queryParams.endTime = this.queryParams.timeRange[1]
      }
      dataCenter(url, this.queryParams).then(response => {
        response.data.list = response.data.list && response.data.list.length > 0 ? response.data.list : []
@@ -431,7 +460,9 @@
.tab {
  padding: 5px 15px;
}
.error-text {
  color: red;
}
.tab:hover {
  cursor: pointer;
  user-select: none;