<template>
  <div id="scroll-board">
    <cmpTitle title="人员异常告警" visitMoreBtn="true" @onMore="clickMore"></cmpTitle>
    <dv-scroll-board :config="config" style="flex:1;cursor: pointer;" @click="jump"/>
  </div>
</template>
<script>
// import {getCaptureList} from "../../../api/smartapplication/capturerecord.js"
import cmpTitle from "../common/cmpTitle.vue"
export default {
  components:{
    cmpTitle
  },
  data () {
    return {
      showtitle:true,
      config: {
        header: ['位置', '人员类型', '年龄', '时间'],
        data: [],
        index: false,
        align: ['center'],
        rowNum: 5,
        headerBGC: 'rgba(6, 30, 93, 0.1)',
        headerHeight: 30,
        oddRowBGC: 'rgba(0, 44, 81, 0.8)',
        evenRowBGC: 'rgba(10, 29, 50, 0.8)',
        // path:'/jobs/personjob'
        path:''
      },
      dataList:[]
    }
  },
  mounted() {
    this.getDataList()
  },
  methods:{
    clickMore(){
      this.$router.push({path:'/community/capturerecord'})
    },
    getDataList(){
      var _this = this;
      let current = 1;
      let size = 20;
      // let params = {
      //   residentialName:''
      // }
      return getCaptureList(current,size).then((res)=>{
        let list = []
        _this.dataList = res.data.data.records
        res.data.data.records.map((item)=>{
            let arr = [];
            arr.push(item.installPath)
            arr.push(item.accessUserType)
            arr.push(item.accessSex)
            arr.push(item.accessDate)
            list.push(arr)
        })
        _this.config.data = list;
        _this.$set(_this.config)
      }).catch((err)=>{
        console.log(err)
      })
    },
    jump(row){
      if(this.config.path!==''){
        this.$router.push({path:this.config.path})
      }else{
        let data = this.dataList[row.rowIndex]
        let params = {
          title:'人员信息',
          type:'flowPeopleInfo'
        }
        this.$emit("onEmit",data,params)
      }
    },

  }
}
</script>

<style lang="less">
  #scroll-board{
    box-sizing: border-box;
    height: 100%;
    width: 100%;
    overflow: hidden;
  }
</style>
