<template>
  <VxeGrid ref="hxPgd" v-bind="gridOptions" @cell-click="cellClick" @current-change="getCurrentData" />
</template>

<script>
import paoWanPgdConfig from './pgdTable'
import {getPgd} from "@/api/zyjh";
export default {
  name:'HxianPgd',
  props:{
    workers:{
      type:Array,
      default:[]
    }
  },
  data(){
    return{
      gridOptions:{},
      list:{},
    }
  },
  created(){
    const {options,columns}=paoWanPgdConfig()
    this.gridOptions=options
    this.gridOptions.columns=columns
  },
  methods:{
    initData(worker,zt){
      getPgd({user:worker,zt:zt,field:'hxry'}).then(res=>{
        this.gridOptions.data=res.data
      })
    },
    getCurrentData(){
      const data= this.$refs.hxPgd.getCurrentRecord()
      window.localStorage.setItem("hxfk",JSON.stringify(data))
    },
    cellClick({row}){
      this.$emit('initPgd',row)
    }
  }
}
</script>
