<template>
    <div class="formula history dataAnalysis">
        <!-- 数据分析 -->
        <div class="page-content">
            <div class="table-title">
                <img src="../../assets/image/analysis.png" alt="" />
                智慧水肥(数据分析)
            </div>
            <div class="search-flex">

                <div class="search-right">
                    <span>时间段</span>
                    <el-date-picker v-model="value1" unlink-panels type="daterange" range-separator="至"
                        start-placeholder="开始日期" end-placeholder="结束日期">
                    </el-date-picker>
                    <div class="input-btn">
                        <div class="btn green">
                            <img src="../../assets/image/irrigateSet1.png" alt="" />查询
                        </div>

                    </div>
                </div>
            </div>

            <div class="analysis-charts">
                <div class="charts" id="realTime-line"></div>
            </div>
        </div>
    </div>
</template>
<script>
import { realTimeLine } from '@/assets/js/charts'
export default {
    data() {
        return {
            value1: '',
                  indexs: 1,
        }
    },
    mounted() {
        this.indexs = this.$route.query.index ? this.$route.query.index : 1;
        this.dataInit()
     
    },
    methods: {
        dataInit() {
            var store = this.$store.state
            var equipmentId=store.equipmentList[this.indexs - 1].deviceId
            var data1 = store.equipmentList[this.indexs - 1].deviceId

            this.api.postFsdata(data1).then(res => {
                if (res.data.code == 200) {
                    var chartsData = res.data.data
                    realTimeLine('realTime-line', chartsData)
                } else {
                    this.$message.error(res.data.msg);
                }
            })
        }
    },

}
</script>
<style lang="scss"></style>
  
  