<template>
  <div id="flex">
    <p align="center">汇总表</p>
    <table border="1px dashed #000"v-model="pooldata" >
      <tr  v-for="date in pooldata" style="width: 200px" align="center">
        <td v-for="i in date" style="width: 100px;" align="center">{{i}}</td>
      </tr>
    </table>

  </div>
</template>
<script>
  import * as Util from '../../Util'
  export default {
    name: 'list',
    props: {
      condition: String,
      startdate: {
        type: String,
        default: Util.toStandardDateString()
      },
      enddate: {
        type: String,
        default: Util.toStandardDateString()
      },
      echartsdate:Array,
      pooldata:Array,
    },
    data () {
      return {
        model: [],
        detailcondition:'', //钻取的字段对应的值
        barparam:'',
        echarts:false,
        listname:[],

      }
    },
    methods: {
      cloumnname(){
        let arrparams=this.$parent.childdate
        let namedate=[]
        var s=0
        console.log(this.$parent.childdate,'测试点汇总数据')
          for (var i=0;i<arrparams.length;i++){
            console.log(arrparams[i][0],'测试点名称')
            var s=0
            for (var pi in arrparams[i][0]){
              if(i==0&&s==0){
                namedate.push()
              }
              if(s!=0){
                if(arrparams[i][0].hasOwnProperty(pi)) {namedate.push(pi)}
              }
                 s++
            }
          }
        this.listname=namedate
        console.log(namedate,'显示汇总表头')
      },
      pooldataearn(){

        let  a=this.$parent.childdate
        let  c=[]
        for (var j=0;j<a[0].length;j++){
          let  aa={}
          var  l=0
          for (var i=0;i<a.length;i++){
            if(i==0){
              aa[l]=a[i][j].name
              l++
              aa[l]=a[i][j].value
            }else {
              aa[l]=a[i][j].value
            }
            l++
          }
          c.push(aa)
        }
        this.$parent.datapool=c
        console.log(this.$parent.datapool,'汇总数据')
      }
    },
    computed:{

    },
    watch:{
      'echartsdate':{
        deep: true,
        handler(val) {
          console.log('更新汇总数据')
          this.pooldataearn()
        }
      },
    },
    ready () {

    }
  }
</script>
<style scoped>
  td{
    border: 1px solid #c6d9ef; height: 10%;width: 20%; color: #333333;
  }
  td:nth-child(odd){
    background-color: #eff4fa;color: #666666;border: 1px solid #c6d9ef;
  }
  p{
    color: #333333;font-size: 20px;
  }
</style>
