<template>
  <div class="app-container1">
    <div class="search">
      <el-date-picker
        ref="inputDatetime"
        v-model="table.getdataListParm.parammaps.inputDatetime"
        :clearable="false"
        class="inputDatetime filter-item"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        style="width: 250px;"
        :picker-options="pickerOptions"
        @change="changeDate"
      />
      <el-button class="el-icon-arrow-left elIconArrowLeft" :disabled="Beforedisabled" @click="handleBefore" />
      <el-button class="el-icon-arrow-right elIconArrowRight" :disabled="Nextdisabled" @click="handleNext" />
      <el-button class="export" @click="handleDownload">导出</el-button>
      <svg-icon icon-class="Up" class="down" style="width: 40px;height: 40px;float: right;" @click="handleQuickJumpChart" />
    </div>
    <div id="table" class="table">
      <h4>混料</h4>
      <el-table
        :key="table.tableKey"
        v-loading="table.listLoading"
        element-loading-text="给我一点时间"
        :data="table.list"
        border
        fit
        highlight-current-row
        style="width: 100%;"
        :row-style="rowStyle"
        :cell-style="tableCellStyle"
        class="elTable table-fixed"
      >
        <el-table-column sortable label="牧场" min-width="90px" align="center">
          <template slot-scope="{row}">
            <a @click="clickPasture(row)">{{ row.pasturename }}</a>
          </template>
        </el-table-column>
        <el-table-column sortable label="理论重量" min-width="90px" align="center" prop="理论重量" />
        <el-table-column sortable label="实际重量" min-width="90px" align="center" prop="实际重量" />
        <el-table-column sortable label="计划混料操作数" min-width="100px" align="center" prop="计划混料操作数" />
        <el-table-column sortable label="已混料操作数" min-width="90px" align="center" prop="已混料操作数" />
        <el-table-column sortable label="混料操作率" min-width="90px" align="center" prop="混料操作率" />
        <el-table-column sortable label="混料误差值" min-width="90px" align="center" prop="混料误差值" />
        <el-table-column sortable label="混料准确率" min-width="90px" align="center" prop="混料准确率" />
        <el-table-column sortable label="取消次数" min-width="90px" align="center" prop="取消次数" />
        <el-table-column :key="20" sortable label="混料正确数" min-width="90px" align="center" prop="混料正确数" />
        <el-table-column :key="21" sortable label="混料正确率" min-width="90px" align="center" prop="混料正确率" />
        <el-table-column :key="22" sortable label="去除取消正确率" min-width="90px" align="center" prop="去除取消正确率" />
        <el-table-column sortable label="标准差" min-width="90px" align="center" prop="方差" />
      </el-table>
      <h4>撒料</h4>
      <el-table
        :key="table2.tableKey"
        v-loading="table2.listLoading"
        element-loading-text="给我一点时间"
        :data="table2.list"
        border
        fit
        highlight-current-row
        style="width: 100%;"
        :row-style="rowStyle"
        :cell-style="tableCellStyle"
        class="elTable table-fixed"
      >
        <el-table-column sortable label="牧场" min-width="90px" align="center">
          <template slot-scope="{row}">
            <a @click="clickPasture(row)">{{ row.pasturename }}</a>
          </template>
        </el-table-column>
        <el-table-column sortable label="理论重量" min-width="90px" align="center" prop="理论重量" />
        <el-table-column sortable label="实际重量" min-width="90px" align="center" prop="实际重量" />
        <el-table-column sortable label="计划撒料操作数" min-width="100px" align="center" prop="计划撒料操作数" />
        <el-table-column sortable label="已撒料操作数" min-width="90px" align="center" prop="已撒料操作数" />
        <el-table-column sortable label="撒料操作率" min-width="90px" align="center" prop="撒料操作率" />
        <el-table-column sortable label="撒料误差值" min-width="90px" align="center" prop="撒料误差值" />
        <el-table-column sortable label="撒料准确率" min-width="90px" align="center" prop="撒料准确率" />
        <el-table-column sortable label="撒料自动跳转次数" min-width="90px" align="center" prop="撒料自动跳转次数" />
        <el-table-column sortable label="撒料手动跳转次数" min-width="90px" align="center" prop="撒料手动跳转次数" />
        <el-table-column :key="20" sortable label="撒料正确数" min-width="90px" align="center" prop="撒料正确数" />
        <el-table-column :key="21" sortable label="撒料正确率" min-width="90px" align="center" prop="撒料正确率" />
        <el-table-column :key="22" sortable label="去除取消正确率" min-width="90px" align="center" prop="去除取消正确率" />
        <el-table-column sortable label="标准差" min-width="90px" align="center" prop="方差" />
      </el-table>
    </div>
    <div class="AnalysisChart">
      <el-row :gutter="10">
        <el-col :span="24" style="margin-bottom: 10px;margin-top: 10px;">
          <span>图表查询时间:</span>
          <el-radio-group v-model="specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeAllSpecificDate">
            <el-radio-button label="1" border>日</el-radio-button>
            <el-radio-button label="2" border>周</el-radio-button>
            <el-radio-button label="3" border>月</el-radio-button>
          </el-radio-group>
          <div v-show="specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
            <el-date-picker v-model="chartDate" :clearable="false" class="inputDatetime filter-item" style="width:250px;" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
          </div>
          <div v-show="specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
            <el-select v-model="selectYear" class="filter-item" style="width:130px;margin-right:10px;" placeholder="请选择年份" @change="changeAllYear">
              <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
            </el-select>
            <el-select v-model="selectWeek" class="filter-item" style="width:170px;" multiple :multiple-limit="2" placeholder="请选择周">
              <el-option v-for="(item,index) in weekList" :key="index" :label="item.name" :value="item.id" />
            </el-select>
          </div>
          <div v-show="specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
            <el-date-picker v-model="chartMonth" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" style="width:250px;" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
          </div>
          <el-button class="successBorder" style="margin-left:10px;" @click="handleAllDate">确认</el-button>
          <svg-icon icon-class="Up" style="width: 40px;height: 40px;float: right;" @click="handleQuickJumpTop" />
        </el-col>
      </el-row>
      <el-row :gutter="10" class="dashboard-editor-container">
        <!-- 计划统计 -->
        <el-col :span="12">
          <div class="grid-content">
            <h4>计划统计</h4>
            <div v-if="chart1.isChart" class="button">
              <div class="chartButton">
                <el-radio-group v-model="chart1.getdataListParm.parammaps.specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeChartSpecificDate('chart1')">
                  <el-radio-button label="1" border>日</el-radio-button>
                  <el-radio-button label="2" border>周</el-radio-button>
                  <el-radio-button label="3" border>月</el-radio-button>
                </el-radio-group>
                <div v-show="chart1.getdataListParm.parammaps.specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart1.getdataListParm.parammaps.inputDatetime" style="width:220px;" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
                </div>
                <div v-show="chart1.getdataListParm.parammaps.specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
                  <el-select v-model="chart1.getdataListParm.parammaps.selectYear" class="filter-item" style="width:80px;margin-right:10px;" placeholder="年份" @change="changeChartYear('chart1')">
                    <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
                  </el-select>
                  <el-select v-model="chart1.getdataListParm.parammaps.selectWeek" class="filter-item" style="width:160px;" multiple :multiple-limit="2" placeholder="请选择周">
                    <el-option v-for="(item,index) in chart1.getdataListParm.parammaps.weekList" :key="index" :label="item.name" :value="item.id" />
                  </el-select>
                </div>
                <div v-show="chart1.getdataListParm.parammaps.specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart1.getdataListParm.parammaps.chartMonth" style="width:220px;" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
                </div>
                <el-button class="successBorder" style="margin-left:10px;" @click="handleChartDate('chart1')">确认</el-button>
              </div>
              <div>
                <div class="exportTable2" @click="handleExport('chart1')">导出</div>
                <div class="exportTable2" @click="handleTable('chart1')">切换表格</div>
              </div>
            </div>
            <div v-if="chart1.isChart" id="chartLine1" v-loading="chart1.listLoading" style="width:100%;height:400px;background: #fff;" />
            <div v-if="chart1.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart1')">导出</div>
                <div class="exportTable" @click="handleChart('chart1')">切换图表</div>
              </div>
              <el-table
                :key="chart1.table.tableKey"
                v-loading="chart1.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart1.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="牧场" sortable min-width="85px" align="center" prop="牧场" />
                <el-table-column label="计划执行重量(kg)" sortable min-width="85px" align="center" prop="实际量" />
                <el-table-column label="配方理论重量(kg)" sortable min-width="85px" align="center" prop="理论量" />
                <el-table-column label="计划准确率" sortable min-width="80px" align="center" prop="field1" />
                <el-table-column label="计划取消重量(kg)" sortable min-width="85px" align="center" prop="计划取消重量" />
                <el-table-column label="计划准确率(去除取消重量)" sortable min-width="110px" align="center" prop="field3" />
                <el-table-column label="计划正确数" sortable min-width="80px" align="center" prop="正确数" />
                <el-table-column label="计划数" sortable min-width="70px" align="center" prop="计划数" />
                <el-table-column label="计划正确率" sortable min-width="80px" align="center" prop="field2" />
              </el-table>
            </div>
          </div>
        </el-col>
        <!-- 牛群准确率 -->
        <el-col :span="12">
          <div class="grid-content">
            <h4>牛群准确率</h4>
            <div v-if="chart2.isChart" class="button">
              <div class="chartButton">
                <el-radio-group v-model="chart2.getdataListParm.parammaps.specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeChartSpecificDate('chart2')">
                  <el-radio-button label="1" border>日</el-radio-button>
                  <el-radio-button label="2" border>周</el-radio-button>
                  <el-radio-button label="3" border>月</el-radio-button>
                </el-radio-group>
                <div v-show="chart2.getdataListParm.parammaps.specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart2.getdataListParm.parammaps.inputDatetime" style="width:220px;" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
                </div>
                <div v-show="chart2.getdataListParm.parammaps.specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
                  <el-select v-model="chart2.getdataListParm.parammaps.selectYear" class="filter-item" style="width:80px;margin-right:10px;" placeholder="年份" @change="changeChartYear('chart2')">
                    <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
                  </el-select>
                  <el-select v-model="chart2.getdataListParm.parammaps.selectWeek" class="filter-item" style="width:160px;" multiple :multiple-limit="2" placeholder="请选择周">
                    <el-option v-for="(item,index) in chart2.getdataListParm.parammaps.weekList" :key="index" :label="item.name" :value="item.id" />
                  </el-select>
                </div>
                <div v-show="chart2.getdataListParm.parammaps.specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart2.getdataListParm.parammaps.chartMonth" style="width:220px;" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
                </div>
                <el-button class="successBorder" style="margin-left:10px;" @click="handleChartDate('chart2')">确认</el-button>
              </div>
              <div>
                <div class="exportTable2" @click="handleExport('chart2')">导出</div>
                <div class="exportTable2" @click="handleTable('chart2')">切换表格</div>
              </div>
            </div>
            <div v-if="chart2.isChart" id="chartLine2" style="width:100%;height:400px;" />
            <div v-if="chart2.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart2')">导出</div>
                <div class="exportTable" @click="handleChart('chart2')">切换图表</div>
              </div>
              <el-table
                :key="chart2.table.tableKey"
                v-loading="chart2.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart2.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="牧场" sortable min-width="90px" align="center" prop="牧场" />
                <el-table-column label="牲畜类别" sortable min-width="90px" align="center" prop="field5" />
                <el-table-column label="计划重量（kg）" sortable min-width="100px" align="center" prop="理论量" />
                <el-table-column label="实际重量（kg）" sortable min-width="100px" align="center" prop="实际量" />
                <el-table-column label="准确率" sortable min-width="90px" align="center" prop="field1" />
              </el-table>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="10" class="dashboard-editor-container">
        <!-- 混料次数统计 -->
        <el-col :span="12">
          <div class="grid-content">
            <h4>混料次数统计</h4>
            <div v-if="chart3.isChart" class="button">
              <div class="chartButton">
                <el-radio-group v-model="chart3.getdataListParm.parammaps.specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeChartSpecificDate('chart3')">
                  <el-radio-button label="1" border>日</el-radio-button>
                  <el-radio-button label="2" border>周</el-radio-button>
                  <el-radio-button label="3" border>月</el-radio-button>
                </el-radio-group>
                <div v-show="chart3.getdataListParm.parammaps.specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart3.getdataListParm.parammaps.inputDatetime" style="width:220px;" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
                </div>
                <div v-show="chart3.getdataListParm.parammaps.specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
                  <el-select v-model="chart3.getdataListParm.parammaps.selectYear" class="filter-item" style="width:80px;margin-right:10px;" placeholder="年份" @change="changeChartYear('chart3')">
                    <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
                  </el-select>
                  <el-select v-model="chart3.getdataListParm.parammaps.selectWeek" class="filter-item" style="width:160px;" multiple :multiple-limit="2" placeholder="请选择周">
                    <el-option v-for="(item,index) in chart3.getdataListParm.parammaps.weekList" :key="index" :label="item.name" :value="item.id" />
                  </el-select>
                </div>
                <div v-show="chart3.getdataListParm.parammaps.specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart3.getdataListParm.parammaps.chartMonth" style="width:220px;" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
                </div>
                <el-button class="successBorder" style="margin-left:10px;" @click="handleChartDate('chart3')">确认</el-button>
              </div>
              <div>
                <div class="exportTable2" @click="handleExport('chart3')">导出</div>
                <div class="exportTable2" @click="handleTable('chart3')">切换表格</div>
              </div>
            </div>
            <div v-if="chart3.isChart" id="chartLine3" style="width:100%;height:400px;" />
            <div v-if="chart3.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart3')">导出</div>
                <div class="exportTable" @click="handleChart('chart3')">切换图表</div>
              </div>
              <el-table
                :key="chart3.table.tableKey"
                v-loading="chart3.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart3.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="牧场" sortable min-width="90px" align="center" prop="牧场" />
                <el-table-column label="自动跳转次数" sortable min-width="90px" align="center" prop="field1" />
                <el-table-column label="手动跳转次数" sortable min-width="100px" align="center" prop="field2" />
                <el-table-column label="混料取消次数" sortable min-width="100px" align="center" prop="field5" />
              </el-table>
            </div>
          </div>
        </el-col>
        <!-- 混料准确率统计 -->
        <el-col :span="12">
          <div class="grid-content">
            <h4>混料准确率统计</h4>
            <div v-if="chart4.isChart" class="button">
              <div class="chartButton">
                <el-radio-group v-model="chart4.getdataListParm.parammaps.specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeChartSpecificDate('chart4')">
                  <el-radio-button label="1" border>日</el-radio-button>
                  <el-radio-button label="2" border>周</el-radio-button>
                  <el-radio-button label="3" border>月</el-radio-button>
                </el-radio-group>
                <div v-show="chart4.getdataListParm.parammaps.specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart4.getdataListParm.parammaps.inputDatetime" style="width:220px;" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
                </div>
                <div v-show="chart4.getdataListParm.parammaps.specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
                  <el-select v-model="chart4.getdataListParm.parammaps.selectYear" class="filter-item" style="width:80px;margin-right:10px;" placeholder="年份" @change="changeChartYear('chart4')">
                    <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
                  </el-select>
                  <el-select v-model="chart4.getdataListParm.parammaps.selectWeek" class="filter-item" style="width:160px;" multiple :multiple-limit="2" placeholder="请选择周">
                    <el-option v-for="(item,index) in chart4.getdataListParm.parammaps.weekList" :key="index" :label="item.name" :value="item.id" />
                  </el-select>
                </div>
                <div v-show="chart4.getdataListParm.parammaps.specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart4.getdataListParm.parammaps.chartMonth" style="width:220px;" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
                </div>
                <el-button class="successBorder" style="margin-left:10px;" @click="handleChartDate('chart4')">确认</el-button>
              </div>
              <div>
                <div class="exportTable2" @click="handleExport('chart4')">导出</div>
                <div class="exportTable2" @click="handleTable('chart4')">切换表格</div>
              </div>
            </div>
            <div v-if="chart4.isChart" id="chartLine4" style="width:100%;height:400px;" />
            <div v-if="chart4.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart4')">导出</div>
                <div class="exportTable" @click="handleChart('chart4')">切换图表</div>
              </div>
              <el-table
                :key="chart4.table.tableKey"
                v-loading="chart4.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart4.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column sortable label="牧场" sortable min-width="90px" align="center" prop="牧场" />
                <el-table-column label="自动跳转次数" sortable min-width="80px" align="center" prop="field3" />
                <el-table-column label="手动跳转次数" sortable min-width="80px" align="center" prop="field4" />
                <el-table-column label="自动跳转理论重量" sortable min-width="85px" align="center" prop="理论自动" />
                <el-table-column label="自动跳转实际重量" sortable min-width="85px" align="center" prop="实际自动" />
                <el-table-column label="自动跳转准确率" sortable min-width="85px" align="center" prop="field1" />
                <el-table-column label="手动跳转理论重量" sortable min-width="85px" align="center" prop="理论手动" />
                <el-table-column label="手动跳转实际重量" sortable min-width="85px" align="center" prop="实际手动" />
                <el-table-column label="手动跳转准确率" sortable min-width="85px" align="center" prop="field2" />
              </el-table>
            </div>
          </div>
        </el-col>
      </el-row>

      <el-row :gutter="10" class="dashboard-editor-container">
        <!-- 栏舍平均撒料时间统计 -->
        <el-col :span="12">
          <div class="grid-content">
            <h4>栏舍平均撒料时间统计</h4>
            <div v-if="chart5.isChart" class="button">
              <div class="chartButton">
                <el-radio-group v-model="chart5.getdataListParm.parammaps.specificDate" class="specificDate" size="mini" style="display: inline-block;" @change="changeChartSpecificDate('chart5')">
                  <el-radio-button label="1" border>日</el-radio-button>
                  <el-radio-button label="2" border>周</el-radio-button>
                  <el-radio-button label="3" border>月</el-radio-button>
                </el-radio-group>
                <div v-show="chart5.getdataListParm.parammaps.specificDate == '1'" class="day" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart5.getdataListParm.parammaps.inputDatetime" style="width:220px;" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptionsDate" />
                </div>
                <div v-show="chart5.getdataListParm.parammaps.specificDate == '2'" class="week" style="display: inline-block; clear: both;margin-left:10px;">
                  <el-select v-model="chart5.getdataListParm.parammaps.selectYear" class="filter-item" style="width:80px;margin-right:10px;" placeholder="年份" @change="changeChartYear('chart5')">
                    <el-option v-for="item in yearList" :key="item" :label="item" :value="item" />
                  </el-select>
                  <el-select v-model="chart5.getdataListParm.parammaps.selectWeek" class="filter-item" style="width:160px;" multiple :multiple-limit="2" placeholder="请选择周">
                    <el-option v-for="(item,index) in chart5.getdataListParm.parammaps.weekList" :key="index" :label="item.name" :value="item.id" />
                  </el-select>
                </div>
                <div v-show="chart5.getdataListParm.parammaps.specificDate == '3'" class="month" style="display: inline-block;margin-left:10px;">
                  <el-date-picker v-model="chart5.getdataListParm.parammaps.chartMonth" style="width:220px;" :clearable="false" value-format="yyyy-MM-dd" type="monthrange" class="inputDatetime filter-item" range-separator="至" :picker-options="pickerOptionsMonth" />
                </div>
                <el-button class="successBorder" style="margin-left:10px;" @click="handleChartDate('chart5')">确认</el-button>
              </div>
              <div>
                <div class="exportTable2" @click="handleExport('chart5')">导出</div>
                <div class="exportTable2" @click="handleTable('chart5')">切换表格</div>
              </div>
            </div>
            <div v-if="chart5.isChart" id="chartLine5" style="width:100%;height:400px;" />
            <div v-if="chart5.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart5')">导出</div>
                <div class="exportTable" @click="handleChart('chart5')">切换图表</div>
              </div>
              <el-table
                :key="chart5.table.tableKey"
                v-loading="chart5.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart5.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="日期" sortable min-width="85px" align="center" prop="日期" />
                <el-table-column label="牧场" sortable min-width="80px" align="center" prop="名称" />
                <el-table-column label="平均撒料时间" sortable min-width="80px" align="center" prop="准确率" />
              </el-table>
            </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content">
            <h4>混料计划取消次数</h4>
            <div v-if="chart6.isChart" class="button">
              <el-date-picker v-model="chart6.getdataListParm.parammaps.inputDatetime" :clearable="false" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" :picker-options="pickerOptions" end-placeholder="结束日期" @change="changeChartDate('chart6')" />
              <div class="exportTable" @click="handleExport('chart6')">导出</div>
              <div class="exportTable" @click="handleTable('chart6')">切换表格</div>
            </div>
            <div v-if="chart6.isChart" id="chartLine6" style="width:100%;height:400px;" />
            <div v-if="chart6.isTable" class="table">
              <div class="button">
                <div class="exportTable" @click="handleExport('chart6')">导出</div>
                <div class="exportTable" @click="handleChart('chart6')">切换图表</div>
              </div>
              <el-table
                :key="chart6.table.tableKey"
                v-loading="chart6.table.listLoading"
                element-loading-text="给我一点时间"
                :data="chart6.table.list"
                border
                fit
                highlight-current-row
                style="width: 100%;"
                height="400"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                class="elTable table-fixed"
              >
                <el-table-column label="牧场" sortable min-width="85px" align="center" prop="牧场" />
                <el-table-column label="日期" sortable min-width="80px" align="center" prop="日期" />
                <el-table-column label="取消次数" sortable min-width="80px" align="center" prop="field1" />
              </el-table>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <el-dialog :title="textMap[pasture.dialogStatus]" :destroy-on-close="true" :visible.sync="pasture.dialogFormVisible" :close-on-click-modal="false" width="90%">
      <div class="app-pasture">
        <div class="search">
          <span style="margin-left: 10px;">统计类型：</span>
          <el-select v-model="pasture.radio" placeholder="统计类型" class="filter-item" style="width: 120px;" @change="changeRadio">
            <el-option v-for="item in statisticalTypeList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-checkbox v-model="pasture.checked" style="margin-right: 10px;" @change="changeChecked">按日期统计</el-checkbox>
          <el-input v-if="pasture.isDriver" v-model="pasture.table.getdataListParm.parammaps.fname" class="filter-item" style="width: 245px;" placeholder="驾驶员" />
          <el-input v-if="pasture.isFormulaName" v-model="pasture.table.getdataListParm.parammaps.fname" class="filter-item" style="width: 245px;" placeholder="配方名称" />
          <el-input v-if="pasture.isHouseName" v-model="pasture.table.getdataListParm.parammaps.fname" class="filter-item" style="width: 245px;" placeholder="栏舍名称" />
          <el-input v-if="pasture.isLivestockType" v-model="pasture.table.getdataListParm.parammaps.fname" class="filter-item" style="width: 245px;" placeholder="牲畜名称" />
          <el-input v-if="pasture.isTrainNumber" v-model="pasture.table.getdataListParm.parammaps.sort" class="filter-item" style="width: 150px;" placeholder="车次" />
          <el-input v-if="pasture.isTrainNumber" v-model="pasture.table.getdataListParm.parammaps.times" class="filter-item" style="width: 150px;" placeholder="班次" />
          <el-input v-if="pasture.isTrainNumber" v-model="pasture.table.getdataListParm.parammaps.fname" class="filter-item" style="width: 150px;" placeholder="TMR名称" />
          <el-button class="successBorder" @click="handleSearch">查询</el-button>
        </div>
        <div class="table">
          <h4>混料</h4>
          <el-table
            :key="pasture.table.tableKey"
            v-loading="pasture.table.listLoading"
            element-loading-text="给我一点时间"
            :data="pasture.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="pasture.checked" :key="0" sortable label="日期" min-width="110px" align="center" prop="计划时间" />
            <el-table-column v-if="pasture.isDriver" :key="1" sortable label="驾驶员" min-width="110px" align="center" prop="驾驶员" />
            <el-table-column v-if="pasture.isFormulaName" :key="2" sortable label="配方名称" min-width="110px" align="center" prop="配方名称" />
            <el-table-column v-if="pasture.isHouseName" :key="3" sortable label="栏舍名称" min-width="110px" align="center" prop="栏舍名称" />
            <el-table-column v-if="pasture.isLivestockType" :key="4" sortable label="牲畜类别" min-width="110px" align="center" prop="牲畜类别" />
            <el-table-column v-if="pasture.isTrainNumber" :key="5" sortable label="车次" min-width="110px" align="center" prop="车次" />
            <el-table-column v-if="pasture.isTrainNumber" :key="6" sortable label="班次" min-width="110px" align="center" prop="班次" />
            <el-table-column v-if="pasture.isTrainNumber" :key="7" sortable label="TMR名称" min-width="110px" align="center" prop="TMR名称" />
            <el-table-column v-if="pasture.isTrainNumber" :key="8" sortable label="驾驶员" min-width="110px" align="center" prop="驾驶员" />
            <el-table-column :key="9" sortable label="理论重量" min-width="110px" align="center" prop="理论重量" />
            <el-table-column :key="10" sortable label="实际重量" min-width="110px" align="center" prop="实际重量" />
            <el-table-column :key="11" sortable label="计划混料操作数" min-width="110px" align="center" prop="计划混料操作数" />
            <el-table-column :key="12" sortable label="已混料操作数" min-width="110px" align="center" prop="已混料操作数" />
            <el-table-column :key="13" sortable label="混料操作率" min-width="110px" align="center" prop="混料操作率" />
            <el-table-column :key="14" sortable label="混料误差值" min-width="110px" align="center" prop="混料误差值" />
            <el-table-column :key="15" sortable label="混料准确率" min-width="110px" align="center" prop="混料准确率" />
            <el-table-column v-if="pasture.isTrainNumber" :key="16" sortable label="混料时间" min-width="100px" align="center" prop="混料时间" />
            <el-table-column v-if="pasture.isTrainNumber" :key="17" sortable label="等待时间" min-width="100px" align="center" prop="等待时间" />
            <el-table-column :key="18" sortable label="混料自动跳转次数" min-width="110px" align="center" prop="混料自动跳转次数" />
            <el-table-column :key="19" sortable label="混料手动跳转次数" min-width="110px" align="center" prop="混料手动跳转次数" />
            <el-table-column :key="20" sortable label="取消次数" min-width="110px" align="center" prop="取消次数" />
            <el-table-column :key="21" sortable label="方差" min-width="110px" align="center" prop="方差" />
          </el-table>
          <h4>撒料</h4>
          <el-table
            :key="pasture.table2.tableKey"
            v-loading="pasture.table2.listLoading"
            element-loading-text="给我一点时间"
            :data="pasture.table2.list"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <el-table-column v-if="pasture.checked" :key="0" sortable label="日期" min-width="110px" align="center" prop="计划时间" />
            <el-table-column v-if="pasture.isDriver" :key="1" sortable label="驾驶员" min-width="110px" align="center" prop="驾驶员" />
            <el-table-column v-if="pasture.isFormulaName" :key="2" sortable label="配方名称" min-width="110px" align="center" prop="配方名称" />
            <el-table-column v-if="pasture.isHouseName" :key="3" sortable label="栏舍名称" min-width="110px" align="center" prop="栏舍名称" />
            <el-table-column v-if="pasture.isLivestockType" :key="4" sortable label="牲畜类别" min-width="110px" align="center" prop="牲畜类别" />
            <el-table-column v-if="pasture.isTrainNumber" :key="5" sortable label="车次" min-width="110px" align="center" prop="车次" />
            <el-table-column v-if="pasture.isTrainNumber" :key="6" sortable label="班次" min-width="110px" align="center" prop="班次" />
            <el-table-column v-if="pasture.isTrainNumber" :key="7" sortable label="TMR名称" min-width="110px" align="center" prop="TMR" />
            <el-table-column v-if="pasture.isTrainNumber" :key="8" sortable label="驾驶员" min-width="110px" align="center" prop="驾驶员" />
            <el-table-column :key="9" sortable label="理论重量" min-width="110px" align="center" prop="理论重量" />
            <el-table-column :key="10" sortable label="实际重量" min-width="110px" align="center" prop="实际重量" />
            <el-table-column :key="11" sortable label="计划撒料操作数" min-width="110px" align="center" prop="计划撒料操作数" />
            <el-table-column :key="12" sortable label="已撒料操作数" min-width="110px" align="center" prop="已撒料操作数" />
            <el-table-column :key="13" sortable label="撒料操作率" min-width="110px" align="center" prop="撒料操作率" />
            <el-table-column :key="14" sortable label="撒料误差值" min-width="110px" align="center" prop="撒料误差值" />
            <el-table-column :key="15" sortable label="撒料准确率" min-width="110px" align="center" prop="撒料准确率" />
            <el-table-column v-if="pasture.isTrainNumber" :key="16" sortable label="撒料时间" min-width="100px" align="center" prop="撒料时间" />
            <el-table-column v-if="pasture.isTrainNumber" :key="17" sortable label="等待时间" min-width="100px" align="center" prop="等待时间" />
            <el-table-column :key="18" sortable label="撒料自动跳转次数" min-width="110px" align="center" prop="撒料自动跳转次数" />
            <el-table-column :key="19" sortable label="撒料手动跳转次数" min-width="110px" align="center" prop="撒料手动跳转次数" />
          </el-table>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom: 10px;">
        <el-button class="cancelClose1" @click="pasture.dialogFormVisible = false; ">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import echarts from 'echarts'
require('echarts/theme/macarons')
import { GetDataByName, GetReportform, whichWeek } from '@/api/common'
import Cookies from 'js-cookie'
import { parseTime } from '@/utils/index.js'
import { json2excel } from '@/utils/index.js'
import { MessageBox } from 'element-ui'
export default {
  name: 'Tab1',
  data() {
    return {
      Beforedisabled: false,
      Nextdisabled: false,
      pickerMinMonth: '',
      pickerOptionsMonth: {
        onPick: ({ maxDate, minDate }) => {
          this.pickerMinMonth = minDate.getTime()
          if (maxDate) {
            this.pickerMinMonth = ''
          }
        },
        // 限制不能选择今天之后的日期
        disabledDate: (time) => {
          if (this.pickerMinMonth !== '') {
            const one = 24 * 3600 * 1000 * 365 * 5
            const minTime = this.pickerMinMonth - 0
            let maxTime = this.pickerMinMonth + one
            if (maxTime > new Date()) {
              maxTime = new Date()
            }
            return time.getTime() < minTime || time.getTime() > maxTime
          }
          return time.getTime() >= Date.now()
        }
      },
      pickerMinDate: '',
      pickerOptionsDate: {
        showWeekNumber: false,
        onPick: ({ maxDate, minDate }) => {
          this.pickerMinDate = minDate.getTime()
          if (maxDate) {
            this.pickerMinDate = ''
          }
        },
        // 限制不能选择今天之后的日期
        disabledDate: (time) => {
          if (this.pickerMinDate !== '') {
            const one = 31 * 24 * 3600 * 1000
            const minTime = this.pickerMinDate - one
            let maxTime = this.pickerMinDate + one
            if (maxTime > new Date()) {
              maxTime = new Date()
            }
            return time.getTime() < minTime || time.getTime() > maxTime
          }
          return time.getTime() > Date.now()
        }
      },
      pickerMinDate: '',
      pickerOptions: {
        onPick: ({ maxDate, minDate }) => {
          this.pickerMinDate = minDate.getTime()
          if (maxDate) {
            this.pickerMinDate = ''
          }
        },
        // 限制不能选择今天之后的日期
        disabledDate: (time) => {
          if (this.pickerMinDate !== '') {
            const one = 31 * 24 * 3600 * 1000
            const minTime = this.pickerMinDate - one
            let maxTime = this.pickerMinDate + one
            if (maxTime > new Date()) {
              maxTime = new Date()
            }
            return time.getTime() < minTime || time.getTime() > maxTime
          }
          return time.getTime() > Date.now()
        }
      },
      chartDate: [],
      selectWeek: [],
      chartMonth: [],
      specificDate: '1',
      selectYear: parseTime(new Date(), '{y}'),
      yearList: [],
      weekList: [],
      table: {
        getdataListParm: {
          name: 'getAccuracyJTHALL',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            fname: '',
            sort: '',
            times: ''
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        temp: {}
      },
      table2: {
        getdataListParm: {
          name: 'getAccuracyJTSALL',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            fname: '',
            sort: '',
            times: ''
          }
        },
        tableKey: 2,
        list: [],
        total: 0,
        listLoading: true,
        temp: {}
      },
      // 计划统计
      chart1: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getJT1AccuracyAllJH',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        statisticsList: [],
        chart1Data3: [],
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },

      // 牛群准确率
      chart2: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getJT1AccuracyAllNQ',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },
      // 混料次数统计
      chart3: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getJT1AccuracyAllHL',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        statisticsList: [],
        chart1Data3: [],
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },
      // 混料准确率统计
      chart4: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getJT1AccuracyAllHLRate',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        statisticsList: [],
        chart4Data3: [],
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },
      // 栏舍平均撒料时间统计
      chart5: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getAccuracyAllLSJT',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },
      // 混料准确率统计
      chart6: {
        chartLine: null,
        chartLine_data: {},
        getdataListParm: {
          name: 'getJT1AccuracyAllQX',
          page: 1,
          offset: 1,
          pagecount: '',
          returntype: 'Map',
          parammaps: {
            pastureid: Cookies.get('pastureid'),
            startTime: parseTime(new Date(), '{y}-{m}-{d}'),
            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
            inputDatetime: [new Date(), new Date()],
            chartDate: [],
            selectWeek: [],
            chartMonth: [],
            specificDate: '1',
            selectYear: parseTime(new Date(), '{y}'),
            yearList: [],
            weekList: []
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        statisticsList: [],
        chart4Data3: [],
        isChart: true,
        isTable: false,
        table: {
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: false
        }
      },
      pasture: {
        dialogFormVisible: false,
        dialogStatus: '',
        radio: '0',
        isDriver: true, // 驾驶员
        isFormulaName: false, // 配方名称
        isHouseName: false, // 栏舍名称
        isLivestockType: false, // 牲畜类别
        isTrainNumber: false, // 车次
        checked: false, // 按日期统计
        table: {
          getdataListParm: {
            name: 'getAccuracyHFT',
            page: 1,
            offset: 1,
            pagecount: '',
            returntype: 'Map',
            parammaps: {
              pastureid: '',
              startTime: '',
              stopTime: '',
              fname: '',
              sort: '',
              times: ''
            }
          },
          tableKey: 1,
          list: [],
          total: 0,
          listLoading: true,
          temp: {}
        },

        table2: {
          getdataListParm: {
            name: 'getAccuracySFT',
            page: 1,
            offset: 1,
            pagecount: '',
            returntype: 'Map',
            parammaps: {
              pastureid: '',
              startTime: '',
              stopTime: '',
              fname: '',
              sort: '',
              times: ''
            }
          },
          tableKey: 2,
          list: [],
          total: 0,
          listLoading: true,
          temp: {}
        }
      },
      textMap: {
        pasture: '牧场'
      },
      statisticalTypeList: [{ id: '0', name: '驾驶员' }, { id: '1', name: '配方名称' }, { id: '2', name: '栏舍名称' }, { id: '3', name: '牲畜类别' }, { id: '4', name: '车次' }],
      rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
      cellStyle: { padding: 0 + 'px' }
    }
  },
  created() {
    this.getTimeFn()
    this.getAllYear()
    this.getList()
    this.getList2()
    this.getChart1()
    this.getChart2()
    this.getChart3()
    this.getChart4()
    this.getChart5()
    this.getChart6()
  },
  methods: {
    getAllYear() {
      var myDate = new Date()
      var thisYear = myDate.getFullYear() // 获取当年年份
      var Section = thisYear - 2001 // 声明一个变量 获得当前年份至想获取年份差 eg.2008
      this.yearList = [] // 声明一个空数组 把遍历出的年份添加到数组里
      for (var i = 0; i <= Section; i++) {
        this.yearList.push(thisYear--)
      }
      console.log(this.yearList)
    },
    changeAllYear() {
      console.log('this.selectYear==>', this.selectYear)
      this.weekList = []
      this.selectWeek = []
      var myWeekList = whichWeek(this.selectYear)
      console.log(myWeekList)
      for (let i = 0; i <= myWeekList.length; i++) {
        var obj = {}
        var a = i + 1
        obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
        obj.id = i
        this.weekList.push(obj)
      }
    },
    changeAllSpecificDate() {
      var start = ''
      var end = ''
      if (this.specificDate == '2') {
        this.selectYear = parseTime(new Date(), '{y}')
        this.changeAllYear()
      } else if (this.specificDate == '3') {
        start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
        end = parseTime(new Date(), '{y}-{m}-{d}')
        this.chartMonth = []
        this.chartMonth.push(start, end)
      }
    },
    handleAllDate() {
      console.log('点击了确认时间')
      MessageBox.confirm('是否调整以下所有图表查询时间?', {
        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
      }).then(() => {
        var startDate = ''
        var endDate = ''
        var status = ''
        if (this.specificDate == '1') {
          startDate = parseTime(this.chartDate[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chartDate[1], '{y}-{m}-{d}')
          this.chart1.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          this.chart2.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          this.chart3.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          this.chart4.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          this.chart5.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          this.chart6.getdataListParm.parammaps.inputDatetime = [startDate, endDate]
          status = 0
          console.log('开始日时==>', startDate)
          console.log('结束日时==>', endDate)
        } else if (this.specificDate == '2') {
          if (this.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.selectYear + '-' + whichWeek(this.selectYear)[this.selectWeek[0]].month + '-' + whichWeek(this.selectYear)[this.selectWeek[0]].date
          endDate = this.selectYear + '-' + whichWeek(this.selectYear)[this.selectWeek[1]].last.month + '-' + whichWeek(this.selectYear)[this.selectWeek[1]].last.date
          status = 1
          this.chart1.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart1.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart1.getdataListParm.parammaps.weekList = this.weekList
          this.chart2.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart2.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart2.getdataListParm.parammaps.weekList = this.weekList
          this.chart3.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart3.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart3.getdataListParm.parammaps.weekList = this.weekList
          this.chart4.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart4.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart4.getdataListParm.parammaps.weekList = this.weekList
          this.chart5.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart5.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart5.getdataListParm.parammaps.weekList = this.weekList
          this.chart6.getdataListParm.parammaps.selectYear = this.selectYear
          this.chart6.getdataListParm.parammaps.selectWeek = this.selectWeek
          this.chart6.getdataListParm.parammaps.weekList = this.weekList
          console.log('开始周时间==>', startDate)
          console.log('结束周时间==>', endDate)
        } else if (this.specificDate == '3') {
          if (this.chartMonth.length > 0) {
            startDate = this.chartMonth[0]
            endDate = this.chartMonth[1].substring(0, 8) + '31'
            status = 2
            this.chart1.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            this.chart2.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            this.chart3.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            this.chart4.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            this.chart5.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            this.chart6.getdataListParm.parammaps.chartMonth = [startDate, endDate]
            console.log('开始月时间==>', startDate)
            console.log('结束月时间==>', endDate)
          } else {
            this.$message({ type: 'error', message: '请输入月', duration: 2000 })
          }
        }
        this.chart1.getdataListParm.parammaps.specificDate = this.specificDate
        this.chart1.getdataListParm.parammaps.startTime = startDate
        this.chart1.getdataListParm.parammaps.stopTime = endDate
        this.chart1.getdataListParm.parammaps.status = status
        this.chart2.getdataListParm.parammaps.startTime = startDate
        this.chart2.getdataListParm.parammaps.stopTime = endDate
        this.chart2.getdataListParm.parammaps.status = status
        this.chart2.getdataListParm.parammaps.specificDate = this.specificDate
        this.chart3.getdataListParm.parammaps.startTime = startDate
        this.chart3.getdataListParm.parammaps.stopTime = endDate
        this.chart3.getdataListParm.parammaps.status = status
        this.chart3.getdataListParm.parammaps.specificDate = this.specificDate
        this.chart4.getdataListParm.parammaps.startTime = startDate
        this.chart4.getdataListParm.parammaps.stopTime = endDate
        this.chart4.getdataListParm.parammaps.status = status
        this.chart4.getdataListParm.parammaps.specificDate = this.specificDate
        this.chart5.getdataListParm.parammaps.startTime = startDate
        this.chart5.getdataListParm.parammaps.stopTime = endDate
        this.chart5.getdataListParm.parammaps.status = status
        this.chart5.getdataListParm.parammaps.specificDate = this.specificDate
        this.chart6.getdataListParm.parammaps.startTime = startDate
        this.chart6.getdataListParm.parammaps.stopTime = endDate
        this.chart6.getdataListParm.parammaps.status = status
        this.chart6.getdataListParm.parammaps.specificDate = this.specificDate
        this.getChart1()
        this.getChart2()
        this.getChart3()
        this.getChart4()
        this.getChart5()
        this.getChart6()
      })
    },
    getTimeFn() {
      const that = this
      const start = new Date()
      const end = new Date()
      const start2 = new Date()
      const end2 = new Date()
      start2.setTime(start2.getTime() - 3600 * 1000 * 24 * 1)
      end2.setTime(end2.getTime() - 3600 * 1000 * 24 * 1)
      that.table.getdataListParm.parammaps.inputDatetime = [start2, end2]
      that.table.getdataListParm.parammaps.startTime = parseTime(start2, '{y}-{m}-{d}')
      that.table.getdataListParm.parammaps.stopTime = parseTime(end2, '{y}-{m}-{d}')
      that.table2.getdataListParm.parammaps.inputDatetime = that.table.getdataListParm.parammaps.inputDatetime
      that.table2.getdataListParm.parammaps.startTime = that.table.getdataListParm.parammaps.startTime
      that.table2.getdataListParm.parammaps.stopTime = that.table.getdataListParm.parammaps.stopTime

      // start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      that.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
      that.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart1.getdataListParm.parammaps.inputDatetime = [start, end]
      that.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
      that.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
      that.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')

      that.chart3.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
      that.chart3.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart3.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart3.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')

      that.chart4.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
      that.chart4.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart4.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart4.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')

      that.chart5.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
      that.chart5.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart5.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart5.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')

      that.chart6.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
      that.chart6.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
      that.chart6.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
      that.chart6.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
    },
    getList() {
      this.table.listLoading = true
      GetDataByName(this.table.getdataListParm).then(response => {
        console.log('汇总统计/混料table数据', response.data.list)
        if (response.data.list !== null) {
          this.table.list = response.data.list
        } else {
          this.table.list = []
        }
        setTimeout(() => {
          this.table.listLoading = false
        }, 100)
      })
    },
    // 汇总统计/撒料
    getList2() {
      this.table2.listLoading = true
      GetDataByName(this.table2.getdataListParm).then(response => {
        console.log('汇总统计/撒料table数据', response.data.list)
        if (response.data.list !== null) {
          this.table2.list = response.data.list
        } else {
          this.table2.list = []
        }
        setTimeout(() => {
          this.table2.listLoading = false
        }, 100)
      })
    },
    changeDate() {
      console.log(this.$refs.inputDatetime.value)
      const startTime = this.$refs.inputDatetime.value[0]
      const stopTime = this.$refs.inputDatetime.value[1]
      this.table.getdataListParm.parammaps.startTime = parseTime(startTime, '{y}-{m}-{d}')
      this.table.getdataListParm.parammaps.stopTime = parseTime(stopTime, '{y}-{m}-{d}')
      this.table2.getdataListParm.parammaps.startTime = parseTime(startTime, '{y}-{m}-{d}')
      this.table2.getdataListParm.parammaps.stopTime = parseTime(stopTime, '{y}-{m}-{d}')
      this.getList()
      this.getList2()
    },
    handleBefore() {
      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
        var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))
        var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))
        if (stop > Date.now() - 8.64e7) {
          this.Nextdisabled = true
          this.Beforedisabled = false
        } else {
          this.Nextdisabled = false
          this.Beforedisabled = false
        }
        this.table.getdataListParm.parammaps.inputDatetime.length = 0
        this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
        this.$forceUpdate()
      }
      this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
      this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
      this.getList()
      this.table2.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.table2.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      this.getList2()
    },
    handleNext() {
      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
        var start2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))
        var stop2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))
        if (stop2 > Date.now() - 8.64e7) {
          this.Nextdisabled = true
          this.Beforedisabled = false
        } else {
          this.Nextdisabled = false
          this.Beforedisabled = false
        }
        this.table.getdataListParm.parammaps.inputDatetime.length = 0
        this.table.getdataListParm.parammaps.inputDatetime.push(start2, stop2)
        this.$forceUpdate()
      }
      this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
      this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
      this.getList()
      this.table2.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.table2.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      this.getList2()
    },
    tableCellStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0 && row.pastureid !== '-1') {
        return {
          textDecoration: 'underline'
        }
      }
      return {
        textDecoration: 'none'
      }
    },
    clickPasture(row) {
      console.log(row)
      if (row.pastureid !== '-1') {
        this.pasture.dialogStatus = 'pasture'
        this.pasture.dialogFormVisible = true
        this.pasture.table.getdataListParm.parammaps.pastureid = row.pastureid
        this.pasture.table2.getdataListParm.parammaps.pastureid = row.pastureid
        this.getTabList()
        this.getTabList2()
      }
    },
    // 切换统计类型
    changeRadio() {
      console.log(this.pasture.radio)
      this.pasture.table.getdataListParm.parammaps.sort = ''
      this.pasture.table.getdataListParm.parammaps.times = ''
      this.pasture.table.getdataListParm.parammaps.fname = ''
      this.pasture.table2.getdataListParm.parammaps.sort = ''
      this.pasture.table2.getdataListParm.parammaps.times = ''
      this.pasture.table2.getdataListParm.parammaps.fname = ''
      if (this.pasture.checked == true) {
        if (this.pasture.radio == '0') {
          console.log('驾驶员')
          this.pasture.isDriver = true
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFTDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFTDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '1') {
          console.log('配方名称')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = true
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFTDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFTDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '2') {
          console.log('栏舍名称')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = true
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHNSDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySNSDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '3') {
          console.log(' 牲畜类别')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = true
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHSCDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySSCDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '4') {
          console.log('车次')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = true
          this.pasture.table.getdataListParm.name = 'getAccuracyHCCDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySCCDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        }
      } else {
        if (this.pasture.radio == '0') {
          console.log('驾驶员')
          this.pasture.isDriver = true
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFT'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFT'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '1') {
          console.log('配方名称')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = true
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFT'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFT'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '2') {
          console.log('栏舍名称')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = true
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHNS'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySNS'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.getTabList2()
        } else if (this.pasture.radio == '3') {
          console.log(' 牲畜类别')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = true
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHSC'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySSC'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '4') {
          console.log('车次')
          this.pasture.isDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = true
          this.pasture.table.getdataListParm.name = 'getAccuracyHCC'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySCC'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        }
      }
    },
    changeChecked() {
      this.handleSearch()
    },
    handleSearch() {
      if (this.pasture.checked == true) {
        if (this.pasture.radio == '0') {
          console.log('配方名称/查询111')
          this.pasture.idDriver = true
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFTDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFTDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '1') {
          console.log('配方名称/查询111')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = true
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFTDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFTDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '2') {
          console.log('栏舍名称/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = true
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHNSDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySNSDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '3') {
          console.log(' 牲畜类别/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = true
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHSCDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySSCDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '4') {
          console.log('车次/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = true
          this.pasture.table.getdataListParm.name = 'getAccuracyHCCDate'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySCCDate'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.parammaps.fname = this.pasture.table.getdataListParm.parammaps.fname
          this.pasture.table2.getdataListParm.parammaps.times = this.pasture.table.getdataListParm.parammaps.times
          this.pasture.table2.getdataListParm.parammaps.projname = this.pasture.table.getdataListParm.parammaps.projname
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        }
      } else {
        if (this.pasture.radio == '0') {
          console.log('驾驶员/查询')
          this.pasture.idDriver = true
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFT'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFT'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '1') {
          console.log('配方名称/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = true
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHFT'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySFT'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '2') {
          console.log('栏舍名称/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = true
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHNS'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySNS'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '3') {
          console.log(' 牲畜类别/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = true
          this.pasture.isTrainNumber = false
          this.pasture.table.getdataListParm.name = 'getAccuracyHSC'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySSC'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        } else if (this.pasture.radio == '4') {
          console.log('车次/查询')
          this.pasture.idDriver = false
          this.pasture.isFormulaName = false
          this.pasture.isHouseName = false
          this.pasture.isLivestockType = false
          this.pasture.isTrainNumber = true
          this.pasture.table.getdataListParm.name = 'getAccuracyHCC'
          this.pasture.table.getdataListParm.offset = 1
          this.getTabList()
          this.pasture.table2.getdataListParm.name = 'getAccuracySCC'
          this.pasture.table2.getdataListParm.parammaps.startTime = this.pasture.table.getdataListParm.parammaps.startTime
          this.pasture.table2.getdataListParm.parammaps.stopTime = this.pasture.table.getdataListParm.parammaps.stopTime
          this.pasture.table2.getdataListParm.parammaps.fname = this.pasture.table.getdataListParm.parammaps.fname
          this.pasture.table2.getdataListParm.parammaps.times = this.pasture.table.getdataListParm.parammaps.times
          this.pasture.table2.getdataListParm.parammaps.projname = this.pasture.table.getdataListParm.parammaps.projname
          this.pasture.table2.getdataListParm.offset = 1
          this.getTabList2()
        }
      }
      this.pasture.table2.getdataListParm.parammaps.fname = this.pasture.table.getdataListParm.parammaps.fname
    },
    // 汇总统计/混料
    getTabList() {
      this.pasture.table.listLoading = true
      this.pasture.table.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.pasture.table.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      GetDataByName(this.pasture.table.getdataListParm).then(response => {
        console.log('汇总统计/混料table数据', response.data.list)
        if (response.data.list !== null) {
          this.pasture.table.list = response.data.list
        } else {
          this.pasture.table.list = []
        }
        setTimeout(() => {
          this.pasture.table.listLoading = false
        }, 100)
      })
    },

    // 汇总统计/撒料
    getTabList2() {
      this.pasture.table2.listLoading = true
      this.pasture.table2.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.pasture.table2.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      GetDataByName(this.pasture.table2.getdataListParm).then(response => {
        console.log('汇总统计/撒料table数据', response.data.list)
        if (response.data.list !== null) {
          this.pasture.table2.list = response.data.list
        } else {
          this.pasture.table2.list = []
        }
        setTimeout(() => {
          this.pasture.table2.listLoading = false
        }, 100)
      })
    },
    // 快速跳转到图表
    handleQuickJumpChart() {
      var myHeight = document.getElementById('table').offsetHeight + 120
      window.scrollTo(myHeight, myHeight)
    },
    // 快速回到顶部
    handleQuickJumpTop() {
      window.scrollTo(0, 0)
    },
    handleChartDate(item) {
      console.log(item)
      var startDate = ''
      var endDate = ''
      if (item == 'chart1') {
        if (this.chart1.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart1.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart1.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          console.log('计划统计开始日期==>', startDate)
          console.log('计划统计结束日期==>', endDate)
          this.chart1.getdataListParm.parammaps.status = 0
        } else if (this.chart1.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart1.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart1.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart1.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart1.getdataListParm.parammaps.selectYear)[this.chart1.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart1.getdataListParm.parammaps.selectYear)[this.chart1.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart1.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart1.getdataListParm.parammaps.selectYear)[this.chart1.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart1.getdataListParm.parammaps.selectYear)[this.chart1.getdataListParm.parammaps.selectWeek[1]].last.date
          console.log('计划统计开始周日期==>', startDate)
          console.log('计划统计结束周日期==>', endDate)
          this.chart1.getdataListParm.parammaps.status = 1
        } else if (this.chart1.getdataListParm.parammaps.specificDate == '3') {
          startDate = this.chart1.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart1.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          console.log('计划统计开始月日期==>', startDate)
          console.log('计划统计结束月日期==>', endDate)
          this.chart1.getdataListParm.parammaps.status = 2
        }
        this.chart1.getdataListParm.parammaps.startTime = startDate
        this.chart1.getdataListParm.parammaps.stopTime = endDate
        this.getChart1()
      } else if (item == 'chart2') {
        if (this.chart2.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart2.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart2.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.chart2.getdataListParm.parammaps.status = 0
          console.log('牛群准确率开始日期==>', startDate)
          console.log('牛群准确率结束日期==>', endDate)
        } else if (this.chart2.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart2.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart2.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart2.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart2.getdataListParm.parammaps.selectYear)[this.chart2.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart2.getdataListParm.parammaps.selectYear)[this.chart2.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart2.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart2.getdataListParm.parammaps.selectYear)[this.chart2.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart2.getdataListParm.parammaps.selectYear)[this.chart2.getdataListParm.parammaps.selectWeek[1]].last.date
          this.chart2.getdataListParm.parammaps.status = 1
          console.log('牛群准确率开始周日期==>', startDate)
          console.log('牛群准确率结束周日期==>', endDate)
        } else if (this.chart2.getdataListParm.parammaps.specificDate == '3') {
          console.log('牛群准确率开始月日期==>', this.chart2.getdataListParm.parammaps.chartMonth)
          startDate = this.chart2.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart2.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          this.chart2.getdataListParm.parammaps.status = 2
          console.log('牛群准确率开始月日期==>', startDate)
          console.log('牛群准确率结束月日期==>', endDate)
        }
        this.chart2.getdataListParm.parammaps.startTime = startDate
        this.chart2.getdataListParm.parammaps.stopTime = endDate
        this.getChart2()
      } else if (item == 'chart3') {
        if (this.chart3.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart3.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart3.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.chart3.getdataListParm.parammaps.status = 0
          console.log('混料次数统计开始日期==>', startDate)
          console.log('混料次数统计结束日期==>', endDate)
        } else if (this.chart3.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart3.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart3.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart3.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart3.getdataListParm.parammaps.selectYear)[this.chart3.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart3.getdataListParm.parammaps.selectYear)[this.chart3.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart3.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart3.getdataListParm.parammaps.selectYear)[this.chart3.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart3.getdataListParm.parammaps.selectYear)[this.chart3.getdataListParm.parammaps.selectWeek[1]].last.date
          this.chart3.getdataListParm.parammaps.status = 1
          console.log('混料次数统计开始周日期==>', startDate)
          console.log('混料次数统计结束周日期==>', endDate)
        } else if (this.chart3.getdataListParm.parammaps.specificDate == '3') {
          startDate = this.chart3.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart3.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          this.chart3.getdataListParm.parammaps.status = 2
          console.log('混料次数统计开始月日期==>', startDate)
          console.log('混料次数统计结束月日期==>', endDate)
        }
        this.chart3.getdataListParm.parammaps.startTime = startDate
        this.chart3.getdataListParm.parammaps.stopTime = endDate
        this.getChart3()
      } else if (item == 'chart4') {
        if (this.chart4.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart4.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart4.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.chart4.getdataListParm.parammaps.status = 0
          console.log('混料准确率统计开始日期==>', startDate)
          console.log('混料准确率统计结束日期==>', endDate)
        } else if (this.chart4.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart4.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart4.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart4.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart4.getdataListParm.parammaps.selectYear)[this.chart4.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart4.getdataListParm.parammaps.selectYear)[this.chart4.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart4.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart4.getdataListParm.parammaps.selectYear)[this.chart4.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart4.getdataListParm.parammaps.selectYear)[this.chart4.getdataListParm.parammaps.selectWeek[1]].last.date
          this.chart4.getdataListParm.parammaps.status = 1
          console.log('混料准确率统计开始周日期==>', startDate)
          console.log('混料准确率统计结束周日期==>', endDate)
        } else if (this.chart4.getdataListParm.parammaps.specificDate == '3') {
          startDate = this.chart4.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart4.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          this.chart4.getdataListParm.parammaps.status = 2
          console.log('混料准确率统计开始月日期==>', startDate)
          console.log('混料准确率统计结束月日期==>', endDate)
        }
        this.chart4.getdataListParm.parammaps.startTime = startDate
        this.chart4.getdataListParm.parammaps.stopTime = endDate
        this.getChart4()
      } else if (item == 'chart5') {
        if (this.chart5.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart5.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart5.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.chart5.getdataListParm.parammaps.status = 0
          console.log('栏舍平均撒料时间统计开始日期==>', startDate)
          console.log('栏舍平均撒料时间统计结束日期==>', endDate)
        } else if (this.chart5.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart5.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart5.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart5.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart5.getdataListParm.parammaps.selectYear)[this.chart5.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart5.getdataListParm.parammaps.selectYear)[this.chart5.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart5.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart5.getdataListParm.parammaps.selectYear)[this.chart5.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart5.getdataListParm.parammaps.selectYear)[this.chart5.getdataListParm.parammaps.selectWeek[1]].last.date
          this.chart5.getdataListParm.parammaps.status = 1
          console.log('栏舍平均撒料时间统计开始周日期==>', startDate)
          console.log('栏舍平均撒料时间统计结束周日期==>', endDate)
        } else if (this.chart5.getdataListParm.parammaps.specificDate == '3') {
          startDate = this.chart5.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart5.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          this.chart5.getdataListParm.parammaps.status = 2
          console.log('栏舍平均撒料时间统计开始月日期==>', startDate)
          console.log('栏舍平均撒料时间统计结束月日期==>', endDate)
        }
        this.chart5.getdataListParm.parammaps.startTime = startDate
        this.chart5.getdataListParm.parammaps.stopTime = endDate
        this.getChart5()
      } else if (item == 'chart6') {
        if (this.chart6.getdataListParm.parammaps.specificDate == '1') {
          startDate = parseTime(this.chart6.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          endDate = parseTime(this.chart6.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.chart6.getdataListParm.parammaps.status = 0
          console.log('混料计划取消次数开始日期==>', startDate)
          console.log('混料计划取消次数结束日期==>', endDate)
        } else if (this.chart6.getdataListParm.parammaps.specificDate == '2') {
          if (this.chart6.getdataListParm.parammaps.selectYear == '') {
            this.$message({ type: 'error', message: '请输入年', duration: 2000 })
            return
          }
          if (this.chart6.getdataListParm.parammaps.selectWeek.length !== 2) {
            this.$message({ type: 'error', message: '请输入查询开始周跟结束周', duration: 2000 })
            return
          }
          startDate = this.chart6.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart6.getdataListParm.parammaps.selectYear)[this.chart6.getdataListParm.parammaps.selectWeek[0]].month + '-' + whichWeek(this.chart6.getdataListParm.parammaps.selectYear)[this.chart6.getdataListParm.parammaps.selectWeek[0]].date
          endDate = this.chart6.getdataListParm.parammaps.selectYear + '-' + whichWeek(this.chart6.getdataListParm.parammaps.selectYear)[this.chart6.getdataListParm.parammaps.selectWeek[1]].last.month + '-' + whichWeek(this.chart6.getdataListParm.parammaps.selectYear)[this.chart6.getdataListParm.parammaps.selectWeek[1]].last.date
          this.chart6.getdataListParm.parammaps.status = 1
          console.log('混料计划取消次数开始周日期==>', startDate)
          console.log('混料计划取消次数结束周日期==>', endDate)
        } else if (this.chart6.getdataListParm.parammaps.specificDate == '3') {
          startDate = this.chart6.getdataListParm.parammaps.chartMonth[0]
          endDate = this.chart6.getdataListParm.parammaps.chartMonth[1].substring(0, 8) + '31'
          this.chart6.getdataListParm.parammaps.status = 2
          console.log('混料计划取消次数开始月日期==>', startDate)
          console.log('混料计划取消次数结束月日期==>', endDate)
        }
        this.chart6.getdataListParm.parammaps.startTime = startDate
        this.chart6.getdataListParm.parammaps.stopTime = endDate
        this.getChart6()
      }
    },
    changeChartSpecificDate(item) {
      var start = ''
      var end = ''
      if (item == 'chart1') {
        if (this.chart1.getdataListParm.parammaps.specificDate == '2') {
          this.chart1.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart1.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart1.getdataListParm.parammaps.weekList = []
          this.chart1.getdataListParm.parammaps.chartMonth = []
          this.chart1.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      } else if (item == 'chart2') {
        if (this.chart2.getdataListParm.parammaps.specificDate == '2') {
          this.chart2.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart2.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart2.getdataListParm.parammaps.weekList = []
          this.chart2.getdataListParm.parammaps.chartMonth = []
          this.chart2.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      } else if (item == 'chart3') {
        if (this.chart3.getdataListParm.parammaps.specificDate == '2') {
          this.chart3.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart3.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart3.getdataListParm.parammaps.weekList = []
          this.chart3.getdataListParm.parammaps.chartMonth = []
          this.chart3.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      } else if (item == 'chart4') {
        if (this.chart4.getdataListParm.parammaps.specificDate == '2') {
          this.chart4.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart4.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart4.getdataListParm.parammaps.weekList = []
          this.chart4.getdataListParm.parammaps.chartMonth = []
          this.chart4.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      } else if (item == 'chart5') {
        if (this.chart5.getdataListParm.parammaps.specificDate == '2') {
          this.chart5.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart5.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart5.getdataListParm.parammaps.weekList = []
          this.chart5.getdataListParm.parammaps.chartMonth = []
          this.chart5.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      } else if (item == 'chart6') {
        if (this.chart6.getdataListParm.parammaps.specificDate == '2') {
          this.chart6.getdataListParm.parammaps.selectYear = parseTime(new Date(), '{y}')
          this.changeChartYear(item)
        } else if (this.chart6.getdataListParm.parammaps.specificDate == '3') {
          start = parseTime(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 31 * 12), '{y}-{m}') + '-01'
          end = parseTime(new Date(), '{y}-{m}-{d}')
          this.chart6.getdataListParm.parammaps.weekList = []
          this.chart6.getdataListParm.parammaps.chartMonth = []
          this.chart6.getdataListParm.parammaps.chartMonth.push(start, end)
        }
      }
    },
    changeChartYear(item) {
      var myWeekList = ''
      if (item == 'chart1') {
        this.chart1.getdataListParm.parammaps.weekList = []
        this.chart1.getdataListParm.parammaps.selectWeek = []
        myWeekList = whichWeek(this.chart1.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart1.getdataListParm.parammaps.weekList.push(obj)
        }
      } else if (item == 'chart2') {
        this.chart2.getdataListParm.parammaps.selectWeek = []
        this.chart2.getdataListParm.parammaps.weekList = []
        myWeekList = whichWeek(this.chart2.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart2.getdataListParm.parammaps.weekList.push(obj)
        }
      } else if (item == 'chart3') {
        this.chart3.getdataListParm.parammaps.selectWeek = []
        this.chart3.getdataListParm.parammaps.weekList = []
        myWeekList = whichWeek(this.chart3.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart3.getdataListParm.parammaps.weekList.push(obj)
        }
      } else if (item == 'chart4') {
        this.chart4.getdataListParm.parammaps.selectWeek = []
        this.chart4.getdataListParm.parammaps.weekList = []
        myWeekList = whichWeek(this.chart4.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart4.getdataListParm.parammaps.weekList.push(obj)
        }
      } else if (item == 'chart5') {
        this.chart5.getdataListParm.parammaps.selectWeek = []
        this.chart5.getdataListParm.parammaps.weekList = []
        myWeekList = whichWeek(this.chart5.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart5.getdataListParm.parammaps.weekList.push(obj)
        }
      } else if (item == 'chart6') {
        this.chart6.getdataListParm.parammaps.selectWeek = []
        this.chart6.getdataListParm.parammaps.weekList = []
        myWeekList = whichWeek(this.chart6.getdataListParm.parammaps.selectYear)
        console.log(myWeekList)
        for (let i = 0; i <= myWeekList.length; i++) {
          var obj = {}
          var a = i + 1
          obj.name = '第' + a + '周(' + myWeekList[i].month + '.' + myWeekList[i].date + '~' + myWeekList[i].last.month + '.' + myWeekList[i].last.date + ')'
          obj.id = i
          this.chart6.getdataListParm.parammaps.weekList.push(obj)
        }
      }
    },
    // 计划统计
    getChart1() {
      this.chart1.listLoading = true
      console.log(this.chart1.getdataListParm.name, '计划统计接口')
      GetReportform(this.chart1.getdataListParm).then(response => {
        if (response.data !== null && response.data.list !== null) {
          this.chart1.table.list = response.data.data
          this.chart1.total = response.data.total
          this.chart1.chartLine_data = response.data.list
          console.log('计划统计图数据', this.chart1.chartLine_data)
          console.log('计划统计表数据', this.chart1.table.list)
          this.roadChartLine1(this.chart1.chartLine_data)
        } else {
          this.chart1.list = []
          this.chart1.chartLine_data = {}
          this.roadChartLine1(this.chart1.chartLine_data)
        }
        setTimeout(() => {
          this.chart1.listLoading = false
        }, 100)
      })
    },
    roadChartLine1(chartLine_data) {
      if (this.chart1.chartLine != null) {
        this.chart1.chartLine.dispose()
      }
      this.chart1.chartLine = echarts.init(document.getElementById('chartLine1'))
      var option = {
        tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' }}},
        legend: { data: ['计划准确率', '计划正确率', '计划准确率（去除取消重量）'] },
        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }}],
        yAxis: [{ type: 'value', name: '百分比', min: 0, max: 100, interval: 20, axisLabel: { formatter: '{value}' }}],
        series: [
          { name: '计划准确率', type: 'bar', itemStyle: { normal: { color: '#7ecf51' }}, data: chartLine_data.data2, markLine: { data: [{ type: 'average' }], symbol: ['none', 'none'], position: 'insideTopCenter', itemStyle: { normal: { lineStyle: { type: 'dotted', width: 3 }, label: { show: true, position: 'middle', formatter: '' }}}, large: true, effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }}},
          { name: '计划正确率', type: 'bar', itemStyle: { normal: { color: '#ff6600' }}, data: chartLine_data.data3, markLine: { data: [{ type: 'average' }], symbol: ['none', 'none'], position: 'insideTopCenter', itemStyle: { normal: { lineStyle: { type: 'dotted', width: 3 }, label: { show: true, position: 'middle', formatter: '' }}}, large: true, effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }}},
          { name: '计划准确率（去除取消重量）', type: 'bar', itemStyle: { normal: { color: '#61a5e8' }}, data: chartLine_data.data4, markLine: { data: [{ type: 'average' }], symbol: ['none', 'none'], position: 'insideTopCenter', itemStyle: { normal: { lineStyle: { type: 'dotted', width: 3 }, label: { show: true, position: 'middle', formatter: '' }}}, large: true, effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }}}
        ]
      }
      this.chart1.chartLine.setOption(option)
      window.onresize = function() {
        this.chart1.chartLine.resize()
      }
    },
    // 牛群准确率
    getChart2() {
      this.chart2.listLoading = true
      GetReportform(this.chart2.getdataListParm).then(response => {
        console.log('牛群准确率图数据', this.chart2.chartLine_data)
        if (response.data !== null && response.data.list !== null) {
          // for (let i = 0; i < response.data.data.length; i++) {
          //   response.data.data[i].准确率 = response.data.data[i].准确率 + '%'
          // }
          this.chart2.table.list = response.data.data
          this.chart2.chartLine_data = response.data.list
          this.chart2.total = response.data.total
          this.chart2.chart3Data3 = response.data.list.data3
          this.chart2.total = response.data.total
          console.log('牛群准确率图数据', this.chart2.chartLine_data)
          console.log('牛群准确率表数据', this.chart2.table.list)
          this.roadChartLine2(this.chart2.chartLine_data)
        } else {
          this.chart2.list = []
          this.chart2.chartLine_data = {}
          this.roadChartLine2(this.chart2.chartLine_data)
        }
        setTimeout(() => {
          this.chart2.listLoading = false
        }, 100)
      })
    },
    roadChartLine2(chartLine_data) {
      if (this.chart2.chartLine != null) {
        this.chart2.chartLine.dispose()
      }
      this.chart2.chartLine = echarts.init(document.getElementById('chartLine2'))
      var option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          }
        },
        legend: {
          data: ['泌乳牛', '后备牛', '干奶牛', '围产牛']
        },
        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }}],
        yAxis: [{ type: 'value', name: '准确率', min: 0, max: 100, interval: 20, axisLabel: { formatter: '{value}%' }}],
        series: [{ name: '泌乳牛', type: 'bar', itemStyle: { normal: { color: '#7ecf51' }},
          data: chartLine_data.data2,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        },
        {
          name: '后备牛',
          type: 'bar',
          itemStyle: {
            normal: {
              color: '#ff6600'
            }
          },
          data: chartLine_data.data3,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        },
        {
          name: '干奶牛',
          type: 'bar',
          itemStyle: {
            normal: {
              color: '#61a5e8'
            }
          },
          data: chartLine_data.data4,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        },
        {
          name: '围产牛',
          type: 'bar',
          itemStyle: {
            normal: {
              color: '#ffff00'
            }
          },
          data: chartLine_data.data5,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        }
        ]
      }
      this.chart2.chartLine.setOption(option)
      window.onresize = function() {
        this.chart2.chartLine.resize()
      }
    },
    // 混料次数统计
    getChart3() {
      this.chart3.listLoading = true
      GetReportform(this.chart3.getdataListParm).then(response => {
        if (response.data !== null && response.data.list !== null) {
          // for (let i = 0; i < response.data.data.length; i++) {
          //   response.data.data[i].准确率 = response.data.data[i].准确率 + '%'
          // }
          this.chart3.table.list = response.data.data
          this.chart3.chartLine_data = response.data.list
          this.chart3.total = response.data.total

          this.chart3.total = response.data.total
          console.log('混料次数统计图', this.chart3.chartLine_data)
          console.log('混料次数统计表', this.chart3.table.list)
          this.roadChartLine3(this.chart3.chartLine_data)
        } else {
          this.chart3.list = []
          this.chart3.chartLine_data = {}
          this.roadChartLine3(this.chart3.chartLine_data)
        }
        setTimeout(() => {
          this.chart3.listLoading = false
        }, 100)
      })
    },
    roadChartLine3(chartLine_data) {
      if (this.chart3.chartLine != null) {
        this.chart3.chartLine.dispose()
      }
      this.chart3.chartLine = echarts.init(document.getElementById('chartLine3'))
      var option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          }
        },
        legend: {
          data: ['自动跳转', '手动跳转', '取消次数']
        },
        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }}],
        yAxis: [{ type: 'value', name: '次数', min: 0, max: 100, interval: 20, axisLabel: { formatter: '{value}' }}],
        series: [{ name: '自动跳转', type: 'bar', itemStyle: { normal: { color: '#7ecf51' }},
          data: chartLine_data.data2,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        },
        {
          name: '手动跳转',
          type: 'bar',
          itemStyle: {
            normal: {
              color: '#ff6600'
            }
          },
          data: chartLine_data.data3,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        }]
      }
      this.chart3.chartLine.setOption(option)
      window.onresize = function() {
        this.chart3.chartLine.resize()
      }
    },
    // 混料准确率统计
    getChart4() {
      this.chart4.listLoading = true
      GetReportform(this.chart4.getdataListParm).then(response => {
        if (response.data !== null && response.data.list !== null) {
          // for (let i = 0; i < response.data.data.length; i++) {
          //   response.data.data[i].准确率 = response.data.data[i].准确率 + '%'
          // }
          this.chart4.table.list = response.data.data
          this.chart4.chartLine_data = response.data.list
          // this.chart4.chartLine_data = {
          //   'data1': ['1牧', '2牧', '3牧', '4牧', '5牧', '6牧', '7牧', '8牧', '9牧', '10牧', '11牧', '12牧'], // x轴
          //   'data2': [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3], // 自动跳转准确率
          //   'data3': [2.6, 5.9, 9.0, 30, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] // 手动跳转准确率
          // }
          this.chart4.total = response.data.total
          console.log('混料准确率统计图', this.chart4.chartLine_data)
          console.log('混料准确率统计表', this.chart4.table.list)
          this.roadChartLine4(this.chart4.chartLine_data)
        } else {
          this.chart4.list = []
          this.chart4.chartLine_data = {}
          this.roadChartLine4(this.chart4.chartLine_data)
        }
        setTimeout(() => {
          this.chart4.listLoading = false
        }, 100)
      })
    },
    roadChartLine4(chartLine_data) {
      if (this.chart4.chartLine != null) {
        this.chart4.chartLine.dispose()
      }
      this.chart4.chartLine = echarts.init(document.getElementById('chartLine4'))
      var option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          }
        },
        legend: {
          data: ['自动跳转准确率', '手动跳转准确率']
        },
        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }}],
        yAxis: [{ type: 'value', name: '混料准确率', min: 0, max: 100, interval: 20, axisLabel: { formatter: '{value}%' }}],
        series: [{ name: '自动跳转准确率', type: 'bar', itemStyle: { normal: { color: '#7ecf51' }},
          data: chartLine_data.data2,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        },
        {
          name: '手动跳转准确率',
          type: 'bar',
          itemStyle: {
            normal: {
              color: '#ff6600'
            }
          },
          data: chartLine_data.data3,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        }]
      }
      this.chart4.chartLine.setOption(option)
      window.onresize = function() {
        this.chart4.chartLine.resize()
      }
    },
    // 栏舍平均撒料时间统计
    getChart5() {
      this.chart5.listLoading = true
      GetReportform(this.chart5.getdataListParm).then(response => {
        if (response.data !== null && response.data.list !== null) {
          this.chart5.table.list = response.data.data
          this.chart5.chartLine_data = response.data.list
          this.chart5.total = response.data.total
          console.log('栏舍平均撒料时间统计图', this.chart5.chartLine_data)
          console.log('栏舍平均撒料时间统计表', this.chart5.table.list)
          this.roadChartLine5(this.chart5.chartLine_data)
        } else {
          this.chart5.list = []
          this.chart5.chartLine_data = {}
          this.roadChartLine5(this.chart5.chartLine_data)
        }
        setTimeout(() => {
          this.chart5.listLoading = false
        }, 100)
      })
    },
    roadChartLine5(chartLine_data) {
      if (this.chart5.chartLine != null) {
        this.chart5.chartLine.dispose()
      }
      this.chart5.chartLine = echarts.init(document.getElementById('chartLine5'))
      var option = {
        title: {
          text: ''
        },
        tooltip: {
          trigger: 'axis',
          formatter: function(params) {
            // console.log(params)
            if (params.length > 0) {
              var tip = params[0].name
              for (let i = 0; i < params.length; i++) {
                var b = []
                // var str = params[i].value
                for (let j = 0; j <= params[i].value.length; j++) {
                  if (params[i].value !== '') {
                    if (params[i].value.charAt(j) == '.') {
                      b[j] = params[i].value.replace('.', ':')
                    }
                  } else {
                    b[j] = ''
                  }
                }
                tip += '<br>' + params[i].seriesName + ': ' + b[b.length - 1]
              }
              return tip
            }
          }
        },
        legend: {
          data: chartLine_data.data1,
          right: 10
        },
        grid: {
          top: '20%',
          left: '5%',
          right: '8%',
          containLabel: true
        },
        toolbox: {
          show: true,
          right: '2%',
          feature: {}
        },
        xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
        yAxis: [{
          type: '',
          name: '时间',
          mix: 0,
          max: 24,
          interval: 2,
          axisLabel: {
            formatter: function(value) {
              var texts = []
              if (value < 10) {
                texts.push('0' + value + ':00')
              } else {
                texts.push(value + ':00')
              }
              return texts
            }
          }
        }],
        series: (function() {
          if (chartLine_data.data3 !== undefined) {
            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.chart5.chartLine.setOption(option)
      window.onresize = function() {
        this.chart5.chartLine.resize()
      }
    },

    // 混料计划取消次数
    getChart6() {
      this.chart6.listLoading = true
      GetReportform(this.chart6.getdataListParm).then(response => {
        if (response.data !== null && response.data.list !== null) {
          // for (let i = 0; i < response.data.data.length; i++) {
          //   response.data.data[i].准确率 = response.data.data[i].准确率 + '%'
          // }
          this.chart6.table.list = response.data.data
          this.chart6.chartLine_data = response.data.list
          // this.chart6.chartLine_data = {
          //   'data1': ['1牧', '2牧', '3牧', '4牧', '5牧', '6牧', '7牧', '8牧', '9牧', '10牧', '11牧', '12牧'], // x轴
          //   'data2': [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3], // 自动跳转准确率
          //   'data3': [2.6, 5.9, 9.0, 30, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] // 手动跳转准确率
          // }
          this.chart6.total = response.data.total
          console.log('混料计划取消次数图', this.chart6.chartLine_data)
          console.log('混料计划取消次数表', this.chart6.table.list)
          this.roadChartLine6(this.chart6.chartLine_data)
        } else {
          this.chart6.list = []
          this.chart6.chartLine_data = {}
          this.roadChartLine6(this.chart6.chartLine_data)
        }
        setTimeout(() => {
          this.chart6.listLoading = false
        }, 100)
      })
    },
    roadChartLine6(chartLine_data) {
      if (this.chart6.chartLine != null) {
        this.chart6.chartLine.dispose()
      }
      this.chart6.chartLine = echarts.init(document.getElementById('chartLine6'))
      var option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          }
        },
        legend: {
          data: ['混料计划取消次数']
        },
        xAxis: [{ type: 'category', data: chartLine_data.data1, axisPointer: { type: 'shadow' }}],
        yAxis: [{ type: 'value', name: '次数', min: 0, max: 100, interval: 20, axisLabel: { formatter: '{value}%' }}],
        series: [{ name: '混料计划取消次数', type: 'bar', itemStyle: { normal: { color: '#7ecf51' }},
          data: chartLine_data.data2,
          markLine: {
            data: [{ type: 'average' }],
            symbol: ['none', 'none'],
            position: 'insideTopCenter',
            itemStyle: {
              normal: {
                lineStyle: { type: 'dotted', width: 3 },
                label: { show: true, position: 'middle', formatter: '' }
              }
            },
            large: true,
            effect: { show: false, loop: true, period: 0, scaleSize: 2, color: null, shadowColor: null, shadowBlur: null }
          }
        }]
      }
      this.chart6.chartLine.setOption(option)
      window.onresize = function() {
        this.chart6.chartLine.resize()
      }
    },

    handleDownload() {
      var excelDatas = [
        {
          tHeader: ['配方名称', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数', '混料正确率', '去除取消正确率', '标准差'],
          filterVal: ['配方名称', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数', '混料正确率', '去除取消正确率', '方差'],
          tableDatas: this.table.list,
          sheetName: '混料'
        },
        {
          tHeader: ['配方名称', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料自动跳转次数', '撒料手动跳转次数', '撒料正确数', '撒料正确率', '去除取消正确率', '标准差'],
          filterVal: ['配方名称', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料自动跳转次数', '撒料手动跳转次数', '撒料正确数', '撒料正确率', '去除取消正确率', '方差'],
          tableDatas: this.table2.list,
          sheetName: '撒料'
        }
      ]
      json2excel(excelDatas, '汇总统计-配方名称', true, 'xlsx')
    },
    // 时间
    changeChartDate(item) {
      console.log(item)
      if (item == 'chart1') {
        if (this.chart1.getdataListParm.parammaps.inputDatetime !== '' && this.chart1.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart1.getdataListParm.parammaps.startTime = parseTime(this.chart1.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart1.getdataListParm.parammaps.stopTime = parseTime(this.chart1.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart1()
        } else {
          this.chart1.getdataListParm.parammaps.inputDatetime = ''
          this.chart1.getdataListParm.parammaps.startTime = ''
          this.chart1.getdataListParm.parammaps.stopTime = ''
          this.getChart1()
        }
      } else if (item == 'chart2') {
        if (this.chart2.getdataListParm.parammaps.inputDatetime !== '' && this.chart2.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart2.getdataListParm.parammaps.startTime = parseTime(this.chart2.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart2.getdataListParm.parammaps.stopTime = parseTime(this.chart2.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart2()
        } else {
          this.chart2.getdataListParm.parammaps.inputDatetime = ''
          this.chart2.getdataListParm.parammaps.startTime = ''
          this.chart2.getdataListParm.parammaps.stopTime = ''
          this.getChart2()
        }
      } else if (item == 'chart3') {
        if (this.chart3.getdataListParm.parammaps.inputDatetime !== '' && this.chart3.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart3.getdataListParm.parammaps.startTime = parseTime(this.chart3.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart3.getdataListParm.parammaps.stopTime = parseTime(this.chart3.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart3()
        } else {
          this.chart3.getdataListParm.parammaps.inputDatetime = ''
          this.chart3.getdataListParm.parammaps.startTime = ''
          this.chart3.getdataListParm.parammaps.stopTime = ''
          this.getChart3()
        }
      } else if (item == 'chart4') {
        if (this.chart4.getdataListParm.parammaps.inputDatetime !== '' && this.chart4.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart4.getdataListParm.parammaps.startTime = parseTime(this.chart4.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart4.getdataListParm.parammaps.stopTime = parseTime(this.chart4.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart4()
        } else {
          this.chart4.getdataListParm.parammaps.inputDatetime = ''
          this.chart4.getdataListParm.parammaps.startTime = ''
          this.chart4.getdataListParm.parammaps.stopTime = ''
          this.getChart4()
        }
      } else if (item == 'chart5') {
        if (this.chart5.getdataListParm.parammaps.inputDatetime !== '' && this.chart5.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart5.getdataListParm.parammaps.startTime = parseTime(this.chart5.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart5.getdataListParm.parammaps.stopTime = parseTime(this.chart5.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart5()
        } else {
          this.chart5.getdataListParm.parammaps.inputDatetime = ''
          this.chart5.getdataListParm.parammaps.startTime = ''
          this.chart5.getdataListParm.parammaps.stopTime = ''
          this.getChart5()
        }
      } else if (item == 'chart6') {
        if (this.chart6.getdataListParm.parammaps.inputDatetime !== '' && this.chart6.getdataListParm.parammaps.inputDatetime !== null) {
          this.chart6.getdataListParm.parammaps.startTime = parseTime(this.chart6.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
          this.chart6.getdataListParm.parammaps.stopTime = parseTime(this.chart6.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
          this.getChart6()
        } else {
          this.chart6.getdataListParm.parammaps.inputDatetime = ''
          this.chart6.getdataListParm.parammaps.startTime = ''
          this.chart6.getdataListParm.parammaps.stopTime = ''
          this.getChart6()
        }
      }
    },

    handleExport(item) {
      if (item == 'chart1') {
        console.log('计划统计导出')
        var excelDatasTabChart1 = [
          {
            tHeader: ['日期', '配方名称', '计划重量（kg）', '实际重量（kg）', '准确率'],
            filterVal: ['日期', '名称', '理论量', '实际量', '准确率'],
            tableDatas: this.chart1.table.list,
            sheetName: '计划统计'
          }
        ]
        json2excel(excelDatasTabChart1, '计划统计', true, 'xlsx')
      } else if (item == 'chart2') {
        console.log('计划统计导出')
        var excelDatasTabChart2 = [
          {
            tHeader: ['日期', '计划执行重量（kg）', '配方理论重量（kg）', '计划准确率', '计划取消重量（kg）', '计划准确率（去除取消重量）', '计划正确数', '计划数', '计划正确率'],
            filterVal: ['日期', '实际量', '理论量', 'field1', '计划取消重量', 'field3', '正确数', '计划数', 'field2'],
            tableDatas: this.chart2.table.list,
            sheetName: '计划统计'
          }
        ]
        json2excel(excelDatasTabChart2, '计划统计', true, 'xlsx')
      } else if (item == 'chart3') {
        console.log('牛群准确率导出')
        var excelDatasTabChart3 = [
          {
            tHeader: ['日期', '牲畜类别', '计划重量（kg）', '实际重量（kg）', '准确率'],
            filterVal: ['日期', '名称', '理论量', '实际量', '准确率'],
            tableDatas: this.chart3.table.list,
            sheetName: '牛群准确率'
          }
        ]
        json2excel(excelDatasTabChart3, '牛群准确率', true, 'xlsx')
      } else if (item == 'chart4') {
        console.log('车辆准确率（重量）导出')
        var excelDatasTabChart4 = [
          {
            tHeader: ['日期', '车次', '计划重量（kg）', '实际重量（kg）', '准确率'],
            filterVal: ['日期', '名称', '理论量', '实际量', '准确率'],
            tableDatas: this.chart4.table.list,
            sheetName: '车辆准确率（重量）'
          }
        ]
        json2excel(excelDatasTabChart4, '车辆准确率（重量）', true, 'xlsx')
      } else if (item == 'chart5') {
        console.log('混料统计导出')
        var excelDatasTabChart5 = [
          {
            tHeader: ['日期', '自动跳转次数', '手动跳转次数', '自动跳转理论重量', '自动跳转实际重量', '自动跳转准确率', '手动跳转理论重量', '手动跳转实际重量', '手动跳转准确率'],
            filterVal: ['日期', 'field1', 'field2', '理论自动', '实际自动', 'field3', '理论手动', '实际手动', 'field4'],
            tableDatas: this.chart5.table.list,
            sheetName: '混料统计'
          }
        ]
        json2excel(excelDatasTabChart5, '混料统计', true, 'xlsx')
      } else if (item == 'chart6') {
        console.log('混料计划取消次数导出')
        var excelDatasTabChart5 = [
          {
            tHeader: ['日期', '自动跳转次数', '手动跳转次数', '自动跳转理论重量', '自动跳转实际重量', '自动跳转准确率', '手动跳转理论重量', '手动跳转实际重量', '手动跳转准确率'],
            filterVal: ['日期', 'field1', 'field2', '理论自动', '实际自动', 'field3', '理论手动', '实际手动', 'field4'],
            tableDatas: this.chart5.table.list,
            sheetName: '混料计划取消次数'
          }
        ]
        json2excel(excelDatasTabChart5, '混料计划取消次数', true, 'xlsx')
      }
    },
    handleTable(item) {
      // 显示切换表格
      if (item == 'chart1') {
        console.log('计划统计表格')
        this.chart1.isTable = true
        this.chart1.isChart = false
      } else if (item == 'chart2') {
        console.log('计划统计表格')
        this.chart2.isTable = true
        this.chart2.isChart = false
      } else if (item == 'chart3') {
        console.log('牛群准确率表格')
        this.chart3.isTable = true
        this.chart3.isChart = false
      } else if (item == 'chart4') {
        console.log('车辆准确率（重量）表格')
        this.chart4.isTable = true
        this.chart4.isChart = false
      } else if (item == 'chart5') {
        console.log('混料统计表格')
        this.chart5.isTable = true
        this.chart5.isChart = false
      } else if (item == 'chart6') {
        console.log('混料计划取消次数表格')
        this.chart6.isTable = true
        this.chart6.isChart = false
      }
    },
    // 切换图表
    handleChart(item) {
      // 显示切换图表
      if (item == 'chart1') {
        console.log('计划统计图表')
        this.chart1.isTable = false
        this.chart1.isChart = true
        this.getChart1()
      } else if (item == 'chart2') {
        console.log('计划统计图表')
        this.chart2.isTable = false
        this.chart2.isChart = true
        this.getChart2()
      } else if (item == 'chart3') {
        console.log('牛群准确率图表')
        this.chart3.isTable = false
        this.chart3.isChart = true
        this.getChart3()
      } else if (item == 'chart4') {
        console.log('车辆准确率（重量）图表')
        this.chart4.isTable = false
        this.chart4.isChart = true
        this.getChart4()
      } else if (item == 'chart5') {
        console.log('混料统计图表')
        this.chart5.isTable = false
        this.chart5.isChart = true
        this.getChart5()
      } else if (item == 'chart6') {
        console.log('混料计划取消次数图表')
        this.chart6.isTable = false
        this.chart6.isChart = true
        this.getChart6()
      }
    }
  }
}

</script>

<style lang="scss" scoped>
  .button{
    height: 95px;
    .exportTable2{float: right;margin-right: 5px;margin-top: 5px;}
  }
  .app-container1{padding-left: 10px;background-color: #F4F4F4;}
  .dashboard-editor-container {
    background-color: #F4F4F4;
    .grid-content{
      background-color:#fff;padding: 0 10px;
      h4{text-align: center;line-height: 50px;}
    }
  }
  .table{margin-bottom: 50px;}
  /deep/ .specificDate .el-radio{margin-right: 0px;}
  /deep/ .el-radio-button__inner{padding: 7px 7px ;}
  /deep/ .el-range-editor.el-input__inner .el-input__icon{width: 0;}
</style>
