Newer
Older
smartcity_env_front / src / views / video / videoPoint.vue
[wangxitong] on 22 Jul 2021 3 KB first commit
<template>
  <app-container>
    <search-area :need-clear="false" :need-search-more="false" type="seperate" size="small" search-more-type="default" @search="fetchData" @clear="clearInput">
      <!--一般查询条件-->
      <search-item>
        <el-input v-model.trim="listQuery.keywords" size="small" placeholder="请输入关键字" clearable/>
      </search-item>
    </search-area>
    <normal-table :data="list" :head="tableOption.head" :query="listQuery" :total="total" :columns="columns" :list-loading="listLoading" :options="tableOption.options" :tools-option="tableOption.toolsOption" size="small" @change="changePage">
      <template slot="btns"/>
      <template slot="columns">
        <el-table-column label="预览" align="center" width="120">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click.stop="goDetail(scope.row)">预览</el-button>
          </template>
        </el-table-column>
      </template>
    </normal-table>
  </app-container>
</template>

<script>
export default {
  name: 'VideoPoint',
  components: { },
  data() {
    return {
      listQuery: {
        keywords: '',
        offset: 1,
        limit: 20
      }, // 筛选条件
      columns: [
        {
          text: '名称',
          value: 'name',
          align: 'center'
        },
        {
          text: '详细地址',
          value: 'position',
          align: 'center'
        },
        {
          text: '所在网格',
          value: 'grid',
          align: 'center'
        },
        {
          text: '摄像头类型',
          value: 'cameraTypeName',
          align: 'center',
          width: 200
        },
        {
          text: '在线状态',
          value: 'online',
          align: 'center',
          width: 80
        }
      ], // 显示列
      timeRange: [], // 时间范围
      list: [], // 列表数据
      total: 0, // 数据总数
      listLoading: true, // 列表加载动画
      tableOption: {
        head: {
          show: true, // 是否需要标题栏,
          text: '数据列表' // 标题名称
        },
        options: {
          needIndex: false // 是否需要序号列
        },
        toolsOption: {
          selectColumns: false, // 是否需要筛选列
          refresh: false // 是否需要刷新按钮
        }
      } // 表格属性
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      const that = this
      setTimeout(function() {
        that.list = [
          { name: '宝水新城监控点', position: '抚州市崇仁县县府西路100号', grid: '第一责任网格', cameraTypeName: '枪机摄像头', online: '在线' },
          { name: '宝水新城监控点', position: '抚州市崇仁县县府西路100号', grid: '第一责任网格', cameraTypeName: '枪机摄像头', online: '在线' },
          { name: '宝水新城监控点', position: '抚州市崇仁县县府西路100号', grid: '第一责任网格', cameraTypeName: '枪机摄像头', online: '在线' },
          { name: '宝水新城监控点', position: '抚州市崇仁县县府西路100号', grid: '第一责任网格', cameraTypeName: '枪机摄像头', online: '在线' }
        ]
        that.total = 200
        that.listLoading = false
      }, 500)
    },
    // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写
    changePage(val) {
      if (val && val.size) {
        this.listQuery.limit = val.size
      }
      if (val && val.page) {
        this.listQuery.offset = val.page
      }
      this.fetchData()
    },
    // 重置后的操作, 若不需要显示重置按钮则不需要写
    clearInput() {
      this.$message.success('clearInput')
    }
  }
}
</script>

<style scoped>

</style>