<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleTabClick">
      <el-tab-pane label="效率统计" name="first">
        <div class="search">
          <el-date-picker v-model="tab.table.getdataListParm.parammaps.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
          <span style="margin-left: 10px;">统计类型:</span>
          <el-radio v-model="tab.radio" label="1" @change="changeRadio">配方</el-radio>
          <el-radio v-model="tab.radio" label="2" @change="changeRadio">栏舍</el-radio>
          <el-radio v-model="tab.radio" label="3" @change="changeRadio">牲畜类别</el-radio>
          <el-input v-if="tab.isFormulaName" v-model="tab.table.getdataListParm.parammaps.source" class="filter-item" style="width: 245px;" placeholder="配方模板" />
          <el-input v-if="tab.isHouseName" v-model="tab.table.getdataListParm.parammaps.source" class="filter-item" style="width: 150px;" placeholder="栏舍" />
          <el-input v-if="tab.isHouseName" v-model="tab.table.getdataListParm.parammaps.source" class="filter-item" style="width: 150px;" placeholder="配方模板" />
          <el-input v-if="tab.isLivestockType" v-model="tab.table.getdataListParm.parammaps.source" class="filter-item" style="width: 150px;" placeholder="牲畜类别" />
          <el-button class="successBorder" @click="handleSearch">查询</el-button>
          <el-button class="export" @click="handleDownload">导出</el-button>
        </div>
        <div class="table">
          <el-table
            :key="tab.table.tableKey"
            v-loading="tab.table.listLoading"
            element-loading-text="给我一点时间"
            :data="tab.table.list"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <el-table-column v-if="tab.isFormulaName" label="配方模板" min-width="110px" align="center" prop="A1" />
            <el-table-column v-if="tab.isHouseName" label="栏舍" min-width="110px" align="center" prop="A1" />
            <el-table-column v-if="tab.isHouseName" label="配方模板" min-width="110px" align="center" prop="A20" />
            <el-table-column v-if="tab.isLivestockType" label="牲畜类别" min-width="110px" align="center" prop="A1" />
            <el-table-column label="实际牛头数" min-width="110px" align="center" prop="A2" />
            <el-table-column label="应混料量(kg)" min-width="110px" align="center" prop="A3" />
            <el-table-column label="实际混料量(kg)" min-width="110px" align="center" prop="A4" />
            <el-table-column label="撒料量(kg)" min-width="110px" align="center" prop="A5" />
            <el-table-column label="混料时间(min)" min-width="110px" align="center" prop="A6" />
            <el-table-column label="搅拌时间(min)" min-width="110px" align="center" prop="A7" />
            <el-table-column label="转投剩料量(kg)" min-width="110px" align="center" prop="A8" />
            <el-table-column label="今日剩料量(kg)" min-width="110px" align="center" prop="A9" />
            <el-table-column label="剩料率(%)" min-width="110px" align="center" prop="A10" />
            <el-table-column label="TMR干物质(%)" min-width="110px" align="center" prop="A11" />
            <el-table-column label="配方干物质采食量(kg/头)" min-width="110px" align="center" prop="A12" />
            <el-table-column label="实际干物质采食量(kg/头)" min-width="110px" align="center" prop="A13" />
            <el-table-column label="采食率(%)" min-width="110px" align="center" prop="A14" />
            <el-table-column label="配方成本(元/头)" min-width="110px" align="center" prop="A15" />
            <el-table-column label="实际成本(元/头)" min-width="110px" align="center" prop="A16" />
            <el-table-column label="产奶量(kg/头)" min-width="110px" align="center" prop="A17" />
            <el-table-column label="饲料转化率" min-width="110px" align="center" prop="A18" />
            <el-table-column label="公斤奶饲料成本" min-width="110px" align="center" prop="A19" />
          </el-table>
          <!-- <pagination v-show="tab.table.total>=0" :total="tab.table.total" :page.sync="tab.table.getdataListParm.offset" :limit.sync="tab.table.getdataListParm.pagecount" @pagination="getTabList" /> -->
        </div>

        <div class="AnalysisChart">
          <el-row :gutter="10">
            <!-- 泌乳牛采食量 -->
            <el-col :span="12" style="position: relative;">
              <h4 style="text-align:center;">泌乳牛采食量</h4>
              <div>
                <el-date-picker v-model="tab.chart1.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart1')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart1')">切换表格</el-button>
              </div>
              <div id="chartLine1" style="width:100%;height:430px;" />
              <div v-if="tab.chart1.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart1')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart1')">切换图表</el-button>
                <el-table
                  :key="tab.chart1.table.tableKey"
                  v-loading="tab.chart1.table.listLoading"
                  element-loading-text="给我一点时间"
                  :data="tab.chart1.table.list"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;"
                  height="430"
                  :row-style="rowStyle"
                  :cell-style="cellStyle"
                  class="elTable table-fixed"
                >
                  <el-table-column label="日期" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="泌乳牛采食量(kg)" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="泌乳牛产奶量(kg)" min-width="110px" align="center" prop="barname" />
                </el-table>
              </div>
            </el-col>
            <!-- 牛栏剩料率 -->
            <el-col :span="12" style="position: relative;">
              <h4 style="text-align:center;">牛栏剩料率</h4>
              <div>
                <el-select v-model="tab.chart2.getdataListParm.parammaps.enable" style="width: 150px;margin-right: 5px;" multiple collapse-tags placeholder="请选择统计参数">
                  <el-option v-for="item in tab.chart2.statisticsList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
                <el-date-picker v-model="tab.chart2.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart2')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart2')">切换表格</el-button>
              </div>
              <div id="chartLine2" style="width:100%;height:400px;" />
              <div v-if="tab.chart2.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart2')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart2')">切换图表</el-button>
                <el-table
                  :key="tab.chart2.table.tableKey"
                  v-loading="tab.chart2.table.listLoading"
                  element-loading-text="给我一点时间"
                  :data="tab.chart2.table.list"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;"
                  height="430"
                  :row-style="rowStyle"
                  :cell-style="cellStyle"
                  class="elTable table-fixed"
                >
                  <el-table-column label="日期" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="栏舍名称" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="剩料量" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="撒料量" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="剩料率" min-width="110px" align="center" prop="barname" />
                </el-table>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <!-- 搅拌时间统计 -->
            <el-col :span="12" style="position: relative;">
              <h4 style="text-align:center;">搅拌时间统计</h4>
              <div>
                <el-date-picker v-model="tab.chart3.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart3')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart3')">切换表格</el-button>
              </div>
              <div id="chartLine3" style="width:100%;height:400px;" />
              <div v-if="tab.chart3.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart3')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart3')">切换图表</el-button>
                <el-table
                  :key="tab.chart3.table.tableKey"
                  v-loading="tab.chart3.table.listLoading"
                  element-loading-text="给我一点时间"
                  :data="tab.chart3.table.list"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;"
                  height="430"
                  :row-style="rowStyle"
                  :cell-style="cellStyle"
                  class="elTable table-fixed"
                >
                  <el-table-column label="日期" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="平均搅拌时间(分钟)" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="混料+搅拌时间(分钟)" min-width="110px" align="center" prop="barname" />
                </el-table>
              </div>
            </el-col>
            <!-- 转化率 -->
            <el-col :span="12" style="position: relative;">
              <h4 style="text-align:center;">转化率</h4>
              <div>
                <el-select v-model="tab.chart4.getdataListParm.parammaps.enable" style="width: 150px;margin-right: 5px;" multiple collapse-tags placeholder="请选择统计参数">
                  <el-option v-for="item in tab.chart4.statisticsList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
                <el-date-picker v-model="tab.chart4.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart4')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart4')">切换表格</el-button>
              </div>
              <div id="chartLine4" style="width:100%;height:400px;" />
              <div v-if="tab.chart4.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart4')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart4')">切换图表</el-button>
                <el-table
                  :key="tab.chart4.table.tableKey"
                  v-loading="tab.chart4.table.listLoading"
                  element-loading-text="给我一点时间"
                  :data="tab.chart4.table.list"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;"
                  height="430"
                  :row-style="rowStyle"
                  :cell-style="cellStyle"
                  class="elTable table-fixed"
                >
                  <el-table-column label="日期" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="配方名称" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="饲料转化率" min-width="110px" align="center" prop="barname" />
                </el-table>
              </div>
            </el-col>
          </el-row>

          <el-row :gutter="10">
            <!-- 成本分析 -->
            <el-col :span="24" style="position: relative;">
              <h4 style="text-align:center;">成本分析</h4>
              <div>
                <el-select v-model="tab.chart5.getdataListParm.parammaps.enable" style="width: 150px;margin-right: 5px;" multiple collapse-tags placeholder="请选择统计参数">
                  <el-option v-for="item in tab.chart5.statisticsList" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
                <el-date-picker v-model="tab.chart5.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart5')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart5')">切换表格</el-button>
              </div>
              <div id="chartLine5" style="width:100%;height:400px;" />
              <div v-if="tab.chart5.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart5')">导出</el-button>
                <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart5')">切换图表</el-button>
                <el-table
                  :key="tab.chart5.table.tableKey"
                  v-loading="tab.chart5.table.listLoading"
                  element-loading-text="给我一点时间"
                  :data="tab.chart5.table.list"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;"
                  height="430"
                  :row-style="rowStyle"
                  :cell-style="cellStyle"
                  class="elTable table-fixed"
                >
                  <el-table-column label="日期" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="牲畜类别" min-width="110px" align="center" prop="barname" />
                  <el-table-column label="公斤奶饲料成本(元)" min-width="110px" align="center" prop="barname" />
                </el-table>
              </div>
            </el-col>

          </el-row>
        </div>
      </el-tab-pane>
      <el-tab-pane label="牛群评估" name="second">
        <div class="search">
          <el-date-picker v-model="tab2.table.getdataListParm.parammaps.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
        </div>
        <div class="table">
          <el-row :gutter="10">
            <!-- 宾州筛分析 -->
            <el-col :span="12">
              <h4 style="text-align:center;">宾州筛分析</h4>
              <el-table
                :key="tab2.table.tableKey"
                v-loading="tab2.table.listLoading"
                element-loading-text="给我一点时间"
                :data="tab2.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="宾州筛" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第一层重量" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A2 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第一层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A3 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第二层重量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A4 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第二层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A5 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第三层重量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A6 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第三层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A7 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第四层重量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A8 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第四层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A9 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="参考标准" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A10 }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <!-- 粪便筛分析 -->
            <el-col :span="12">
              <h4 style="text-align:center;">粪便筛分析</h4>
              <el-table
                :key="tab2.table2.tableKey"
                v-loading="tab2.table2.listLoading"
                element-loading-text="给我一点时间"
                :data="tab2.table2.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="粪便筛" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第一层重量" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A2 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第一层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A3 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第二层重量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A4 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第二层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A5 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第三层重量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A6 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="第三层百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A7 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="参考标准" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A8 }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <!-- BCS评分 -->
            <el-col :span="12">
              <h4 style="text-align:center;">BCS评分</h4>
              <el-table
                :key="tab2.table3.tableKey"
                v-loading="tab2.table3.listLoading"
                element-loading-text="给我一点时间"
                :data="tab2.table3.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="栏舍" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="抽查样本数" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A2 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="单产" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A3 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="干物质采食量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A4 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="泌乳天数" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A5 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="标准分数" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A6 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="2.75-分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A7 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="2.75分(数量、百分比" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A8 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="3分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A9 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="3.25分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A10 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="3.5分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A11 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="3.75分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A12 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="4+分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A13 }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <!-- 粪便评分 -->
            <el-col :span="12">
              <h4 style="text-align:center;">粪便评分</h4>
              <el-table
                :key="tab2.table4.tableKey"
                v-loading="tab2.table4.listLoading"
                element-loading-text="给我一点时间"
                :data="tab2.table4.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="栏舍" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A1 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="抽查样本数" min-width="130px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A2 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="单产" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A3 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="干物质采食量" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A4 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="泌乳天数" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A5 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="标准分数" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A6 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="1分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A7 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="2分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A8 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="3分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A9 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="4分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A10 }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="5分(数量、百分比)" min-width="110px" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.A11 }}</span>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>

        </div>
      </el-tab-pane>
    </el-tabs>
  </div>

</template>

<script>
import echarts from 'echarts'

require('echarts/theme/macarons')
import { GetDataByName } from '@/api/common'
import Cookies from 'js-cookie'
import { parseTime } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { json2excel } from '@/utils/index.js'
export default {
  name: 'ErrorAnalysis',
  components: { Pagination },
  data() {
    return {
      activeName: 'first',
      tab: {
        radio: '1',
        isFormulaName: true, // 配方名称
        isHouseName: false, // 栏舍名称
        isLivestockType: false, // 牲畜类别
        table: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 1,
          list: [
            { 'id': 1, 'A1': '干奶牛', 'A2': '107', 'A3': '3210', 'A4': '3200', 'A5': '3200', 'A6': '1.5', 'A7': '3.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.45', 'A12': '13.50', 'A13': '13.46', 'A14': '99.70', 'A15': '30.9', 'A16': '30.8', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 2, 'A1': '临产牛', 'A2': '93', 'A3': '3003', 'A4': '3008', 'A5': '3008', 'A6': '2.6', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '14.85', 'A13': '14.88	', 'A14': '100.20', 'A15': '41.01', 'A16': '41.08', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 3, 'A1': '新产牛', 'A2': '16', 'A3': '372', 'A4': '362', 'A5': '33620', 'A6': '1.25', 'A7': '3.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '11.16', 'A13': '10.86', 'A14': '97.31', 'A15': '31.85', 'A16': '31.0', 'A17': '15', 'A18': '65%', 'A19': '1.55' },
            { 'id': 4, 'A1': '新产牛', 'A2': '119', 'A3': '3840', 'A4': '3864', 'A5': '3864', 'A6': '2.12', 'A7': '3.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '15.49', 'A13': '10.21', 'A14': '100.65', 'A15': '44.21', 'A16': '44.48', 'A17': '20', 'A18': '72%', 'A19': '1.6' },
            { 'id': 5, 'A1': '青年牛', 'A2': '103', 'A3': '2280', 'A4': '2287', 'A5': '2287', 'A6': '3', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.18', 'A13': '9.67', 'A14': '100.29', 'A15': '19.26', 'A16': '19.32', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 6, 'A1': '高产牛', 'A2': '96', 'A3': '4409', 'A4': '1976', 'A5': '1976', 'A6': '1', 'A7': '2.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.47', 'A12': '21.59', 'A13': '9.41', 'A14': '44.79', 'A15': '57.41', 'A16': '25.73', 'A17': '27', 'A18': '85%', 'A19': '1.2' },
            { 'id': 7, 'A1': '小育成', 'A2': '155', 'A3': '3308', 'A4': '3316', 'A5': '3316', 'A6': '1.63', 'A7': '2.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.44', 'A12': '9.39', 'A13': '9.98', 'A14': '100.21', 'A15': '22.2', 'A16': '22.25', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 8, 'A1': '大公牛', 'A2': '113', 'A3': '2684', 'A4': '2684', 'A5': '2684', 'A6': '2.2', 'A7': '3.5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.42', 'A12': '9.98', 'A13': '9.98', 'A14': '100.00', 'A15': '15.2', 'A16': '15.2', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 9, 'A1': '青年牛', 'A2': '154', 'A3': '3342', 'A4': '3326', 'A5': '3326', 'A6': '2.5', 'A7': '4.23', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '9.98', 'A13': '13.46', 'A14': '99.50', 'A15': '18.88', 'A16': '18.79', 'A17': '', 'A18': '', 'A19': '' },
            { 'id': 10, 'A1': '青年牛', 'A2': '150', 'A3': '3418', 'A4': '3417', 'A5': '3417', 'A6': '3.1', 'A7': '5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.48', 'A13': '13.46', 'A14': '100.00', 'A15': '19.82', 'A16': '19.82', 'A17': '', 'A18': '', 'A19': '' }
          ],
          total: 0,
          listLoading: true,
          temp: {}
        },

        table2: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 2,
          list: [],
          total: 0,
          listLoading: true,
          temp: {}
        },

        chart1: {
          chartLine: null,
          chartLine_data: {},
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              enable: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          statisticsList: [{ id: '0', name: '配方01' }, { id: '1', name: '配方02' }, { id: '2', name: '配方03' }],
          isChart: true,
          isTable: false,
          table: {
            getdataListParm: {
              name: 'getBarmilkList',
              page: 1,
              offset: 1,
              pagecount: 10,
              returntype: 'Map',
              parammaps: {
                pastureid: Cookies.get('pastureid'),
                enable: ''
              }
            },
            tableKey: 1,
            list: [],
            total: 0,
            listLoading: true
          }
        },

        chart2: {
          chartLine: null,
          chartLine_data: {},
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              enable: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          statisticsList: [{ id: '0', name: '配方01' }, { id: '1', name: '配方02' }, { id: '2', name: '配方03' }],
          isChart: true,
          isTable: false,
          table: {
            getdataListParm: {
              name: 'getBarmilkList',
              page: 1,
              offset: 1,
              pagecount: 10,
              returntype: 'Map',
              parammaps: {
                pastureid: Cookies.get('pastureid'),
                enable: ''
              }
            },
            tableKey: 1,
            list: [],
            total: 0,
            listLoading: true
          }
        },

        chart3: {
          chartLine: null,
          chartLine_data: {},
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              enable: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          isChart: true,
          isTable: false,
          table: {
            getdataListParm: {
              name: 'getBarmilkList',
              page: 1,
              offset: 1,
              pagecount: 10,
              returntype: 'Map',
              parammaps: {
                pastureid: Cookies.get('pastureid'),
                enable: ''
              }
            },
            tableKey: 1,
            list: [],
            total: 0,
            listLoading: true
          }
        },

        chart4: {
          chartLine: null,
          chartLine_data: {},
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              enable: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          statisticsList: [{ id: '0', name: '配方01' }, { id: '1', name: '配方02' }, { id: '2', name: '配方03' }],
          isChart: true,
          isTable: false,
          table: {
            getdataListParm: {
              name: 'getBarmilkList',
              page: 1,
              offset: 1,
              pagecount: 10,
              returntype: 'Map',
              parammaps: {
                pastureid: Cookies.get('pastureid'),
                enable: ''
              }
            },
            tableKey: 1,
            list: [],
            total: 0,
            listLoading: true
          }
        },

        chart5: {
          chartLine: null,
          chartLine_data: {},
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              enable: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          statisticsList: [{ id: '0', name: '配方01' }, { id: '1', name: '配方02' }, { id: '2', name: '配方03' }],
          isChart: true,
          isTable: false,
          table: {
            getdataListParm: {
              name: 'getBarmilkList',
              page: 1,
              offset: 1,
              pagecount: 10,
              returntype: 'Map',
              parammaps: {
                pastureid: Cookies.get('pastureid'),
                enable: ''
              }
            },
            tableKey: 1,
            list: [],
            total: 0,
            listLoading: true
          }
        }
      },

      tab2: {
        table: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 1,
          list: [
            { 'id': 1, 'A1': '平均值', 'A2': '76.9', 'A3': '15.7%', 'A4': '159.5', 'A5': '32.7%', 'A6': '251.7', 'A7': '51.6%', 'A8': '', 'A9': '', 'A10': '' },
            { 'id': 2, 'A1': '变异系数', 'A2': '5.69', 'A3': '5.69', 'A4': '5.46', 'A5': '5.46', 'A6': '4.91', 'A7': '4.91', 'A8': '', 'A9': '', 'A10': '' },
            { 'id': 3, 'A1': '17号/新产牛', 'A2': '29', 'A3': '10.51%', 'A4': '91', 'A5': '32.97%', 'A6': '156', 'A7': '56.52%', 'A8': '', 'A9': '', 'A10': '10-15|30-50|40-60' },
            { 'id': 4, 'A1': '2号南/高产1', 'A2': '75.62', 'A3': '16.04%', 'A4': '162.33', 'A5': '34.42%', 'A6': '233.60', 'A7': '49.54%', 'A8': '', 'A9': '', 'A10': '10-15|30-50|40-60' },
            { 'id': 5, 'A1': '4号北/高产2', 'A2': '81.34', 'A3': '16.17%', 'A4': '158.46', 'A5': '31.51%', 'A6': '263.10', 'A7': '52.32%', 'A8': '', 'A9': '', 'A10': '10-15|30-50|40-60' },
            { 'id': 6, 'A1': '4号南/高产3', 'A2': '72.67', 'A3': '15.21%', 'A4': '154.34', 'A5': '32.31%', 'A6': '250.67', 'A7': '52.48%', 'A8': '', 'A9': '', 'A10': '10-15|30-50|40-60' }
          ],
          total: 0,
          listLoading: true,
          temp: {}
        },
        table2: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 1,
          list: [
            { 'id': 1, 'A1': '平均值', 'A2': '74.2', 'A3': '16.7%', 'A4': '150', 'A5': '35.7%', 'A6': '225.7', 'A7': '41.6%', 'A8': '' },
            { 'id': 2, 'A1': '变异系数', 'A2': '6.5', 'A3': '6.5', 'A4': '5.96', 'A5': '5.96', 'A6': '4.21', 'A7': '4.21', 'A8': '' },
            { 'id': 3, 'A1': '17号/新产牛', 'A2': '29', 'A3': '10.51%', 'A4': '91', 'A5': '32.97%', 'A6': '156', 'A7': '56.52%', 'A8': '0-10|10-20|50-100' },
            { 'id': 4, 'A1': '2号南/高产1', 'A2': '44', 'A3': '12.32%', 'A4': '70', 'A5': '19.61%', 'A6': '32', 'A7': '8.49%', 'A8': '0-10|10-20|50-100' },
            { 'id': 5, 'A1': '4号北/高产2', 'A2': '31', 'A3': '8.22%', 'A4': '243', 'A5': '68.07%', 'A6': '314', 'A7': '83.29%', 'A8': '0-10|10-20|50-100' },
            { 'id': 6, 'A1': '4号南/高产3', 'A2': '35', 'A3': '9.51%', 'A4': '150', 'A5': '60.31%', 'A6': '215', 'A7': '72.48%', 'A8': '0-10|10-20|50-100' }
          ],
          total: 0,
          listLoading: true,
          temp: {}
        },
        table3: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 1,
          list: [
            { 'id': 1, 'A1': '3号/新产1', 'A2': '110', 'A3': '20', 'A4': '18.14', 'A5': '47', 'A6': '3', 'A7': '7(7.69%)', 'A8': '16(17.58%)', 'A9': '34(37.36%)', 'A10': '18(19.78%)', 'A11': '9(9.12%)', 'A12': '7(7.69%)', 'A13': '1(1.56%)' },
            { 'id': 2, 'A1': '3号北/低产牛', 'A2': '89', 'A3': '18', 'A4': '23.69', 'A5': '100', 'A6': '3', 'A7': '5(5.21%)', 'A8': '12(12.50%)', 'A9': '36(37.50%)', 'A10': '18(18.75%)', 'A11': '11(11.46%)', 'A12': '9(9.38%)', 'A13': '5(5.21%)' },
            { 'id': 3, 'A1': '17号/新产牛', 'A2': '91', 'A3': '16', 'A4': '23.79', 'A5': '96', 'A6': '3.5', 'A7': '2(1.83%)', 'A8': '10(9.17%)', 'A9': '32(29.36%)', 'A10': '31(28.44%)', 'A11': '15(13.76%)', 'A12': '12(11.01%)', 'A13': '7(6.42%)' },
            { 'id': 4, 'A1': '2号南/高产1', 'A2': '100', 'A3': '19', 'A4': '21.68', 'A5': '76', 'A6': '3.25', 'A7': '1(1.22%)', 'A8': '3(3.37%)', 'A9': '9(10.11%)', 'A10': '18(20.22%)', 'A11': '24(26.97%)', 'A12': '26(29.21%)', 'A13': '9(10.11%)' },
            { 'id': 5, 'A1': '4号北/高产2', 'A2': '120', 'A3': '21', 'A4': '23.05', 'A5': '85', 'A6': '3', 'A7': '5(5.81%)', 'A8': '9(10.47%)', 'A9': '37(43.02)', 'A10': '17(19.77%)', 'A11': '12(13.95%)', 'A12': '5(5.81%)', 'A13': '1(1.16%)' },
            { 'id': 6, 'A1': '4号南/高产3', 'A2': '102', 'A3': '22', 'A4': '24.09', 'A5': '96', 'A6': '3', 'A7': '5(5.05%)', 'A8': '20(20.20%)', 'A9': '40(40.40%)', 'A10': '20(20.20%)', 'A11': '8(8.08%)', 'A12': '6(6.06%)', 'A13': '1(1.56%)' }
          ],
          total: 0,
          listLoading: true,
          temp: {}
        },
        table4: {
          getdataListParm: {
            name: 'getBarmilkList',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: Cookies.get('pastureid'),
              startTime: '',
              stopTime: '',
              inputDatetime: ''
            }
          },
          tableKey: 1,
          list: [
            { 'id': 1, 'A1': '3号/新产1', 'A2': '82', 'A3': '20', 'A4': '18.14', 'A5': '47', 'A6': '3', 'A7': '2(2.44%)', 'A8': '26(31,71%)', 'A9': '54(65.85%)', 'A10': '0(0%)', 'A11': '0(0%)' },
            { 'id': 2, 'A1': '3号北/低产牛', 'A2': '55', 'A3': '18', 'A4': '23.69', 'A5': '100', 'A6': '3', 'A7': '0(0%)', 'A8': '11(20%)', 'A9': '42(76.36%)', 'A10': '2(3.64%)', 'A11': '0(0%)' },
            { 'id': 3, 'A1': '17号/新产牛', 'A2': '44', 'A3': '16', 'A4': '23.79', 'A5': '96', 'A6': '3', 'A7': '0(0%)', 'A8': '6(13.64%)', 'A9': '35(79.55%)', 'A10': '3(6.82%)', 'A11': '0(0%)' },
            { 'id': 4, 'A1': '2号南/高产1', 'A2': '45', 'A3': '19', 'A4': '21.68', 'A5': '76', 'A6': '3', 'A7': '0(0%)', 'A8': '7(15.56%)', 'A9': '32(71.11%)', 'A10': '6(13.33%)', 'A11': '0(0%)' },
            { 'id': 5, 'A1': '4号北/高产2', 'A2': '53', 'A3': '21', 'A4': '23.05', 'A5': '85', 'A6': '3', 'A7': '0(0%)', 'A8': '13(24.53%)', 'A9': '35(66.04%)', 'A10': '5(9.43%)', 'A11': '0(0%)' },
            { 'id': 6, 'A1': '4号南/高产3', 'A2': '62', 'A3': '22', 'A4': '24.09', 'A5': '96', 'A6': '3', 'A7': '0(0%)', 'A8': '10(16.13%)', 'A9': '44(70.97%)', 'A10': '8(12.90%)', 'A11': '0(0%)' }],
          total: 0,
          listLoading: true,
          temp: {}
        }
      },
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' }
    }
  },

  created() {
    this.getTabList()
    this.getTabList2()
    this.getChart1()
    this.getChart2()
    this.getChart3()
    this.getChart4()
    this.getChart5()
  },
  mounted() {

  },
  methods: {
    handleDownload() {
      if (this.tab.radio == '1') {
        var excelDatas = [
          {
            tHeader: ['配方模板', '实际牛头数', '应混料量(kg)', '实际混料量(kg)', '撒料量(kg)', '混料时间(min)', '搅拌时间(min)', '转投剩料量(kg)', '今日剩料量(kg)', '剩料率(%)', 'TMR干物质(%)', '配方干物质采食量(kg/头)', '实际干物质采食量(kg/头)', '采食率(%) ', '配方成本(元/头 )', '实际成本(元/ 头)', '产奶量(kg /头)', '饲 料转化率', '公斤奶饲料成本'],
            filterVal: ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18', 'A19'],
            tableDatas: this.tab.table.list,
            sheetName: '配方'
          }
        ]
        json2excel(excelDatas, '效率统计-配方', true, 'xlsx')
      } else if (this.tab.radio == '2') {
        var excelDatas2 = [
          {
            tHeader: ['栏舍', '配方模板', '实际牛头数', '应混料量(kg)', '实际混料量(kg)', '撒料量(kg)', '混料时间(min)', '搅拌时间(min)', '转投剩料量(kg)', '今日剩料量(kg)', '剩料率(%)', 'TMR干物质(%)', '配方干物质采食量(kg/头)', ' 实际干物质采食量( kg/头)', '采食率 (%)', '配方成本( 元/头)', '实际成本 (元/头)', '产奶量(kg/头)', '饲料转化率', '公斤奶饲料成本'],
            filterVal: ['A1', 'A20', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18', 'A19'],
            tableDatas: this.tab.table.list,
            sheetName: '栏舍'
          }
        ]
        json2excel(excelDatas2, '效率统计-栏舍', true, 'xlsx')
      } else if (this.tab.radio == '3') {
        var excelDatas3 = [
          {
            tHeader: ['牲畜类别', '实际牛头数', '应混料量(kg)', '实际混料量(kg)', '撒料量(kg)', '混料时间(min)', '搅拌时间(min)', '转投剩料量(kg)', '今日剩料量(kg)', '剩料率(%)', 'TMR干物质(%)', '配方干 物质采食量(kg/ 头)', '实际干物质采 食量(kg/头)', ' 采食率(%)', '配方 成本(元/头)', '实际成本(元/头)', '产奶量(kg/头)', '饲料转化率', '公斤奶饲料成本'],
            filterVal: ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18', 'A19'],
            tableDatas: this.tab.table.list,
            sheetName: '牲畜类别'
          }
        ]
        json2excel(excelDatas3, '效率统计-牲畜类别', true, 'xlsx')
      }
    },
    handleTabClick() {
      if (this.activeName == 'first') {
        this.getTabList()
        this.getTabList2()
        this.getChart1()
        this.getChart2()
        this.getChart3()
        this.getChart4()
        this.getChart5()
      } else if (this.activeName == 'second') {
        this.getTab2List()
        this.getTab2List2()
        this.getTab2List3()
        this.getTab2List4()
      }
    },
    changeRadio() {
      console.log(this.tab.radio)
      if (this.tab.radio == '1') {
        console.log('配方名称')
        this.tab.isFormulaName = true
        this.tab.isHouseName = false
        this.tab.isLivestockType = false
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
        this.tab.table.list = [
          { 'id': 1, 'A1': '干奶牛', 'A2': '107', 'A3': '3210', 'A4': '3200', 'A5': '3200', 'A6': '1.5', 'A7': '3.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.45', 'A12': '13.50', 'A13': '13.46', 'A14': '99.70', 'A15': '30.9', 'A16': '30.8', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 2, 'A1': '临产牛', 'A2': '93', 'A3': '3003', 'A4': '3008', 'A5': '3008', 'A6': '2.6', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '14.85', 'A13': '14.88	', 'A14': '100.20', 'A15': '41.01', 'A16': '41.08', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 3, 'A1': '新产牛', 'A2': '16', 'A3': '372', 'A4': '362', 'A5': '33620', 'A6': '1.25', 'A7': '3.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '11.16', 'A13': '10.86', 'A14': '97.31', 'A15': '31.85', 'A16': '31.0', 'A17': '15', 'A18': '65%', 'A19': '1.55' },
          { 'id': 4, 'A1': '新产牛', 'A2': '119', 'A3': '3840', 'A4': '3864', 'A5': '3864', 'A6': '2.12', 'A7': '3.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '15.49', 'A13': '10.21', 'A14': '100.65', 'A15': '44.21', 'A16': '44.48', 'A17': '20', 'A18': '72%', 'A19': '1.6' },
          { 'id': 5, 'A1': '青年牛', 'A2': '103', 'A3': '2280', 'A4': '2287', 'A5': '2287', 'A6': '3', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.18', 'A13': '9.67', 'A14': '100.29', 'A15': '19.26', 'A16': '19.32', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 6, 'A1': '高产牛', 'A2': '96', 'A3': '4409', 'A4': '1976', 'A5': '1976', 'A6': '1', 'A7': '2.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.47', 'A12': '21.59', 'A13': '9.41', 'A14': '44.79', 'A15': '57.41', 'A16': '25.73', 'A17': '27', 'A18': '85%', 'A19': '1.2' },
          { 'id': 7, 'A1': '小育成', 'A2': '155', 'A3': '3308', 'A4': '3316', 'A5': '3316', 'A6': '1.63', 'A7': '2.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.44', 'A12': '9.39', 'A13': '9.98', 'A14': '100.21', 'A15': '22.2', 'A16': '22.25', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 8, 'A1': '大公牛', 'A2': '113', 'A3': '2684', 'A4': '2684', 'A5': '2684', 'A6': '2.2', 'A7': '3.5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.42', 'A12': '9.98', 'A13': '9.98', 'A14': '100.00', 'A15': '15.2', 'A16': '15.2', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 9, 'A1': '青年牛', 'A2': '154', 'A3': '3342', 'A4': '3326', 'A5': '3326', 'A6': '2.5', 'A7': '4.23', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '9.98', 'A13': '13.46', 'A14': '99.50', 'A15': '18.88', 'A16': '18.79', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 10, 'A1': '青年牛', 'A2': '150', 'A3': '3418', 'A4': '3417', 'A5': '3417', 'A6': '3.1', 'A7': '5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.48', 'A13': '13.46', 'A14': '100.00', 'A15': '19.82', 'A16': '19.82', 'A17': '', 'A18': '', 'A19': '' }
        ]
      } else if (this.tab.radio == '2') {
        console.log('栏舍名称')
        this.tab.isFormulaName = false
        this.tab.isHouseName = true
        this.tab.isLivestockType = false
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
        this.tab.table.list = [
          { 'id': 1, 'A1': '2号南', 'A2': '107', 'A3': '3210', 'A4': '3200', 'A5': '3200', 'A6': '1.5', 'A7': '3.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.45', 'A12': '13.50', 'A13': '13.46', 'A14': '99.70', 'A15': '30.9', 'A16': '30.8', 'A17': '', 'A18': '', 'A19': '', 'A20': '干奶牛' },
          { 'id': 2, 'A1': '1号北', 'A2': '93', 'A3': '3003', 'A4': '3008', 'A5': '3008', 'A6': '2.6', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '14.85', 'A13': '14.88	', 'A14': '100.20', 'A15': '41.01', 'A16': '41.08', 'A17': '', 'A18': '', 'A19': '', 'A20': '临产牛' },
          { 'id': 3, 'A1': '1号南', 'A2': '16', 'A3': '372', 'A4': '362', 'A5': '33620', 'A6': '1.25', 'A7': '3.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '11.16', 'A13': '10.86', 'A14': '97.31', 'A15': '31.85', 'A16': '31.0', 'A17': '15', 'A18': '65%', 'A19': '1.55', 'A20': '新产牛' },
          { 'id': 4, 'A1': '5号南', 'A2': '119', 'A3': '3840', 'A4': '3864', 'A5': '3864', 'A6': '2.12', 'A7': '3.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '15.49', 'A13': '10.21', 'A14': '100.65', 'A15': '44.21', 'A16': '44.48', 'A17': '20', 'A18': '72%', 'A19': '1.6', 'A20': '新产牛' },
          { 'id': 5, 'A1': '5号北西', 'A2': '103', 'A3': '2280', 'A4': '2287', 'A5': '2287', 'A6': '3', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.18', 'A13': '9.67', 'A14': '100.29', 'A15': '19.26', 'A16': '19.32', 'A17': '', 'A18': '', 'A19': '', 'A20': '青年牛' },
          { 'id': 6, 'A1': '4号北', 'A2': '96', 'A3': '4409', 'A4': '1976', 'A5': '1976', 'A6': '1', 'A7': '2.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.47', 'A12': '21.59', 'A13': '9.41', 'A14': '44.79', 'A15': '57.41', 'A16': '25.73', 'A17': '27', 'A18': '85%', 'A19': '1.2', 'A20': '高产牛' },
          { 'id': 7, 'A1': '4号南', 'A2': '155', 'A3': '3308', 'A4': '3316', 'A5': '3316', 'A6': '1.63', 'A7': '2.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.44', 'A12': '9.39', 'A13': '9.98', 'A14': '100.21', 'A15': '22.2', 'A16': '22.25', 'A17': '', 'A18': '', 'A19': '', 'A20': '小育成' },
          { 'id': 8, 'A1': '8号南', 'A2': '113', 'A3': '2684', 'A4': '2684', 'A5': '2684', 'A6': '2.2', 'A7': '3.5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.42', 'A12': '9.98', 'A13': '9.98', 'A14': '100.00', 'A15': '15.2', 'A16': '15.2', 'A17': '', 'A18': '', 'A19': '', 'A20': '大公牛' },
          { 'id': 9, 'A1': '7号北', 'A2': '154', 'A3': '3342', 'A4': '3326', 'A5': '3326', 'A6': '2.5', 'A7': '4.23', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '9.98', 'A13': '13.46', 'A14': '99.50', 'A15': '18.88', 'A16': '18.79', 'A17': '', 'A18': '', 'A19': '', 'A20': '青年牛' },
          { 'id': 10, 'A1': '8号北', 'A2': '150', 'A3': '3418', 'A4': '3417', 'A5': '3417', 'A6': '3.1', 'A7': '5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.48', 'A13': '13.46', 'A14': '100.00', 'A15': '19.82', 'A16': '19.82', 'A17': '', 'A18': '', 'A19': '', 'A20': '青年牛' }
        ]
      } else if (this.tab.radio == '3') {
        console.log(' 牲畜类别')
        this.tab.isFormulaName = false
        this.tab.isHouseName = false
        this.tab.isLivestockType = true
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
        this.tab.table.list = [
          { 'id': 1, 'A1': '干奶牛', 'A2': '107', 'A3': '3210', 'A4': '3200', 'A5': '3200', 'A6': '1.5', 'A7': '3.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.45', 'A12': '13.50', 'A13': '13.46', 'A14': '99.70', 'A15': '30.9', 'A16': '30.8', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 2, 'A1': '临产牛', 'A2': '93', 'A3': '3003', 'A4': '3008', 'A5': '3008', 'A6': '2.6', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '14.85', 'A13': '14.88	', 'A14': '100.20', 'A15': '41.01', 'A16': '41.08', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 3, 'A1': '新产牛', 'A2': '16', 'A3': '372', 'A4': '362', 'A5': '33620', 'A6': '1.25', 'A7': '3.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '11.16', 'A13': '10.86', 'A14': '97.31', 'A15': '31.85', 'A16': '31.0', 'A17': '15', 'A18': '65%', 'A19': '1.55' },
          { 'id': 4, 'A1': '新产牛', 'A2': '119', 'A3': '3840', 'A4': '3864', 'A5': '3864', 'A6': '2.12', 'A7': '3.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.48', 'A12': '15.49', 'A13': '10.21', 'A14': '100.65', 'A15': '44.21', 'A16': '44.48', 'A17': '20', 'A18': '72%', 'A19': '1.6' },
          { 'id': 5, 'A1': '青年牛', 'A2': '103', 'A3': '2280', 'A4': '2287', 'A5': '2287', 'A6': '3', 'A7': '4.2', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.18', 'A13': '9.67', 'A14': '100.29', 'A15': '19.26', 'A16': '19.32', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 6, 'A1': '高产牛', 'A2': '96', 'A3': '4409', 'A4': '1976', 'A5': '1976', 'A6': '1', 'A7': '2.3', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.47', 'A12': '21.59', 'A13': '9.41', 'A14': '44.79', 'A15': '57.41', 'A16': '25.73', 'A17': '27', 'A18': '85%', 'A19': '1.2' },
          { 'id': 7, 'A1': '小育成', 'A2': '155', 'A3': '3308', 'A4': '3316', 'A5': '3316', 'A6': '1.63', 'A7': '2.4', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.44', 'A12': '9.39', 'A13': '9.98', 'A14': '100.21', 'A15': '22.2', 'A16': '22.25', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 8, 'A1': '大公牛', 'A2': '113', 'A3': '2684', 'A4': '2684', 'A5': '2684', 'A6': '2.2', 'A7': '3.5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.42', 'A12': '9.98', 'A13': '9.98', 'A14': '100.00', 'A15': '15.2', 'A16': '15.2', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 9, 'A1': '青年牛', 'A2': '154', 'A3': '3342', 'A4': '3326', 'A5': '3326', 'A6': '2.5', 'A7': '4.23', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '9.98', 'A13': '13.46', 'A14': '99.50', 'A15': '18.88', 'A16': '18.79', 'A17': '', 'A18': '', 'A19': '' },
          { 'id': 10, 'A1': '青年牛', 'A2': '150', 'A3': '3418', 'A4': '3417', 'A5': '3417', 'A6': '3.1', 'A7': '5', 'A8': '0', 'A9': '0', 'A10': '0', 'A11': '0.46', 'A12': '10.48', 'A13': '13.46', 'A14': '100.00', 'A15': '19.82', 'A16': '19.82', 'A17': '', 'A18': '', 'A19': '' }
        ]
      }
    },

    // 汇总统计/混料
    getTabList() {
      this.tab.table.listLoading = true
      GetDataByName(this.tab.table.getdataListParm).then(response => {
        console.log('汇总统计/混料table数据', response.data.list)
        if (response.data.list !== null) {
          // this.tab.table.list = response.data.list
          // this.tab.table.total = response.data.total
        } else {
          this.tab.table.list = []
        }
        setTimeout(() => {
          this.tab.table.listLoading = false
        }, 100)
      })
    },
    // 汇总统计/撒料
    getTabList2() {
      this.tab.table2.listLoading = true
      GetDataByName(this.tab.table2.getdataListParm).then(response => {
        console.log('汇总统计/撒料table数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.table2.list = response.data.list
          this.tab.table2.total = response.data.total
        } else {
          this.tab.table2.list = []
        }
        setTimeout(() => {
          this.tab.table2.listLoading = false
        }, 100)
      })
    },
    // 开始日期/结束日期
    changeDate() {
      if (this.tab.table.getdataListParm.parammaps.inputDatetime !== '' && this.tab.table.getdataListParm.parammaps.inputDatetime !== null) {
        this.tab.table.getdataListParm.parammaps.startTime = parseTime(this.tab.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
        this.tab.table.getdataListParm.parammaps.stopTime = parseTime(this.tab.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
      } else {
        this.tab.table.getdataListParm.parammaps.inputDatetime = ''
        this.tab.table.getdataListParm.parammaps.startTime = ''
        this.tab.table.getdataListParm.parammaps.stopTime = ''
      }
      this.tab.table.getdataListParm.offset = 1
      this.getTabList()
    },
    // 查询
    handleSearch() {
      if (this.tab.radio == '1') {
        console.log('配方名称/查询')
        this.tab.isFormulaName = true
        this.tab.isHouseName = false
        this.tab.isLivestockType = false
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
      } else if (this.tab.radio == '2') {
        console.log('栏舍名称/查询')
        this.tab.isFormulaName = false
        this.tab.isHouseName = true
        this.tab.isLivestockType = false
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
      } else if (this.tab.radio == '3') {
        console.log(' 牲畜类别/查询')
        this.tab.isFormulaName = false
        this.tab.isHouseName = false
        this.tab.isLivestockType = true
        this.tab.table.getdataListParm.name = 'getBarmilkList'
        this.getTabList()
        this.tab.table2.getdataListParm.name = 'getBarmilkList'
        this.getTabList2()
      }
    },

    // 泌乳牛采食量
    getChart1() {
      this.tab.chart1.listLoading = true
      GetDataByName(this.tab.chart1.getdataListParm).then(response => {
        console.log('泌乳牛采食量图表数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart1.chartLine_data = {
            data1: ['09/16', '09/17', '09/18', '09/19', '09/20', '09/21', '09/22', '09/23', '09/24', '09/25', '09/26', '09/27', '09/28', '09/29', '09/30'],
            data2: [25, 27.2, 26.5, 29, 26.4, 23.6, 27.7, 28, 31, 33.5, 30, 35, 29.8, 26, 29.5],
            data3: [22.5, 25, 26.5, 24.3, 27.1, 25.5, 29, 22.4, 29, 19.8, 23.5, 22.8, 27.6, 21.2, 26]
          }
          this.tab.chart1.total = response.data.total
          this.roadChartLine1(this.tab.chart1.chartLine_data)
        } else {
          this.tab.chart1.list = []
        }
        setTimeout(() => {
          this.tab.chart1.listLoading = false
        }, 100)
      })
    },
    getChart1Table() {
      this.tab.chart1.table.listLoading = true
      GetDataByName(this.tab.chart1.table.getdataListParm).then(response => {
        console.log('泌乳牛采食量table/导出数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart1.table.list = response.data.list
          this.tab.chart1.table.total = response.data.total
        } else {
          this.tab.chart1.table.list = []
        }
        setTimeout(() => {
          this.tab.chart1.table.listLoading = false
        }, 100)
      })
    },
    roadChartLine1(chartLine_data) {
      if (this.tab.chart1.chartLine != null) {
        this.tab.chart1.chartLine.dispose()
      }
      this.tab.chart1.chartLine = echarts.init(document.getElementById('chartLine1'))
      var option = {
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['泌乳牛采食量', '泌乳牛产奶量']
        },
        xAxis: [
          {
            type: 'category',
            data: chartLine_data.data1
          }
        ],
        yAxis: [
          {
            type: 'value',
            name: '泌乳牛采食量',
            axisLabel: {
              formatter: '{value} '
            }
          }, {
            type: 'value',
            name: '泌乳牛产奶量',
            axisLabel: {
              formatter: '{value} '
            }
          }
        ],
        series: [{
          name: '泌乳牛采食量',
          type: 'bar',
          itemStyle: { /* 设置柱状颜色*/
            normal: {
              color: '#61a5e8'
            }
          },
          data: chartLine_data.data2
        }, {
          name: '泌乳牛产奶量',
          type: 'line',
          itemStyle: { /* 设置折线颜色*/
            normal: {
              color: '#ff2d2d'
            }
          },
          data: chartLine_data.data3
        }]
      }
      this.tab.chart1.chartLine.setOption(option)
      window.onresize = function() {
        this.tab.chart1.chartLine.resize()
      }
    },

    // 牛栏剩料率
    getChart2() {
      this.tab.chart2.listLoading = true
      GetDataByName(this.tab.chart2.getdataListParm).then(response => {
        console.log('牛栏剩料率图表数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart2.chartLine_data = {
            data1: ['17号', '5号南', '3南东', '3南西', '1号南'],
            data2: ['09/16', '09/17', '09/18', '09/19', '09/20', '09/21', '09/22', '09/23', '09/24', '09/25', '09/26', '09/27', '09/28', '09/29', '09/30'],
            data3: [
              { data: [3.5, 2.7, 6.6, 1.8, 2.2, 4.1, 5.3, 2.7, 0.8, 0.65, 2.1, 2.55, 2.7, 3.45, 2.1] },
              { data: [2.8, 2.54, 1.5, 2.3, 2.1, 1.5, 1.9, 3.3, 4.1, 2.3, 2.6, 2.1, 2.73, 1.2, 0.65] },
              { data: [1.2, 1.3, 1.1, 3.4, 0.9, 2.3, 2.1, 1.8, 3.6, 4.16, 2.87, 3.2, 4.1, 2.7, 2.1] },
              { data: [2.1, 3.54, 1.9, 2.7, 2.1, 2.5, 2.9, 2.3, 2.1, 4.3, 1.5, 1.1, 2.53, 3.2, 1.65] },
              { data: [2.8, 5.4, 2.5, 3.3, 3.1, 1.7, 1.2, 3.6, 1.1, 1.3, 2.7, 2.3, 1.3, 1.8, 3.1] }
            ]

          }
          this.tab.chart2.total = response.data.total
          this.roadChartLine2(this.tab.chart2.chartLine_data)
        } else {
          this.tab.chart2.list = []
        }
        setTimeout(() => {
          this.tab.chart2.listLoading = false
        }, 100)
      })
    },
    getChart2Table() {
      this.tab.chart2.table.listLoading = true
      GetDataByName(this.tab.chart2.table.getdataListParm).then(response => {
        console.log('牛栏剩料率table/导出数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart2.table.list = response.data.list
          this.tab.chart2.table.total = response.data.total
        } else {
          this.tab.chart2.table.list = []
        }
        setTimeout(() => {
          this.tab.chart2.table.listLoading = false
        }, 100)
      })
    },
    roadChartLine2(chartLine_data) {
      if (this.tab.chart2.chartLine != null) {
        this.tab.chart2.chartLine.dispose()
      }
      this.tab.chart2.chartLine = echarts.init(document.getElementById('chartLine2'))
      var option = {
        title: {
          text: ''
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: chartLine_data.data1,
          top: 10,
          right: 10
        },
        grid: {
          left: '3%',
          right: '8%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          show: true,
          right: '2%',
          feature: {}
        },
        xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '时间' },
        yAxis: {
          type: 'value', name: '剩料率'
        },
        series: (function() {
          var serie = []
          for (var i = 0; i < chartLine_data.data3.length; i++) {
            var item = {
              name: chartLine_data.data1[i],
              type: 'line',
              data: chartLine_data.data3[i].data
            }
            serie.push(item)
          }
          return serie
        }())
      }
      this.tab.chart2.chartLine.setOption(option)
      window.onresize = function() {
        this.tab.chart2.chartLine.resize()
      }
    },

    // 搅拌时间统计
    getChart3() {
      this.tab.chart3.listLoading = true
      GetDataByName(this.tab.chart3.getdataListParm).then(response => {
        console.log('搅拌时间统计图表数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart3.chartLine_data = {
            data1: ['平均搅拌时间', '混料+搅拌时间'],
            data2: ['09/16', '09/17', '09/18', '09/19', '09/20', '09/21', '09/22', '09/23', '09/24', '09/25', '09/26', '09/27', '09/28', '09/29', '09/30'],
            data3: [12, 13, 10.5, 10.4, 12.9, 13.3, 11.1, 11.5, 10.8, 12.5, 11.8, 12.9, 12.3, 12.1, 11.9],
            data4: [33.5, 33.2, 34.1, 35.4, 35.9, 36.4, 34.1, 34.2, 33.9, 35.5, 34.7, 35.9, 35.2, 34.8, 34.1]
          }
          this.tab.chart3.total = response.data.total
          this.roadChartLine3(this.tab.chart3.chartLine_data)
        } else {
          this.tab.chart3.list = []
        }
        setTimeout(() => {
          this.tab.chart3.listLoading = false
        }, 100)
      })
    },
    getChart3Table() {
      this.tab.chart3.table.listLoading = true
      GetDataByName(this.tab.chart3.table.getdataListParm).then(response => {
        console.log('搅拌时间统计table/导出数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart3.table.list = response.data.list
          this.tab.chart3.table.total = response.data.total
        } else {
          this.tab.chart3.table.list = []
        }
        setTimeout(() => {
          this.tab.chart3.table.listLoading = false
        }, 100)
      })
    },
    roadChartLine3(chartLine_data) {
      if (this.tab.chart3.chartLine != null) {
        this.tab.chart3.chartLine.dispose()
      }
      this.tab.chart3.chartLine = echarts.init(document.getElementById('chartLine3'))
      var option = {
        title: {
          text: ''
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: chartLine_data.data1,
          top: 10,
          right: 10
        },
        grid: {
          left: '3%',
          right: '8%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          show: true,
          right: '2%',
          feature: {}
        },
        xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '时间' },
        yAxis: {
          type: 'value', name: '分钟',
          axisLabel: {
            formatter: '{value}min'
          }
        },
        series: [
          {
            name: chartLine_data.data1[0],
            type: 'line',
            stack: '总量',
            data: chartLine_data.data3
          },
          {
            name: chartLine_data.data1[1],
            type: 'line',
            stack: '总量',
            data: chartLine_data.data4
          },
          {
            name: chartLine_data.data1[2],
            type: 'line',
            stack: '总量',
            data: chartLine_data.data5
          }
        ]
      }
      this.tab.chart3.chartLine.setOption(option)
      window.onresize = function() {
        this.tab.chart3.chartLine.resize()
      }
    },

    // 转化率
    getChart4() {
      this.tab.chart4.listLoading = true
      GetDataByName(this.tab.chart4.getdataListParm).then(response => {
        console.log('转化率图表数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart4.chartLine_data = {
            data1: ['新产牛', '高产牛', '干奶牛', '低产牛', '小公牛', '小育成', '青年牛'],
            data2: ['09/16', '09/17', '09/18', '09/19', '09/20', '09/21', '09/22', '09/23', '09/24', '09/25', '09/26', '09/27', '09/28', '09/29', '09/30'],
            data3: [
              { data: [76.5, 80.6, 75, 81, 85.5, 86.6, 87, 91.5, 87, 74, 76, 69.5, 84, 68.8, 91] },
              { data: [78, 84, 85, 81, 80, 82.6, 85.8, 90.5, 84, 79.5, 77.6, 79.5, 81, 78.8, 92] },
              { data: [86.5, 86, 77, 87, 70.5, 76, 92, 81.5, 86, 77.8, 72, 79.5, 88, 71, 93] },
              { data: [74.5, 80, 75, 71, 81, 84, 89.7, 95, 80.7, 79, 72, 65, 88, 67.1, 89] },
              { data: [79, 78, 71, 86, 80, 88, 82.8, 93, 83, 78.7, 74.6, 79.5, 94, 88.8, 81] },
              { data: [85, 88.6, 85, 81, 71.5, 89.6, 80.7, 94, 85.7, 70, 77.4, 79.1, 81, 65, 90.5] },
              { data: [78, 85, 69, 87, 92, 82, 87, 95.5, 80.7, 71.4, 70.6, 79.5, 81.4, 78.8, 88] }
            ]
          }

          this.tab.chart4.total = response.data.total
          this.roadChartLine4(this.tab.chart4.chartLine_data)
        } else {
          this.tab.chart4.list = []
        }
        setTimeout(() => {
          this.tab.chart4.listLoading = false
        }, 100)
      })
    },
    getChart4Table() {
      this.tab.chart4.table.listLoading = true
      GetDataByName(this.tab.chart4.table.getdataListParm).then(response => {
        console.log('转化率table/导出数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart4.table.list = response.data.list
          this.tab.chart4.table.total = response.data.total
        } else {
          this.tab.chart4.table.list = []
        }
        setTimeout(() => {
          this.tab.chart4.table.listLoading = false
        }, 100)
      })
    },
    roadChartLine4(chartLine_data) {
      if (this.tab.chart4.chartLine != null) {
        this.tab.chart4.chartLine.dispose()
      }
      this.tab.chart4.chartLine = echarts.init(document.getElementById('chartLine4'))
      var option = {
        title: {
          text: ''
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: chartLine_data.data1,
          top: 10,
          right: 10
        },
        grid: {
          left: '3%',
          right: '8%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          show: true,
          right: '2%',
          feature: {}
        },
        xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '时间' },
        yAxis: {
          type: 'value', name: '百分比'
        },
        series: (function() {
          var serie = []
          for (var i = 0; i < chartLine_data.data3.length; i++) {
            var item = {
              name: chartLine_data.data1[i],
              type: 'line',
              data: chartLine_data.data3[i].data
            }
            serie.push(item)
          }
          return serie
        }())
      }
      this.tab.chart4.chartLine.setOption(option)
      window.onresize = function() {
        this.tab.chart4.chartLine.resize()
      }
    },

    // 成本分析
    getChart5() {
      this.tab.chart5.listLoading = true
      GetDataByName(this.tab.chart5.getdataListParm).then(response => {
        console.log('转化率图表数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart5.chartLine_data = {
            data1: ['新产牛', '高产牛', '低产牛'],
            data2: ['09/16', '09/17', '09/18', '09/19', '09/20', '09/21', '09/22', '09/23', '09/24', '09/25', '09/26', '09/27', '09/28', '09/29', '09/30'],
            data3: [
              { data: [1.5, 1.2, 1.7, 1.2, 1.6, 1.7, 1.6, 1.5, 1.2, 1.7, 1.2, 1.6, 1.7, 1.5, 2.1] },
              { data: [1.7, 0.8, 1.2, 1.8, 1.7, 1.2, 1.8, 1.1, 1.5, 1.9, 1.8, 1.3, 1.4, 1.5, 1.4] },
              { data: [1.3, 2.2, 1.9, 1.4, 2.1, 1, 1.3, 1.7, 1, 2, 1, 2.2, 1.1, 1.5, 1.2, 1.9] }
            ]
          }
          this.tab.chart5.total = response.data.total
          this.roadChartLine5(this.tab.chart5.chartLine_data)
        } else {
          this.tab.chart5.list = []
        }
        setTimeout(() => {
          this.tab.chart5.listLoading = false
        }, 100)
      })
    },
    getChart5Table() {
      this.tab.chart5.table.listLoading = true
      GetDataByName(this.tab.chart5.table.getdataListParm).then(response => {
        console.log('转化率table/导出数据', response.data.list)
        if (response.data.list !== null) {
          this.tab.chart5.table.list = response.data.list
          this.tab.chart5.table.total = response.data.total
        } else {
          this.tab.chart5.table.list = []
        }
        setTimeout(() => {
          this.tab.chart5.table.listLoading = false
        }, 100)
      })
    },
    roadChartLine5(chartLine_data) {
      if (this.tab.chart5.chartLine != null) {
        this.tab.chart5.chartLine.dispose()
      }
      this.tab.chart5.chartLine = echarts.init(document.getElementById('chartLine5'))
      var option = {
        title: {
          text: ''
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: chartLine_data.data1,
          top: 10,
          right: 10
        },
        grid: {
          left: '3%',
          right: '8%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          show: true,
          right: '2%',
          feature: {}
        },
        xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '时间' },
        yAxis: {
          type: 'value', name: '百分比'
        },
        series: (function() {
          var serie = []
          for (var i = 0; i < chartLine_data.data3.length; i++) {
            var item = {
              name: chartLine_data.data1[i],
              type: 'line',
              data: chartLine_data.data3[i].data
            }
            serie.push(item)
          }
          return serie
        }())
      }
      this.tab.chart5.chartLine.setOption(option)
      window.onresize = function() {
        this.tab.chart5.chartLine.resize()
      }
    },

    // 导出
    handleExport(item) {
      if (item == 'chart1') {
        console.log('泌乳牛采食量导出')
        this.getChart1Table()
      } else if (item == 'chart2') {
        console.log('牛栏剩料率导出')
        this.getChart2Table()
      } else if (item == 'chart3') {
        console.log('搅拌时间统计导出')
        this.getChart3Table()
      } else if (item == 'chart4') {
        console.log('转化率导出')
        this.getChart4Table()
      } else if (item == 'chart5') {
        console.log('成本分析导出')
        this.getChart5Table()
      }
    },
    // 切换表格
    handleTable(item) {
      // 显示切换表格
      if (item == 'chart1') {
        console.log('泌乳牛采食量表格')
        this.tab.chart1.isTable = true
        this.tab.chart1.isChart = false
        this.getChart1Table()
      } else if (item == 'chart2') {
        console.log('牛栏剩料率表格')
        this.tab.chart2.isTable = true
        this.tab.chart2.isChart = false
        this.getChart2Table()
      } else if (item == 'chart3') {
        console.log('搅拌时间统计表格')
        this.tab.chart3.isTable = true
        this.tab.chart3.isChart = false
        this.getChart3Table()
      } else if (item == 'chart4') {
        console.log('转化率表格')
        this.tab.chart4.isTable = true
        this.tab.chart4.isChart = false
        this.getChart4Table()
      } else if (item == 'chart5') {
        console.log('成本分析表格')
        this.tab.chart5.isTable = true
        this.tab.chart5.isChart = false
        this.getChart5Table()
      }
    },
    // 切换图表
    handleChart(item) {
      // 显示切换图表
      if (item == 'chart1') {
        console.log('泌乳牛采食量图表')
        this.tab.chart1.isTable = false
        this.tab.chart1.isChart = true
      } else if (item == 'chart2') {
        console.log('牛栏剩料率图表')
        this.tab.chart2.isTable = false
        this.tab.chart2.isChart = true
      } else if (item == 'chart3') {
        console.log('搅拌时间统计图表')
        this.tab.chart3.isTable = false
        this.tab.chart3.isChart = true
      } else if (item == 'chart4') {
        console.log('转化率图表')
        this.tab.chart4.isTable = false
        this.tab.chart4.isChart = true
      } else if (item == 'chart5') {
        console.log('成本分析图表')
        this.tab.chart5.isTable = false
        this.tab.chart5.isChart = true
      }
    },

    // 宾州筛分析
    getTab2List() {
      this.tab2.table.listLoading = true
      GetDataByName(this.tab2.table.getdataListParm).then(response => {
        console.log('宾州筛分析table数据', response.data.list)
        if (response.data.list !== null) {
          // this.tab2.table.list = response.data.list
          // this.tab2.table.total = response.data.total
        } else {
          this.tab2.table.list = []
        }
        setTimeout(() => {
          this.tab2.table.listLoading = false
        }, 100)
      })
    },

    // 粪便筛分析
    getTab2List2() {
      this.tab2.table2.listLoading = true
      GetDataByName(this.tab2.table2.getdataListParm).then(response => {
        console.log('粪便筛分析table数据', response.data.list)
        if (response.data.list !== null) {
          // this.tab2.table2.list = response.data.list
          // this.tab2.table2.total = response.data.total
        } else {
          this.tab2.table2.list = []
        }
        setTimeout(() => {
          this.tab2.table2.listLoading = false
        }, 100)
      })
    },

    // BCS评分
    getTab2List3() {
      this.tab2.table3.listLoading = true
      GetDataByName(this.tab2.table3.getdataListParm).then(response => {
        console.log('BCS评分table数据', response.data.list)
        if (response.data.list !== null) {
          // this.tab2.table3.list = response.data.list
          // this.tab2.table3.total = response.data.total
        } else {
          this.tab2.table3.list = []
        }
        setTimeout(() => {
          this.tab2.table3.listLoading = false
        }, 100)
      })
    },

    // 粪便评分
    getTab2List4() {
      this.tab2.table4.listLoading = true
      GetDataByName(this.tab2.table4.getdataListParm).then(response => {
        console.log('成本分析table数据', response.data.list)
        if (response.data.list !== null) {
          // this.tab2.table4.list = response.data.list
          // this.tab2.table4.total = response.data.total
        } else {
          this.tab2.table4.list = []
        }
        setTimeout(() => {
          this.tab2.table4.listLoading = false
        }, 100)
      })
    }

  }
}
</script>
<style lang="scss" scoped>
  .search{margin-bottom:10px;}
</style>