<template>
    <div class="box">
        <div class="searchBar">
            <el-tabs v-model="activeName" @tab-click="handleClick" type="card">
                <el-tab-pane label="月曲线偏差率排行榜" name="first" :key="'first'">
                    <el-card class="box-card">
                    <!-- <div slot="header" class="clearfix" style="font-size:15px">
                        <span>查询条件</span>
                    </div> -->
                    <el-form :inline="true" :model="formInline" class="demo-form-inline">
                <el-row :gutter="1">
                    <el-form-item label="查询条件">
                    </el-form-item>
                    <el-form-item label="风场">
                    <el-select v-model="value"  
                    @change="queryApData()" placeholder="请选择">
                    <el-option
                        v-for="item in options"
                        :key="item.name"
                        :label="item.name"
                        :value="item.id"
                    >
                    </el-option>
                    </el-select>
                    </el-form-item>
                    <el-form-item label="年份：">
                        <el-date-picker
                        value-format="yyyy"
                        v-model="year"
                        type="year"
                        placeholder="选择年"
                        format="yyyy"
                        >
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="月份：">
                        <el-date-picker
                        value-format="yyyy-MM"
                        v-model="month"
                        type="month"
                        placeholder="选择月"
                        format="yyyy-MM">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item>
                    <el-button type="primary" @click="queryApData" :plain="true"
                        >查询</el-button
                    >
                    </el-form-item>
                    <el-form-item>
                    <el-button type="primary" @click="toExcel()">导出</el-button>
                    </el-form-item>
                </el-row>
                </el-form>
                </el-card>
            </el-tab-pane>
            <el-tab-pane label="日曲线偏差率排行榜" name="second" :key="'second'">
                <el-card class="box-card">
                    <!-- <div slot="header" class="clearfix" style="font-size:15px">
                        <span>查询条件</span>
                    </div> -->
                    <el-form :inline="true" :model="formInline" class="demo-form-inline">
                <el-row :gutter="1">
                    <el-form-item label="查询条件"></el-form-item>
                    <el-form-item label="风场">
                    <el-select v-model="value"  
                    @change="queryApData()" placeholder="请选择">
                    <el-option
                        v-for="item in options"
                        :key="item.name"
                        :label="item.name"
                        :value="item.id"
                    >
                    </el-option>
                    </el-select>
                    </el-form-item>
                    <el-form-item label="选择时间：">
                        <el-date-picker
                        value-format="yyyy-MM-dd"
                        v-model="time"
                        type="date"
                        placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item>
                    <el-button type="primary" @click="queryApData" :plain="true"
                        >查询</el-button
                    >
                    </el-form-item>
                    <el-form-item>
                    <el-button type="primary" @click="toExcel()">导出</el-button>
                    </el-form-item>
                </el-row>
                </el-form>
                </el-card>
            </el-tab-pane>
        </el-tabs>
        <el-table
            id="devicerattable"
            :data="gridData"
            :row-style="{ height: '10px' }" 
            :cell-style="{ textAlign: 'center',padding:'1px' }" 
            :header-cell-style="headStyle"
            @sort-change="changeTableSort"
            @row-click="tableDatawindturbineName"
            style="font-size: 10px;margin-top:1%;cursor: pointer;">
            <el-table-column :label=title>
            <el-table-column
              type="index"
              width="40">
            </el-table-column>
            <el-table-column
              prop="windturbineid"
              label="风机"
               width="260">
               <template slot-scope="scope" > 
                  <div @click="clickCopy('1')" :style="{color:'#000000'}">{{scope.row.windturbineid}}</div>
              </template> 
            </el-table-column>
            <el-table-column
            :sortable="'custom'"
              prop="monthdeviationrate"
              label="实际/保证(%)"
              width="260">
              <template slot-scope="scope" > 
                  <div @click="clickCopy('sjbz')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template> 
            </el-table-column>
            <el-table-column
            :sortable="'custom'"
              prop="standarddeviationrate"   
              label="实际/量优(%)"
              width="260">
              <template slot-scope="scope" > 
                  <div @click="clickCopy('sjzy')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template> 
            </el-table-column>
            <el-table-column
            :sortable="'custom'"
              prop="yeardeviationrate"
              label="实际/保证(%)"
              width="260">
              <template slot-scope="scope" > 
                  <div @click="clickCopy('zybz')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template>
            </el-table-column>
            <el-table-column
              prop="deviationrate1"
              label="环比"
               width="260">
               <template slot-scope="scope" > 
                  <div @click="clickCopy('hb')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template>
            </el-table-column>
            <el-table-column
              prop="deviationrate2"
              label="同比"
               width="260">
               <template slot-scope="scope" > 
                  <div @click="clickCopy('tb')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template>
            </el-table-column>
            <el-table-column
              prop="deviationrate3"
              label="比标杆风机"
               width="260">
               <template slot-scope="scope" > 
                  <div @click="clickCopy('bg')" :style="{color:'#000000'}">{{scope.row.monthdeviationrate}}</div>
              </template>
            </el-table-column>
            </el-table-column>        
       </el-table>
       <el-dialog :title="eldialogtitle" :visible.sync="dialogFormVisible">
           <div style="width:100%;height:400px">
            <div id="leiDaTu" class="echart" style="width:100%;height:350px"></div>
           </div>
        </el-dialog>
        </div>
    </div>
</template>
<script>
    import rankingCurveDeviationRate from "@assets/js/performanceAnalysis/rankingCurveDeviationRate";
    export default rankingCurveDeviationRate;
</script>
<style lang="scss" scoped>
    @import "@assets/css/performanceAnalysis/rankingCurveDeviationRate.scss";
</style>