<template>
  <div class="app-container">
    <div class="operation">
      <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" @change="changeDate" />
      <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
      <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
    </div>
    <div class="search" />
    <div class="table">
      <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="98px" align="center">
          <template slot-scope="{row}">
            <a @click="clickFormulaTemplateIndex(row)">{{ row.tname }}</a>
          </template>
        </el-table-column>
        <el-table-column sortable label="牛头数" prop="ccount" min-width="58px" align="center" />
        <el-table-column label="干物质(kg)" align="center">
          <el-table-column sortable prop="dry" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.dry) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.dry) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="产奶净能(MJ)" align="center">
          <el-table-column sortable prop="nm" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.nm) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.nm) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="奶牛能量单位(NND)" align="center">
          <el-table-column sortable prop="nuint" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.nuint) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.nuint) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="粗蛋白(g)" align="center">
          <el-table-column prop="cp" label="配方量" min-width="58" align="center" />
          <el-table-column label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.cp) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.cp) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="磷(g)" align="center">
          <el-table-column sortable prop="p" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.p) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.p) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="产奶净能(MCal/DM)" align="center">
          <el-table-column sortable prop="nmd" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.nmd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.nmd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="粗蛋白(%DM)" align="center">
          <el-table-column sortable prop="cpd" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.cpd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.cpd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="脂肪(%DM)" align="center">
          <el-table-column sortable prop="fat" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.fat) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.fat) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="淀粉(%DM)" align="center">
          <el-table-column sortable prop="starch" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.starch) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.starch) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="NDF(%DM)" align="center">
          <el-table-column sortable prop="ndf" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.ndf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.ndf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="粗料中的NDF(%DM)" align="center">
          <el-table-column sortable prop="cndf" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.cndf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.cndf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="ADF(%DM)" align="center">
          <el-table-column sortable prop="adf" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.adf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.adf) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="钙(%DM)" align="center">
          <el-table-column sortable prop="cad" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.cad) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.cad) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="磷(%DM)" align="center">
          <el-table-column sortable prop="pd" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.pd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.pd) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column sortable label="精粗比(%)" align="center">
          <el-table-column sortable prop="jcrate" label="配方量" min-width="58" align="center" />
          <el-table-column sortable label="TMR料" min-width="65" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Hrate * scope.row.jcrate) | keepTreeNum }}</span>
            </template>
          </el-table-column>
          <el-table-column sortable label="采食量" min-width="58" align="center">
            <template slot-scope="scope">
              <span>{{ (scope.row.Srate * scope.row.jcrate) | keepTreeNum }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="操作" align="center" width="70" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="{row}">
            <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee(row)" />
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="table.total>0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
    </div>

    <!-- 查看 -->
    <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" class="dialogMinHeight" :visible.sync="see.dialogFormVisible" :close-on-click-modal="false" width="90%">
      <template slot="title">
        <div class="avue-crud__dialog__header">
          <span class="el-dialog__title">
            <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
            {{ textMap[see.dialogStatus] }}
          </span>
          <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
            <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
            <svg-icon v-else icon-class="fullscreen" />
          </div>
        </div>
      </template>
      <div class="app-see dialogMinHeight">
        <div class="tableSee">
          <el-table
            :key="see.table.tableKey"
            v-loading="see.table.listLoading"
            element-loading-text="给我一点时间"
            :data="see.table.list"
            border
            fit
            show-summary
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="tableCellStyle"
            class="elTable table-fixed"
          >
            <el-table-column label="栏舍/指标" min-width="100px" align="center">
              <template slot-scope="{row}">
                <a @click="clickFormulaHurdlesIndex(row)">{{ row.barname }}</a>
              </template>
            </el-table-column>
            <el-table-column label="牛头数" min-width="100px" align="center" prop="ccount" />
            <el-table-column label="干物质(kg)" min-width="130px" align="center">
              <el-table-column prop="dry-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="dry-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="dry-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="dry-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="产奶净能(M)" min-width="130px" align="center">
              <el-table-column prop="nm-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="nm-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="nm-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="nm-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="奶牛能量单位(NND)" min-width="130px" align="center">
              <el-table-column prop="nuint-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="nuint-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="nuint-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="nuint-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="粗蛋白(g)" min-width="130px" align="center">
              <el-table-column prop="cp-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="cp-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="cp-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="cp-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="磷(g)" min-width="130px" align="center">
              <el-table-column prop="p-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="p-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="p-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="p-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="产奶净能(MCal/DM)" min-width="130px" align="center">
              <el-table-column prop="nmd-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="nmd-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="nmd-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="nmd-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="粗蛋白(%DM)" min-width="130px" align="center">
              <el-table-column prop="cpd-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="cpd-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="cpd-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="cpd-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="脂肪(%DM)" min-width="130px" align="center">
              <el-table-column prop="fat-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="fat-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="fat-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="fat-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="淀粉(%DM)" min-width="130px" align="center">
              <el-table-column prop="starch-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="starch-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="starch-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="starch-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="NDF(%DM)" min-width="130px" align="center">
              <el-table-column prop="ndf-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="ndf-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="ndf-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="ndf-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="粗料中的NDF(%DM)" min-width="130px" align="center">
              <el-table-column prop="cndf-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="cndf-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="cndf-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="cndf-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="ADF(%DM)" min-width="130px" align="center">
              <el-table-column prop="adf-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="adf-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="adf-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="adf-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="钙(%DM)" min-width="130px" align="center">
              <el-table-column prop="cad-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="cad-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="cad-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="cad-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="磷(%DM)" min-width="130px" align="center">
              <el-table-column prop="pd-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="pd-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="pd-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="pd-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="(4.0)饲料转化效率(kg/DM)" min-width="130px" align="center">
              <el-table-column prop="trans4f-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="trans4f-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="trans4f-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="trans4f-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="(3.5)饲料转化效率(kg/DM)" min-width="130px" align="center">
              <el-table-column prop="trans35f-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="trans35f-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="trans35f-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="trans35f-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="精粗比(%)" min-width="130px" align="center">
              <el-table-column prop="jcrate-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="jcrate-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="jcrate-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="jcrate-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="日粮成本(元)" min-width="130px" align="center">
              <el-table-column prop="uprice-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="uprice-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="uprice-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="uprice-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="干物质成本(元/公斤)" min-width="130px" align="center">
              <el-table-column prop="upriced-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="upriced-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="upriced-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="upriced-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
            <el-table-column label="日公斤奶成本(元)" min-width="130px" align="center">
              <el-table-column prop="kprice-nur" label="奶牛需要" min-width="70" align="center" />
              <el-table-column prop="kprice-FT" label="配方量" min-width="58" align="center" />
              <el-table-column prop="kprice-H" label="TMR料" min-width="65" align="center" />
              <el-table-column prop="kprice-S" label="采食量" min-width="58" align="center" />
            </el-table-column>
          </el-table>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom: 10px;">
        <el-button class="cancelClose" style="right: 20px" @click="see.dialogFormVisible = false;$route.params.tname = '' ">关闭</el-button>
      </div>
    </el-dialog>

    <!-- 配方详情 -->
    <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="details.dialogFormVisible" :close-on-click-modal="false" width="90%">
      <template slot="title">
        <div class="avue-crud__dialog__header">
          <span class="el-dialog__title">
            <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
            {{ textMap[details.dialogStatus] }}
          </span>
          <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
            <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
            <svg-icon v-else icon-class="fullscreen" />
          </div>
        </div>
      </template>
      <div class="details dialogMinHeight">
        <el-form ref="temp" :rules="details.rules" :model="details.temp" label-position="right" label-width="120px" style="width: 100%;margin-bottom:30px">
          <el-row>
            <el-col :span="8">
              <el-form-item label="历史记录时间:" prop="maxDate">
                <el-date-picker v-model="details.temp.maxDate" :clearable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" placeholder="请选择历史记录时间" @change="changeMaxDate" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div class="table1">
          <div ref="templateDialog" class="templateDialog">
            <div class="recipeTemplateF">
              <p>配方模板表</p>
            </div>
          </div>
          <el-table
            :key="details.table1.tableKey"
            v-loading="details.table1.listLoading"
            element-loading-text="给我一点时间"
            :data="details.table1.list"
            border
            fit
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <el-table-column label="序号" type="index" width="50" align="center" />
            <el-table-column label="配方名称" min-width="100px" align="center" prop="tname" />
            <el-table-column label="牲畜类别" min-width="100px" align="center" prop="ccname" />
            <el-table-column label="配方类型" min-width="100px" align="center" prop="fttype" />
            <el-table-column label="来源" min-width="100px" align="center" prop="source" />
            <el-table-column label="版本号" min-width="100px" align="center" prop="version" />
            <el-table-column label="版本时间" min-width="100px" align="center" prop="versiontime" />
          </el-table>
        </div>
        <div class="table2 detailDialog">
          <div class="recipeTemplateF">
            <p>配方详情表</p>
          </div>
          <el-table
            :key="details.table2.tableKey"
            v-loading="details.table2.listLoading"
            element-loading-text="给我一点时间"
            :data="details.table2.list"
            border
            fit
            show-summary
            highlight-current-row
            style="width: 100%;"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            class="elTable table-fixed"
          >
            <el-table-column label="序号" type="index" width="50" align="center" />
            <el-table-column label="饲料组" min-width="100px" align="center" prop="feedgroup" />
            <el-table-column label="饲料名称" min-width="100px" align="center" prop="fname" />
            <el-table-column label="重量(KG)" min-width="100px" align="center" prop="fweight" />
            <el-table-column label="搅拌延时(min)" min-width="100px" align="center" prop="autosecond" />
            <el-table-column label="是否锁定牛头数比例" min-width="100" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.islockcount == '0'">否</span>
                <span v-if="scope.row.islockcount == '1'">是</span>
              </template>
            </el-table-column>
            <el-table-column label="顺序" min-width="100" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.sort }}</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" style="bottom: 10px;">
        <el-button class="cancelClose" style="right: 20px" @click="details.dialogFormVisible = false;">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { GetDataByName, postJson } from '@/api/common'
import Cookies from 'js-cookie'
import Pagination from '@/components/Pagination'
import { parseTime } from '@/utils/index.js'
export default {
  name: 'FormulationEvaluation',
  components: { Pagination },
  filters: {
    keepTreeNum(value) {
      value = Number(value)
      return value.toFixed(3)
    }
  },
  data() {
    return {
      dialogFull: false,
      table: {
        getdataListParm: {
          name: 'judgenurFTReport',
          page: 1,
          offset: 1,
          pagecount: parseInt(Cookies.get('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()]
          }
        },
        tableKey: 1,
        list: [],
        total: 0,
        listLoading: true,
        temp: {}
      },
      see: {
        dialogFormVisible: false,
        dialogStatus: '',
        temp: {},
        rules: {},
        table: {
          tableKey: 0,
          list: [],
          total: 0,
          listLoading: true,
          getdataListParm: {
            name: 'judgenurFTReport',
            page: 1,
            offset: 1,
            pagecount: 0,
            returntype: 'Map',
            parammaps: {
              name: 'judgenurBarBmReport',
              name1: 'judgenurBarHSL'
            }
          }
        }
      },
      details: {
        dialogFormVisible: false,
        dialogStatus: '',
        temp: {
          maxDate: ''
        },
        rules: {},
        table1: {
          tableKey: 0,
          list: [],
          total: 0,
          listLoading: true,
          getdataListParm: {
            name: 'getFTListDateHis',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: '',
              id: ''
            }
          }
        },
        table2: {
          tableKey: 0,
          list: [],
          total: 0,
          listLoading: true,
          getdataListParm: {
            name: 'getFTdetailListDate',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: '',
              ftid: '',
              date: '',
              version: ''
            }
          }
        },
        maxDate: {
          getdataListParm: {
            name: 'getFTMaxDate',
            page: 1,
            offset: 1,
            pagecount: 10,
            returntype: 'Map',
            parammaps: {
              pastureid: ''
            }
          }
        }
      },
      textMap: {
        see: '',
        details: '配方详情'
      },
      rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
      cellStyle: { padding: 0 + 'px' }
    }
  },

  created() {
    if (this.$route.params.tname !== '' && this.$route.params.tname !== undefined && this.$route.params.startTime !== undefined && this.$route.params.stopTime !== undefined) {
      console.log(this.table.getdataListParm.parammaps.inputDatetime, 'this.table.getdataListParm.parammaps.inputDatetime')
      this.table.getdataListParm.parammaps.startTime = this.$route.params.startTime
      this.table.getdataListParm.parammaps.stopTime = this.$route.params.stopTime
      this.textMap.see = '栏舍详情——' + this.$route.params.tname
      setTimeout(() => {
        this.dialogFull = false
        this.see.dialogStatus = 'see'
        this.see.dialogFormVisible = true
      }, 500)
      this.see.table.getdataListParm.parammaps.ftid = this.$route.params.ftid
      this.see.table.getdataListParm.parammaps.pastureid = this.$route.params.pastureid
      this.see.table.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.see.table.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      this.getListSee()
    }
    this.getList()
  },

  methods: {
    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
          this.table.pageNum = response.data.pageNum
          this.table.pageSize = response.data.pageSize
          this.table.total = response.data.total
        } else {
          this.table.list = []
        }
        console.log(this.$route.params.tname)
        // this.see.dialogFormVisible = false
        setTimeout(() => {
          this.table.listLoading = false
        }, 100)
      })
    },
    changeDate() {
      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
        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()
      }
    },
    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))
        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()
    },
    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))
        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()
    },
    tableCellStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        return {
          textDecoration: 'underline'
        }
      }
      return {
        textDecoration: 'none'
      }
    },
    clickFormulaTemplateIndex(row) {
      console.log('点击了配方模板/指标')
      this.dialogFull = false
      this.details.dialogStatus = 'details'
      this.details.dialogFormVisible = true
      this.details.table1.getdataListParm.parammaps.pastureid = row.pastureid
      this.details.table1.getdataListParm.parammaps.id = row.ftid

      this.details.maxDate.getdataListParm.parammaps.pastureid = row.pastureid
      this.getMaxDate()
    },

    getMaxDate() {
      GetDataByName(this.details.maxDate.getdataListParm).then(response => {
        if (response.data.list !== null) {
          this.details.temp.maxDate = response.data.list[0].maxdate
        } else {
          this.details.temp.maxDate = ''
        }
        this.details.table1.getdataListParm.parammaps.date = this.details.temp.maxDate
        this.details.table2.getdataListParm.parammaps.date = this.details.temp.maxDate

        this.getListDetails1()
      })
    },
    changeMaxDate(item) {
      this.details.table1.getdataListParm.parammaps.date = this.details.temp.maxDate
      this.getListDetails1()
    },
    getListDetails1() {
      this.details.table1.listLoading = true
      GetDataByName(this.details.table1.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.details.table1.list = response.data.list
          this.details.table1.pageNum = response.data.pageNum
          this.details.table1.pageSize = response.data.pageSize
          this.details.table1.total = response.data.total

          this.details.table2.getdataListParm.parammaps.pastureid = this.details.table1.list[0].pastureid
          this.details.table2.getdataListParm.parammaps.ftid = this.details.table1.list[0].id
          this.details.table2.getdataListParm.parammaps.version = this.details.table1.list[0].version
          this.getListDetails2()
        } else {
          this.details.table1.list = []
          this.details.table2.list = []
        }
        setTimeout(() => {
          this.details.table1.listLoading = false
        }, 100)
      })
    },
    getListDetails2() {
      this.details.table2.listLoading = true
      GetDataByName(this.details.table2.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.details.table2.list = response.data.list
          this.details.table2.pageNum = response.data.pageNum
          this.details.table2.pageSize = response.data.pageSize
          this.details.table2.total = response.data.total
        } else {
          this.details.table2.list = []
        }
        setTimeout(() => {
          this.details.table2.listLoading = false
        }, 100)
      })
    },
    clickFormulaHurdlesIndex(row) {
      console.log('点击了栏舍/指标')
      this.$router.push('/formulationPlan/DhedFormula')
    },
    handleSee(row) {
      console.log('查看', row)
      this.dialogFull = false
      this.textMap.see = '栏舍详情——' + row.tname
      this.see.dialogStatus = 'see'
      this.see.dialogFormVisible = true
      this.see.table.getdataListParm.parammaps.ftid = row.ftid
      this.see.table.getdataListParm.parammaps.pastureid = row.pastureid
      this.see.table.getdataListParm.parammaps.startTime = this.table.getdataListParm.parammaps.startTime
      this.see.table.getdataListParm.parammaps.stopTime = this.table.getdataListParm.parammaps.stopTime
      this.getListSee()
    },
    getListSee() {
      this.see.table.listLoading = true
      const url = 'authdata/GETNurJudgeRport'
      const data = this.see.table.getdataListParm
      postJson(url, data).then(response => {
        if (response.data !== null) {
          console.log('table数据', response.data)
          this.see.table.list = response.data
          this.see.table.pageNum = response.data.pageNum
          this.see.table.pageSize = response.data.pageSize
          this.see.table.total = response.data.total
        } else {
          this.see.table.list = []
        }
        setTimeout(() => {
          this.see.table.listLoading = false
        }, 100)
      })
    }

  }
}
</script>
<style lang="scss" scoped>
  .search {clear: both; }
  .table { margin-top: 10px; }
  .table2{margin-top: 20px;}
  .templateDialog{
     background: #fff;
     position: relative;
   }
  .detailDialog{
     background: #fff;
     position: relative;
   }
</style>
<style>
  .tableSee .el-table { overflow-x: auto; }
  .tableSee .el-table__header-wrapper,
  .tableSee .el-table__body-wrapper,
  .tableSee .el-table__footer-wrapper { overflow: visible; }
  .tableSee .el-table::after { position: relative; }
  .tableSee .el-table--scrollable-x .el-table__body-wrapper { overflow: visible; }
</style>
