<template>
  <div id='app1' class="basic-main" v-show="(!echarts)&&(!isActiveTotalForm)">
    <criteria-paged :model="model" :pager='true' v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.search' v-ref:cri>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
           <div>
             <P1>巴彦淖尔腾洁燃气有限责任公司物联网查询系统</P1>
           </div>
          </div>
          <div class="row" v-show="$parent.$parent.criteriaShow">
          </div>
        </div>
      </criteria>
      <data-grid id="usergasall" :model="model" partial='list' class="list_area table_sy"  v-ref:grid>
        <template partial='head'>
          <tr>
            <th style="text-align:center">
              <nobr1>欠费总金额</nobr1>
            </th>
            <th style="text-align:center">
              <nobr1>欠费户数</nobr1>
            </th>
            <th style="text-align:center">
              <nobr1>未抄表户数</nobr1>
            </th>
            <th style="text-align:center">
              <nobr1>失联用户总数</nobr1>
            </th>
          </tr>

        </template>
        <template partial='body'>
          <td style="text-align:center">
            <nobr1>{{row.money}}</nobr1>
          </td>
          <td style="text-align:center">
            <nobr1>{{row.number}}</nobr1>
          </td>
          <td style="text-align:center">
            <nobr1>{{row.anzhuang}}</nobr1>
          </td>
          <td style="text-align:center">

            <nobr1>{{row.slday}}</nobr1>
          </td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
  <div style="height: 40px;width: 100%;" v-show="echarts">
    <div style="display: inline-block;">
      <button class="button_search button_spacing" @click="notShowEcharts()">隐藏图表</button>
    </div>
    <!--      图显示模板-->

  </div>
  <div style="width: 100%;height: 90%;" v-show="echarts">
    <sign-analysis-echarts  :condition="condition" :startdate="startDate"
                            :enddate="endDate" :echarts="echarts"></sign-analysis-echarts>
  </div>
  <div style="width: 100%;height: 90%;" v-show="isActiveTotalForm">

  </div>
</template>

<script>
  import {PagedList} from 'vue-client'
  import * as Util from '../../Util'
  let readySomething = async function (self) {
    await self.$MagLoadParams.loadParam()
    self.initParams()
  }
  export default {
    title: '首页',
    props: ['data'],
    // components: {signAnalysisEcharts},
    data() {
      return {
        model: new PagedList('rs/sql/shouye', 20, {
          startDate: 'this.model.startDate',
          endDate: 'this.model.endDate'
        }),
        startDate: '',
        endDate: '',
        condition: '1=1',
        signtype:['type1'],
        }
    },
    ready() {
      readySomething(this)
      this.$refs.paged.$refs.cri.model.startDate = Util.toStandardDateString() + ' 00:00:00.000'
      this.$refs.paged.$refs.cri.model.endDate = Util.toStandardDateString() + ' 23:59:59.000'
      console.log("type:"+this.$refs.paged.$refs.cri.model.f_error_type)
      // this.getErrorInfo('f_error_level')
      console.log("type:"+this.$refs.paged.$refs.cri.model.f_error_type)
      this.$refs.paged.$refs.cri.search()
    },
    // ready() {
    //   this.$refs.paged.$refs.cri.model.start_f_parameter_date = Util.toStandardDateString() + ' 00:00:00'
    //   this.$refs.paged.$refs.cri.model.end_f_parameter_date = Util.toStandardDateString() + ' 23:59:59'
    //   this.$refs.paged.$refs.cri.search()
    // },
    methods: {



      search(args) {
        this.startDate = this.$refs.paged.$refs.cri.model.startDate
        this.endDate = this.$refs.paged.$refs.cri.model.endDate
        this.f_error_type=this.$refs.paged.$refs.cri.model.f_error_type
        console.log('1231321312312321')
        /* if (this.endDate == '' || this.startDate == '') {
        return this.$showMessage("时间区间的开始和结束时间不能为空！")
        }*/
        this.condition = this.$refs.paged.$refs.cri.condition

        args.condition = this.condition
        this.model.search(args.condition, args.model)
      },


    },
    computed: {
      getCondition() {
        let condition = this.$refs.paged.$refs.cri.condition
        return {
          condition: condition,
          startDate: `${this.$refs.paged.$refs.cri.model.startDate}`,
          endDate: `${this.$refs.paged.$refs.cri.model.endDate}`
        }
      },
    }
  }
</script>
<style>
   p1{
     font-size:50px ;
     text-align: center;
     color: #537cff;
   }
   nobr1{
     font-size:30px ;
  }
</style>
