<template>
  <div>
    <el-dialog
      :visible.sync="showFormDias"
      width="85%"
      :before-close="handleClose"
    >
      <div id="echartsBox"></div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="goInfo">保 存</el-button>
        <el-button @click="handleClose">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import basin from '@/api/basin.js'
import req from '@/request.js'
import * as echarts from 'echarts'
export default {
  name: 'FormDialog',
  props: {
    showFormDias: {
      type: Boolean,
      default: false,
    },
    // title: {
    //   type: String,
    //   default: '',
    // },
    // pId: {
    //   type: String,
    //   default: '',
    // },
  },
  data() {
    return {
      echartLiat: [],
    }
  },
  created() {},
  mounted(){
      this.getCharts()
  },
  methods: {
    getCharts() {
      let chartDom = document.getElementById('echartsBox')
      let myChart = echarts.init(chartDom)
      let option = {
        xAxis: {
          type: 'category',
          data: ['数据1', '数据2', '数据3', '数据4', '数据5', '数据6', '数据7'],
        },
        yAxis: {
          type: 'value',
		   scale:true
        },
        series: [
          {
            data: [150, 230, 224, 218, 135, 147, 260],
            type: 'line',
          },
        ],
      }

      option && myChart.setOption(option)
    },
    handleClose() {
      this.echartLiat = [];
      this.$emit('closeFormDiaos')
    },
    goInfo(e) {
      this.$refs.formInfo.validate((valid) => {
        if (valid) {
          this.$emit('closeFormDiaos')
          this.$emit('refList')
        } else {
          return false
        }
      })
    },
  },
}
</script>
<style lang="scss" scoped>
// ::v-deep .el-input__inner {
//   border: 1px solid orange;
// }
// ::v-deep .el-textarea__inner {
//   border: 1px solid orange;
// }
#echartsBox{
    width:500px;
    height:500px;
}
</style>
