<!-- 视频查看记录 -->
<template>
  <div class="app-container videoViewingHistory">
    <div class="page-container videoViewingHistoryPage">
      <div class="page-form-title-box">
        <el-form :model="queryParams" class="form-box" ref="queryForm"
                 :inline="true" style="width:100%;">
          <el-form-item label="" prop="searchValue">
            <el-input
              maxLength="30"
              v-model="queryParams.searchValue"
              placeholder="实验室/房间号"
              style="width: 200px"
            />
          </el-form-item>
          <el-form-item label="" prop="state">
            <el-date-picker
              :clearable="false"
              v-model="dateRange"
              size="small"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
          <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
          <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
        </el-form>
      </div>
      <div class="page-content-box">
        <el-table class="table-box" border :data="dataList">
          <el-table-column label="序号" type="index" width="60"/>
          <el-table-column label="查看人" prop="createName"  show-overflow-tooltip/>
          <el-table-column label="查看时间" prop="createTime" width="200" show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
            </template>
          </el-table-column>
          <el-table-column label="来源" prop="source" width="200" show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.source==1?'实验室详情-pc':(scope.row.source==2?'实验室详情-app':(scope.row.source==3?'视频监控-信息牌':(scope.row.source==4?'应急预警-pc':(scope.row.source==5?'应急预警-app':'')))) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实验室" prop="subjectName" width="200" show-overflow-tooltip/>
          <el-table-column label="监控名称" prop="deviceName" width="200" show-overflow-tooltip/>
          <el-table-column label="学院" prop="deptName" width="200" show-overflow-tooltip/>
          <el-table-column label="楼栋" prop="buildName" width="200" show-overflow-tooltip/>
        </el-table>
        <pagination :page-sizes="[20, 30, 40, 50]"
                    v-show="total>0"
                    :total="total"
                    :page.sync="queryParams.page"
                    :limit.sync="queryParams.pageSize"
                    @pagination="getList"
        />
      </div>
    </div>
  </div>
</template>
<script>
  import { laboratoryCameraRecordGetCameraRecord } from "@/api/integratedManagement/index";
  export default {
    name: 'index',
    data () {
      return {
        //查询条件
        queryParams:{
          page:1,
          pageSize:20,
          searchValue:"",
        },
        //时间数据
        dateRange:[],
        //列表数据
        dataList:[],
        //数据数量
        total:0,
      }
    },
    created () {

    },
    mounted () {
      this.getList();
    },
    methods: {
      //查询按钮
      handleQuery(){
        this.$set(this.queryParams,'page',1);
        this.getList();
      },
      //重置按钮
      resetQuery(){
        this.$set(this,'dateRange',[])
        this.$set(this,'queryParams',{
          page:1,
          pageSize:20,
          searchValue:"",
        });
        this.getList();
      },
      //获取数据列表
      getList(){
        let obj = JSON.parse(JSON.stringify(this.queryParams))
        if(this.dateRange[0]){
          obj.startTime = this.dateRange[0]+'T00:00:00'
          obj.endTime = this.dateRange[1]+'T23:59:59'
        }else{
          obj.startTime = "";
          obj.endTime = "";
        }
        laboratoryCameraRecordGetCameraRecord(obj).then(response => {
          this.$set(this,'dataList',response.data.records);
          this.$set(this,'total',response.data.total);
        });
      },
    },
  }
</script>
<style scoped lang="scss">
  .videoViewingHistory{
    .videoViewingHistoryPage{

    }
  }
</style>
